/* =====================================================================
   NamDU · Yakuniy Davlat Attestatsiyasi — Examination Booklet
   Institutional paper aesthetic, anchored on the NamDU seal (deep blue + gold).
   Type: Fraunces (display serif) · IBM Plex Sans (body) · IBM Plex Mono (data)
   ===================================================================== */

/* ----------------------------- Reset ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; } /* guarantee the hidden attribute wins over any display rule */
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ol, ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ----------------------------- Tokens ----------------------------- */
:root,
[data-theme="light"] {
  --paper:      #faf8f2;   /* ivory exam paper */
  --paper-2:    #f2eddf;
  --surface:    #ffffff;
  --surface-2:  #f7f3ea;
  --surface-3:  #efe9da;
  --line:       #e2dbc9;
  --line-2:     #cfc6ad;
  --ink:        #16202c;
  --ink-2:      #45505e;
  --muted:      #7c8694;
  --brand:      #0056a0;   /* NamDU deep blue */
  --brand-deep: #003e73;
  --brand-soft: rgba(0, 86, 160, .10);
  --gold:       #b0881c;   /* refined academic gold */
  --gold-deep:  #8a6914;
  --gold-soft:  rgba(176, 136, 28, .15);
  --ok:         #1c7a4f;
  --ok-soft:    rgba(28, 122, 79, .13);
  --bad:        #b23a2e;
  --bad-soft:   rgba(178, 58, 46, .12);
  --shadow:     0 1px 2px rgba(22, 32, 44, .05), 0 10px 28px -16px rgba(22, 32, 44, .22);
  --shadow-lg:  0 2px 6px rgba(22, 32, 44, .06), 0 28px 56px -24px rgba(22, 32, 44, .30);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  --maxw: 1140px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  --paper:      #0d1626;
  --paper-2:    #0a111e;
  --surface:    #141f33;
  --surface-2:  #1a2740;
  --surface-3:  #21304e;
  --line:       #293750;
  --line-2:     #384a6b;
  --ink:        #ece6d8;
  --ink-2:      #b7c0d0;
  --muted:      #828da0;
  --brand:      #5aa6e6;
  --brand-deep: #7fc0f3;
  --brand-soft: rgba(90, 166, 230, .16);
  --gold:       #d8b44a;
  --gold-deep:  #ecc96b;
  --gold-soft:  rgba(216, 180, 74, .18);
  --ok:         #36ad75;
  --ok-soft:    rgba(54, 173, 117, .18);
  --bad:        #e55a4c;
  --bad-soft:   rgba(229, 90, 76, .18);
  --shadow:     0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lg:  0 2px 8px rgba(0, 0, 0, .4), 0 32px 60px -26px rgba(0, 0, 0, .7);
}

/* ----------------------------- Base ----------------------------- */
body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* very faint paper warmth, no busy grid */
  background-image: radial-gradient(circle at 20% 0%, var(--paper-2), transparent 60%);
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.serif { font-family: var(--serif); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.wrap--narrow { max-width: 820px; }

.display { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; line-height: 1.08; font-size: clamp(1.9rem, 5vw, 2.8rem); }
.display--sm { font-size: clamp(1.5rem, 4vw, 2rem); }
.eyebrow {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brand); font-weight: 500;
}

