@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("./assets/fonts/plus-jakarta-sans-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #102b4a;
  --ink: #18304a;
  --muted: #526479;
  --teal: #007668;
  --line: #dce5ed;
  --bg: #f4f7fa;
  --red: #b83238;
  --green: #167647;
  --orange: #8b5107;
  --content-width: 1380px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 18px; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.56; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #0da68e;
  outline-offset: 3px;
}
a { color: var(--teal); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.3; letter-spacing: -.035em; font-weight: 750; }
h2 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -.02em; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.5; font-weight: 700; }
small, .small { font-size: .875rem; }
p + p { margin-top: .6rem; }
.muted { color: var(--muted); }
.loading { margin: 2rem; }
.app-shell { min-height: 100vh; width: 100%; min-width: 0; }

/* Primary navigation stays horizontal, with contained scrolling on mobile. */
.site-header { width: 100%; min-width: 0; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 12px 28px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand > div { min-width: 0; }
.brand-symbol {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--navy);
  color: #53d8bf;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}
.brand strong { display: block; font-size: 1.2rem; font-weight: 750; line-height: 1.4; letter-spacing: -.025em; }
.brand span { display: block; font-size: .875rem; color: var(--muted); }
.header-meta { text-align: right; flex-shrink: 0; font-size: .875rem; line-height: 1.5; }
.header-meta strong { display: block; color: var(--ink); font-weight: 650; }
.header-meta span { display: block; color: var(--muted); }
.nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: var(--content-width);
  min-width: 0;
  margin: 0 auto;
  padding: 5px 28px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #ccd9e2 transparent;
}
.nav::-webkit-scrollbar { height: 3px; }
.nav::-webkit-scrollbar-thumb { background: #ccd9e2; border-radius: 4px; }
.nav button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.nav button.active { background: #e7f5ef; border-color: #c8e6dc; color: #00675c; }
.nav button:hover:not(:disabled) { background: #eef4f8; color: var(--ink); }
.nav button.active:hover:not(:disabled) { background: #dff1e9; color: #00675c; }
.nav-icon { width: 18px; display: grid; place-items: center; font-size: 1rem; line-height: 1; }
.main { width: 100%; min-width: 0; }
.topbar {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 10px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.topbar > span { font-size: .875rem; color: var(--muted); }
.status-pill { padding: 4px 10px; border: 1px solid #cce7db; border-radius: 999px; background: #e9f5ef; color: #17644c !important; font-size: .875rem !important; font-weight: 550; line-height: 1.5; white-space: nowrap; }
.status-pill.sample { background: #fff0dc; border-color: #ecd5ae; color: var(--orange) !important; }
.workspace { width: 100%; max-width: var(--content-width); margin: 0 auto; padding: 14px 28px 30px; min-width: 0; }
.notice { margin-bottom: 16px; padding: 10px 14px; border: 1px solid #ead4ad; border-radius: 10px; background: #fff7e9; color: #6d4615; font-size: .875rem; line-height: 1.55; overflow-wrap: anywhere; }
.notice.real { background: #edf5fb; border-color: #d3e2ee; color: #355a75; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; min-width: 0; }
.page-head > div { min-width: 0; }
.page-head p { margin-top: 5px; color: var(--muted); }
.eyebrow { margin-bottom: 3px; color: var(--teal); font-size: .875rem; font-weight: 650; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 2px 5px #17395603; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 254px; align-items: start; gap: 18px; min-width: 0; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; min-width: 0; }
.field { display: grid; gap: 5px; min-width: 0; flex: 1 1 240px; max-width: 470px; }
.field label { font-size: .875rem; font-weight: 650; }
.field select, .field input { min-width: 0; width: 100%; max-width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #c7d3de; border-radius: 9px; background: #fff; color: var(--ink); font-size: 1rem; }
.count { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.toolbar > .count { padding-bottom: 11px; }
.question-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.question-meta > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.type-tag { flex-shrink: 0; padding: 3px 8px; border-radius: 6px; background: #edf4fb; color: #305c84; font-weight: 550; }
.question-title { margin-bottom: 16px; font-size: 1.125rem; font-weight: 650; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.options { display: grid; gap: 9px; }
.option { display: flex; align-items: flex-start; gap: 10px; min-width: 0; min-height: 48px; padding: 11px 14px; border: 1px solid #cfdae4; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; }
.option:hover { background: #f6f9fc; border-color: #adbfce; }
.option.selected { border-color: var(--teal); background: #edf8f3; box-shadow: inset 3px 0 var(--teal); }
.option:focus-within { outline: 2px solid #0da68e; outline-offset: 2px; }
.option input { flex-shrink: 0; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--teal); }
.option-key { flex-shrink: 0; font-weight: 700; }
.option-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer-box { margin-top: 16px; padding: 16px; border: 1px solid #b7dcd0; border-radius: 11px; background: #f0faf5; }
.answer-box.wrong { background: #fff5f5; border-color: #f0c4c4; }
.answer-box.neutral { background: #f3f6fa; border-color: var(--line); }
.answer-box h3 { margin-bottom: 8px; }
.answer-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-box p + .answer-text, .answer-box p + div.answer-text { margin-top: 6px; }
.source { margin-top: 12px; padding-top: 10px; border-top: 1px solid #d7e4dd; color: var(--muted); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.source-list { margin: 6px 0 0; padding-left: 22px; }
.source-list li + li { margin-top: 7px; }
.source-note { margin-top: 4px; font-size: .8125rem; }
.source-original, .knowledge-list .source-original { margin-top: 5px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.source-original summary, .knowledge-list .source-original summary { min-height: 44px; padding: 10px 0; font-size: .8125rem; font-weight: 500; }
.source-original ol { padding-left: 22px; }
.source-original p, .source-original li { font-size: .8125rem; white-space: pre-wrap; }
.knowledge-body > p + p { margin-top: 12px; }
.coverage-item + .coverage-item { margin-top: 16px; }
.coverage-item > p { margin-top: 7px; }
.warning { margin-top: 8px; color: var(--orange); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.button { min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 650; line-height: 1.4; transition: background .15s, border-color .15s, box-shadow .15s; }
.primary { background: var(--teal); color: #fff; box-shadow: 0 2px 3px #00766812; }
.primary:hover:not(:disabled) { background: #006457; }
.secondary { border-color: #c7d3de; background: #fff; color: var(--ink); }
.secondary:hover:not(:disabled) { background: #f3f7fa; border-color: #a9bece; }
.danger { background: #ad3238; color: #fff; }
.danger:hover:not(:disabled) { background: #922a30; }
.text-button { min-height: 44px; padding: 10px 2px; border: 0; background: none; color: var(--teal); font-weight: 650; line-height: 1.4; text-align: left; }
.text-button:hover:not(:disabled) { color: #004e45; text-decoration: underline; text-underline-offset: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.question-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.question-footer .count { text-align: center; }
.progress-track { height: 6px; margin: 12px 0 14px; overflow: hidden; border-radius: 10px; background: #e4ecf3; }
.progress-track span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.side-panel h3 { margin-bottom: 6px; }
.side-note { color: var(--muted); font-size: .875rem; line-height: 1.6; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .875rem; }
.stat-row strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.side-panel .stat-row:last-child { padding-bottom: 0; }
.essay-input { display: block; width: 100%; min-height: 172px; padding: 12px 14px; resize: vertical; border: 1px solid #c7d3de; border-radius: 10px; background: #fff; color: var(--ink); font-size: 1rem; line-height: 1.6; }
.essay-input::placeholder { color: #6b7c8d; }
.exam-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.exam-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.exam-card .button { align-self: flex-start; margin-top: 4px; }
.exam-card .muted { flex: 1; }
.exam-details { display: flex; flex-wrap: wrap; gap: 5px 13px; color: var(--muted); font-size: .875rem; }
.timer { flex-shrink: 0; padding: 8px 12px; border: 1px solid #badbd3; border-radius: 10px; background: #eaf8f4; color: #05695e; font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer.urgent { border-color: #ebbbbb; background: #fff1f1; color: var(--red); }
.practice-clock { display: flex; align-items: center; gap: 12px; max-width: 480px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.practice-clock > div:first-child { display: grid; flex-shrink: 0; gap: 2px; }
.stopwatch { display: block; font-size: 1.125rem; font-weight: 750; line-height: 1.4; font-variant-numeric: tabular-nums; color: var(--navy); white-space: nowrap; }
.clock-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.clock-button { min-height: 40px; padding: 8px 10px; border: 1px solid #c7d3de; border-radius: 8px; background: #f8fafc; color: var(--ink); font-size: .875rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.clock-button:hover:not(:disabled) { background: #edf5f1; border-color: #accec2; color: #00675c; }
.clock-button[data-action="clock-start"], .clock-button[data-action="clock-pause"] { background: #e7f5ef; border-color: #c8e6dc; color: #00675c; }
.exam-layout .side-panel > .button { width: 100%; }
.exam-layout .side-panel > .button + .button { margin-top: 8px; }
.question-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.question-grid button { min-height: 40px; padding: 7px 0; border: 1px solid #d0dae4; border-radius: 8px; background: #fff; color: var(--ink); font-size: .875rem; font-variant-numeric: tabular-nums; }
.question-grid button:hover { background: #f2f7fa; }
.question-grid button.answered { background: #dff3eb; border-color: #a2cdbc; }
.question-grid button.current { border-color: var(--teal); outline: 2px solid var(--teal); outline-offset: 1px; font-weight: 750; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.result-stat { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result-stat strong { display: block; margin-bottom: 5px; font-size: 1.65rem; font-weight: 750; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.result-stat span { color: var(--muted); font-size: .875rem; }
.result-stat.featured { background: var(--navy); border-color: var(--navy); color: #fff; }
.result-stat.featured span { color: #d5e3ef; }
.review-list { display: grid; gap: 14px; }
.review-list .question-title { margin-bottom: 10px; font-size: 1.0625rem; }
.review-label { margin-bottom: 6px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.correct-text { color: var(--green); }
.wrong-text { color: var(--red); }
.rubric { margin: 10px 0; padding-left: 22px; white-space: normal; }
.rubric li { margin: 4px 0; }
.self-score { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.self-score input { width: 85px; min-height: 44px; padding: 8px 10px; border: 1px solid #c7d3de; border-radius: 8px; font-size: 1rem; }
.empty { padding: 36px 20px; text-align: center; }
.empty h2 { margin-bottom: 8px; }
.knowledge-list { display: grid; gap: 9px; }
.knowledge-list details { min-width: 0; padding: 0 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.knowledge-list summary { min-height: 48px; padding: 12px 0; cursor: pointer; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; }
.knowledge-list details[open] { border-color: #b6ccc8; }
.knowledge-body { margin-top: 2px; padding-bottom: 16px; }
.knowledge-body h3 { margin: 16px 0 6px; }
.knowledge-body p { white-space: pre-wrap; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #e9f1f7; color: #3c5973; font-size: .875rem; font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
dialog { width: calc(100% - 32px); max-width: 460px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: 0 18px 80px #102b4a28; }
dialog p { margin-top: 8px; color: var(--muted); }
dialog::backdrop { background: #102b4a80; }
.error { max-width: 760px; margin: 40px auto; padding: 24px; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; color: var(--muted); font-size: .875rem; }
.sample-inline { color: var(--orange); font-size: .875rem; font-weight: 650; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  .header-inner { padding-inline: 24px; }
  .nav { padding-inline: 24px; }
  .topbar { padding-inline: 24px; }
  .workspace { padding-inline: 24px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-panel { display: none; }
  .exam-layout { grid-template-columns: minmax(0, 1fr) 232px; }
  .exam-layout .side-panel { display: block; }
  .exam-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .header-inner { gap: 12px; padding: 9px 16px 5px; }
  .brand { gap: 9px; }
  .brand-symbol { flex-basis: 34px; width: 34px; height: 34px; border-radius: 9px; font-size: 19px; }
  .brand strong { font-size: 1.1rem; }
  .brand span { display: none; }
  .header-meta { max-width: 48%; font-size: .875rem; }
  .header-meta strong { font-weight: 600; }
  .nav { gap: 4px; padding: 3px 16px 5px; }
  .nav button { padding: 10px 12px; min-height: 44px; }
  .nav-icon { display: none; }
  .topbar { gap: 8px; padding: 6px 16px 0; align-items: flex-start; }
  .topbar > span:first-child { flex: 1; min-width: 0; }
  .status-pill { max-width: 54%; white-space: normal; text-align: right; padding: 3px 8px; }
  .workspace { padding: 10px 16px 24px; }
  h1 { font-size: 1.5rem; }
  .notice { padding: 7px 10px; margin-bottom: 10px; line-height: 1.5; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head:has(.practice-clock) { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  .page-head:has(.practice-clock) > div:first-child { width: 100%; }
  .page-head:has(.practice-clock) .eyebrow { display: inline; margin: 0 8px 0 0; }
  .page-head:has(.practice-clock) h1 { display: inline; }
  .page-head:has(.practice-clock) p { margin-top: 3px; line-height: 1.45; }
  .practice-clock { display: grid; gap: 4px; width: 100%; max-width: none; padding: 6px 8px; }
  .practice-clock > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .clock-actions { flex-wrap: wrap; width: 100%; }
  .clock-button { flex: 1 1 auto; min-height: 44px; padding: 10px 8px; }
  .page-head p { font-size: 1rem; }
  .panel { padding: 16px; border-radius: 12px; }
  .toolbar { gap: 10px; align-items: stretch; margin-bottom: 14px; }
  .field { flex-basis: 100%; width: 100%; max-width: none; }
  .toolbar > .count { padding-bottom: 0; }
  .page-head:has(.practice-clock) + .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; margin-bottom: 10px; }
  .page-head:has(.practice-clock) + .toolbar .field { width: auto; gap: 3px; }
  .page-head:has(.practice-clock) + .toolbar .field:only-of-type { grid-column: 1 / -1; }
  .page-head:has(.practice-clock) + .toolbar select { padding-inline: 9px; overflow: hidden; text-overflow: ellipsis; }
  .page-head:has(.practice-clock) + .toolbar > .count { grid-column: 1 / -1; }
  .question-title { margin-bottom: 14px; font-size: 1.0625rem; }
  .question-meta { gap: 8px; align-items: flex-start; margin-bottom: 10px; }
  .type-tag { max-width: 48%; white-space: normal; text-align: right; }
  .option { gap: 9px; padding: 11px 12px; }
  .answer-box { padding: 14px; }
  .layout { display: block; }
  .exam-layout { display: flex; flex-direction: column-reverse; gap: 14px; }
  .exam-layout > .panel { width: 100%; }
  .question-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
  .question-grid button { min-height: 44px; }
  .exam-layout .side-note { display: block; }
  .side-panel .stat-row { display: none; }
  .exam-cards { grid-template-columns: 1fr; gap: 12px; }
  .exam-card { gap: 9px; }
  .exam-card .button { align-self: stretch; }
  .result-stats { gap: 10px; }
  .result-stat { padding: 14px; }
  .result-stat strong { font-size: 1.45rem; }
  .question-footer { gap: 8px; margin-top: 16px; padding-top: 14px; }
  .question-footer .button { padding: 10px 12px; }
  .timer { padding: 7px 9px; font-size: 1rem; }
  .knowledge-list details { padding-inline: 14px; }
  .knowledge-list summary { min-height: 48px; }
  .app-footer { align-items: flex-start; flex-direction: column; gap: 0; margin-top: 16px; }
  .self-score { align-items: flex-start; }
}

@media (max-width: 380px) {
  .header-inner, .nav, .topbar { padding-inline: 12px; }
  .workspace { padding-inline: 12px; }
  .header-meta { max-width: 46%; }
  .panel { padding: 14px; }
  .exam-layout .panel.side-panel { padding: 14px 10px; }
  .question-grid { gap: 5px; }
  .result-stat { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
