:root {
  color-scheme: light;
  --background: #f5f4ed;
  --paper: #fffefb;
  --ink: #172a24;
  --muted: #51635b;
  --line: #e1e5da;
  --green: #185b46;
  --green-dark: #104735;
  --green-wash: #e6f0e7;
  --blue: #284f6f;
  --red: #9e3532;
  --radius: 18px;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; line-height: 1.6; overscroll-behavior-y: none; }
a { color: var(--green); }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #186c9c; outline-offset: 3px; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.18; letter-spacing: -.05em; }
h2 { font-size: 1.34rem; line-height: 1.35; letter-spacing: -.026em; }
small, .small { font-size: .86rem; }
code { background: #edf0e8; padding: .1em .35em; border-radius: 4px; }
.quiet { color: var(--muted); }
.frame { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.content { flex: 1; padding-block: 44px 55px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.padded { padding: 25px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 11px; }
.section-tag, .badge { display: inline-flex; align-items: center; background: #ecf1e8; color: #365c4a; border-radius: 100px; padding: 3px 10px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.eyebrow { color: var(--green); font-weight: 750; font-size: .83rem; letter-spacing: .13em; margin-bottom: 8px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.empty { padding: 18px 0 4px; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 18px; min-height: 66px; padding-block: env(safe-area-inset-top) 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.12rem; letter-spacing: .04em; white-space: nowrap; }
.account { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; }
.account-name { font-size: .88rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.footer { display: flex; gap: 14px; justify-content: space-between; padding-block: 14px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.footer span:first-child { font-weight: 750; }
.install-app { white-space: nowrap; margin-left: auto; }

.primary, .outline, .plain, .danger { min-height: 42px; border: 1px solid transparent; border-radius: 9px; padding: 8px 15px; font-weight: 700; line-height: 1.4; }
.button { text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.primary { background: var(--green); color: white; }
.primary:not(:disabled):hover { background: var(--green-dark); }
.outline { background: var(--paper); color: var(--green); border-color: #c1d3c7; }
.outline:not(:disabled):hover { background: var(--green-wash); }
.plain { background: transparent; color: var(--green); padding-inline: 8px; }
.plain:hover { text-decoration: underline; }
.danger { background: #fff7f4; color: var(--red); border-color: #e7bcb4; }
.danger:hover { background: #ffebe5; }
.form-stack { display: grid; gap: 13px; margin-top: 19px; }
.form-stack label { display: grid; gap: 5px; font-size: .88rem; font-weight: 700; }
.form-stack label > :is(input, select) { min-width: 0; width: 100%; min-height: 43px; border: 1px solid #cbd5cc; background: #fcfcf8; border-radius: 8px; padding: 8px 10px; color: var(--ink); font-size: 1rem; font-weight: 450; }
.form-stack input::placeholder { color: #65756c; }
.form-stack input[type=file] { border-style: dashed; }
.form-stack input::file-selector-button { border: 0; background: var(--green-wash); color: var(--green-dark); padding: 4px 8px; margin-inline-end: 9px; border-radius: 4px; cursor: pointer; }
.form-end { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.notice { padding: 12px 15px; margin-bottom: 16px; border: 1px solid; border-radius: 10px; overflow-wrap: anywhere; }
.notice ul { margin-block: 6px 0; padding-inline-start: 24px; }
.notice.error { background: #fff1ed; color: #842824; border-color: #ecc6bd; }
.notice.success { background: #eaf4e9; color: #215639; border-color: #c5dcc8; }
.notice.warning { background: #fff5de; color: #674713; border-color: #e9d2a4; }

.login-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; align-items: stretch; padding-block: clamp(35px, 10vh, 92px); }
.login-intro { border-radius: 23px; background-color: #123c30; color: #f9faf1; padding: clamp(26px, 5vw, 55px); background-image: linear-gradient(135deg, #123c30 36%, transparent 100%), repeating-linear-gradient(0deg, transparent 0 31px, #5d89683d 31px 32px), repeating-linear-gradient(90deg, transparent 0 31px, #5d89683d 31px 32px); }
.login-intro .eyebrow { color: #c4dabc; }
.login-intro h1 { font-size: clamp(2.25rem, 5.3vw, 4rem); margin-bottom: 18px; }
.login-intro > p:not(.eyebrow) { max-width: 26rem; color: #d8e7d8; }
.intro-modes { display: grid; gap: 8px; margin-top: clamp(24px, 5vw, 54px); }
.intro-modes div { display: flex; align-items: center; gap: 12px; }
.intro-modes span { color: #b2d1ad; font-size: .85rem; font-variant-numeric: tabular-nums; }
.login-panel { padding: clamp(25px, 4vw, 43px); display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { font-size: 1.85rem; margin-bottom: 6px; }
.login-panel .notice { margin: 13px 0 0; }
.login-panel .primary { margin-top: 5px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 23px; }
.page-heading h1 { margin-bottom: 7px; }
.heading-stat { border-left: 1px solid #cdd8ce; padding-left: 16px; min-width: 102px; }
.heading-stat strong, .heading-stat span { display: block; }
.heading-stat strong { font-size: 2.23rem; line-height: 1; font-variant-numeric: tabular-nums; }
.heading-stat span { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.bank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.stat-card { padding: 16px 19px; display: grid; gap: 2px; }
.stat-card strong { font-size: clamp(1.45rem, 3vw, 2.18rem); line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-card strong small { color: var(--muted); font-weight: 500; }
.stat-note { color: var(--green); font-size: .78rem; }
.stat-note.under { color: #8a561a; }
.danger-panel { border-color: #ebd8ce; }
.danger-tag { background: #f7e9e3; color: var(--red); }
.user-list, .history-list { list-style: none; padding: 0; margin: 0; }
.user-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding-block: 9px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.student-icon { background: #edf1e7; color: var(--green); font-size: .78rem; font-weight: 750; border-radius: 8px; display: grid; place-items: center; width: 30px; height: 30px; }

.modes { margin-bottom: 19px; }
.mode-card { padding: clamp(18px, 3vw, 28px); border-color: #cbdacb; background: #eff5ea; }
.exam.mode-card { border-color: #ccdce3; background: #eef4f7; }
.exam .primary { background: var(--blue); }
.exam .primary:not(:disabled):hover { background: #1d3b54; }
.mode-index { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .78rem; color: var(--green); font-weight: 700; }
.mode-index span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #b8cdb9; border-radius: 9px; }
.exam .mode-index { color: var(--blue); }
.exam .mode-index span:first-child { border-color: #bfd0da; }
.mode-card h2 { font-size: 1.8rem; margin: 18px 0 5px; }
.mode-card p { color: var(--muted); }
.mode-spec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; min-height: 45px; padding-block: 9px; border-top: 1px solid #d9e2d7; border-bottom: 1px solid #d9e2d7; font-size: .86rem; }
.practice-modes { display: grid; gap: 0; }
.practice-modes .mode-spec { margin: 0; border-bottom: 0; }
.practice-modes .mode-spec:last-child { border-bottom: 1px solid #d9e2d7; }
.practice-modes .mode-spec strong { min-width: 5.5em; }
.practice-modes .mode-spec form, .practice-modes .mode-spec > .button { margin-left: auto; }
.practice-modes .mode-spec .primary { min-height: 34px; padding: 5px 11px; font-size: .82rem; }
.exam-split { border-color: #d4e0e6; }
.exam-split span { padding-inline-end: 9px; }
.exam-split span:not(:last-child) { border-right: 1px solid #c4d4de; }
.mode-card .mode-hint { margin-top: 7px; color: #78501a; font-size: .84rem; }
.history-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.history-list a:hover strong { text-decoration: underline; }
.history-list time { color: var(--muted); font-size: .84rem; }
.history-list a > span { font-size: .84rem; }
.history-bank { color: var(--muted); font-size: .78rem; font-weight: 500; overflow-wrap: anywhere; }

.sub-heading { margin: 0 0 11px; align-items: center; }
.sub-heading h2 { font-size: 1.16rem; }
.bank-list { display: grid; gap: 10px; margin-bottom: 22px; }
.bank-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 19px; text-decoration: none; color: var(--ink); }
.bank-row:hover { border-color: #b5cbb9; background: #f6faf2; }
.bank-row-main { display: grid; gap: 2px; min-width: 0; }
.bank-row-main strong { font-size: 1.14rem; overflow-wrap: anywhere; }
.bank-row-state { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.exam-badge { background: #e2ecf3; color: #2a5474; }
.muted-badge { background: #f1f0e6; color: #6b6852; }
.bank-go { color: var(--green); font-size: .88rem; font-weight: 700; white-space: nowrap; }
.paper-bank { margin-top: 2px; }

.back-link { text-decoration: none; display: inline-block; margin-bottom: 6px; font-weight: 700; }
.back-link:hover { text-decoration: underline; }
.paper-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 13px; margin-bottom: 18px; }
.paper-info { display: flex; align-items: center; gap: 10px; }
.clock { display: grid; border-radius: 9px; padding: 5px 12px; min-width: 102px; text-align: center; background: var(--green-wash); color: var(--green-dark); line-height: 1.35; }
.clock span { font-size: .74rem; font-weight: 700; }
.clock strong { font-size: 1.37rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock.ending { color: #8c2823; background: #f9e5de; }
.paper-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 17px; align-items: start; }
.question-panel { padding: clamp(17px, 3vw, 29px); }
.question-kicker { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 18px; font-size: .88rem; font-weight: 750; color: var(--muted); }
.question-panel fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.question-text { display: block; width: 100%; padding: 0; font-size: clamp(1.1rem, 2.4vw, 1.43rem); font-weight: 720; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.select-hint { margin-top: 5px; }
.options { display: grid; gap: 9px; margin-top: 16px; }
.option { display: flex; align-items: baseline; gap: 9px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; cursor: pointer; }
.option:hover, .option:has(:checked) { background: #edf5ea; border-color: #acc9b1; }
.option input { flex-shrink: 0; accent-color: var(--green); inline-size: 1rem; block-size: 1rem; margin: 0 2px 0 0; align-self: center; }
.option-key { color: var(--green); font-size: .83rem; font-weight: 800; }
.option-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.question-tail { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-block: 3px 7px; }
.question-tail button { flex-shrink: 0; }
.question-actions { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.navigator { padding: 15px; }
.navigator h2 { margin-bottom: 4px; }
.navigator progress { inline-size: 100%; block-size: .45rem; accent-color: var(--green); }
.navigator-groups { max-height: 440px; overflow: auto; margin-top: 6px; padding: 1px 3px; }
.navigator summary { padding: 7px 1px; color: var(--muted); font-size: .86rem; }
.navigator details { border-bottom: 1px solid var(--line); }
.numbers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 0 1px 8px; }
.number { padding: 0; min-height: 35px; border: 1px solid var(--line); border-radius: 6px; background: #f8f8f2; font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ink); }
.number:hover, .number.answered { background: var(--green-wash); border-color: #b5cbb9; }
.number.current { border: 2px solid var(--green); font-weight: 800; }
.nav-key { margin-top: 9px; }
.nav-key span { display: inline-block; width: .72rem; height: .72rem; border: 1px solid #a7bfae; border-radius: 3px; background: var(--green-wash); }

.result-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: clamp(18px, 4vw, 33px); margin: 6px 0 14px; background: #143f33; border-color: #143f33; color: #fbfcf5; }
.result-hero .eyebrow, .result-hero p { color: #d1e5d4; }
.result-hero h1 { margin-bottom: 8px; }
.score { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.score strong { font-size: clamp(2.1rem, 6vw, 3.8rem); line-height: 1; }
.score span { color: #d1e5d4; font-size: .9rem; }
.positive-text { color: var(--green); }
.negative-text { color: var(--red); }
.review-list { margin-top: 12px; }
.review-list details { border-top: 1px solid var(--line); }
.review-list summary { padding: 12px 0; }
.review-list summary:hover { color: var(--green); }
.review-number { display: inline-block; margin-inline: 4px 7px; color: var(--green); font-size: .82rem; font-weight: 750; }
.review-stem { font-weight: 650; overflow-wrap: anywhere; }
.review-body { padding: 6px 0 14px; }
.review-body dl { background: #f5f6ee; border-radius: 9px; padding: 10px 13px; margin-top: 6px; }
.review-body dl div { display: grid; grid-template-columns: 75px 1fr; gap: 9px; padding-block: 3px; }
.review-body dt { font-weight: 750; font-size: .88rem; }
.review-body dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.unanswered-review { margin-top: 18px; border-color: #d8d8c6; background: #fffef8; }

@media (max-width: 760px) {
  .frame { width: calc(100% - 28px); }
  .content { padding-block: 23px 35px; }
  .paper-grid, .login-wrap { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { gap: 15px; padding-block: 22px 36px; }
  .login-intro { order: 2; }
  .login-intro h1 { font-size: 2rem; }
  .login-intro br { display: none; }
  .navigator-groups { max-height: 250px; }
  .numbers { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .option { min-height: 50px; padding-block: 12px; }
  .number { min-height: 40px; }
  .question-actions { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); padding-bottom: max(5px, env(safe-area-inset-bottom)); backdrop-filter: blur(9px); }
}

@media (max-width: 560px) {
  .topbar-inner { min-height: 58px; gap: 5px; }
  .topbar-inner, .footer { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .install-app { padding-inline: 4px; font-size: .76rem; }
  .account { gap: 4px; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .padded { padding: 17px; }
  .page-heading { align-items: flex-start; }
  .heading-stat { min-width: 72px; padding-left: 8px; }
  .heading-stat strong { font-size: 1.85rem; }
  .bank-grid { gap: 7px; }
  .stat-card { padding: 9px; font-size: .86rem; }
  .stat-note { font-size: .71rem; }
  .history-list a { gap: 4px 8px; }
  .history-list time { font-size: .76rem; }
  .history-bank { display: none; }
  .bank-row { flex-wrap: wrap; gap: 8px; padding: 13px 14px; }
  .bank-row-state { justify-content: flex-start; order: 3; }
  .bank-go { margin-left: auto; }
  .paper-top h1 { font-size: 1.65rem; }
  .paper-info { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .paper-info button { padding-inline: 8px; font-size: .85rem; min-height: 38px; }
  .clock { padding: 4px 8px; min-width: 72px; }
  .numbers { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .result-hero { flex-wrap: wrap; }
  .account-name { max-width: 4.5rem; }
}
