/* ==========================================================================
   akarxam: fresh green theme
   ========================================================================== */

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;

  --ink: #0f1f17;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e3ebe6;
  --line-strong: #cfdcd4;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --bg: #f4faf6;

  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --amber-ink: #92400e;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-ink: #991b1b;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 23, .06);
  --shadow: 0 1px 2px rgba(15, 31, 23, .05), 0 8px 24px -8px rgba(15, 31, 23, .10);
  --shadow-lg: 0 24px 60px -20px rgba(15, 31, 23, .30);
  --focus: 0 0 0 3px rgba(34, 197, 94, .35);

  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --topbar-h: 64px;
  --q-size: 1.0625rem;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.icon { flex-shrink: 0; display: block; }
.noscript { padding: 24px; text-align: center; }

:focus-visible { outline: none; box-shadow: var(--focus); }

/* Abstract background ---------------------------------------------------- */

.backdrop-art {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 28rem at 8% -6%, rgba(74, 222, 128, .30), transparent 70%),
    radial-gradient(34rem 26rem at 100% 0%, rgba(163, 230, 53, .18), transparent 70%),
    radial-gradient(40rem 30rem at 90% 105%, rgba(45, 212, 191, .16), transparent 70%),
    var(--bg);
}
.backdrop-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(22, 163, 74, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 163, 74, .06) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.btn-primary { background: var(--green-600); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 16px -6px rgba(22, 163, 74, .6); }
.btn-primary:hover:not(:disabled) { background: var(--green-700); }

.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--green-400); background: var(--green-50); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-flag { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-flag:hover { border-color: var(--amber); color: var(--amber-ink); }
.btn-flag.is-active { background: var(--amber-bg); border-color: var(--amber); color: var(--amber-ink); }
.btn-flag.is-active .icon { fill: var(--amber); stroke: var(--amber-ink); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }

/* Brand ------------------------------------------------------------------ */

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand-logo { display: block; flex-shrink: 0; width: 32px; height: 32px; filter: drop-shadow(0 3px 6px rgba(22, 163, 74, .25)); }
.brand-lg .brand-logo { width: 36px; height: 36px; }
.wordmark { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); }
.wordmark span { color: var(--green-600); }
.brand-lg .wordmark { font-size: 1.3rem; }

/* Site header (landing + result) ---------------------------------------- */

.site-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
}
.site-header.is-narrow { max-width: 920px; padding-inline: 20px; }

/* Cards ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Landing
   ========================================================================== */

.landing {
  min-height: calc(100vh - 76px);
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}

