/* /drive — only what vision.css does not already have. */

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

.drive { padding: 0 var(--gutter) clamp(32px, 4vw, 56px); }
.drive-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); gap: var(--gap); align-items: start; }
@media (max-width: 1000px) { .drive-grid { grid-template-columns: 1fr; } }

.track { display: block; width: 100%; aspect-ratio: 200 / 140; cursor: pointer; background: var(--black-1); }

.knobs { display: grid; gap: 2px; padding-top: 2px; }
.knob { display: grid; grid-template-columns: 5.5em repeat(3, minmax(0, 1fr)); gap: 2px; align-items: stretch; }
.knob .label { display: flex; align-items: center; padding: 0 12px; color: var(--gray); }
.knob .btn { min-width: 0; padding: 0 6px; }

.drive-side { display: grid; gap: 2px; }
.focus { display: grid; gap: 8px; padding: 16px; }
.focus p { margin: 0; }
.focus .label { color: var(--gray); }
.focus-name { font-family: var(--narrow); font-weight: 700; font-size: clamp(1.4rem, 1vw + 1rem, 1.9rem); line-height: 1.1; color: var(--naples); }
html[data-lang="th"] .focus-name { font-family: var(--thai); }
.focus-row { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 8px; font-size: var(--micro); min-height: 2.9em; }
/* The unnamed row: the lesson of the room, so it reads as its own line. */
.focus-row.unnamed { color: var(--gray); }
.focus-row.unnamed .unnamed { color: var(--naples); }
.focus .btn { justify-self: start; }

.cards { display: grid; gap: 2px; }
.car-card {
  display: grid; grid-template-columns: 2.4em minmax(0, 1fr); grid-template-areas: "id name" "id say" "id score"; gap: 2px 10px; align-items: baseline;
  padding: 10px 12px; border: 0; text-align: left; cursor: pointer;
  background: var(--black); color: var(--white); font: inherit; font-size: var(--micro);
}
.car-card:hover { background: var(--black-2); }
.car-card[aria-pressed="true"] { outline: 2px solid var(--white); outline-offset: -2px; }
.car-card.is-crashed .car-id { background: var(--signal); }
.car-id { grid-area: id; align-self: start; display: flex; align-items: center; justify-content: center; height: 2.2em; font-weight: 600; color: var(--black); }
.car-card[data-style="careful"] .car-id { background: var(--white); }
.car-card[data-style="normal"] .car-id { background: var(--gray); }
.car-card[data-style="hasty"] .car-id { background: var(--naples); }
.car-name { grid-area: name; font-weight: 600; }
.car-score { grid-area: score; color: var(--gray); }
.car-say { grid-area: say; color: var(--naples); min-height: 2.9em; }

.legend { margin: 8px 0 0; }
.habits th:first-child { width: 34%; }

.scenario-picks { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px; margin-bottom:12px; }
.scenario-picks .btn { white-space:normal; min-height:60px; }
.cards { max-height:540px; overflow:auto; }
@media(max-width:700px) { .scenario-picks { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.driver-dialog { padding:0; border:1px solid var(--gray); width:min(1100px,96vw); max-width:96vw; max-height:96dvh; background:var(--black); color:var(--white); overflow:auto; }
.driver-dialog::backdrop { background:rgba(7,12,17,.8); }
.driver-shell { display:grid; gap:2px; }
.driver-head { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 16px; }
.driver-head h2 { margin:0; font-size:1.4rem; }
.driver-screen canvas { width:100%; height:clamp(210px,48dvh,520px); display:block; }
.driver-dashboard { padding:12px 16px; display:grid; grid-template-columns:auto 1fr; gap:6px 20px; }
.driver-dashboard p { margin:0; }
.driver-dashboard p:last-child { grid-column:1/-1; color:var(--gray); white-space:pre-line; }
.driver-note { padding:8px 16px 14px; margin:0; color:var(--gray); }
.driver-dialog .controls .btn { flex:1; white-space:normal; }
@media(max-width:600px) { .driver-dashboard { grid-template-columns:1fr; } .driver-dialog .controls { display:grid; grid-template-columns:1fr 1fr; } }

/* "Try this" buttons sit at the end of each experiment. */
.try-go { min-height: 36px; margin: 6px 0 4px; padding: 0 12px; }

/* ── The gate ────────────────────────────────────────────────────────── */
/* A teaching device, not a security control. It has to stay a BAND: the room
   itself must still be on the first screen, or the gate has eaten the thing it
   was introducing. Budget is roughly 300 px — the track has to start under it.
   The long explanation lives under the room, not above it. */
.gate {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: clamp(14px, 1.6vw, 22px) var(--gutter);
  background: var(--field); color: var(--field-text);
}
.gate-head h2 { font-size: var(--subtitle); line-height: 1.08; }
.gate-head .lede { margin: 6px 0 0; max-width: 46ch; font-size: var(--micro); font-weight: 400; }
.gate .stem-label { color: var(--naples); margin-bottom: 6px; }
.captcha { display: grid; gap: 8px; align-content: center; }
/* The nine buttons sit ON the drawn squares rather than in a row beneath them.
   It saves a strip of height, and it means you click the square you mean. */
.captcha-pad { position: relative; width: min(58vw, 248px); }
.captcha-grid {
  width: 100%; aspect-ratio: 1;
  background: var(--black); border: 0; cursor: pointer; display: block;
}
.captcha-tiles {
  position: absolute; inset: 0; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2px;
}
.captcha-tiles .btn {
  min-height: 0; min-width: 0; padding: 0;
  background: transparent; color: transparent; font-size: 0.6875rem;
}
.captcha-tiles .btn:hover { background: rgba(251, 230, 160, 0.22); color: transparent; }
.captcha-tiles .btn[aria-pressed="true"] {
  background: rgba(241, 90, 48, 0.3); color: var(--naples);
  outline: 3px solid var(--signal); outline-offset: -3px;
}
.captcha-ask { margin: 0; font-size: var(--micro); font-weight: 600; }
.captcha .controls { background: transparent; gap: 2px; }
.captcha .controls .btn { min-height: 36px; padding: 0 12px; }
.gate-replay { display: none; margin-left: auto; }
.gate-replay .btn { min-height: 34px; padding: 0 12px; }
.captcha [data-captcha-state]:empty { display: none; }
/* The machine's report card, once it has taken a fresh grid. */
.gate-taught { margin: 6px 0 0; max-width: 78ch; color: var(--naples); }
/* Once you are through, the gate stops being a wall and becomes a receipt.
   It has done its job, and the room needs its pixels back: 370px of black band
   sitting on top of a road you cannot see is the same defect as the essay was.
   The headline stays — it is the line this page exists to make — and the
   challenge stays one click away, because removing the only way back to it
   would be a small theft of its own. */
.gate[data-open="true"] { padding: 8px var(--gutter); align-items: center; }
.gate[data-open="true"] .captcha,
.gate[data-open="true"] .gate-head .lede { display: none; }
.gate[data-open="true"] .gate-head h2 { font-size: var(--body); line-height: 1.2; }
.gate[data-open="true"] .stem-label { display: none; }
.gate[data-open="true"] .gate-replay { display: inline-flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
/* The long-form story, now sitting under the room as an ordinary chapter. */
.chapter.gate-note { background: var(--quiet); color: var(--quiet-text); }
@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; }
  .captcha-pad { width: min(88vw, 320px); }
}
