:root {
  --ink: #16231e;
  --muted: #68756f;
  --paper: #f5f2ea;
  --surface: #fffef9;
  --green: #1f5943;
  --green-dark: #12372a;
  --lime: #c9dc74;
  --line: #d9ded7;
  --danger: #a33f35;
  --shadow: 0 18px 55px rgba(27, 51, 40, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(22,35,30,.1); background: rgba(245,242,234,.9); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.brand { color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: var(--lime); font: 600 25px Georgia, serif; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.account-bar { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.login-shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 1.15fr .7fr; gap: 9vw; align-items: center; padding: 70px 0; }
.login-copy h1, .workspace-head h1, .page-heading h1 { font-family: Georgia, "Noto Serif SC", serif; font-weight: 500; line-height: 1.15; }
.login-copy h1 { font-size: clamp(44px, 5.4vw, 76px); margin: 16px 0 26px; letter-spacing: -.035em; }
.login-copy > p { max-width: 620px; font-size: 18px; line-height: 1.8; color: var(--muted); }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; }
.principles { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 42px; color: var(--muted); }
.principles span { display: flex; gap: 8px; align-items: baseline; }
.principles b { color: var(--green); font: 500 20px Georgia, serif; }
.panel { background: var(--surface); border: 1px solid rgba(18,55,42,.12); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.login-panel { display: grid; gap: 22px; padding: 38px; }
.login-panel h2, .narrow-panel h2 { font-size: 28px; margin: 8px 0 0; }
label { display: grid; gap: 8px; color: #39453f; font-size: 14px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 13px 14px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
textarea { line-height: 1.75; resize: vertical; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,89,67,.1); }
.button { border: 0; border-radius: 999px; min-height: 46px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 750; transition: transform .15s, opacity .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: white; background: var(--green); }
.button.dark { color: var(--lime); background: var(--green-dark); }
.button.ghost { background: transparent; color: var(--green); border: 1px solid rgba(31,89,67,.25); }
.button.compact { min-height: 36px; padding: 0 15px; font-size: 13px; }
.form-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.error { min-height: 20px; margin: 0; color: var(--danger); font-size: 14px; }
.center-shell { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 40px 0; }
.narrow-panel { width: min(440px, 100%); display: grid; gap: 20px; }
.app-shell { padding: 30px 0 80px; }
.tabs { display: flex; gap: 6px; width: fit-content; margin-bottom: 35px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); }
.tab { border: 0; border-radius: 999px; padding: 10px 18px; color: var(--muted); background: transparent; font-weight: 700; }
.tab.active { background: var(--green-dark); color: white; }
.workspace-head, .page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 30px; }
.workspace-head h1, .page-heading h1 { margin: 8px 0 0; font-size: clamp(32px, 4vw, 52px); }
.step-track { display: flex; align-items: center; gap: 9px; color: #8a948f; font-size: 12px; white-space: nowrap; }
.step-track span.active { color: var(--green); font-weight: 800; }
.step-track i { width: 22px; height: 1px; background: var(--line); }
.upload-card { min-height: 410px; border: 1.5px dashed #9eaaa4; border-radius: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 35px; background: rgba(255,254,249,.55); }
.upload-card h2 { margin: 16px 0 8px; font-size: 28px; }
.upload-card p { max-width: 500px; margin: 0 0 24px; color: var(--muted); line-height: 1.7; }
.upload-card small { margin-top: 14px; color: #89938e; }
.upload-symbol { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 20px; background: var(--lime); color: var(--green-dark); font-size: 38px; }
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.question-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.question-grid > *, .result-column, .panel, .result-column .panel > * { min-width: 0; }
.image-panel { position: sticky; top: 100px; display: grid; gap: 20px; }
.image-panel img { width: 100%; max-height: 620px; object-fit: contain; border-radius: 14px; background: #ece9e0; }
.result-column { display: grid; gap: 20px; }
.result-column .panel { display: grid; gap: 20px; }
.section-title { display: flex; align-items: center; gap: 14px; }
.section-title .number { color: var(--green); font: 500 26px Georgia, serif; }
.section-title small { color: var(--muted); }
.section-title h2 { margin: 2px 0 0; font-size: 22px; }
.loading { color: var(--green); display: flex; align-items: center; gap: 10px; }
.loading span { width: 16px; height: 16px; border: 2px solid #bfd0c7; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { padding: 13px 15px; border-radius: 12px; background: #fff5da; color: #765b13; font-size: 14px; }
.answer-block { margin: 0 0 20px; }
.answer-block h3 { margin: 0 0 8px; color: var(--green); font-size: 15px; }
.answer-block p, .answer-block li { line-height: 1.75; }
.answer-block ul, .answer-block ol { padding-left: 22px; margin: 0; }
.formula { display: block; overflow-x: auto; margin-top: 8px; padding: 11px 13px; border-radius: 10px; color: var(--green-dark); background: #edf2eb; font-family: Georgia, serif; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.history-item { text-align: left; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 20px; color: inherit; }
.history-item:hover { border-color: var(--green); }
.history-item small { color: var(--muted); }
.history-item p { line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.status-pill { display: inline-flex; margin-top: 10px; padding: 5px 9px; border-radius: 999px; color: var(--green); background: #edf2eb; font-size: 11px; font-weight: 800; }
.admin-grid { display: grid; grid-template-columns: .75fr 1.25fr; gap: 22px; align-items: start; }
.admin-grid form { display: grid; gap: 18px; }
.user-list { display: grid; gap: 1px; background: var(--line); }
.user-row { background: var(--surface); display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; padding: 13px 0; font-size: 14px; }
.user-row small { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 30; padding: 12px 20px; border-radius: 999px; color: white; background: var(--green-dark); box-shadow: var(--shadow); }

@media (max-width: 820px) {
  main { width: min(100% - 28px, 680px); }
  .topbar { height: 68px; padding: 0 16px; }
  .brand small { display: none; }
  .login-shell { grid-template-columns: 1fr; gap: 35px; padding: 45px 0; }
  .login-copy h1 { font-size: 44px; }
  .login-copy > p { font-size: 16px; }
  .login-panel { padding: 26px; }
  .workspace-head { align-items: start; flex-direction: column; }
  .step-track { width: 100%; overflow-x: auto; padding-bottom: 5px; }
  .question-grid, .admin-grid { grid-template-columns: 1fr; }
  .image-panel { position: static; }
  .history-list { grid-template-columns: 1fr; }
  .panel { padding: 22px; border-radius: 18px; }
  .user-row { grid-template-columns: 1fr auto; }
  .user-row span:nth-child(2) { grid-row: 2; }
}

@media (max-width: 430px) {
  .brand strong { font-size: 15px; }
  .account-bar #userName { display: none; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { flex: 1; white-space: nowrap; padding-inline: 12px; }
  .upload-card { min-height: 360px; padding: 24px; }
  .workspace-head h1, .page-heading h1 { font-size: 36px; }
  .formula { padding-inline: 8px; font-size: 14px; }
}
