/* ==========================================================================
   G1 Ontario Practice: styles
   1. Tokens & reset        6. Home
   2. Layout, app bar, nav  7. Chapters hub
   3. Typography            8. Signs & sign browser
   4. Cards, buttons, bars  9. Tests & exam start
   5. Rings & gauges       10. Quiz engine   11. Utilities
   ========================================================================== */

/* ---------- 1. Tokens & reset ---------- */
:root {
  /* "Queen's Park": ink on paper with a deep guide-sign blue.
     All pairs computed >= 4.5:1 on their surfaces (WCAG AA body text). */
  --bg: #f3f5f7;
  --bg-elev: #eceff2;
  --card: #ffffff;
  --card-hi: #f7f9fb;
  --line: rgba(16, 32, 54, .10);
  --line-hi: rgba(16, 32, 54, .18);
  --text: #1b2430;
  --muted: #57657a;            /* 5.9:1 on --card, WCAG AA for body text */
  --faint: rgba(16, 32, 54, .05);

  --accent: #175a9d;
  --accent-dim: rgba(23, 90, 157, .10);
  --accent-deep: #123f70;
  --success: #1c7a4a;
  --success-dim: rgba(28, 122, 74, .10);
  --danger: #c23434;
  --danger-dim: rgba(194, 52, 52, .10);
  --warn: #a35b12;
  --warn-dim: rgba(163, 91, 18, .10);
  --violet: #5f4bb6;
  --pink: #ad3a68;

  --bg-glass: rgba(243, 245, 247, .88);
  --shadow-sm: 0 1px 2px rgba(16, 32, 54, .06);
  --shadow-md: 0 4px 14px rgba(16, 32, 54, .08), 0 1px 3px rgba(16, 32, 54, .06);
  --shadow-lg: 0 14px 36px rgba(16, 32, 54, .14), 0 2px 6px rgba(16, 32, 54, .08);

  /* per-group accent, overridden by .g-* on chapter cards */
  --acc: var(--accent);
  --acc-dim: var(--accent-dim);

  --r-sm: 12px;
  --r: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --pad: 16px;
  --nav-h: 66px;
  --bar-h: 56px;
  --t: 180ms cubic-bezier(.2, .7, .3, 1);
  --t-slow: 420ms cubic-bezier(.2, .7, .3, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

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

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}

a { color: var(--accent); }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 2. Layout, app bar, nav ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--bar-h);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) var(--pad) 10px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.appbar[hidden] { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 11px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-txt {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.brand-txt small {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.appbar-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color var(--t), background var(--t);
}

.appbar-btn:active { background: var(--card-hi); color: var(--text); }

.appbar-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  padding: 4px var(--pad)
           calc(env(safe-area-inset-bottom, 0px) + var(--nav-h) + 30px);
}

/* full-screen routes (quiz, flashcards) carry their own top padding */
.view.is-full {
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
}

/* applied only when the screen actually changes, so answering a question
   inside a quiz does not re-animate the whole page */
.view.is-enter { animation: enter var(--t) both; }

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view.is-enter { animation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  gap: 2px;
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
}

.nav[hidden] { display: none; }

.nav-btn {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  transition: color var(--t), background var(--t);
}

.nav-btn span { white-space: nowrap; }

.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.is-active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* seven tabs have to survive a 320px phone without the labels wrapping */
@media (max-width: 400px) {
  .nav { gap: 0; padding-left: 3px; padding-right: 3px; }
  .nav-btn { font-size: 9px; letter-spacing: -.015em; border-radius: 11px; gap: 2px; }
  .nav-btn svg { width: 20px; height: 20px; }
}

/* ---------- 3. Typography ---------- */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; }

.h1 { font-size: 28px; line-height: 1.16; }
.h2 { font-size: 20px; line-height: 1.25; }
.h3 { font-size: 17px; }

.sub {
  color: var(--muted);
  font-size: 14.5px;
  margin: 6px 0 0;
  line-height: 1.5;
}

.eyebrow,
.section-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title { margin: 26px 0 10px; }

.muted { color: var(--muted); }

.screen-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.screen-head .h2 { flex: 1; text-align: center; }