/* ----------------------------- App bar ----------------------------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}
.appbar__brand { display: inline-flex; align-items: center; gap: 12px; }
.appbar__seal { width: 34px; height: 34px; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,.12)); }
.appbar__brandtext { display: flex; flex-direction: column; line-height: 1.12; }
.appbar__brandtext strong { font-family: var(--serif); font-weight: 600; font-size: .92rem; color: var(--ink); }
.appbar__brandtext small { color: var(--muted); font-size: .68rem; letter-spacing: .02em; }
.appbar__actions { display: flex; align-items: center; gap: 8px; }
.chip-nav {
  font-size: .84rem; font-weight: 500; color: var(--ink-2);
  padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  transition: all .2s var(--ease);
}
.chip-nav:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.iconbtn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-md); color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface);
  transition: all .2s var(--ease);
}
.iconbtn:hover { color: var(--brand); border-color: var(--brand); }
.iconbtn .i-moon { display: none; }
[data-theme="dark"] .iconbtn .i-sun { display: none; }
[data-theme="dark"] .iconbtn .i-moon { display: block; }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 600; font-size: .95rem; line-height: 1;
  padding: 13px 20px; border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px -8px var(--brand); }
.btn--primary:hover { background: var(--brand-deep); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--xl { padding: 16px 28px; font-size: 1.04rem; border-radius: var(--r-lg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.linkbtn { color: var(--brand); font-weight: 500; font-size: .85rem; padding: 4px 2px; }
.linkbtn:hover { text-decoration: underline; }
.dot { color: var(--line-2); }

/* ----------------------------- Cover sheet (signature hero) ----------------------------- */
.coversheet {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px double var(--brand);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 38px 30px 26px;
  text-align: center;
  overflow: hidden;
}
.coversheet::before, .coversheet::after {
  content: ""; position: absolute; left: 30px; right: 30px; height: 1px; background: var(--line);
}
.coversheet::before { top: 96px; }
.coversheet__top { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 16px; }
.coversheet__seal { width: 84px; height: 84px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.15)); margin-bottom: 4px; }
.coversheet__uni { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; letter-spacing: .04em; color: var(--brand-deep); text-transform: uppercase; }
.coversheet__title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 4.2vw, 2.1rem); line-height: 1.12; letter-spacing: -.01em; color: var(--ink); max-width: 22ch; }
.coversheet__sub { color: var(--muted); font-size: .9rem; }

