:root {
  --navy: #0d1b2a;
  --blue: #1e6fd9;
  --blue-dark: #155ab5;
  --amber: #f5a623;
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #5b6c84;
  --border: #d9e2ec;
  --green: #16713d;
  --green-bg: #eaf8ef;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --orange: #9a5d00;
  --orange-bg: #fff4df;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(30,111,217,.35); outline-offset: 2px; }

.topbar { height: 68px; background: var(--navy); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1120px) / 2)); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 750; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: var(--blue); color: white; display: inline-grid; place-items: center; font-weight: 800; }
.quiet { border: 1px solid rgba(255,255,255,.34); background: transparent; color: white; border-radius: 7px; padding: 8px 14px; cursor: pointer; }
.quiet:hover { background: rgba(255,255,255,.09); }

.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }
.intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -.02em; }
.intro p { color: var(--muted); margin: 0; font-size: 16px; line-height: 1.55; }
.scope { white-space: nowrap; color: #7a4a00; background: #fff4df; border: 1px solid #f3ce8f; border-radius: 7px; padding: 9px 12px; font-weight: 700; font-size: 13px; }

.upload-form { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 26px; box-shadow: 0 10px 30px rgba(13,27,42,.06); }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.fixed-recipe { display: flex; justify-content: space-between; gap: 18px; margin: 0 0 22px; padding: 14px 16px; border-radius: 8px; background: #edf4fd; color: var(--navy); }
.fixed-recipe span { color: var(--muted); text-align: right; }
legend, .file-field strong { font-size: 16px; font-weight: 750; margin-bottom: 11px; }
.sizes { display: flex; gap: 10px; }
.sizes label { cursor: pointer; }
.sizes input { position: absolute; opacity: 0; }
.sizes span { display: grid; place-items: center; width: 64px; height: 44px; border: 1px solid #b8c5d6; border-radius: 8px; font-weight: 750; background: white; }
.sizes input:checked + span { background: var(--blue); border-color: var(--blue); color: white; box-shadow: 0 0 0 3px rgba(30,111,217,.14); }
.file-fields { display: grid; grid-template-columns: 1fr; gap: 16px; }
.file-field { border: 1px solid var(--border); background: #f8fafc; border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.file-field span { color: var(--muted); font-size: 13px; }
.file-field input { margin-top: 5px; width: 100%; color: var(--muted); }
.file-field input::file-selector-button { border: 1px solid #aab8c8; border-radius: 6px; background: white; padding: 8px 11px; margin-right: 10px; cursor: pointer; color: var(--ink); font-weight: 650; }
.primary { border: 0; border-radius: 8px; background: var(--blue); color: white; font-weight: 750; padding: 12px 18px; cursor: pointer; }
.primary:hover { background: var(--blue-dark); }
.analyze { width: 100%; margin-top: 18px; min-height: 48px; font-size: 16px; }
.privacy { color: var(--muted); text-align: center; font-size: 12px; margin: 12px 0 0; }
.message { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.message.error { color: var(--red); background: var(--red-bg); border: 1px solid #f4adad; }

.results { margin-top: 34px; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.results-heading h2 { margin-bottom: 4px; font-size: 24px; }
.results-heading p { margin: 0; color: var(--muted); }
.results-heading a { color: var(--blue); font-weight: 700; text-decoration: none; }
.size-result { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 13px 15px; border: 1px solid #b8d5f7; border-radius: 8px; background: #edf4fd; }
.size-result span { color: var(--muted); font-size: 13px; text-align: right; }
.result { display: grid; grid-template-columns: minmax(260px, .72fr) 1.5fr; gap: 24px; background: white; border: 1px solid var(--border); border-left-width: 6px; border-radius: 10px; padding: 22px; margin-bottom: 16px; }
.result.ok_candidate { border-left-color: var(--green); }
.result.suspect { border-left-color: var(--red); }
.result.not_evaluable { border-left-color: var(--amber); }
.status-label { display: inline-block; border-radius: 6px; padding: 5px 9px; font-size: 12px; font-weight: 800; margin-bottom: 12px; }
.ok_candidate .status-label { color: var(--green); background: var(--green-bg); }
.suspect .status-label { color: var(--red); background: var(--red-bg); }
.not_evaluable .status-label { color: var(--orange); background: var(--orange-bg); }
.result h3 { margin-bottom: 9px; font-size: 21px; }
.summary { font-size: 16px; line-height: 1.55; }
dl { margin: 18px 0 0; display: grid; gap: 6px; }
dl div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf1f5; padding: 6px 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; font-size: 13px; font-weight: 700; }
.note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 15px 0 0; }
.comparisons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
figure { margin: 0; min-width: 0; }
figure img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; }
figcaption { text-align: center; color: var(--muted); font-size: 12px; margin-top: 6px; }
.decision-boundary { color: var(--muted); font-size: 13px; text-align: center; margin: 18px 0 0; }

.login-page { display: grid; place-items: center; padding: 24px; background: var(--navy); }
.login-panel { width: min(420px, 100%); background: white; border-radius: 14px; padding: 34px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.login-panel .brand-mark { margin-bottom: 20px; }
.login-panel h1 { margin-bottom: 6px; }
.login-panel > p { color: var(--muted); margin-bottom: 24px; }
.login-form { display: grid; gap: 9px; }
.login-form label { font-size: 13px; color: var(--muted); font-weight: 650; }
.login-form input { border: 1px solid #b8c5d6; border-radius: 7px; padding: 11px 12px; margin-bottom: 6px; min-height: 44px; }
.login-form button { margin-top: 8px; min-height: 46px; }

@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .page { width: min(100% - 22px, 1120px); padding-top: 24px; }
  .intro { display: block; }
  .scope { display: inline-block; margin-top: 14px; }
  .upload-form { padding: 18px; }
  .file-fields, .result, .comparisons { grid-template-columns: 1fr; }
  .result { padding: 17px; }
  .results-heading { align-items: flex-start; }
  .size-result { display: grid; gap: 5px; }
  .size-result span { text-align: left; }
}