.screen-head .ttl {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.screen-head .ttl .t {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-head .ttl .s {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background var(--t);
}

.icon-btn:active { background: var(--card-hi); }

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spacer { width: 44px; min-width: 44px; }

/* ---------- 4. Cards, buttons, bars ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}

.card + .card { margin-top: 12px; }

.tap {
  display: block;
  width: 100%;
  transition: transform var(--t), background var(--t), border-color var(--t);
}

.tap:active { transform: scale(.985); background: var(--card-hi); }

.tap[disabled], .tap.is-disabled {
  opacity: .5;
  cursor: default;
  pointer-events: none;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--card-hi);
  border: 1px solid var(--line-hi);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  transition: transform var(--t), background var(--t), opacity var(--t), color var(--t);
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-sm);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--danger-dim); border-color: rgba(194, 52, 52, .3); color: var(--danger); }
.btn-success { background: var(--success-dim); border-color: rgba(28, 122, 74, .3); color: var(--success); }
.btn-warn { background: var(--warn-dim); border-color: rgba(163, 91, 18, .3); color: var(--warn); }
.btn-white { background: #fff; border-color: #fff; color: var(--accent-deep); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

.bar {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: var(--faint);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--acc);
  transition: width var(--t-slow);
}

.bar.is-done > i { background: var(--success); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warn { background: var(--warn-dim); color: var(--warn); }
.badge-muted { background: var(--faint); color: var(--muted); }

/* white chip so signs stay legible on the dark background */
.sign-chip {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  overflow: hidden;
}

.sign-chip svg,
.sign-chip .sign-img { width: 100%; height: 100%; object-fit: contain; }

.sign-panel {
  background: #fff;
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sign-panel svg { width: 100%; height: auto; max-width: 190px; }
.sign-panel.is-lg svg { max-width: 240px; }

/* Raster sign photos are ~170px sources; render at natural size so the
   browser never upscales them soft. SVGs above stay fluid. */
.sign-panel .sign-img { width: auto; height: auto; max-width: min(100%, 240px); }

.sign-img { display: block; }
.img-failed > .sign-img { display: none; }

.notice {
  border: 1px solid rgba(255, 159, 67, .3);
  background: var(--warn-dim);
  color: var(--warn);
  border-radius: var(--r);
  padding: 16px;
  font-size: 14.5px;
}

.empty-state {
  margin-top: 30px;
  text-align: center;
  padding: 28px 20px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
}

.empty-state > svg {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state .t { font-size: 19px; font-weight: 800; }
.empty-state p { color: var(--muted); font-size: 14.5px; margin: 8px 0 18px; }

/* generic icon + text + chevron row */
.line-card,
.due-card,
.nudge {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 68px;
  padding: 14px 16px;
  margin-top: 12px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
}

.line-card .ic,
.due-card .ic,
.nudge .ic {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--acc-dim);
  color: var(--acc);
}

.line-card .ic svg,
.due-card .ic svg,
.nudge .ic svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-card .txt,
.due-card .txt,
.nudge .txt { flex: 1; min-width: 0; }

.line-card .t,
.due-card .t,
.nudge .t { display: block; font-weight: 700; font-size: 15.5px; }

.line-card .s,
.due-card .s,
.nudge .s { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.35; }

.chev {
  color: var(--muted);
  display: flex;
  align-items: center;
}

.chev svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 5. Rings & gauges ---------- */
.ring { width: 100%; height: 100%; overflow: visible; }

.ring circle {
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.ring .ring-bg { stroke: var(--faint); }
.ring .ring-fill {
  stroke: var(--acc);
  transition: stroke-dashoffset 900ms cubic-bezier(.25, .8, .3, 1);
}

.ring.is-gauge circle { stroke-width: 8; }
.ring.is-score circle { stroke-width: 10; }

/* ---------- 6. Home ---------- */
.ready-hero {
  margin-top: 6px;
  padding: 18px 16px 16px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(23, 90, 157, .08) 0%, rgba(23, 90, 157, 0) 62%),
    var(--card);
  border: 1px solid var(--line-hi);
  box-shadow: var(--shadow-md);
}

.ready-hero.is-ready {
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(28, 122, 74, .1) 0%, rgba(28, 122, 74, 0) 62%),
    var(--card);
}

.ready-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.ready-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gauge {
  text-align: center;
  padding: 12px 6px 10px;
  border-radius: var(--r);
  background: var(--faint);
}

.gauge-ring {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto;
}

.gauge-mid {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-mid b {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}

.gauge-mid i { font-style: normal; font-size: 14px; font-weight: 700; color: var(--muted); }

.gauge.is-ok { --acc: var(--success); }
.gauge.is-ok .gauge-mid b { color: var(--success); }

.gauge-lbl { margin-top: 10px; font-size: 15px; font-weight: 800; }
.gauge-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); font-weight: 600; }

.ready-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.ready-note b { color: var(--text); }

.trust {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--r);
  background: rgba(52, 199, 123, .07);
  border: 1px solid rgba(52, 199, 123, .2);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.trust svg {
  width: 19px;
  height: 19px;
  min-width: 19px;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trust b { color: var(--text); }

.due-card { --acc: var(--warn); }
.due-card.is-empty { --acc: var(--success); opacity: .85; }

.due-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}

.nudge {
  --acc: var(--violet);
  border-color: rgba(167, 139, 250, .35);
  background:
    linear-gradient(135deg, rgba(167, 139, 250, .13), rgba(167, 139, 250, 0) 70%),
    var(--card);
}

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;          /* grid items default to min-width:auto, which made this
                            two-column row overflow on very narrow phones */
  min-height: 62px;
  padding: 13px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
}