.coversheet__meta {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; margin: 20px -30px 0;
  border-top: 1px solid var(--line);
}
.coversheet__meta > div {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.coversheet__meta > div:nth-child(3n) { border-right: none; }
.coversheet__meta > div:nth-last-child(-n+3) { border-bottom: none; }
.coversheet__meta dt { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.coversheet__meta dd { font-size: 1rem; font-weight: 500; color: var(--ink); }
.coversheet__note { margin-top: 18px; color: var(--ink-2); font-size: .9rem; }
.coversheet__note strong { color: var(--ink); }

/* ----------------------------- Panel ----------------------------- */
.panel { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px 22px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel__title { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; }
.panel__tools { display: flex; align-items: center; gap: 8px; }
.panel__hint { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.panel__count { color: var(--muted); font-size: .82rem; margin-top: 14px; }
.setup__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; align-items: center; }

/* ----------------------------- Chips ----------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface-2);
  font-size: .88rem; font-weight: 500; color: var(--ink-2);
  transition: all .18s var(--ease); user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip__count { font-family: var(--mono); font-size: .72rem; color: var(--muted); background: var(--surface-3); padding: 1px 7px; border-radius: var(--r-pill); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.chip[aria-pressed="true"] .chip__count { background: rgba(0,0,0,.18); color: #fff; }

/* ----------------------------- Screens ----------------------------- */
.screen { display: none; padding: 34px 0 80px; animation: fade .4s var(--ease); }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----------------------------- Quiz runner ----------------------------- */
.runner-top {
  position: sticky; top: 61px; z-index: 20;
  padding: 14px 0; margin-bottom: 22px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.runner-top__row { display: flex; align-items: center; gap: 26px; }
.timer { display: flex; flex-direction: column; line-height: 1.1; flex-shrink: 0; }
.timer__label { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.timer__value { font-size: 1.7rem; font-weight: 600; color: var(--brand); }
.timer.is-low .timer__value { color: var(--bad); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.runner-top__progress { flex: 1; }
.runner-top__count { font-size: .8rem; color: var(--muted); margin-top: 9px; text-align: right; }

/* ruler progress */
.ruler { position: relative; height: 22px; }
.ruler__track { position: absolute; top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); background: var(--line); }
.ruler__fill { display: block; height: 100%; width: 0%; background: var(--brand); transition: width .35s var(--ease); }
.ruler__ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.ruler__tick { width: 1px; height: 8px; background: var(--line-2); }
.ruler__tick--major { height: 12px; background: var(--line-2); }

/* question card */
.qcard { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 30px; }
.qcard__head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.qcard__num { display: grid; place-items: center; min-width: 50px; height: 50px; padding: 0 6px; font-size: 1.15rem; font-weight: 600; color: #fff; background: var(--brand); border-radius: var(--r-sm); }
.qcard__topic { font-size: .82rem; color: var(--muted); font-weight: 500; }
.qcard__text { font-family: var(--serif); font-size: clamp(1.18rem, 3.2vw, 1.5rem); line-height: 1.38; font-weight: 500; color: var(--ink); margin-bottom: 22px; }

/* options — ruled answer-sheet rows */
.options { display: flex; flex-direction: column; }
.option {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px; width: 100%; text-align: left;
  padding: 15px 14px; border-radius: 0;
  border: none; border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background .14s var(--ease);
}
.option:first-child { border-top: 1px solid var(--line); }
.option:hover { background: var(--surface-2); }
.option__badge {
  flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; font-family: var(--mono); font-weight: 600; font-size: .88rem;
  background: var(--surface); color: var(--ink-2); border: 1.5px solid var(--line-2);
  transition: all .16s var(--ease);
}
.option__text { padding-top: 4px; font-size: 1rem; line-height: 1.45; }
.option[aria-pressed="true"] { background: var(--brand-soft); }
.option[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.option[aria-pressed="true"] .option__badge { background: var(--brand); color: #fff; border-color: var(--brand); }

/* runner footer */
.runner-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }

/* navigator */
.navigator { margin-top: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.navigator > summary { cursor: pointer; font-weight: 600; font-size: .92rem; list-style: none; display: flex; align-items: center; gap: 8px; }
.navigator > summary::-webkit-details-marker { display: none; }
.navigator > summary::before { content: "▸"; color: var(--muted); transition: transform .2s var(--ease); }
.navigator[open] > summary::before { transform: rotate(90deg); }
.navigator__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; margin-top: 14px; }
.navcell { height: 38px; border-radius: var(--r-sm); font-family: var(--mono); font-size: .82rem; font-weight: 500; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); transition: all .15s var(--ease); }
.navcell:hover { border-color: var(--brand); color: var(--brand); }
.navcell--done { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }
.navcell--cur { outline: 2px solid var(--brand); outline-offset: 1px; color: var(--ink); font-weight: 700; }
.navigator__legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: .76rem; color: var(--muted); }
.navigator__legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw--done { background: var(--brand-soft); border: 1px solid var(--brand); }
.sw--cur { background: transparent; outline: 2px solid var(--brand); }
.sw--empty { background: var(--surface-3); border: 1px solid var(--line); }

/* ----------------------------- Results ----------------------------- */
.result-head { margin-bottom: 24px; }
.result-head .eyebrow { margin-bottom: 10px; }
.scoreboard { display: grid; grid-template-columns: minmax(210px, 250px) 1fr; gap: 36px; align-items: center; }
.scoreboard__ring { position: relative; display: grid; place-items: center; }
.ring { fill: none; stroke-width: 10; transform: rotate(-90deg); transform-origin: 60px 60px; transform-box: view-box; }
.ring--track { stroke: var(--surface-3); }
.ring--value { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.1s var(--ease), stroke .4s var(--ease); }
[data-theme="dark"] .ring--value { stroke: var(--gold); }
.scoreboard__center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.scoreboard__pct { font-size: 2.6rem; font-weight: 600; color: var(--ink); }
.scoreboard__sub { font-size: .82rem; color: var(--muted); }

/* round ink seal stamp */
.seal {
  position: absolute; top: -8px; right: -6px;
  width: 104px; height: 104px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  border: 3px solid var(--ok);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--ok);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  transform: rotate(-10deg) scale(.6); opacity: 0;
  pointer-events: none; z-index: 2;
}
.seal span { display: block; width: 100%; padding: 0 6px; }
.seal__verdict { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ok); line-height: 1; }
.seal__sub { font-family: var(--mono); font-size: .52rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ok); margin-top: 5px; opacity: .85; }
.seal.is-pass { border-color: var(--ok); box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--ok); }
.seal.is-pass .seal__verdict, .seal.is-pass .seal__sub { color: var(--ok); }
.seal.is-fail { border-color: var(--bad); box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--bad); }
.seal.is-fail .seal__verdict, .seal.is-fail .seal__sub { color: var(--bad); }
.seal.show { animation: sealStamp .5s .25s var(--ease) forwards; }
@keyframes sealStamp {
  0%   { transform: rotate(-26deg) scale(1.9); opacity: 0; }
  60%  { transform: rotate(-7deg) scale(.93); opacity: 1; }
  100% { transform: rotate(-10deg) scale(1); opacity: .95; }
}