.landing-hero h1 {
  margin-top: 0;
  font-size: clamp(1.9rem, 3.8vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}
.hero-art {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 16px;
}

.setup-card { padding: 28px; display: grid; gap: 22px; }
.setup-card h2 { font-size: 1.2rem; }

/* Numbered steps -------------------------------------------------------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding-bottom: 24px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before {
  content: '';
  position: absolute; left: 17px; top: 42px; bottom: 6px;
  width: 2px; border-radius: 2px;
  background: var(--line);
}
.step.is-done::before { background: var(--green-300); }

.step-num {
  position: relative;
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-weight: 800; font-size: .95rem;
  color: var(--muted); background: var(--surface);
  border: 2px solid var(--line-strong);
  transition: background-color .2s, border-color .2s, color .2s;
}
.step-num .icon { display: none; }
.step.is-done .step-num { background: var(--green-100); border-color: var(--green-300); color: var(--green-700); }
.step.is-done .step-n { display: none; }
.step.is-done .step-num .icon { display: block; }
.step.is-active .step-num { background: var(--green-600); border-color: var(--green-600); color: #fff; }

.step-body { display: grid; gap: 10px; min-width: 0; }
.step-body h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 36px; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.step:not(.is-active) .step-body h3 { color: var(--ink-2); }
.step-hint { margin-top: -6px; font-size: .85rem; color: var(--muted); }
.step.is-done .step-hint { display: none; }
.step-body > .btn { justify-self: start; }

.step-pointer {
  display: none;
  align-items: center; gap: 4px;
  padding: 2px 9px 2px 6px;
  border-radius: 99px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--green-800); background: var(--green-100);
}
.step.is-active .step-pointer { display: inline-flex; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(-4px); } }

.dropzone {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.step.is-active .dropzone { border-color: var(--green-400); background: var(--green-50); }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--green-500); background: var(--green-50); }
.dropzone:focus-within { box-shadow: var(--focus); border-color: var(--green-500); }
.dropzone-icon {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 12px; background: var(--surface); color: var(--green-600);
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.dropzone-text { display: grid; }
.dropzone-title { font-weight: 700; }
.dropzone-hint { font-size: .85rem; color: var(--muted); }

.import-status { padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: .875rem; }
.import-status .status-row { display: flex; gap: 12px; align-items: flex-start; }
.import-status .status-row > div { display: grid; gap: 2px; min-width: 0; }
.import-status strong { overflow-wrap: anywhere; }
.import-status.is-ok { background: var(--green-50); border-color: var(--green-200); }
.import-status.is-ok .icon { color: var(--green-600); }
.import-status.is-error { background: #fff5f5; border-color: #fecaca; }
.import-status.is-error .icon { color: var(--red); }
.error-list { margin: 6px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; color: var(--red-ink); overflow-wrap: anywhere; }

.start-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; }
.input-suffix {
  display: flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.input-suffix:focus-within { border-color: var(--green-500); box-shadow: var(--focus); }
.input-suffix input { flex: 1; min-width: 0; height: 44px; padding: 0 0 0 14px; border: 0; outline: 0; background: transparent; font-weight: 600; }
.input-suffix span { padding: 0 12px; color: var(--muted); font-size: .9rem; }
.field-error { color: var(--red); font-size: .85rem; }

.fineprint { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; color: var(--muted); }
.fineprint .icon { margin-top: 3px; }

/* ==========================================================================
   Exam
   ========================================================================== */

.exam { min-height: 100vh; display: flex; flex-direction: column; }
.exam[data-font="small"]  { --q-size: .95rem; }
.exam[data-font="medium"] { --q-size: 1.0625rem; }
.exam[data-font="big"]    { --q-size: 1.25rem; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; }
.confirm-top { display: none; }

.font-size-label { display: inline-grid; place-items: center; width: 26px; color: var(--muted); }
.font-size {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.font-size button {
  width: 34px; height: 32px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-weight: 700; line-height: 1;
}
.font-size button:nth-child(1) { font-size: .78rem; }
.font-size button:nth-child(2) { font-size: .95rem; }
.font-size button:nth-child(3) { font-size: 1.15rem; }
.font-size button[aria-pressed="true"] { background: var(--surface); color: var(--green-700); box-shadow: var(--shadow-sm); }

.timer {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border-radius: 10px;
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem;
  color: var(--green-800); background: var(--green-100); border: 1px solid var(--green-200);
}
.timer.is-warning { color: var(--amber-ink); background: var(--amber-bg); border-color: #fcd34d; }
.timer.is-danger { color: var(--red-ink); background: var(--red-bg); border-color: #fca5a5; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, .15); } }

.exam-body {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Sidebar --------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  max-height: calc(100vh - var(--topbar-h) - 48px);
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.sidebar-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.sidebar-title .muted { font-size: .8rem; font-weight: 500; }
.progress { margin-top: 10px; height: 6px; border-radius: 99px; background: var(--green-50); overflow: hidden; border: 1px solid var(--green-100); }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green-400), var(--green-600)); transition: width .25s ease; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-answered { background: var(--green-500); }
.dot-empty { background: var(--surface); border: 1px solid var(--line-strong); }
.dot-flag { background: var(--amber); border-radius: 50%; }

.qgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding: 4px;
  margin: -4px;
  overscroll-behavior: contain;
}
.sidebar .qgrid { flex: 1; min-height: 0; }
.qbtn {
  position: relative;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color .12s, border-color .12s;
}
.qbtn:hover { border-color: var(--green-400); }
.qbtn.is-answered { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.qbtn.is-answered:hover { background: var(--green-600); }
.qbtn.is-current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green-700); }
.qbtn.is-flagged::after {
  content: '';
  position: absolute; top: -4px; right: -4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--amber); border: 2px solid var(--surface);
}

