:root {
  color-scheme: dark;
  --ink: #0b1010;
  --panel: #151c19;
  --panel-raised: #1d2622;
  --paper: #f1f3ec;
  --accent: #d5ee54;
  --muted: #b9c3ba;
  --line: #3d4841;
  --blue: #75a8ef;
  --red: #ff9d91;
  --amber: #ffd27d;
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--ink); scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: radial-gradient(circle at 50% -15%, #29372e 0, var(--ink) 44rem); color: var(--paper); font-family: Arial, Helvetica, sans-serif; font-size: 1rem; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.wrap { width: min(calc(100% - 2rem), 1120px); margin-inline: auto; }
.skip-link { position: fixed; top: -6rem; left: 1rem; z-index: 100; padding: .75rem 1rem; background: var(--accent); color: var(--ink); font-weight: 900; }
.skip-link:focus { top: 1rem; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 82px; border-bottom: 1px solid var(--line); }
.wordmark { margin: 0; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 900; line-height: 1; letter-spacing: -.045em; }
.tagline { margin: .35rem 0 0; color: var(--muted); font-size: .82rem; }
nav { display: flex; align-items: center; gap: .35rem 1rem; }
.text-control, .link-button { min-height: 44px; padding: .4rem .15rem; border: 0; background: transparent; color: var(--paper); font-size: .9rem; font-weight: 750; text-decoration: underline; text-underline-offset: .25em; cursor: pointer; }
.text-control:hover, .link-button:hover { color: var(--accent); }
.text-control:disabled { opacity: .42; cursor: not-allowed; }

.main { display: grid; place-items: start center; min-height: 650px; padding-block: clamp(1.5rem, 4vw, 3.5rem); }
.intro-card, .practice-card, .review-shell, .completion-card { width: min(100%, 790px); min-width: 0; }
.intro-card, .completion-card { margin-top: clamp(1rem, 6vh, 4rem); padding: clamp(1.5rem, 5vw, 3.25rem); border: 1px solid var(--line); border-top: 8px solid var(--accent); border-radius: var(--radius); background: var(--panel); box-shadow: 0 24px 70px rgb(0 0 0 / .28); }
.intro-card h1, .completion-card h1, .practice-card h1, .review-shell h1 { margin: 0; font-size: clamp(1.85rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -.045em; }
.intro-card > p:not(.eyebrow), .completion-card > p:not(.eyebrow) { max-width: 56ch; color: var(--muted); font-size: 1.08rem; }
.eyebrow { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 .8rem; color: var(--accent); font-size: .73rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.onboarding-icon { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; margin-bottom: 1.2rem; border: 2px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 1.6rem; }
.step-dots { display: flex; gap: .45rem; margin-block: 1.5rem; }
.step-dots span { width: 2rem; height: .35rem; border-radius: 1rem; background: var(--line); }
.step-dots span.active { background: var(--accent); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: .7rem 1.2rem; border: 2px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--ink); font-weight: 900; cursor: pointer; }
.primary-button:hover { background: #e5fa7d; }

.practice-card, .review-shell { padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: var(--radius); background: rgb(21 28 25 / .95); box-shadow: 0 24px 70px rgb(0 0 0 / .28); }
.section-heading, .review-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.practice-pill { flex: 0 0 auto; padding: .38rem .62rem; border: 1px solid var(--accent); color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.vehicle-frame { position: relative; overflow: hidden; margin: 0; border: 1px solid #5a675f; border-radius: 12px; background: #080b0a; touch-action: pan-y; }
.vehicle-frame img { display: block; width: 100%; max-height: 430px; aspect-ratio: 18 / 11; object-fit: cover; }
.vehicle-frame figcaption { position: absolute; right: .6rem; bottom: .55rem; max-width: calc(100% - 1.2rem); padding: .3rem .5rem; border-radius: 4px; background: rgb(11 16 16 / .86); color: var(--paper); font-size: .7rem; }
.prompt { margin: 1rem 0 .7rem; font-weight: 800; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.choice { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; align-items: center; gap: .45rem; min-height: 58px; padding: .65rem .75rem; border: 2px solid var(--line); border-radius: 9px; background: var(--panel-raised); color: var(--paper); text-align: left; font-weight: 800; cursor: pointer; }
.choice > span { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 1px solid currentColor; border-radius: 50%; font-size: .8rem; }
.choice kbd { padding: .12rem .35rem; border: 1px solid #647068; border-radius: 4px; background: var(--ink); color: var(--muted); font-size: .68rem; }
.choice:hover { border-color: var(--accent); }
.choice.police > span { color: var(--blue); }
.choice.ordinary > span { color: var(--accent); }
.choice.bad > span { color: var(--red); }
.choice.skip > span { color: var(--amber); }
.choice:disabled { opacity: .52; cursor: wait; }
.feedback, .status { min-height: 1.5em; margin: .7rem 0 0; font-weight: 750; }
.feedback.error, .status.error { color: var(--red); }
.feedback.success, .status.success { color: var(--accent); }
.human-check { display: grid; justify-items: start; gap: .6rem; margin-top: .8rem; padding: .85rem; border: 1px solid var(--line); border-radius: 9px; background: var(--ink); }
.human-check p { margin: 0; color: var(--muted); font-size: .85rem; }

.personal-count { display: grid; flex: 0 0 auto; gap: .1rem; padding: .45rem .65rem; border-left: 3px solid var(--accent); text-align: right; }
.personal-count strong { font-size: .86rem; }
.personal-count span { color: var(--muted); font-size: .7rem; }
.loading { display: grid; place-items: center; min-height: 360px; margin: 0; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.context-row, .review-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-width: 0; }
.context-row { margin-top: .55rem; }
.context-button, .report-button, .undo-button { min-height: 44px; border: 0; background: transparent; font-weight: 800; text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }
.context-button { color: var(--accent); }
.gesture-hint { overflow-wrap: anywhere; color: var(--muted); font-size: .75rem; text-align: right; }
.review-actions { min-height: 48px; margin-top: .35rem; }
.report-button { color: var(--muted); font-size: .8rem; }
.undo-button { padding-inline: .6rem; border: 1px solid var(--accent); border-radius: 7px; color: var(--accent); text-decoration: none; }

.trust-footer { padding-block: 2.25rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .77rem; }
.trust-footer > p { max-width: 92ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-top: .6rem; }
.link-button { min-height: 44px; color: var(--muted); font-size: .77rem; }
.prototype-note { color: var(--accent); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

dialog { width: min(calc(100% - 2rem), 610px); max-height: calc(100vh - 2rem); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--paper); box-shadow: 0 24px 90px #000; }
dialog::backdrop { background: rgb(0 0 0 / .76); }
dialog form { position: relative; margin: 0; padding: clamp(1.4rem, 5vw, 2.5rem); }
dialog h2 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.5rem); line-height: 1.08; letter-spacing: -.04em; }
dialog p { color: var(--muted); }
.dialog-close { position: absolute; top: .75rem; right: .75rem; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 1.5rem; cursor: pointer; }
label { display: block; margin: 1rem 0 .35rem; font-weight: 800; }
label span { color: var(--muted); font-size: .75rem; font-weight: 400; }
select, textarea { width: 100%; min-height: 48px; padding: .65rem .75rem; border: 2px solid #718078; border-radius: 7px; background: var(--paper); color: var(--ink); }
textarea { min-height: 7rem; resize: vertical; }
#report-form .primary-button { margin-top: 1rem; }

@media (min-width: 900px) {
  .main { padding-block: 2rem; }
  .vehicle-frame img { max-height: 360px; object-fit: contain; }
  .choice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice { grid-template-columns: 1.4rem minmax(0, 1fr); font-size: .82rem; line-height: 1.15; }
  .choice kbd { display: none; }
}

@media (max-width: 600px) {
  .wrap { width: min(calc(100% - 1rem), 1120px); }
  .site-header { min-height: 66px; }
  .tagline { display: none; }
  nav { gap: .55rem; }
  .text-control { font-size: .75rem; }
  .main { min-height: 610px; padding-block: .7rem 1.5rem; }
  .intro-card, .completion-card { margin-top: .25rem; padding: 1.35rem; }
  .practice-card, .review-shell { padding: .75rem; border-radius: 13px; }
  .section-heading, .review-heading { margin-bottom: .7rem; }
  .practice-card h1, .review-shell h1 { font-size: 1.55rem; }
  .eyebrow { margin-bottom: .45rem; font-size: .65rem; }
  .vehicle-frame img { max-height: 240px; }
  .vehicle-frame figcaption { font-size: .61rem; }
  .prompt { margin: .7rem 0 .5rem; font-size: .9rem; }
  .choice-grid { gap: .45rem; }
  .choice { grid-template-columns: 1.25rem minmax(0, 1fr); min-height: 56px; padding: .45rem .5rem; font-size: .78rem; line-height: 1.15; }
  .choice > span { width: 1.2rem; height: 1.2rem; }
  .choice kbd { display: none; }
  .personal-count { padding: .3rem .45rem; }
  .personal-count strong { font-size: .72rem; }
  .personal-count span { font-size: .62rem; }
  .loading { min-height: 250px; }
  .gesture-hint { font-size: .65rem; }
  .context-button, .report-button, .undo-button { font-size: .72rem; }
  .status { margin-top: .35rem; font-size: .8rem; }
  .trust-footer { padding-block: 1.5rem 2rem; }
}

@media (max-width: 365px) {
  .wordmark { font-size: 1.2rem; }
  .text-control { font-size: .7rem; }
  .choice { font-size: .73rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