.scoreboard__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow); }
.stat__k { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat__v { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; margin-top: 4px; color: var(--ink); }
.stat__v small { font-size: .9rem; color: var(--muted); font-weight: 400; }
.stat--ok .stat__v { color: var(--ok); }
.stat--bad .stat__v { color: var(--bad); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ----------------------------- Review ----------------------------- */
.review-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.review-head .eyebrow { margin-bottom: 8px; }
.review-filter { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; gap: 2px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 16px; border-radius: var(--r-pill); font-size: .85rem; font-weight: 500; color: var(--muted); transition: all .15s var(--ease); }
.seg input:checked + span { background: var(--brand); color: #fff; }

.review-list { display: flex; flex-direction: column; gap: 14px; }
.rv-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow); }
.rv-item.is-correct { border-left-color: var(--ok); }
.rv-item.is-wrong { border-left-color: var(--bad); }
.rv-item.is-skipped { border-left-color: var(--muted); }
.rv-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.rv-num { font-family: var(--mono); font-weight: 600; color: var(--muted); font-size: .85rem; }
.rv-topic { font-size: .76rem; color: var(--muted); }
.rv-tag { margin-left: auto; font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--r-pill); }
.rv-tag--ok { color: var(--ok); background: var(--ok-soft); }
.rv-tag--bad { color: var(--bad); background: var(--bad-soft); }
.rv-tag--skip { color: var(--muted); background: var(--surface-3); }
.rv-q { font-family: var(--serif); font-weight: 500; font-size: 1.08rem; margin-bottom: 14px; line-height: 1.4; }
.rv-opts { display: flex; flex-direction: column; }
.rv-opt { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); font-size: .94rem; margin-bottom: 6px; }
.rv-opt__badge { flex-shrink: 0; font-family: var(--mono); font-weight: 600; font-size: .82rem; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.rv-opt.is-correct { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.rv-opt.is-correct .rv-opt__badge { background: var(--ok); color: #fff; }
.rv-opt.is-user-wrong { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.rv-opt.is-user-wrong .rv-opt__badge { background: var(--bad); color: #fff; }
.rv-opt__mark { margin-left: auto; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; align-self: center; }
.rv-opt.is-correct .rv-opt__mark { color: var(--ok); }
.rv-opt.is-user-wrong .rv-opt__mark { color: var(--bad); }

/* ----------------------------- Bank ----------------------------- */
.bank-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin: 14px 0 18px; }
.bank-head .eyebrow { margin-bottom: 8px; }
.bank-search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 10px 16px; min-width: 260px; box-shadow: var(--shadow); }
.bank-search svg { color: var(--muted); flex-shrink: 0; }
.bank-search input { border: none; background: none; outline: none; width: 100%; font-size: .95rem; }
.bank-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.chips--bank .chip { font-size: .82rem; padding: 7px 12px; }
.bank-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.bank-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow); }
.bank-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.bank-card__num { font-family: var(--mono); font-size: .74rem; color: var(--brand); font-weight: 600; }
.bank-card__topic { font-size: .72rem; color: var(--muted); }
.bank-card__q { font-family: var(--serif); font-weight: 500; font-size: 1rem; margin-bottom: 12px; line-height: 1.4; }
.bank-card__opts { display: flex; flex-direction: column; gap: 6px; }
.bank-opt { font-size: .86rem; padding: 7px 11px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); display: flex; gap: 8px; }
.bank-opt b { font-family: var(--mono); color: var(--muted); font-weight: 600; }
.bank-opt.is-ans { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); color: var(--ink); }
.bank-opt.is-ans b { color: var(--ok); }
.bank-empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: .95rem; }