/* Question ------------------------------------------------------------- */

.stage { display: grid; gap: 16px; min-width: 0; }

.qcard {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.qcard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.qmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qnumber { font-weight: 800; color: var(--green-700); font-size: .95rem; letter-spacing: -0.01em; }
.qcard-actions { display: flex; gap: 8px; }

.chip {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip-multi { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }

.qtext {
  margin-top: 18px;
  font-size: calc(var(--q-size) * 1.08);
  font-weight: 600;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.qhint { margin-top: 14px; font-size: .85rem; color: var(--muted); }

.qimage { margin: 18px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); text-align: center; }
.qimage img { display: block; margin: 0 auto; max-height: 440px; width: auto; object-fit: contain; border-radius: 6px; }
.image-error { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--muted); font-size: .9rem; }

.options { margin: 12px 0 0; padding: 0; border: 0; display: grid; gap: 10px; min-width: 0; }

.option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: var(--q-size);
  transition: border-color .12s, background-color .12s;
}
.option:hover { border-color: var(--green-300); background: var(--green-50); }
.option.is-selected { border-color: var(--green-500); background: var(--green-50); }
.option:focus-within { box-shadow: var(--focus); }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.option-key {
  flex-shrink: 0;
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; margin-top: -2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  font-size: .85rem; font-weight: 700; color: var(--ink-2);
  background: var(--surface);
}
.option input[type="radio"] ~ .option-key { border-radius: 50%; }
.option.is-selected .option-key { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.option-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }

.qnav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.qnav-pos { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; }