.chip .glyph {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
}

.chip .glyph svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip .glyph.warn { background: var(--warn-dim); color: var(--warn); }

/* small phones: tighten the two-up stat chips so the labels stop overflowing,
   and fall back to a single column on the very narrowest screens */
@media (max-width: 400px) {
  .chip { padding: 13px 12px; gap: 8px; }
  .chip .glyph { width: 30px; height: 30px; min-width: 30px; }
}

@media (max-width: 340px) {
  .chips { grid-template-columns: 1fr; }
}
.chip .lbl { flex: 1; min-width: 0; font-weight: 700; font-size: 14.5px; }
.chip .num { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.chip small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); line-height: 1.3; }

.big-card {
  position: relative;
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.big-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, var(--acc-dim), transparent 55%);
  opacity: .55;
  pointer-events: none;
}

.big-card .txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.big-card .txt .h2 { font-size: 22px; }
.big-card .txt .sub { margin-top: 3px; font-size: 13.5px; }

.big-card .art {
  position: relative;
  z-index: 1;
  width: 66px;
  height: 66px;
  min-width: 66px;
  border-radius: 18px;
  background: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--acc);
}

.big-card .art svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.big-card.accent-orange { --acc: var(--warn); --acc-dim: var(--warn-dim); }
.big-card.accent-green { --acc: var(--success); --acc-dim: var(--success-dim); }
.big-card.accent-violet { --acc: var(--violet); --acc-dim: rgba(95, 75, 182, .1); }

/* ---------- 7. Chapters hub ---------- */
.curriculum {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(110% 90% at 90% 0%, rgba(95, 75, 182, .08) 0%, rgba(95, 75, 182, 0) 60%),
    var(--card);
  border: 1px solid var(--line-hi);
  box-shadow: var(--shadow-md);
}

.curr-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.curr-head .ic {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 14px;
  background: rgba(167, 139, 250, .16);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
}

.curr-head .ic svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curr-head .txt { flex: 1; min-width: 0; }
.curr-head .t { display: block; font-weight: 800; font-size: 16.5px; }
.curr-head .s { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.ch-card {
  display: block;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--acc);
  border-radius: var(--r-lg);
  padding: 14px 14px 14px 15px;
  margin-top: 10px;
}

