:root {
  --navy: #0c2744;
  --blue: #145da0;
  --sky: #dff1ff;
  --red: #cf2e3b;
  --cream: #f8f5ed;
  --ink: #13202c;
  --muted: #617080;
  --line: #d9e0e7;
  --white: #fff;
  --green: #13795b;
  --shadow: 0 18px 50px rgba(12, 39, 68, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #f5f7f9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: white; }
.skip-link:focus { top: 1rem; }
.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 76px;
  padding: .75rem max(1.25rem, calc((100vw - 1200px) / 2));
  color: white;
  background: rgba(12, 39, 68, .97);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
}
.brand { display: flex; align-items: center; gap: .75rem; margin-right: auto; color: white; text-decoration: none; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; background: var(--red); font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand small { color: #bdd3e7; font-size: .72rem; }
nav { display: flex; gap: .25rem; }
.nav-link, .help-toggle { border: 0; color: #d7e5f2; background: transparent; }
.nav-link { padding: .75rem 1rem; border-radius: 10px; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.1); }
.help-toggle { display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; }
.help-toggle-text { font-size: .8rem; font-weight: 700; }
.help-toggle[aria-pressed="false"] { opacity: .55; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.flag { width: 24px; height: 16px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.translation-tip .flag, .somali-button .flag, .translation-head .flag { box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.view { display: none; }
.view.active { display: block; }
.hero {
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  gap: 4rem;
  align-items: center;
  min-height: 600px;
  padding: 5rem max(1.25rem, calc((100vw - 1200px) / 2));
  color: white;
  background:
    radial-gradient(circle at 80% 25%, rgba(55, 153, 225, .32), transparent 22rem),
    linear-gradient(135deg, #0c2744, #103d67);
}
.eyebrow { margin: 0 0 .55rem; color: #2183c9; font-size: .78rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.hero .eyebrow { color: #85cdfd; }
.hero h1 { max-width: 700px; margin: 0; font-family: Georgia, serif; font-size: clamp(2.7rem, 6vw, 5.6rem); line-height: .98; }
.hero h1 span { color: #8ed2ff; }
.hero-copy { max-width: 650px; margin: 1.5rem 0; color: #d7e5f2; font-size: 1.15rem; }
[data-so] { text-decoration: underline dotted rgba(20,93,160,.42); text-underline-offset: 4px; cursor: help; }
.hero [data-so] { text-decoration-color: rgba(255,255,255,.45); }
.hero-actions, .result-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.button { padding: .85rem 1.25rem; border: 2px solid transparent; border-radius: 12px; font-weight: 800; transition: .18s ease; }
.button:hover { transform: translateY(-2px); }
.button.primary { color: white; background: var(--red); box-shadow: 0 8px 20px rgba(207,46,59,.25); }
.button.secondary { color: var(--navy); border-color: var(--line); background: white; }
.hero .button.secondary { border-color: rgba(255,255,255,.4); color: white; background: transparent; }
.translation-tip { margin-top: 1.25rem; color: #bdd3e7; font-size: .86rem; }
.hero-card { padding: 2rem; border: 1px solid rgba(255,255,255,.18); border-radius: 30px; background: rgba(255,255,255,.09); backdrop-filter: blur(10px); }
.ring { display: grid; width: 185px; height: 185px; margin: auto; place-content: center; border: 12px solid #64b9ef; border-right-color: rgba(255,255,255,.18); border-radius: 50%; text-align: center; }
.ring strong { font-family: Georgia, serif; font-size: 4rem; line-height: .9; }
.ring span { color: #bdd3e7; }
.hero-card dl { margin: 2rem 0 0; }
.hero-card dl div { display: flex; justify-content: space-between; padding: .7rem 0; border-top: 1px solid rgba(255,255,255,.13); }
.hero-card dt { color: #bdd3e7; }
.hero-card dd { margin: 0; font-weight: 800; }
.section-shell { max-width: 1200px; margin: auto; padding: 5rem 1.25rem; }
.page-section { min-height: calc(100vh - 160px); }
.section-heading { display: flex; gap: 3rem; align-items: end; justify-content: space-between; margin-bottom: 2rem; }
.section-heading h1, .section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.2rem); }
.section-heading > p { max-width: 520px; color: var(--muted); }
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.category-card { position: relative; min-height: 225px; padding: 1.4rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 18px rgba(12,39,68,.04); }
.category-card:hover { border-color: #91bfe2; box-shadow: var(--shadow); transform: translateY(-3px); }
.category-card button { position: absolute; inset: 0; border: 0; background: transparent; }
.category-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 16px; background: var(--sky); font-size: 1.6rem; }
.category-card h3 { margin: 1rem 0 .3rem; font-size: 1.25rem; }
.category-card p { margin: 0; color: var(--muted); }
.category-foot { position: absolute; right: 1.4rem; bottom: 1.2rem; left: 1.4rem; display: flex; justify-content: space-between; color: var(--blue); font-size: .85rem; font-weight: 800; }
.memory-section { padding-top: 1rem; }
.memory-card { max-width: 760px; height: 350px; margin: auto; perspective: 1200px; }
.memory-card-inner { position: relative; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.memory-card.flipped .memory-card-inner { transform: rotateY(180deg); }
.memory-face { position: absolute; display: grid; inset: 0; padding: 3rem; place-content: center; border-radius: 28px; text-align: center; backface-visibility: hidden; box-shadow: var(--shadow); }
.memory-front { color: white; background: linear-gradient(145deg, var(--navy), var(--blue)); }
.memory-back { border: 1px solid #bcd8c9; background: #effaf5; transform: rotateY(180deg); }
.memory-face h3 { max-width: 580px; margin: 1rem 0; font-family: Georgia, serif; font-size: clamp(1.7rem, 4vw, 2.8rem); }
.memory-label { font-size: .75rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.tap-hint { color: #bdd3e7; }
.memory-controls { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.5rem; }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--navy); background: white; }
.test-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.test-card { display: flex; gap: 1.2rem; align-items: center; padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: white; }
.test-number { display: grid; flex: 0 0 58px; height: 58px; place-items: center; border-radius: 15px; color: white; background: var(--navy); font-size: 1.3rem; font-weight: 900; }
.test-card h2 { margin: 0; font-size: 1.15rem; }
.test-card p { margin: .15rem 0 0; color: var(--muted); font-size: .86rem; }
.test-card .button { margin-left: auto; }
.progress-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 3rem; }
.stat-card { padding: 1.5rem; border-radius: 20px; color: white; background: var(--navy); }
.stat-card:nth-child(2) { background: var(--blue); }
.stat-card:nth-child(3) { background: var(--green); }
.stat-card strong { display: block; font-family: Georgia, serif; font-size: 2.5rem; }
.topic-progress { display: grid; gap: .9rem; margin-bottom: 3rem; }
.topic-row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 1rem; align-items: center; }
.bar { height: 11px; overflow: hidden; border-radius: 10px; background: #e2e8ee; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.import-panel { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.import-panel > div { margin-right: auto; }
.import-panel h2, .import-panel p { margin: 0; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.text-button { padding: .5rem; border: 0; color: var(--blue); background: transparent; font-weight: 800; }
.status-message { flex-basis: 100%; color: var(--green); }
.quiz-shell { max-width: 900px; min-height: calc(100vh - 150px); margin: auto; padding: 2.5rem 1.25rem 5rem; }
.quiz-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.quiz-meta { text-align: center; }
.quiz-meta span, .quiz-meta strong { display: block; }
.quiz-meta span { color: var(--muted); font-size: .8rem; }
.timer { min-width: 80px; font-weight: 900; text-align: right; }
.quiz-progress-track { height: 7px; margin: 1rem 0 2rem; overflow: hidden; border-radius: 10px; background: #dfe6ec; }
.quiz-progress-track span { display: block; width: 0; height: 100%; background: var(--red); transition: width .25s; }
.question-card { padding: clamp(1.5rem, 5vw, 3.5rem); border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.question-category { color: var(--blue); font-weight: 900; text-transform: uppercase; }
.question-card h1 { margin: .5rem 0; font-family: Georgia, serif; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.2; }
.select-instruction { color: var(--muted); }
.answer-list { display: grid; gap: .8rem; margin: 2rem 0; }
.answer-option { display: flex; gap: .9rem; align-items: center; width: 100%; padding: 1rem; border: 2px solid var(--line); border-radius: 14px; text-align: left; background: white; }
.answer-option:hover { border-color: #95bddd; }
.answer-option.selected { border-color: var(--blue); background: #edf7ff; }
.answer-option.correct { border-color: var(--green); background: #e9f8f1; }
.answer-option.wrong { border-color: var(--red); background: #fff0f1; }
.answer-letter { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 50%; background: #e9eef2; font-weight: 900; }
.answer-feedback { margin: 1rem 0; padding: 1rem; border-left: 5px solid var(--blue); background: #edf7ff; }
.answer-feedback strong { display: block; margin-bottom: .3rem; }
.quiz-actions { display: flex; justify-content: flex-end; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.results-shell { max-width: 800px; min-height: calc(100vh - 150px); margin: auto; padding: 5rem 1.25rem; text-align: center; }
.result-icon { display: grid; width: 85px; height: 85px; margin: 0 auto 1rem; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 2.5rem; }
.results-shell h1 { margin: 0; font-family: Georgia, serif; font-size: 3rem; }
.result-score { display: flex; align-items: baseline; justify-content: center; gap: .7rem; margin: 2rem 0; }
.result-score strong { font-family: Georgia, serif; font-size: 4.5rem; }
.result-score span { color: var(--muted); font-size: 1.3rem; }
.results-breakdown { display: grid; gap: .5rem; margin: 2rem auto; text-align: left; }
.breakdown-row { display: grid; grid-template-columns: 150px 1fr 50px; gap: 1rem; align-items: center; }
.result-actions { justify-content: center; }
.translation-popover { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; width: min(380px, calc(100vw - 2rem)); padding: 1.2rem 2.5rem 1.2rem 1.2rem; border: 1px solid #e3bd3e; border-radius: 16px; background: #fff8d7; box-shadow: var(--shadow); }
.translation-popover > span { color: #7a5b00; font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.translation-popover p { margin: .35rem 0 0; }
.translation-popover button { position: absolute; top: .5rem; right: .7rem; border: 0; background: transparent; font-size: 1.5rem; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding: 2rem max(1.25rem, calc((100vw - 1200px) / 2)); color: #9bb0c3; background: var(--navy); font-size: .76rem; }

@media (max-width: 800px) {
  .site-header { flex-wrap: wrap; gap: .5rem; }
  .brand { width: calc(100% - 130px); }
  nav { order: 3; width: 100%; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.1); }
  .nav-link { flex: 1; padding: .6rem .3rem; }
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 3rem; }
  .hero-card { display: flex; gap: 1.5rem; align-items: center; }
  .ring { width: 130px; height: 130px; margin: 0; border-width: 9px; }
  .ring strong { font-size: 2.8rem; }
  .hero-card dl { flex: 1; margin: 0; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading { display: block; }
}

@media (max-width: 560px) {
  .help-toggle { font-size: .78rem; }
  .hero { min-height: auto; }
  .hero-card { display: block; }
  .ring { margin: auto; }
  .hero-card dl { margin-top: 1.5rem; }
  .category-grid, .test-grid, .progress-summary { grid-template-columns: 1fr; }
  .category-card { min-height: 205px; }
  .memory-card { height: 390px; }
  .memory-face { padding: 2rem 1.3rem; }
  .test-card { flex-wrap: wrap; }
  .test-card .button { width: 100%; margin: 0; }
  .topic-row { grid-template-columns: 110px 1fr 44px; gap: .5rem; font-size: .85rem; }
  .quiz-topbar { flex-wrap: wrap; }
  .quiz-meta { order: 3; width: 100%; }
  .breakdown-row { grid-template-columns: 100px 1fr 40px; gap: .5rem; font-size: .8rem; }
}

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

/* ===== Header tools / accounts ===== */
.header-tools { display: flex; align-items: center; gap: .5rem; }
.account-button {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .85rem .4rem .4rem;
  color: #fff; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  font-size: .82rem; font-weight: 700;
}
.account-button:hover { background: rgba(255,255,255,.2); }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--red); color: #fff; font-weight: 900; font-size: .85rem;
}
.avatar.guest { background: rgba(255,255,255,.25); }

/* ===== Buttons / shared ===== */
.button.taxi { background: #1d1d1f; color: #fff; }
.button.taxi:hover { background: #333; }
.button.full { width: 100%; margin-top: auto; }
.block-title { margin: 2.5rem 0 1rem; font-size: 1.25rem; }
.block-note { margin: -.6rem 0 1rem; color: var(--muted); font-size: .9rem; }

/* ===== Source / provenance note ===== */
.source-note {
  display: flex; gap: .7rem; align-items: flex-start;
  max-width: 760px; margin: 1.25rem 0; padding: .9rem 1.1rem;
  border: 1px solid #d8e2ec; border-left: 4px solid var(--blue);
  border-radius: 12px; background: #f4f8fc;
  color: #35506b; font-size: .88rem; line-height: 1.55;
}
.source-note::before { content: "ℹ"; flex: 0 0 auto; font-size: 1rem; line-height: 1.4; }
.source-note strong { color: var(--navy); }
.source-note.on-dark {
  border-color: rgba(255,255,255,.22); border-left-color: #8ed2ff;
  background: rgba(255,255,255,.08); color: #d7e5f2;
}
.source-note.on-dark strong { color: #fff; }
.page-section { padding-top: 2.5rem; }
.empty { padding: 1.25rem; color: var(--muted); background: #f3f6fa; border-radius: 12px; }

/* ===== Taxi ===== */
.taxi-banner {
  display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: space-between;
  padding: 2rem; margin-bottom: 1rem; border-radius: 20px;
  color: #fff; background: linear-gradient(135deg, #15181d, #2b3440);
}
.taxi-banner h1 { margin: .25rem 0 .75rem; }
.taxi-banner p { max-width: 54ch; color: #cfd8e3; }
.taxi-banner .eyebrow { color: #f5c542; }
.taxi-stat {
  display: grid; place-items: center; padding: 1.25rem 1.75rem;
  border-radius: 16px; background: rgba(255,255,255,.1);
}
.taxi-stat strong { font-size: 2.4rem; line-height: 1; }
.taxi-stat span { font-size: .8rem; color: #cfd8e3; }

/* ===== Quiz extras ===== */
.select-instruction { margin: .25rem 0 .5rem; font-weight: 700; color: var(--red); }
.somali-button {
  display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1rem;
  padding: .45rem .9rem; border: 1px solid #cfdbe8; border-radius: 999px;
  background: #fff; font-size: .82rem; font-weight: 700; color: var(--navy);
}
.somali-button:hover { background: #eef4fa; }
.answer-option.selected { border-color: var(--blue); background: #eaf2fb; }
.answer-so { display: block; margin-top: .2rem; font-size: .85rem; color: var(--muted); }
.answer-feedback .so-line { margin-top: .5rem; font-style: italic; }

/* ===== Review list ===== */
.review-filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip {
  padding: .4rem .9rem; border: 1px solid #cfdbe8; border-radius: 999px;
  background: #fff; font-size: .82rem; font-weight: 700; color: var(--navy);
}
.chip.active { color: #fff; background: var(--navy); border-color: var(--navy); }
.review-list { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.review-row {
  display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: start;
  padding: .9rem 1rem; border-radius: 12px; background: #fff;
  border: 1px solid #e3eaf2; border-left: 5px solid #cbd5e1;
}
.review-row.right { border-left-color: #1f9d55; }
.review-row.wrong { border-left-color: var(--red); }
.review-mark {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: .85rem; font-weight: 900; color: #fff; background: #cbd5e1;
}
.review-row.right .review-mark { background: #1f9d55; }
.review-row.wrong .review-mark { background: var(--red); }
.review-q { margin: 0 0 .3rem; font-weight: 600; }
.review-meta { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.progress-owner { margin-bottom: 1.25rem; color: var(--muted); }

/* ===== About ===== */
.about-wrap { display: grid; grid-template-columns: auto 1fr; gap: 2.5rem; align-items: start; }
.about-photo {
  display: grid; place-items: center; width: 120px; height: 120px; border-radius: 28px;
  font-size: 2.6rem; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
}
.about-wrap h1 { margin: .25rem 0 1rem; }
.about-wrap p { max-width: 68ch; margin-bottom: 1rem; line-height: 1.75; }
.about-lead { font-size: 1.15rem; font-weight: 600; color: var(--navy); }
.about-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 1.75rem 0; }
.about-cards article { padding: 1.1rem; border-radius: 14px; background: #f3f6fa; }
.about-cards strong { display: block; margin-bottom: .35rem; }
.about-cards span { font-size: .88rem; color: var(--muted); }
.about-sign { font-weight: 700; color: var(--navy); }

/* ===== Modals ===== */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: 1.25rem; background: rgba(8, 20, 35, .6);
}
.overlay[hidden] { display: none; }
.modal {
  position: relative; width: min(460px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 2rem; border-radius: 20px; background: #fff;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.modal.narrow { width: min(340px, 100%); text-align: center; }
.modal h2 { margin: .25rem 0 .75rem; }
.modal-sub { margin: 1.5rem 0 .6rem; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.modal-note { color: var(--muted); font-size: .92rem; }
.modal-close {
  position: absolute; top: .9rem; right: .9rem; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: #eef2f7; font-size: 1.2rem; color: var(--navy);
}
.account-form { display: grid; gap: .4rem; margin-top: 1.25rem; }
.account-form label { font-size: .85rem; font-weight: 700; }
.account-form .optional { font-weight: 400; color: var(--muted); }
.account-form input {
  padding: .75rem .9rem; border: 1px solid #cfdbe8; border-radius: 10px;
  font: inherit; font-size: 1rem;
}
.account-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.account-form button { margin-top: .75rem; }
.form-error { min-height: 1.1rem; margin: 0; color: var(--red); font-size: .85rem; }
.account-list { display: grid; gap: .5rem; }
.account-chip {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .7rem .9rem;
  border: 1px solid #dde5ee; border-radius: 12px; background: #fff; text-align: left; color: var(--navy);
}
.account-chip:hover { background: #eef4fa; }
.account-chip.current { border-color: var(--blue); background: #eaf2fb; }
.account-chip small { display: block; font-size: .78rem; color: var(--muted); }
.text-button.danger { color: var(--red); }
#continue-guest { display: block; width: 100%; margin-top: 1rem; text-align: center; }

.translation-head { display: flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 800px) {
  .about-wrap { grid-template-columns: 1fr; gap: 1.5rem; }
  .about-photo { width: 84px; height: 84px; border-radius: 20px; font-size: 1.9rem; }
  .taxi-banner { padding: 1.5rem; }
  .help-toggle-text { display: none; }
  .account-button span:not(.avatar) { display: none; }
  .account-button { padding: .35rem; }
}

.card-link { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.category-card .category-foot { gap: .5rem; }
.test-card .button.full { width: 100%; margin: .5rem 0 0; }

/* Answer states must win over .selected */
.answer-option.correct { border-color: var(--green, #1f9d55); background: #e9f8f1; }
.answer-option.wrong { border-color: var(--red); background: #fff0f1; }
.answer-option:disabled { opacity: 1; cursor: default; }
.answer-option:disabled .answer-en { color: var(--navy); }
.answer-option.correct .answer-letter { color: #fff; background: #1f9d55; }
.answer-option.wrong .answer-letter { color: #fff; background: var(--red); }
.answer-feedback.good { border-left-color: #1f9d55; background: #e9f8f1; }
.answer-feedback.bad { border-left-color: var(--red); background: #fff0f1; }
.quiz-shell { padding-top: 3.5rem; }
.button.taxi { gap: .45rem; display: inline-flex; align-items: center; }

/* ===== Driving theory study centre ===== */
.button.theory { color: #0c2744; background: #f6c945; }
.button.theory:hover { background: #ffd968; }
.theory-hero {
  display: flex; gap: 2rem; align-items: center; justify-content: space-between;
  padding: 2rem; margin-bottom: 1rem; border-radius: 20px;
  color: #fff; background: linear-gradient(135deg, #173f61, #116b73);
}
.theory-hero h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.5rem); }
.theory-hero p:not(.eyebrow) { max-width: 720px; margin-bottom: 0; color: #d8f1f0; }
.theory-stat { flex: 0 0 155px; padding: 1.25rem; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; text-align: center; background: rgba(255,255,255,.1); }
.theory-stat strong { display: block; font-family: Georgia, serif; font-size: 2.8rem; }
.theory-stat span { color: #d8f1f0; font-size: .8rem; }
.theory-layout { display: grid; grid-template-columns: minmax(220px, .34fr) 1fr; gap: 1.5rem; align-items: start; }
.theory-sidebar, .theory-study { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.theory-sidebar { position: sticky; top: 100px; }
.theory-sidebar h2, .theory-gallery-heading h2 { margin: 0; }
.theory-category-list { display: grid; gap: .45rem; max-height: 610px; overflow: auto; padding-right: .2rem; }
.theory-topic-button { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border: 1px solid transparent; border-radius: 11px; color: var(--ink); text-align: left; background: #f5f8fb; }
.theory-topic-button:hover, .theory-topic-button.active { border-color: #8ac8d0; color: #0c5360; background: #e8f8f8; }
.theory-topic-button span { color: var(--muted); font-size: .76rem; }
.study-plan { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; padding: 1.25rem; border-radius: 16px; background: #eef9f8; }
.study-plan h2 { margin: 0; font-family: Georgia, serif; }
.study-plan p:not(.eyebrow) { max-width: 500px; margin: .3rem 0 0; color: #355d65; }
.plan-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; min-width: 360px; margin: 0; padding: 0; list-style: none; counter-reset: plan; }
.plan-steps li { display: grid; gap: .15rem; padding: .75rem; border-radius: 10px; background: #fff; counter-increment: plan; }
.plan-steps li::before { content: counter(plan); color: #13818a; font-weight: 900; }
.plan-steps span { color: var(--muted); font-size: .76rem; }
.theory-gallery-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.theory-gallery-heading .block-note { margin: .3rem 0 0; }
.theory-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; max-height: 1100px; overflow: auto; padding: .2rem; }
.theory-shot { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #f5f7f9; }
.theory-shot a { display: block; aspect-ratio: 9 / 16; overflow: hidden; background: #e7edf2; }
.theory-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .2s ease; }
.theory-shot a:hover img { transform: scale(1.04); }
.theory-shot figcaption { padding: .4rem .55rem; color: var(--muted); font-size: .72rem; }
@media (max-width: 900px) {
  .theory-layout { grid-template-columns: 1fr; }
  .theory-sidebar { position: static; }
  .theory-category-list { grid-template-columns: repeat(2, 1fr); max-height: 260px; }
  .theory-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .study-plan { display: block; }
  .plan-steps { min-width: 0; margin-top: 1rem; }
}
@media (max-width: 560px) {
  .theory-hero { display: block; }
  .theory-stat { margin-top: 1rem; }
  .theory-category-list { grid-template-columns: 1fr; }
  .theory-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-steps { grid-template-columns: 1fr; }
}

/* ===== Theory quiz review ===== */
.theory-missed-panel {
  display: flex; gap: 2rem; align-items: center; justify-content: space-between;
  margin: 2rem 0 3rem; padding: 1.5rem 2rem; border: 1px solid #f2c7ca;
  border-radius: 20px; background: #fff7f7;
}
.theory-missed-panel h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; }
.theory-missed-panel p:not(.eyebrow) { margin: .35rem 0 0; color: var(--muted); }
.missed-action { display: grid; min-width: 220px; text-align: center; }
.missed-action strong { color: var(--red); font-family: Georgia, serif; font-size: 2.8rem; line-height: 1; }
.missed-action span { margin-bottom: .75rem; color: var(--muted); font-size: .8rem; }
.theory-heading { margin-top: 1rem; }
@media (max-width: 650px) {
  .theory-missed-panel { display: block; padding: 1.25rem; }
  .missed-action { margin-top: 1rem; }
}
.theory-mocks-heading { margin-top: 4rem; }
.category-card .theory-coverage { margin-top: .6rem; padding-bottom: 2rem; color: var(--blue); font-size: .8rem; font-weight: 700; }

/* ===== Language picker ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.language-picker { display: flex; align-items: center; gap: .3rem; padding: .3rem .6rem; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: #d7e5f2; }
.language-picker select { max-width: 9.5rem; border: 0; color: inherit; background: transparent; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.language-picker select option { color: #13263b; }
.lang-badge { display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 3px; border-radius: 4px; background: #e8b33a; color: #13263b; font-size: .65rem; font-weight: 900; }
.lang-badge[hidden] { display: none; }
[dir="rtl"].answer-so, [dir="rtl"].so-line, #translation-text[dir="rtl"] { text-align: right; }

/* ===== Theory pictures ===== */
.question-image { margin: .2rem 0 1rem; text-align: center; }
.question-image img { max-width: min(260px, 70%); max-height: 240px; object-fit: contain; }
.answer-list.picture-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.answer-option .answer-pic { display: block; width: 100%; max-height: 130px; margin-bottom: .4rem; object-fit: contain; }
.picture-grid .answer-option { flex-direction: column; align-items: stretch; min-width: 0; text-align: center; }
.picture-grid .answer-letter { align-self: center; }
@media (max-width: 720px) {
  .language-picker select { max-width: 6.5rem; }
}
@media (max-width: 1180px) {
  .help-toggle-text { display: none; }
}

/* ===== Welcome demonstration (auto-playing) ===== */
.welcome-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; margin-top: 1.5rem; padding: 2rem; border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.welcome-demo h2 { margin: .2rem 0 .6rem; font-family: Georgia, serif; font-size: clamp(1.8rem, 3.5vw, 2.6rem); color: var(--navy); }
.welcome-demo .hero-actions { margin-top: 1rem; }
.demo-screen { position: relative; padding: 1.4rem; border: 2px solid var(--line); border-radius: 18px; background: var(--cream); min-height: 360px; }
.demo-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.demo-tabs button { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: white; font-weight: 700; cursor: pointer; }
.demo-tabs button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: white; }
#demo-question { margin: .3rem 0; font-size: 1.15rem; transition: background .3s; border-radius: 6px; }
.demo-highlight { background: #fff3a6; box-shadow: 0 0 0 4px #fff3a6; }
.demo-somali { margin: .4rem 0; padding: .6rem .8rem; border-left: 4px solid #4189dd; border-radius: 8px; background: #e9f3ff; animation: demo-in .4s ease; }
.demo-options { display: grid; gap: .45rem; margin: .8rem 0; }
.demo-options button { padding: .6rem .8rem; border: 2px solid var(--line); border-radius: 10px; background: white; text-align: left; cursor: pointer; }
.demo-options .demo-correct { border-color: var(--green); background: #e9f8f1; font-weight: 700; }
#demo-feedback { margin: .3rem 0; color: var(--green); font-weight: 700; }
#demo-language-tip { margin: .5rem 0 1rem; padding: .3rem .4rem; border-radius: 6px; transition: background .3s; }
.demo-track { position: absolute; left: 1.4rem; right: 1.4rem; bottom: .8rem; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.demo-track span { display: block; height: 100%; width: 0; background: var(--blue); transition: width 1s linear; }
.demo-pulse { outline: 3px solid #ffd43b; outline-offset: 2px; animation: demo-pulse 1s ease-in-out infinite; }
@keyframes demo-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes demo-pulse { 50% { outline-color: transparent; } }
@media (max-width: 800px) { .welcome-demo { grid-template-columns: 1fr; padding: 1.2rem; } }

/* ===== Learn together rooms ===== */
.room-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; margin-top: 1rem; }
.room-panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.room-panel h2 { margin-top: 0; }
.room-toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; }
.room-code { padding: .2rem .6rem; border-radius: 8px; background: var(--sky); font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: .15em; }
.room-chose { margin-left: auto; color: var(--blue); font-weight: 800; }
#room-connection { color: var(--muted); }
#room-counter { font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .demo-pulse, .demo-somali { animation: none; } }
.room-timer[hidden], .room-setup[hidden], #room-session[hidden], .demo-somali[hidden], #demo-feedback[hidden] { display: none; }
.room-session:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.2rem; align-items: start; margin-top: 1rem; }
.room-board ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.room-board li { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .7rem; border-radius: 10px; background: #f3f6f9; }
.room-board li.me { background: var(--sky); font-weight: 700; }
.room-board li strong { white-space: nowrap; }
.room-timer { display: inline-block; margin: 0; padding: .3rem .8rem; border-radius: 999px; background: var(--navy); color: white; font-size: 1.3rem; font-weight: 800; }
.room-timer.low { background: var(--red); }
@media (max-width: 800px) { .room-session:not([hidden]) { grid-template-columns: 1fr; } }
.room-session .answer-option:disabled { color: inherit; }
.room-voice { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0; }
.room-voice .button { padding: .55rem 1rem; }
#room-voice-status { color: var(--muted); font-size: .9rem; }
.room-remove { margin-left: .5rem; padding: .2rem .55rem; border: 1px solid var(--red); border-radius: 999px; background: white; color: var(--red); font-size: .78rem; font-weight: 700; cursor: pointer; }
.room-remove:hover { background: #fff0f1; }

/* ===== Advertising (hidden until enabled in ads-config.js) ===== */
.ad-slot[hidden] { display: none; }
.ad-slot {
  display: block;
  margin: 28px auto;
  max-width: 970px;
  min-height: 100px;
  text-align: center;
}
.ad-slot::before {
  content: "Advertisement";
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7a8c;
}

/* ===== Privacy page ===== */
.privacy-body { max-width: 760px; line-height: 1.65; }
.privacy-body h2 { margin: 26px 0 6px; font-size: 1.15rem; }
.privacy-body a, footer a { color: inherit; text-decoration: underline; }