/* Copy deterrent: no text selection inside the exam while it is running. */
body.exam-active .exam,
body.exam-active .dialog {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.exam-active .exam img { -webkit-user-drag: none; }

/* ==========================================================================
   Dialog
   ========================================================================== */

.dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { display: flex; flex-direction: column; gap: 16px; }
.dialog::backdrop { background: rgba(15, 31, 23, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { font-size: 1.2rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-pill { display: grid; gap: 0; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.stat-pill strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-pill span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat-pill-answered { background: var(--green-50); border-color: var(--green-200); }
.stat-pill-answered strong { color: var(--green-700); }
.stat-pill-flag { background: #fffbeb; border-color: #fde68a; }
.stat-pill-flag strong { color: var(--amber-ink); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--green-700); box-shadow: var(--shadow-sm); }

.dialog-sm { width: min(460px, calc(100vw - 32px)); }
.order-choice { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; min-width: 0; }
.order-choice legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 600; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.choice:hover { border-color: var(--green-300); }
.choice:has(input:checked) { border-color: var(--green-500); background: var(--green-50); }
.choice:focus-within { box-shadow: var(--focus); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choice-icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.choice:has(input:checked) .choice-icon { background: var(--green-600); color: #fff; }
.choice-text { display: grid; min-width: 0; }
.choice-text span { font-size: .85rem; color: var(--muted); }
.qgrid-dialog { max-height: 260px; min-height: 48px; }
.warning { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--amber-bg); color: var(--amber-ink); font-size: .875rem; font-weight: 500; }
.warning .icon { margin-top: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.empty-note { grid-column: 1 / -1; padding: 8px 0; font-size: .9rem; }

/* ==========================================================================
   Result
   ========================================================================== */

.result { max-width: 920px; margin: 0 auto; padding: 24px 20px 64px; display: grid; gap: 20px; }
.result-card { padding: 28px; display: grid; gap: 22px; }
.timeup-badge { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 6px 12px; border-radius: 99px; background: var(--amber-bg); color: var(--amber-ink); font-size: .85rem; font-weight: 600; }

.result-top { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.score-ring {
  --score: 0;
  --ring: var(--green-500);
  width: 168px; height: 168px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring) calc(var(--score) * 1%), var(--green-50) 0);
}
.score-ring.is-low { --ring: var(--amber); }
.score-ring-inner {
  width: 136px; height: 136px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.score-value { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.score-label { margin-top: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.result-summary { display: grid; gap: 8px; min-width: 0; }
.result-summary h1 { font-size: 1.7rem; font-weight: 800; }
.result-stats { margin-top: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.stat > div { display: grid; }
.stat strong { font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat-correct { background: var(--green-50); border-color: var(--green-200); }
.stat-correct .icon { color: var(--green-600); }
.stat-wrong { background: #fff5f5; border-color: #fecaca; }
.stat-wrong .icon { color: var(--red); }
.stat-total .icon { color: var(--ink-2); }
.result-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.review-card { padding: 24px 28px; }
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.review-head h2 { font-size: 1.2rem; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.review-item { padding: 16px 18px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); }
.review-correct { border-left-color: var(--green-500); }
.review-wrong { border-left-color: var(--red); }
.review-skipped { border-left-color: var(--line-strong); }
.review-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-num { font-weight: 800; color: var(--ink-2); margin-right: 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-correct { background: var(--green-100); color: var(--green-800); }
.badge-wrong { background: var(--red-bg); color: var(--red-ink); }
.badge-skipped { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-flag { background: var(--amber-bg); color: var(--amber-ink); }
.review-q { margin-top: 10px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-img { display: block; margin-top: 10px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.review-options { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.review-option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--ink-2); }
.review-option .option-key { width: 24px; height: 24px; font-size: .75rem; margin-top: 0; border-radius: 6px; }
.review-option.is-answer { background: var(--green-50); color: var(--ink); }
.review-option.is-answer .option-key { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.review-option.is-wrong-pick { background: #fff5f5; }
.review-option.is-wrong-pick .option-key { background: var(--red); border-color: var(--red); color: #fff; }
.tag { flex-shrink: 0; align-self: center; padding: 1px 8px; border-radius: 99px; font-size: .7rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag-answer { background: var(--green-100); color: var(--green-800); border-color: var(--green-200); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 960px) {
  .site-header { padding: 16px 20px 0; }
  .landing { grid-template-columns: 1fr; gap: 28px; padding: 20px 20px 32px; align-content: start; }
  .hero-art { max-width: 560px; }

  .exam-body { grid-template-columns: 1fr; padding: 16px 16px 32px; }
  .nav-toggle { display: inline-grid; }
  .confirm-top { display: inline-flex; }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0; bottom: 0; left: 0;
    width: min(320px, 86vw);
    max-height: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .drawer-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(15, 31, 23, .4); }
}

@media (max-width: 600px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .font-size-label { display: none; }
  .confirm-top { padding: 0 10px; }
  .confirm-top-text { display: none; }
  .font-size button { width: 30px; }
  .timer { padding: 0 10px; font-size: 1rem; }
  .qcard { padding: 20px 16px; }
  .option { padding: 12px; gap: 12px; }
  .qnav { padding: 10px; }
  .qnav .btn { padding: 0 14px; }
  .setup-card { padding: 20px; }
  .start-row { grid-template-columns: 110px minmax(0, 1fr); }
  .result { padding: 20px 16px 48px; }
  .result-card, .review-card { padding: 20px 16px; }
  .result-top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { flex-direction: column; text-align: center; gap: 4px; padding: 10px 6px; }
  .result-actions .btn { flex: 1; }
  .dialog { padding: 18px; }
  .stat-pill strong { font-size: 1.25rem; }
}

@media (max-width: 440px) {
  .topbar .brand { display: none; }
  .topbar-left, .topbar-right { gap: 6px; }
}

@media (max-width: 380px) {
  .qnav-pos { display: none; }
}

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

@media print {
  body.exam-active * { display: none !important; }
}