.ch-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ch-num {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: var(--acc-dim);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.ch-num svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ch-top .txt { flex: 1; min-width: 0; }
.ch-top .t { display: block; font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.ch-top .s { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.ch-foot { margin-top: 12px; }
.ch-foot .st { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }

.g-violet { --acc: var(--violet); --acc-dim: rgba(95, 75, 182, .1); }
.g-blue   { --acc: var(--accent); --acc-dim: var(--accent-dim); }
.g-green  { --acc: var(--success); --acc-dim: var(--success-dim); }
.g-orange { --acc: var(--warn); --acc-dim: var(--warn-dim); }
.g-pink   { --acc: var(--pink); --acc-dim: rgba(173, 58, 104, .1); }

/* ---------- 8. Signs & sign browser ---------- */
.hero {
  position: relative;
  margin-top: 16px;
  padding: 22px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: var(--shadow-md);
  color: #fff;
  overflow: hidden;
}

.hero h2 { font-size: 25px; line-height: 1.15; max-width: 76%; }
.hero p { margin: 8px 0 16px; font-size: 14.5px; opacity: .92; max-width: 76%; }
.hero .btn-white { width: auto; display: inline-flex; min-height: 48px; }

.hero .deco {
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 150px;
  height: 150px;
  opacity: .18;
  color: #fff;
  pointer-events: none;
}

.hero .deco svg { width: 100%; height: 100%; fill: currentColor; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}

.stat .k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat .ic { display: flex; color: var(--accent); }

.stat .ic svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat .v { font-size: 21px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }

.row-card {
  display: block;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-top: 10px;
}

.row-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-main .txt { flex: 1; min-width: 0; }
.row-main .txt .t { display: block; font-weight: 700; font-size: 15.5px; }
.row-main .txt .s { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.row-foot { margin-top: 12px; }

.row-foot .st {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 7px;
}

.test-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 14px;
  background: var(--card-hi);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.test-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.test-icon.green { color: var(--success); }
.test-icon.orange { color: var(--warn); }

.about p { margin: 0 0 10px; font-size: 14.5px; color: var(--muted); }
.about p:last-child { margin-bottom: 0; }
.about strong { color: var(--text); }

.facts { margin: 0; padding-left: 20px; }
.facts li { font-size: 14px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
.facts li:last-child { margin-bottom: 0; }
.facts b { color: var(--text); }

.fact-card {
  display: flex;
  gap: 13px;
  padding: 16px;
  margin-top: 10px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
}

.fact-card .ic {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fact-card .ic svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fact-card .txt { flex: 1; min-width: 0; }
.fact-card .t { font-weight: 800; font-size: 15.5px; margin-bottom: 8px; }

/* ---- flashcard browser ---- */
.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin: 0 calc(var(--pad) * -1);
  padding-left: var(--pad);
  padding-right: var(--pad);
  scrollbar-width: none;
}

.pills::-webkit-scrollbar { display: none; }

.pill {
  flex: 0 0 auto;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
}

.pill.is-active {
  background: var(--accent-dim);
  border-color: rgba(108, 140, 255, .4);
  color: var(--accent);
}

.flash-progress { margin: 4px 0 14px; }

.flash-progress .l {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
}

.flash-stage.slide-l { animation: slideL var(--t-slow) both; }
.flash-stage.slide-r { animation: slideR var(--t-slow) both; }

@keyframes slideL {
  from { opacity: 0; transform: translateX(26px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slideR {
  from { opacity: 0; transform: translateX(-26px); }
  to   { opacity: 1; transform: none; }
}

/* A 2D "turn": the visible face squeezes out along X while the other swings in.
   Deliberately not a preserve-3d flip: a 3D rendering context stops Chrome
   painting the sign photos inside the card. */
.flip {
  position: relative;
  display: block;
  width: 100%;
  min-height: 330px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.flip .face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line-hi);
  overflow: hidden;
  transform-origin: 50% 50%;
  transition: opacity 190ms ease, transform 300ms cubic-bezier(.2, .8, .3, 1);
}

/* static wrapper: gives sizeFlip() an honest content height to measure */
.flip .face-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.flip .front { opacity: 1; transform: none; }
.flip .back { opacity: 0; transform: scaleX(.7); }
.flip.is-back .front { opacity: 0; transform: scaleX(.7); }
.flip.is-back .back { opacity: 1; transform: none; }

/* reserve the plate height so a slow image load cannot collapse the card */
.flip .sign-panel { width: 100%; min-height: 208px; }

.flip-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.flip .b-name { font-size: 21px; font-weight: 800; text-align: center; letter-spacing: -.02em; }
.flip .b-cat { display: block; }
.flip .b-meaning {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  overflow-y: auto;
  max-height: 190px;
}

.flash-status {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.flash-status .btn { flex: 1; font-size: 14.5px; }

.nav-pair { display: flex; gap: 10px; margin-top: 10px; }
.nav-pair .btn { flex: 1; }

.status-line {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 14px;
  color: var(--muted);
}

.status-line.learned { color: var(--success); }
.status-line.learning { color: var(--warn); }

/* ---------- 8b. Cards (whole-bank flashcards) ---------- */
.card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.card-bar .count {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.card-bar .count i { font-style: normal; font-weight: 700; font-size: 13px; color: var(--muted); }

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--line-hi);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  transition: color var(--t), background var(--t), border-color var(--t);
}

.shuffle-btn:active { background: var(--card-hi); color: var(--accent); border-color: rgba(108, 140, 255, .4); }

.shuffle-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-flip { margin-top: 12px; }
.card-flip .face { padding: 22px 18px; }
.card-flip .face-in { gap: 13px; }
.card-flip .sign-hero { width: 100%; margin-bottom: 0; }
.card-flip .sign-hero.has-plate .sign-img { max-width: 180px; }
.card-flip .sign-hero.is-diagram .sign-img { max-width: 100%; }

.c-kind {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--faint);
}

.c-q {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.34;
  letter-spacing: -.01em;
  text-align: center;
}

.c-qsm {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.42;
  color: var(--muted);
  text-align: center;
}

.c-answer {
  width: 100%;
  padding: 16px 16px;
  border-radius: var(--r);
  background: var(--success-dim);
  border: 1px solid rgba(52, 199, 123, .35);
  color: var(--success);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.34;
  text-align: center;
  letter-spacing: -.01em;
}

.c-explain {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* ---------- 8c. Info guide ---------- */
.info-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 6px;
  padding: 16px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 100% at 8% 0%, rgba(23, 90, 157, .08) 0%, rgba(23, 90, 157, 0) 62%),
    var(--card);
  border: 1px solid var(--line-hi);
  box-shadow: var(--shadow-md);
}

.info-hero .ic {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 14px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-hero .ic svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.info-hero .txt { flex: 1; min-width: 0; }
.info-hero .t { display: block; font-weight: 800; font-size: 16px; }
.info-hero .s { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.45; }

.line-card.accent-info { --acc: var(--accent); --acc-dim: var(--accent-dim); }

/* accordion */
.acc {
  margin-top: 10px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--acc);
  overflow: hidden;
}

.acc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 14px 14px 15px;
  transition: background var(--t);
}

.acc-head:active { background: var(--card-hi); }

.acc-head .ic {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  background: var(--acc-dim);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
}

.acc-head .ic svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acc-head .txt { flex: 1; min-width: 0; }
.acc-head .t { display: block; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.acc-head .s { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.35; }

.acc-head .caret {
  display: flex;
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform var(--t), color var(--t);
}

.acc-head .caret svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acc.is-open .acc-head .caret { transform: rotate(-90deg); color: var(--acc); }

.acc-body { display: none; padding: 0 16px 18px 15px; }
.acc.is-open .acc-body { display: block; animation: accIn var(--t) both; }

@keyframes accIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.acc-sub {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 18px 0 9px;
}

.acc-body > .acc-sub:first-child { margin-top: 4px; }

/* key numbers */
.num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin: 4px 0 4px;
}

.num {
  padding: 12px 10px;
  border-radius: var(--r-sm);
  background: var(--acc-dim);
  text-align: center;
}

.num b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--acc);
  line-height: 1.1;
}

.num span {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.25;
}

/* numbered test-day flow */
.steps { list-style: none; margin: 6px 0 0; padding: 0; }

.steps li {
  position: relative;
  display: flex;
  gap: 13px;
  padding-bottom: 16px;
}

.steps li:last-child { padding-bottom: 0; }

.steps li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 2px;
  width: 2px;
  background: var(--line-hi);
}

.steps li:last-child::before { display: none; }

.steps .n {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: var(--acc-dim);
  color: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.steps .s-txt { flex: 1; min-width: 0; padding-top: 4px; }
.steps .s-txt b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.steps .s-txt p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.steps .s-txt p b { display: inline; font-size: inherit; color: var(--text); }

/* citizen / newcomer document paths */
.path-card {
  padding: 13px 14px;
  border-radius: var(--r-sm);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  margin-top: 8px;
}

.path-card .p-t { font-size: 13.5px; font-weight: 800; margin-bottom: 7px; }
.path-card .facts { padding-left: 17px; }

/* soft note */
.callout {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--warn-dim);
  border: 1px solid rgba(163, 91, 18, .25);
  font-size: 13px;
  line-height: 1.5;
  color: var(--warn);
}

.callout b { color: var(--text); }

.callout svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 1px;
  fill: none;
  stroke: var(--warn);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* official outbound link */
.linkout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-hi);
  color: inherit;
  text-decoration: none;
  transition: background var(--t), border-color var(--t);
}

