:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #fff;
  --surface-muted: #eef2f6;
  --ink: #121a26;
  --muted: #536074;
  --line: #dde3eb;
  --line-strong: #c4cedb;
  --accent: #174ea6;
  --on-accent: #fff;
  --accent-soft: #e8f0fc;
  --success: #176c4a;
  --success-soft: #e7f4ee;
  --danger: #b42332;
  --danger-soft: #fcecee;
  --on-danger: #fff;
  --sign-blue: #174ea6;
  --sign-red: #d71920;
  --sign-amber: #f2b705;
  --on-sign: #fff;
  --asphalt: #2b313b;
  --lane: #f4f6f9;
  --ch-1: #174ea6;
  --ch-2: #5b8ad9;
  --ch-3: #1f8a70;
  --ch-4: #7d8899;
  --ch-5: #e0a800;
  --ch-6: #c4561c;
  --control-border: #8090a3;
  --shadow: 0 18px 48px rgb(23 32 45 / 0.1);
  --radius-tile: 16px;
  --radius-panel: 12px;
  --radius-control: 10px;
  --font: "Be Vietnam Pro", "Segoe UI", "Roboto", "Helvetica Neue", "Arial", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1724;
    --surface: #172233;
    --surface-muted: #131d2b;
    --ink: #e8edf5;
    --muted: #b9c4d4;
    --line: #2a384b;
    --line-strong: #43546b;
    --accent: #8ab4f8;
    --on-accent: #0c1b32;
    --accent-soft: #1b2b44;
    --success: #76d7a7;
    --success-soft: #16302a;
    --danger: #ff9da8;
    --danger-soft: #3a1d25;
    --on-danger: #2a0f16;
    --sign-blue: #1f5bb8;
    --sign-red: #e5484d;
    --sign-amber: #f2b705;
    --on-sign: #fff;
      --asphalt: #1c2430;
    --lane: #dfe5ee;
    --ch-1: #5b8def;
    --ch-2: #a9c4f5;
    --ch-3: #3fb08f;
    --ch-4: #8593a6;
    --ch-5: #f2b705;
    --ch-6: #e07a45;
    --control-border: #94a3b8;
    --shadow: 0 18px 48px rgb(0 0 0 / 0.35);
  }
}

/* Same values as the media query block above; keep both in sync. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1724;
  --surface: #172233;
  --surface-muted: #131d2b;
  --ink: #e8edf5;
  --muted: #b9c4d4;
  --line: #2a384b;
  --line-strong: #43546b;
  --accent: #8ab4f8;
  --on-accent: #0c1b32;
  --accent-soft: #1b2b44;
  --success: #76d7a7;
  --success-soft: #16302a;
  --danger: #ff9da8;
  --danger-soft: #3a1d25;
  --on-danger: #2a0f16;
  --sign-blue: #1f5bb8;
  --sign-red: #e5484d;
  --sign-amber: #f2b705;
  --on-sign: #fff;
  --asphalt: #1c2430;
  --lane: #dfe5ee;
  --ch-1: #5b8def;
  --ch-2: #a9c4f5;
  --ch-3: #3fb08f;
  --ch-4: #8593a6;
  --ch-5: #f2b705;
  --ch-6: #e07a45;
  --control-border: #94a3b8;
  --shadow: 0 18px 48px rgb(0 0 0 / 0.35);
}

* {
  box-sizing: border-box;
}

html {
  accent-color: var(--accent);
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  scrollbar-color: var(--line-strong) var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 40;
  border-radius: var(--radius-control);
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  transform: translateY(-160%);
}

.skip-link:focus-visible {
  transform: none;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.nav-shell {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

/* With the 12px shell gap, keeps at least 28px before the nav links. */
.nav-shell .brand {
  margin-right: 16px;
  white-space: nowrap;
}