/* ----------------------------- Resume banner ----------------------------- */
.resume {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  border-left: 4px solid var(--brand);
  border-radius: var(--r-lg);
  padding: 16px 18px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.resume__icon { color: var(--brand); flex-shrink: 0; }
.resume__text { flex: 1; min-width: 180px; }
.resume__text strong { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.resume__text span { color: var(--ink-2); font-size: .9rem; }
.resume__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------- History ----------------------------- */
.history-empty { text-align: center; color: var(--muted); padding: 56px 20px; font-size: .95rem; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.hist-item {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-2);
  border-radius: var(--r-md); padding: 14px 18px; box-shadow: var(--shadow);
  transition: border-color .15s var(--ease);
}
.hist-item:hover { border-color: var(--line-2); }
.hist-item.is-pass { border-left-color: var(--ok); }
.hist-item.is-fail { border-left-color: var(--bad); }
.hist-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-item__verdict { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.hist-item.is-pass .hist-item__verdict { color: var(--ok); }
.hist-item.is-fail .hist-item__verdict { color: var(--bad); }
.hist-item__meta { font-size: .76rem; color: var(--muted); }
.hist-item__topics { font-size: .8rem; color: var(--ink-2); }
.hist-item__score { text-align: right; flex-shrink: 0; }
.hist-item__pct { display: block; font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1; }
.hist-item__open { color: var(--brand); font-weight: 600; font-size: .85rem; white-space: nowrap; padding: 8px 6px; flex-shrink: 0; }
.hist-item__open:hover { text-decoration: underline; }

/* ----------------------------- Modal ----------------------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8,12,22,.55); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.modal__box { position: relative; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 26px; max-width: 440px; width: 100%; animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.modal__body { color: var(--ink-2); margin-bottom: 22px; line-height: 1.5; }
.modal__body b { color: var(--ink); font-family: var(--mono); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ----------------------------- Toast ----------------------------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: var(--r-pill); font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 100; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease); max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 720px) {
  .appbar { padding: 9px 16px; }
  .appbar__brandtext small { display: none; }
  .appbar__brandtext strong { font-size: .84rem; }
  .wrap { padding-inline: 16px; }
  .coversheet { padding: 28px 18px 22px; }
  .coversheet::before, .coversheet::after { left: 18px; right: 18px; }
  .coversheet__meta { margin-inline: -18px; grid-template-columns: repeat(2, 1fr); }
  .coversheet__meta > div { border-right: 1px solid var(--line) !important; }
  .coversheet__meta > div:nth-child(2n) { border-right: none !important; }
  .coversheet__meta > div:nth-last-child(-n+2) { border-bottom: none; }
  .runner-top { top: 57px; }
  .runner-top__row { gap: 16px; }
  .timer__value { font-size: 1.4rem; }
  .qcard { padding: 22px; }
  .scoreboard { grid-template-columns: 1fr; gap: 24px; }
  .scoreboard__ring { justify-self: center; }
  .seal { right: -2px; }
  .review-head { align-items: flex-start; }
  .bank-search { min-width: 100%; }
  .bank-list { grid-template-columns: 1fr; }
  .runner-foot { flex-wrap: wrap; }
  .runner-foot #finishBtn { order: 3; width: 100%; }
}
@media (max-width: 420px) {
  .coversheet__meta { grid-template-columns: 1fr; }
  .coversheet__meta > div { border-right: none !important; }
  .chip-nav { display: none; }
}

/* ----------------------------- Motion / a11y ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ring--value { transition: none; }
}
