:root {
  color-scheme: light;
  --ink: #172b3a;
  --muted: #657889;
  --line: #d9e3ea;
  --surface: #ffffff;
  --surface-soft: #f4f8fb;
  --primary: #0b527e;
  --primary-dark: #073a5b;
  --accent: #d9942f;
  --success: #1a7958;
  --success-soft: #e9f6ef;
  --danger: #b44949;
  --danger-soft: #fff0ef;
  --shadow: 0 14px 36px rgba(18, 51, 72, .09);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--surface-soft); }

body { margin: 0; color: var(--ink); background: var(--surface-soft); line-height: 1.6; }

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }

.site-header { color: #fff; background: linear-gradient(115deg, #073a5b, #0b527e); }
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.header-inner { display: flex; align-items: center; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; }
.brand small { display: block; margin-top: -2px; color: #b8d0df; font-size: .62rem; font-weight: 400; letter-spacing: .05em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid rgba(255,255,255,.7); border-radius: 10px; color: #fff; font-size: 1.1rem; }

.site-footer { margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; text-align: center; }
.site-footer p { margin: 0; }
.page-container { padding-top: 48px; }

.hero-card { display: flex; align-items: center; justify-content: space-between; min-height: 220px; padding: 42px 48px; overflow: hidden; border-radius: 18px; color: #fff; background: linear-gradient(120deg, #0a466c, #147595); box-shadow: var(--shadow); }
.hero-copy { max-width: 690px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .15em; }
.hero-card h1, .exam-header h1, .result-hero h1, .admin-heading h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.2; }
.hero-card .lead { margin: 14px 0 0; color: #d9edf7; font-size: 1.05rem; }
.hero-badge { display: grid; width: 110px; height: 110px; place-items: center; margin-right: 12px; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; background: rgba(255,255,255,.09); }
.hero-badge span { display: block; margin-top: 20px; font-size: 3.5rem; line-height: .7; }
.hero-badge small { color: #c5e2ec; }

.form-card, .admin-filter-card, .admin-table-card, .detail-summary { margin-top: 24px; padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.section-heading h2 { margin: 0; font-size: 1.45rem; }
.form-help { margin: 5px 0 0; color: var(--muted); font-size: .92rem; }
.narrow-form { max-width: 520px; margin-top: 28px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group + .field-group { margin-top: 18px; }
.field-group label { color: var(--ink); font-size: .9rem; font-weight: 700; }
.field-group input, .field-group select { width: 100%; min-height: 46px; padding: 9px 13px; border: 1px solid #b9cbd6; border-radius: 8px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.field-group input::placeholder { color: #9aabb6; }
.field-group input:focus, .field-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 82, 126, .14); }
.field-hint { margin: 0; color: var(--muted); font-size: .78rem; }
.form-message { min-height: 1.5em; margin: 14px 0 0; color: var(--danger); font-size: .9rem; }
.form-message:empty { display: none; }
.notice-box { max-width: 720px; margin-top: 28px; padding: 18px 20px; border-left: 4px solid var(--accent); border-radius: 6px; background: #fff8eb; color: #614b2b; font-size: .88rem; }
.notice-box strong { color: #704d15; }
.notice-box ul { margin: 8px 0 0; padding-left: 20px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 19px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; line-height: 1.3; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .text-link:focus-visible, .answer-option:focus-within { outline: 3px solid rgba(217, 148, 47, .45); outline-offset: 2px; }
.button-primary { color: #fff; background: var(--primary); box-shadow: 0 4px 10px rgba(11, 82, 126, .16); }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); }
.button-secondary { border-color: #b8ccd8; color: var(--primary); background: #fff; }
.button-secondary:hover { border-color: var(--primary); background: #f5fafc; }
.button-wide { width: 100%; margin-top: 10px; }
.button-small { min-height: 36px; padding: 6px 13px; font-size: .86rem; }
.button:disabled, .button-disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.button-spinner { display: none; width: 16px; height: 16px; margin-left: 9px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .button-spinner { display: inline-block; }
.is-loading .button-label { opacity: .75; }
@keyframes spin { to { transform: rotate(360deg); } }

.exam-container { max-width: 900px; }
.exam-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 24px; }
.exam-candidate { margin: 8px 0 0; color: var(--muted); }
.exam-counter { min-width: 190px; color: var(--primary); font-size: .88rem; font-weight: 700; text-align: right; }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #dce8ee; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.exam-stage { min-height: 450px; padding: 36px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.loading-panel, .error-panel { display: grid; min-height: 370px; place-items: center; align-content: center; text-align: center; }
.loading-spinner { width: 38px; height: 38px; border: 4px solid #d8e5eb; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-panel p { margin: 18px 0 0; color: var(--muted); }
.question-meta { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .87rem; }
.question-type { padding: 3px 10px; border-radius: 99px; color: var(--primary); background: #eaf4f8; font-weight: 700; }
.question-content { margin: 24px 0 28px; font-size: clamp(1.15rem, 2.5vw, 1.45rem); line-height: 1.65; }
.question-content p { margin: 0 0 12px; }
.question-content p:last-child { margin-bottom: 0; }
.question-hint { margin: -14px 0 22px; color: var(--muted); font-size: .88rem; }
.answer-options { display: grid; gap: 12px; padding: 0; border: 0; }
.answer-option { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 15px 17px; border: 1px solid #c5d5de; border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.answer-option:hover { border-color: var(--primary); background: #f8fcfd; }
.answer-option.selected { border-color: var(--primary); background: #edf7fa; box-shadow: 0 0 0 2px rgba(11, 82, 126, .1); }
.answer-option input { position: absolute; opacity: 0; }
.answer-indicator { display: grid; flex: 0 0 21px; width: 21px; height: 21px; place-items: center; margin-top: 1px; border: 2px solid #a5bac5; border-radius: 50%; color: #fff; font-size: .74rem; }
.answer-option.selected .answer-indicator { border-color: var(--primary); background: var(--primary); }
.answer-option.selected .answer-indicator::after { width: 7px; height: 7px; border-radius: 50%; background: #fff; content: ""; }
.answer-text { flex: 1; white-space: pre-wrap; }
.question-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.finish-panel { min-height: 370px; text-align: center; }
.completion-icon { display: grid; width: 66px; height: 66px; place-items: center; margin: 22px auto; border-radius: 50%; color: #fff; background: var(--success); font-size: 2rem; }
.finish-panel h2 { margin: 0; }
.finish-panel > p { color: var(--muted); }
.finish-summary { color: var(--ink) !important; font-weight: 700; }
.error-icon { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: 16px; border-radius: 50%; color: #fff; background: var(--danger); font-size: 1.8rem; font-weight: 700; }
.error-panel h2 { margin: 0; }
.error-panel p { max-width: 560px; color: var(--muted); }
.exam-footer { display: flex; justify-content: space-between; padding: 16px 2px; color: var(--muted); font-size: .82rem; }
.exam-footer p { margin: 0; }
.text-link { color: var(--primary); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.result-container { max-width: 900px; }
.result-hero { margin-bottom: 24px; }
.result-candidate { margin: 8px 0 0; color: var(--muted); }
.score-card { display: flex; align-items: stretch; justify-content: space-between; gap: 28px; padding: 34px; border-radius: 16px; color: #fff; background: linear-gradient(120deg, #0a466c, #147595); box-shadow: var(--shadow); }
.score-label, .meta-label { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.score-card .score-label { color: #bad9e6; }
.score-value { margin: 3px 0 0; line-height: 1; }
.score-value strong { font-size: clamp(2.8rem, 8vw, 4.8rem); }
.score-value span { margin-left: 8px; color: #c6e2eb; font-size: 1.2rem; }
.result-status { display: inline-block; margin: 18px 0 0; padding: 4px 12px; border-radius: 99px; color: #fff; background: rgba(255,255,255,.16); font-weight: 700; }
.result-status.status-pass { color: #d5f8e6; background: rgba(30, 155, 102, .35); }
.result-status.status-fail { color: #ffe0d9; background: rgba(180, 73, 73, .35); }
.score-meta { display: grid; align-content: center; gap: 18px; min-width: 190px; padding-left: 28px; border-left: 1px solid rgba(255,255,255,.24); }
.score-meta .meta-label { color: #bad9e6; }
.score-meta strong { display: block; color: #fff; font-size: .9rem; font-weight: 600; }
.answer-review-section { margin-top: 24px; padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.answer-review { display: grid; gap: 10px; margin: 26px 0 0; padding-left: 28px; }
.answer-review li { padding: 13px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.answer-review li::marker { color: var(--muted); font-weight: 700; }
.review-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.review-answer { color: var(--muted); font-size: .9rem; }
.status-pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.status-pass { color: var(--success); background: var(--success-soft); }
.status-fail { color: var(--danger); background: var(--danger-soft); }
.status-neutral { color: var(--muted); background: #edf1f3; }
.loading-row { color: var(--muted); }
.result-actions { margin-top: 24px; text-align: center; }

.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.admin-filter-card { padding: 22px; }
.filter-form { display: grid; grid-template-columns: repeat(5, 1fr) auto auto; align-items: end; gap: 12px; }
.filter-form .field-group + .field-group { margin-top: 0; }
.filter-form .field-group label { font-size: .8rem; }
.filter-form .field-group input, .filter-form .field-group select { min-height: 40px; padding: 6px 9px; }
.filter-form .button { min-height: 40px; }
.admin-table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.table-toolbar p { margin: 0; }
.table-toolbar strong { color: var(--ink); }
.table-toolbar > span { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.results-table th, .results-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.results-table th { color: var(--muted); background: #f7fafb; font-size: .78rem; font-weight: 700; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover { background: #fbfdfe; }
.table-action { text-align: right !important; }
.empty-row td { padding: 48px 16px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; border-top: 1px solid var(--line); }
.pagination-current { color: var(--muted); font-size: .86rem; }
.detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.detail-person strong { display: block; margin-top: 4px; font-size: 1.08rem; }
.status-text-pass { color: var(--success); }
.status-text-fail { color: var(--danger); }
.status-text-neutral { color: var(--muted); }
.compact-heading { padding: 22px 24px 0; }
.answer-table { margin-top: 8px; }

.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { color: #cfe4ef; font-size: .9rem; font-weight: 600; text-decoration: none; }
.site-nav a:hover { color: #fff; text-decoration: underline; }
.site-nav a:focus-visible { outline: 3px solid rgba(217, 148, 47, .45); outline-offset: 2px; }

.identity-panel { margin-top: 24px; }
.identity-panel .form-card { margin-top: 0; }
.identity-panel .notice-box { margin-top: 20px; }

.question-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.question-chip { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #c5d5de; border-radius: 8px; color: var(--muted); background: var(--surface); font-size: .9rem; font-weight: 700; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.question-chip:hover { border-color: var(--primary); color: var(--primary); }
.question-chip.is-answered { border-color: var(--primary); color: #fff; background: var(--primary); }
.question-chip.is-current { box-shadow: 0 0 0 3px rgba(11, 82, 126, .18); }
.question-chip:focus-visible { outline: 3px solid rgba(217, 148, 47, .45); outline-offset: 2px; }

.answer-option.is-locked { cursor: default; background: #f7fafb; }
.form-message.is-info { color: var(--muted); }
.finish-actions, .error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.exam-footer-state { font-size: .82rem; }
.result-status.status-neutral { color: #e4eef4; background: rgba(255, 255, 255, .16); }

.review-item { display: grid; gap: 8px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-body { display: grid; gap: 4px; }
.review-content { font-size: .95rem; }
.review-content p { margin: 0 0 8px; }
.review-content p:last-child { margin-bottom: 0; }
.review-answer { color: var(--muted); font-size: .9rem; }
.review-time { color: var(--muted); font-size: .8rem; }
.toolbar-hint { margin-left: 8px; }

@media (max-width: 800px) {
  .filter-form { grid-template-columns: repeat(2, 1fr); }
  .filter-form .button, .filter-form .text-link { align-self: center; }
  .detail-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .container { width: min(100% - 28px, 1120px); }
  .page-container { padding-top: 28px; }
  .hero-card { min-height: 0; padding: 30px 24px; }
  .hero-badge { display: none; }
  .form-card, .admin-filter-card, .answer-review-section, .exam-stage, .score-card { padding: 24px 18px; }
  .exam-header, .admin-heading { align-items: flex-start; flex-direction: column; }
  .exam-counter { width: 100%; min-width: 0; text-align: left; }
  .score-card { flex-direction: column; }
  .score-meta { min-width: 0; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.24); border-left: 0; }
  .filter-form { grid-template-columns: 1fr 1fr; }
  .filter-form .field-group:nth-child(3), .filter-form .field-group:nth-child(4), .filter-form .field-group:nth-child(5) { grid-column: span 2; }
  .filter-form .button { grid-column: span 2; }
  .filter-form .text-link { grid-column: span 2; text-align: center; }
  .detail-summary { grid-template-columns: 1fr 1fr; padding: 22px 18px; }
  .exam-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .review-row { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (max-width: 460px) {
  .filter-form, .detail-summary { grid-template-columns: 1fr; }
  .filter-form .field-group:nth-child(n), .filter-form .button, .filter-form .text-link { grid-column: auto; }
}