.brand img {
  border-radius: 9px;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.primary-nav a:not(.nav-cta),
.footer-links a,
.back-link {
  transition: color 160ms ease;
}

.primary-nav a:not(.nav-cta):hover,
.footer-links a:hover,
.back-link:hover {
  color: var(--accent);
}

.footer-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-cta {
  display: inline-flex;
  white-space: nowrap;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-control);
  padding: 0 18px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.theme-toggle:not([data-state]) {
  display: none;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon {
  display: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.theme-fill {
  fill: currentcolor;
  stroke: none;
}

.theme-toggle[data-state="system"] .theme-icon-system,
.theme-toggle[data-state="light"] .theme-icon-light,
.theme-toggle[data-state="dark"] .theme-icon-dark {
  display: block;
}

.menu-toggle {
  display: none;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0 16px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

/* Shared */

.section {
  padding: 112px 0 120px;
}

.section h2 {
  font-size: clamp(1.875rem, 3.4vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: end;
  gap: 24px 64px;
}

.section-head p {
  max-width: 34em;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.button:disabled {
  cursor: default;
  opacity: 0.45;
}

.text-link {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.text-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Hero */

.hero {
  overflow: hidden;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  align-items: center;
  gap: 72px;
  padding-top: 72px;
}

.hero-copy {
  padding-bottom: 72px;
}

.hero-copy h1 {
  font-size: clamp(2.75rem, 5.4vw, 4.5rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.hero-copy h1 span {
  display: block;
}

.hero-copy h1 span + span {
  color: var(--accent);
}

.hero-lede {
  max-width: 28em;
  margin: 28px 0 36px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}

.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 540px;
  margin: 56px 0 0;
}

.hero-facts div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 4px;
  border-left: 3px solid var(--line);
  padding: 2px 16px;
}

.hero-facts div:first-child {
  border-left-color: var(--accent);
}

.hero-facts dd {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.hero-facts dt {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* The quiz stage overlaps the road strip below it. */
.hero-stage {
  margin-bottom: -64px;
  border-radius: 20px;
  padding: 20px 24px 24px;
  background: var(--sign-blue);
}

.hero-stage-label {
  margin: 0 0 14px;
  color: var(--on-sign);
  font-size: 14px;
  font-weight: 600;
}

/* Road strip */

.road {
  position: relative;
  height: 136px;
  overflow: hidden;
  background: var(--asphalt);
}

.road::before {
  position: absolute;
  right: 0;
  bottom: 14px;
  left: 0;
  height: 2px;
  background: var(--lane);
  content: "";
  opacity: 0.55;
}

.road::after {
  position: absolute;
  right: 0;
  bottom: 64px;
  left: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--lane) 0 44px, transparent 44px 88px);
  content: "";
}

/* One-way road (white dashed line), traffic drives right to left.
   The outer lane (top, on the driver's right) is slower; the inner lane is faster.
   Cars in one lane share a speed and are spread by --offset, so they never overlap. */
.road-car {
  --dur: 18s;

  position: absolute;
  bottom: 22px;
  left: 0;
  width: auto;
  height: 26px;
  filter: brightness(0) invert(1);
  opacity: 0.92;
  animation: drive var(--dur) linear calc(var(--dur) * var(--offset, 0)) infinite;
}

.road-car.lane-outer {
  --dur: 28s;

  bottom: 76px;
}

.road-car[src*="xe_tai"],
.road-car[src*="xe_somi_romoc"],
.road-car[src*="xe_keo_romoc"] {
  height: 36px;
}

.road-car[src*="xe_khach"] {
  height: 34px;
}

@keyframes drive {
  from {
    translate: 100vw;
  }

  to {
    translate: -200px;
  }
}

/* Quiz */

.quiz {
  display: flex;
  min-height: 600px;
  flex-direction: column;
  border-radius: var(--radius-panel);
  padding: 24px;
  background: var(--surface);
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.quiz-count {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.quiz-progress {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quiz-progress li {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 200ms ease;
}

.quiz-progress .is-current {
  background: var(--accent);
}

.quiz-progress .is-correct {
  background: var(--success);
}

.quiz-progress .is-wrong {
  background: var(--danger);
}

.quiz-body {
  flex: 1;
}

.quiz-tag {
  display: inline-block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.quiz-tag.is-critical {
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--danger);
  color: var(--on-danger);
}

.quiz-question {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
}

.quiz-image {
  width: 100%;
  height: 176px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.quiz-answers {
  display: grid;
  gap: 8px;
}

.quiz-answer {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.quiz-key {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.quiz-answer:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-answer:disabled {
  cursor: default;
}

.quiz-answer.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.quiz-answer:hover:not(:disabled) .quiz-key {
  border-color: var(--accent);
  color: var(--accent);
}

.quiz-answer.is-correct .quiz-key {
  border-color: var(--success);
  background: var(--success);
  color: var(--surface);
}

.quiz-answer.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-answer.is-wrong .quiz-key {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--surface);
}

.quiz-feedback {
  margin-top: 12px;
  border-radius: var(--radius-control);
  padding: 12px 14px;
  background: var(--surface-muted);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.quiz-feedback.is-shown {
  opacity: 1;
  transform: none;
}

.quiz-verdict {
  margin: 0;
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
}

.quiz-verdict.is-wrong {
  color: var(--danger);
}

.quiz-explain {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.quiz-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.quiz-next {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

.quiz-result {
  display: grid;
  flex: 1;
  align-content: center;
  justify-items: start;
  gap: 12px;
}

.quiz-score {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.quiz-score:focus {
  outline: none;
}

.quiz-result-note {
  max-width: 34em;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 16px;
}

.quiz-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Features bento */

.features-section {
  padding-top: 136px;
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 56px;
}

.tile {
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: var(--radius-tile);
  padding: 28px;
  background: var(--surface);
}

.tile h3 {
  font-size: 20px;
  line-height: 1.35;
}

.tile p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.tile-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.tile-media {
  grid-column: span 7;
  grid-row: span 2;
  overflow: hidden;
  padding: 0;
}

.tile-media-frame {
  flex: 1;
  min-height: 280px;
  background: #fff;
}

.tile-media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-media figcaption {
  padding: 24px 28px 28px;
}

.tile-exam,
.tile-review {
  grid-column: span 5;
}

.tile .tile-meta {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--ink);
}

.tile-exam p:not(.tile-meta) {
  margin-bottom: 20px;
}

.tile-critical {
  grid-column: span 4;
}

.tile-critical .tile-icon {
  stroke: var(--danger);
}

.critical-list {
  margin: auto 0 0;
  padding-top: 20px;
}

.critical-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 14px;
}

.critical-list div:last-child {
  padding-bottom: 0;
}

.critical-list dt {
  color: var(--muted);
}

.critical-list dd {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile-chapters {
  grid-column: span 8;
}

.chapter-bar {
  display: flex;
  gap: 3px;
  height: 18px;
  margin: 24px 0 20px;
}

.chapter-bar span {
  border-radius: 4px;
  background: var(--ch);
}

.chapter-bar [data-ch="1"] { flex: 180; }
.chapter-bar [data-ch="2"] { flex: 25; }
.chapter-bar [data-ch="3"] { flex: 58; }
.chapter-bar [data-ch="4"] { flex: 37; }
.chapter-bar [data-ch="5"] { flex: 185; }
.chapter-bar [data-ch="6"] { flex: 115; }

[data-ch="1"] { --ch: var(--ch-1); }
[data-ch="2"] { --ch: var(--ch-2); }
[data-ch="3"] { --ch: var(--ch-3); }
[data-ch="4"] { --ch: var(--ch-4); }
[data-ch="5"] { --ch: var(--ch-5); }
[data-ch="6"] { --ch: var(--ch-6); }

.chapter-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.45;
}

.chapter-list li::before {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--ch);
  content: "";
}

.chapter-list span {
  color: var(--muted);
}

.chapter-list b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Signs */

.signs-section,
.faq-section {
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.sign-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
}

.sign-group {
  --tone: var(--sign-blue);
  overflow: hidden;
  border-radius: var(--radius-tile);
  padding: 8px;
  background: var(--surface-muted);
}

.sign-group[data-tone="red"] {
  --tone: var(--sign-red);
}

.sign-group[data-tone="amber"] {
  --tone: var(--sign-amber);
}

.sign-group-art {
  display: flex;
  height: 148px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-bottom: 4px solid var(--tone);
  border-radius: 10px 10px 0 0;
  background: #fff;
}

.sign-group-art img {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.sign-group h3 {
  padding: 16px 14px 0;
  font-size: 18px;
  line-height: 1.35;
}

.sign-codes {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0 14px 14px;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.sign-codes li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
}

.sign-codes b {
  display: block;
  border-radius: 6px;
  padding: 1px 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.signs-more {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.signs-more a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* License picker */

.license-picker {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
  gap: 56px;
  margin-top: 56px;
}

.license-tabs {
  display: grid;
  align-content: start;
  gap: 28px;
}

.license-tab-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.license-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.license-chip {
  min-width: 60px;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 120ms ease;
}

.license-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.license-chip:active {
  transform: translateY(1px);
}

.license-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.license-card {
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
}

.license-band {
  display: flex;
  min-height: 148px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: var(--sign-blue);
  color: var(--on-sign);
}

.license-code {
  margin: 0;
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.license-art {
  flex: none;
  width: 240px;
  height: 64px;
  object-fit: contain;
  object-position: right center;

  /* Turn the black vehicle silhouettes white on the blue band. */
  filter: brightness(0) invert(1);
}

.license-body {
  padding: 28px 32px 32px;
}

.license-body h3 {
  font-size: 24px;
  line-height: 1.3;
}

.license-desc {
  max-width: 48ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.license-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 28px 0 0;
  border-block: 1px solid var(--line);
}

.license-stats div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 2px;
  padding: 18px 16px;
}

.license-stats div:first-child {
  padding-left: 0;
}

.license-stats div + div {
  border-left: 1px solid var(--line);
}

.license-stats dd {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.license-stats dt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.license-stat-critical dd {
  color: var(--danger);
}

.license-rule {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.license-rule::before {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--danger);
  content: "";
}

/* FAQ */

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px;
}

.faq-head p {
  max-width: 26em;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.faq-item {
  border-top: 2px solid var(--ink);
  padding-top: 20px;
}

.faq-item h3 {
  font-size: 18px;
  line-height: 1.4;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15.5px;
}

.faq-item a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Download */

.download-section {
  padding: 112px 0;
}

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px 48px;
  border-radius: 24px;
  padding: 56px;
  outline: 2px solid var(--on-sign);
  outline-offset: -12px;
  background: var(--sign-blue);
  color: var(--on-sign);
}

.download-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 28px;
  border: 2px solid var(--on-sign);
  border-radius: 18px;
}

.download-copy h2 {
  max-width: 18ch;
  font-size: clamp(2rem, 3.6vw, 3rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.download-note {
  margin: 14px 0 0;
  color: var(--on-sign);
  font-size: 15px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-button {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  min-width: 172px;
  min-height: 60px;
  align-content: center;
  justify-items: start;
  border: 0;
  border-radius: var(--radius-panel);
  padding: 8px 22px 8px 18px;
  background: #0b111a;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.store-button:hover {
  background: #222c3a;
}

.store-button:active {
  transform: translateY(1px);
}

.store-button:focus-visible {
  outline-color: var(--on-sign);
}

.store-icon {
  grid-row: 1 / span 2;
  align-self: center;
  width: 24px;
  height: 24px;
  fill: currentcolor;
}

.store-kicker {
  font-size: 12px;
  line-height: 1.3;
}

.store-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

/* Sources and disclaimer */

.sources-section {
  border-top: 1px solid var(--line);
  padding: 64px 0;
}

.sources-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px 72px;
}

.sources-grid h2 {
  font-size: 20px;
  line-height: 1.35;
}

.sources-grid p {
  max-width: 60ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.sources-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sources-list li {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.sources-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.sources-list a,
.legal-content a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sources-list span {
  color: var(--muted);
  font-size: 14px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 36px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.footer-meta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.footer-meta p {
  margin: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(360px, calc(100% - 48px));
  border-radius: var(--radius-control);
  padding: 13px 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Legal pages */

.legal-main {
  min-height: calc(100dvh - 170px);
  padding: 64px 0 112px;
}

.legal-container {
  max-width: 760px;
}

.back-link {
  display: inline-block;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.legal-container h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1.2;
}

.legal-lede {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.legal-date {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.legal-content {
  display: grid;
  margin-top: 56px;
}

.legal-content section {
  border-top: 1px solid var(--line);
  padding: 28px 0 32px;
}

.legal-content h2 {
  font-size: 20px;
  line-height: 1.35;
}

.legal-content p {
  max-width: 66ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

/* Breakpoints */

@media (max-width: 1080px) {
  .faq-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq-head {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .primary-nav {
    gap: 20px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding-top: 56px;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .hero-stage {
    max-width: 640px;
  }

  .section-head,
  .license-picker,
  .sources-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .license-picker {
    gap: 32px;
    margin-top: 40px;
  }

  .tile-media {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .tile-exam,
  .tile-review {
    grid-column: span 6;
  }

  .tile-critical,
  .tile-chapters {
    grid-column: 1 / -1;
  }

  .sign-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
}

@media (max-width: 700px) {
  html {
    scroll-padding-top: 16px;
  }

  .container {
    width: calc(100% - 32px);
  }

  .site-header {
    position: relative;
  }

  .nav-shell {
    min-height: 64px;
    gap: 12px;
  }

  .header-tools {
    gap: 8px;
  }

  .header-tools .nav-cta {
    padding: 0 14px;
    font-size: 14px;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .primary-nav {
    position: absolute;
    top: 64px;
    right: 16px;
    left: 16px;
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .primary-nav a {
    padding: 13px 12px;
  }

  .primary-nav .nav-cta {
    margin-top: 6px;
  }

  .section {
    padding: 72px 0 80px;
  }

  .section h2 {
    font-size: clamp(1.75rem, 7.4vw, 2.125rem);
  }

  .section-head p {
    font-size: 16px;
  }

  .hero-grid {
    gap: 40px;
    padding-top: 40px;
  }

  .hero-copy h1 {
    font-size: clamp(2.25rem, 10.4vw, 3rem);
  }

  .hero-lede {
    margin: 18px 0 26px;
    font-size: 17px;
  }

  .hero-facts {
    margin-top: 36px;
  }

  .hero-facts div {
    padding: 0 10px 0 12px;
  }

  .hero-facts dd {
    font-size: 22px;
  }

  .hero-facts dt {
    font-size: 13px;
  }

  .hero-stage {
    margin-inline: -16px;
    margin-bottom: -40px;
    border-radius: 0;
    padding: 16px 16px 20px;
  }

  .road {
    height: 104px;
  }

  .road::after {
    bottom: 50px;
  }

  .road-car {
    --dur: 14s;

    bottom: 18px;
    height: 20px;
  }

  .road-car[src*="xe_tai"],
  .road-car[src*="xe_somi_romoc"],
  .road-car[src*="xe_keo_romoc"] {
    height: 28px;
  }

  .road-car[src*="xe_khach"] {
    height: 26px;
  }

  /* The quiz stage covers the outer lane on phones; keep two inner cars. */
  .road-car.lane-outer,
  .road-car.is-wide-only {
    display: none;
  }

  .quiz {
    min-height: 560px;
    padding: 18px 16px;
  }

  .quiz-result {
    min-height: 420px;
  }

  .quiz-image {
    height: 148px;
  }

  .quiz-question {
    font-size: 17px;
  }

  .features-section {
    padding-top: 80px;
  }

  .bento {
    gap: 12px;
    margin-top: 40px;
  }

  .tile {
    padding: 22px;
  }

  .tile-exam,
  .tile-review {
    grid-column: 1 / -1;
  }

  .tile-media {
    padding: 0;
  }

  .tile-media-frame {
    min-height: 0;
  }

  .tile-media figcaption {
    padding: 20px 22px 22px;
  }


  .chapter-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .sign-groups {
    display: flex;
    gap: 12px;
    margin: 40px -16px 0;
    padding: 0 16px 8px;
    overflow-x: auto;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .sign-group {
    flex: 0 0 76%;
    scroll-snap-align: start;
  }

  .sign-group-art {
    height: 120px;
  }

  .sign-group-art img {
    width: 64px;
    height: 64px;
  }

  .license-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
  }

  .license-chip {
    min-width: 0;
    padding: 0;
    font-size: 15px;
  }

  .license-band {
    min-height: 112px;
    padding: 20px;
  }

  .license-code {
    font-size: 56px;
  }

  .license-art {
    width: 168px;
    height: 44px;
  }

  .license-body {
    padding: 20px 20px 24px;
  }

  .license-body h3 {
    font-size: 21px;
  }

  .license-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-stats div {
    padding: 14px 12px;
  }

  .license-stats div:nth-child(odd) {
    padding-left: 0;
  }

  .license-stats div:nth-child(3) {
    border-left: 0;
  }

  .license-stats div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .license-stats dd {
    font-size: 21px;
  }

  .faq-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .faq-item h3 {
    font-size: 17px;
  }

  .download-section {
    padding: 72px 0;
  }

  .download-panel {
    border-radius: 18px;
    padding: 36px 24px 28px;
    outline-offset: -8px;
  }

  .download-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 20px;
    border-radius: 14px;
  }

  .store-button {
    flex: 1 1 150px;
  }

  .footer-grid {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-meta {
    text-align: left;
  }

  .sources-section {
    padding: 48px 0;
  }

  .legal-main {
    padding: 48px 0 80px;
  }

  .back-link {
    margin-bottom: 36px;
  }

  .legal-lede {
    font-size: 17px;
  }

  .legal-content {
    margin-top: 40px;
  }
}

/* Tablet: room for the full nav only when the brand shows its icon alone. */
@media (701px <= width <= 860px) {
  .nav-shell .brand span {
    display: none;
  }
}

@media (max-width: 360px) {
  .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .road-car {
    animation: none;
    translate: calc(80vw + 360px * var(--offset, 0));
  }
}