.linkout:active { background: var(--card-hi); }

.linkout .ic {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 11px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.linkout .ic svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.linkout .txt { flex: 1; min-width: 0; }
.linkout .t { display: block; font-weight: 700; font-size: 14.5px; }
.linkout .s { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

.i-violet { --acc: var(--violet); --acc-dim: rgba(167, 139, 250, .16); }
.i-blue   { --acc: var(--accent); --acc-dim: var(--accent-dim); }
.i-green  { --acc: var(--success); --acc-dim: var(--success-dim); }
.i-orange { --acc: var(--warn); --acc-dim: var(--warn-dim); }
.i-pink   { --acc: var(--pink); --acc-dim: rgba(255, 123, 169, .16); }

/* ---------- 9. Tests & exam start ---------- */
.exam-hero {
  position: relative;
  margin-top: 6px;
  padding: 24px 20px;
  border-radius: var(--r-xl);
  text-align: center;
  background:
    radial-gradient(110% 100% at 50% 0%, rgba(163, 91, 18, .08) 0%, rgba(163, 91, 18, 0) 65%),
    var(--card);
  border: 1px solid rgba(163, 91, 18, .22);
  box-shadow: var(--shadow-md);
}

.exam-hero .ic {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--warn-dim);
  color: var(--warn);
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-hero .ic svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.exam-hero h2 { font-size: 23px; }
.exam-hero p { margin: 8px 0 12px; font-size: 14.5px; color: var(--muted); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  margin-top: 12px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  transition: border-color var(--t), background var(--t);
}

.switch-row:active { background: var(--card-hi); }

.switch-row .ic {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  background: var(--card-hi);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch-row .ic svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.switch-row .txt { flex: 1; min-width: 0; }
.switch-row .t { display: block; font-weight: 700; font-size: 15.5px; }
.switch-row .s { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.switch-row .s b { color: var(--text); }

.switch {
  width: 52px;
  height: 32px;
  min-width: 52px;
  border-radius: 99px;
  background: var(--line-hi);
  position: relative;
  transition: background var(--t);
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--t);
}

.switch.is-on { background: var(--accent); }
.switch.is-on i { transform: translateX(20px); }

.switch-row[aria-checked="true"] { border-color: rgba(108, 140, 255, .4); }
.switch-row[aria-checked="true"] .ic { color: var(--accent); background: var(--accent-dim); }

/* ---------- 10. Quiz engine ---------- */
.quiz-head { margin-bottom: 14px; }

.quiz-progress { margin-bottom: 4px; }

.quiz-progress .l {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
}

.tick { font-variant-numeric: tabular-nums; color: var(--text); }

.q-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-top: 16px;
  touch-action: pan-y;
}

/* numbered question strip */
.qnums {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px;
  margin: 12px calc(var(--pad) * -1) 0;
  padding-left: var(--pad);
  padding-right: var(--pad);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.qnums::-webkit-scrollbar { display: none; }

.qnum {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}

.qnum.is-answered { color: var(--text); border-color: var(--line-hi); background: var(--card-hi); }
.qnum.is-answered.is-right { color: var(--success); border-color: rgba(28, 122, 74, .3); }
.qnum.is-answered.is-wrong { color: var(--danger); border-color: rgba(194, 52, 52, .3); }

.qnum.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.qnum[disabled] { opacity: .55; pointer-events: none; }

/* pre-submit answer grid */
.presubmit {
  margin-top: 8px;
  padding: 20px 16px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 1px solid var(--line);
}

.presubmit .ic {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 17px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.presubmit .ic svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legend {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.legend .leg {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--faint);
}

.gnums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.gnum {
  min-height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  border: 1px dashed var(--line-hi);
  color: var(--muted);
  transition: background var(--t), color var(--t), border-color var(--t);
}

.gnum.is-done {
  background: var(--accent-dim);
  border: 1px solid rgba(108, 140, 255, .4);
  color: var(--accent);
}

/* question text on the page background (questions without artwork) */
.q-plain {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: -.02em;
  text-align: left;
  margin: 22px 0 4px;
}

/* favourite toggle under the choices */
.fav-btn {
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.fav-btn svg { fill: none; }

.fav-btn.is-on {
  color: var(--warn);
  background: var(--warn-dim);
  border-color: rgba(255, 159, 67, .35);
}

.fav-btn.is-on svg { fill: currentColor; }

/* Sign photos and official MTO diagrams share one pipeline: a large image on
   a white rounded plate above the question text. */
.sign-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 4px;
  margin-bottom: 4px;
}

.sign-hero svg,
.sign-hero .sign-img {
  width: 100%;
  height: auto;
  max-width: 220px;
  filter: drop-shadow(0 4px 12px rgba(16, 32, 54, .18));
}

/* Raster sign photos: natural size only, never upscaled (sources are ~170px). */
.sign-hero .sign-img { width: auto; max-width: min(100%, 220px); }

.sign-hero.has-plate {
  background: #fff;
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
}

.sign-hero.has-plate svg,
.sign-hero.has-plate .sign-img { max-width: 200px; filter: none; }

/* diagrams are wide illustrations, not square signs, so give them the full
   plate, but never upscale past natural size (sources are 170-390px). */
.sign-hero.is-diagram { padding: 10px; }
.sign-hero.is-diagram .sign-img { width: auto; max-width: 100%; }

.q-card .q-text {
  font-size: 18.5px;
  font-weight: 800;
  line-height: 1.36;
  text-align: center;
  letter-spacing: -.01em;
  margin-top: 12px;
}

.choices { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }

.choice {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 18px 20px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-hi);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  transition: background var(--t), border-color var(--t), transform var(--t), color var(--t);
}

.choice:active { transform: scale(.99); }

.choice.is-picked { border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.choice.is-correct { border-color: var(--success); background: var(--success-dim); color: var(--text); }
.choice.is-wrong { border-color: var(--danger); background: var(--danger-dim); color: var(--text); }

.choices.is-locked .choice { pointer-events: none; }

.swipe-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.explain {
  margin-top: 14px;
  border-radius: var(--r);
  padding: 14px;
  border: 1px solid var(--line-hi);
  background: var(--bg-elev);
  animation: pop var(--t) both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.explain .hd {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.explain.ok .hd { color: var(--success); }
.explain.no .hd { color: var(--danger); }
.explain p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.5; }

.quiz-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.quiz-actions .btn { flex: 1; }

/* results */
.result-hero {
  text-align: center;
  padding: 26px 18px 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--card);
}

.score-ring {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
}

.score-mid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-mid b { font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.score-mid i { font-style: normal; font-size: 19px; color: var(--muted); }
.score-mid .verdict { margin-top: 6px; font-size: 14px; font-weight: 800; }

.result-hero.pass { --acc: var(--success); }
.result-hero.pass .score-mid b, .result-hero.pass .verdict { color: var(--success); }
.result-hero.fail { --acc: var(--danger); }
.result-hero.fail .score-mid b, .result-hero.fail .verdict { color: var(--danger); }

.result-hero .note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.result-hero .note + .note { margin-top: 3px; }

.tally {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.section-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  margin-top: 10px;
}

.section-row .n { flex: 1; font-weight: 700; }
.section-row .sc { color: var(--muted); font-weight: 700; font-size: 13.5px; }

.your-answer {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.your-answer b { color: var(--text); }

/* ---------- 11. Utilities ---------- */
.center { text-align: center; }
.mt { margin-top: 14px; }
.mt-lg { margin-top: 22px; }

@media (min-width: 561px) {
  .view.is-full { padding-top: 26px; }
}

/* ==========================================================================
   12. Professional polish layer ("Queen's Park" redesign)
   Elevation, weight hierarchy, hover states, lettered choices, rhythm.
   ========================================================================== */

/* elevation scale */
.card, .line-card, .due-card, .nudge, .big-card, .ch-card,
.row-card, .chip, .fact-card, .stat, .acc, .switch-row {
  box-shadow: var(--shadow-sm);
}

.result-hero, .presubmit, .flip .face { box-shadow: var(--shadow-md); }

/* weight hierarchy: rows at 600 so headings and numerals lead */
.line-card .t, .due-card .t, .nudge .t, .ch-top .t,
.row-main .txt .t, .switch-row .t, .linkout .t, .chip .lbl { font-weight: 600; }
.nav-btn { font-weight: 600; }
.pill { font-weight: 500; }

/* hover states for desktop and trackpad */
@media (hover: hover) and (pointer: fine) {
  .tap:hover { background: var(--card-hi); border-color: var(--line-hi); }
  .btn:hover { filter: brightness(1.05); }
  .nav-btn:hover { color: var(--text); }
  .pill:hover, .shuffle-btn:hover, .qnum:hover { border-color: var(--line-hi); color: var(--text); }
  .choice:not(.is-picked):not(.is-correct):not(.is-wrong):hover {
    border-color: var(--accent);
    background: var(--card-hi);
  }
  .appbar-btn:hover, .icon-btn:hover { background: var(--card-hi); color: var(--text); }
  .linkout:hover, .acc-head:hover { background: var(--card-hi); }
}

/* lettered answer choices via CSS counters */
.choices { counter-reset: choice; }

.choice { display: flex; align-items: center; gap: 12px; }

.choice::before {
  content: counter(choice, upper-alpha);
  counter-increment: choice;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--faint);
  border: 1px solid var(--line-hi);
  color: var(--muted);
  transition: background var(--t), color var(--t), border-color var(--t);
}

.choice.is-picked::before  { background: var(--accent);  border-color: var(--accent);  color: #fff; }
.choice.is-correct::before { background: var(--success); border-color: var(--success); color: #fff; }
.choice.is-wrong::before   { background: var(--danger);  border-color: var(--danger);  color: #fff; }

/* feedback panel accent edge */
.explain { border-left: 3px solid var(--line-hi); }
.explain.ok { border-left-color: var(--success); }
.explain.no { border-left-color: var(--danger); }

/* radius consistency */
.btn, .nav-btn, .quiz-actions .btn { border-radius: var(--r-sm); }
.brand-mark, .ch-num, .line-card .ic, .due-card .ic, .nudge .ic,
.acc-head .ic, .fact-card .ic, .curr-head .ic, .info-hero .ic,
.test-icon, .switch-row .ic, .linkout .ic, .sign-chip { border-radius: var(--r-sm); }
.big-card .art, .exam-hero .ic, .presubmit .ic { border-radius: var(--r); }

/* type scale normalization */
.sub { font-size: 14px; }
.line-card .t, .due-card .t, .nudge .t, .ch-top .t, .row-main .txt .t,
.switch-row .t, .chip .lbl { font-size: 15px; }
.line-card .s, .ch-top .s, .row-main .txt .s, .switch-row .s { font-size: 13px; }
.q-card .q-text { font-size: 18px; }
.choice { font-size: 15px; }

/* touch target */
.appbar-btn { width: 44px; height: 44px; min-width: 44px; }

/* bottom nav: calmer active state carried by stroke weight */
.nav-btn { border-radius: var(--r-sm); transition: color var(--t), background var(--t); }
.nav-btn.is-active { color: var(--accent); background: transparent; }
.nav-btn.is-active svg { stroke-width: 2.3; }

/* progress bars: inset track */
.bar { background: var(--faint); box-shadow: inset 0 0 0 1px var(--line); }

/* gauges */
.gauge-mid b { font-variant-numeric: tabular-nums; }
.ring .ring-bg { stroke: var(--faint); }

/* section rhythm */
.section-title { margin: 28px 0 12px; }
.view > .section-title:first-child { margin-top: 8px; }

/* focus refinements */
.btn-primary:focus-visible, .qnum.is-current:focus-visible { outline-color: var(--text); }
.nav-btn:focus-visible, .pill:focus-visible { outline-offset: -2px; }

/* selection and micro-interaction */
::selection { background: var(--accent-dim); color: var(--text); }
.tap:active { transform: scale(.99); }

/* brand mark presence */
.brand-mark { border: 1px solid var(--line-hi); box-shadow: var(--shadow-sm); }

/* switch on tokens */
.switch { background: var(--line-hi); }
.switch i { box-shadow: var(--shadow-sm); }

/* desktop frame: seat the app column */
@media (min-width: 561px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
  .nav { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* light theme: white sign plates need a hairline to read as plates */
.sign-panel, .sign-hero.has-plate, .sign-chip { border: 1px solid var(--line); }
