/* Immersive German+ browser draft
   Visual language: German transit wayfinding. Signal yellow signs with black type,
   rail navy for boards, slate panels for the "headset" UI. */

:root {
  --yellow: #ffcc00;
  --yellow-deep: #e6b800;
  --ink: #111417;
  --slate: #1e2a38;
  --slate-2: #2a3a4c;
  --navy: #17324d;
  --concrete: #dfe4e8;
  --paper: #f7f8f5;
  --muted: #a9b6c3;
  --good: #2e9e5b;
  --miss: #d64545;
  --sign: "Barlow Semi Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --text: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --band-h: 64px;
  --radius-sign: 6px;
  --radius-panel: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--concrete);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Journey band (the overhead sign) ---------- */

.band {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--band-h);
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 0 16px;
  background: var(--yellow);
  color: var(--ink);
  z-index: 20;
  box-shadow: 0 2px 0 rgba(17, 20, 23, 0.25);
}

.band-brand {
  margin: 0;
  align-self: center;
  font-family: var(--sign);
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
}

.journey {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex: 1;
  min-width: 0;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.journey::-webkit-scrollbar { display: none; }

.stop {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.005em;
  white-space: nowrap;
  border-left: 2px solid rgba(17, 20, 23, 0.18);
}
.stop:first-child { border-left: 0; }
.stop svg { width: 26px; height: 26px; flex: none; fill: currentColor; }
.stop .num {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.65;
}
.stop.done { opacity: 0.55; }
.stop.done .num { display: none; }
.stop .tick { display: none; width: 18px; height: 18px; }
.stop.done .tick { display: block; }
.stop[aria-current="step"] {
  background: var(--ink);
  color: var(--yellow);
  opacity: 1;
}

.band-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool {
  font-family: var(--sign);
  font-weight: 600;
  font-size: 1rem;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sign);
  padding: 4px 12px;
}
.tool:hover { background: rgba(17, 20, 23, 0.08); }

/* ---------- Stage ---------- */

.stage {
  position: fixed;
  inset: var(--band-h) 0 0 0;
}
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }

.look-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  background: rgba(30, 42, 56, 0.78);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.9rem;
  pointer-events: none;
  transition: opacity 0.6s;
}
.look-hint.gone { opacity: 0; }

.fade {
  position: absolute;
  inset: 0;
  background: var(--concrete);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.fade.on { opacity: 1; }

/* ---------- Dialogue panel ---------- */

.panel {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  max-height: calc(100% - 36px);
  overflow-y: auto;
  background: rgba(30, 42, 56, 0.96);
  color: var(--paper);
  border-radius: var(--radius-panel);
  box-shadow: 0 18px 40px -18px rgba(10, 16, 24, 0.6);
}

.line { padding: 16px 22px 14px; }

.line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.speaker {
  margin: 0;
  font-family: var(--sign);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--yellow);
}
.speaker-en { color: var(--muted); font-weight: 500; }

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(247, 248, 245, 0.28);
  color: var(--paper);
  border-radius: var(--radius-sign);
  padding: 3px 10px 3px 8px;
  font-size: 0.85rem;
}
.ghost svg { width: 18px; height: 18px; fill: currentColor; }
.ghost:hover { border-color: var(--paper); }

.de {
  margin: 6px 0 0;
  font-size: 1.5rem;
  line-height: 1.35;
  font-weight: 700;
  max-width: 34em;
}
.de:empty { display: none; }

.en {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
}
.en:empty { display: none; }

.reveal {
  margin-top: 8px;
  background: none;
  border: 1px dashed rgba(247, 248, 245, 0.4);
  border-radius: var(--radius-sign);
  color: var(--paper);
  padding: 6px 12px;
  font-size: 0.9rem;
}

.task {
  border-top: 1px solid rgba(247, 248, 245, 0.12);
  padding: 14px 22px 18px;
  background: var(--slate-2);
  border-radius: 0 0 var(--radius-panel) var(--radius-panel);
}

.task-text {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 1.05rem;
}

.talk {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.ptt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 26px 0 20px;
  background: var(--yellow);
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.25rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.ptt svg { width: 26px; height: 26px; fill: currentColor; }
.ptt:hover { background: var(--yellow-deep); }
.ptt:disabled { opacity: 0.45; cursor: not-allowed; }
.ptt.listening { background: var(--paper); }
.ptt.listening::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  border: 3px solid var(--yellow);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.04); }
}

.link {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--paper);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.95rem;
}
.link:hover { color: var(--yellow); }

.typebox {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.typebox input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sign);
  border: 2px solid rgba(247, 248, 245, 0.25);
  background: rgba(10, 16, 24, 0.35);
  color: var(--paper);
  font-size: 1.1rem;
}
.typebox input:focus { border-color: var(--yellow); outline: none; }
.check {
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sign);
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.1rem;
}

.heard {
  margin: 12px 0 0;
  font-size: 1rem;
}
.heard:empty { display: none; }
.heard .q { font-weight: 700; }
.status {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 4px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 0.95rem;
}
.status.good { background: var(--good); color: #fff; }
.status.miss { background: var(--miss); color: #fff; }
.status.info { background: rgba(247, 248, 245, 0.16); color: var(--paper); }

.hint {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--yellow);
  background: rgba(247, 248, 245, 0.06);
  border-radius: 0 var(--radius-sign) var(--radius-sign) 0;
}
.hint p { margin: 0 0 4px; }

.choices, .pick {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.choices-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.choice, .pick-btn {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sign);
  border: 2px solid rgba(247, 248, 245, 0.22);
  background: rgba(10, 16, 24, 0.25);
  color: var(--paper);
  font-size: 1.08rem;
}
.choice:hover:not(:disabled), .pick-btn:hover:not(:disabled) { border-color: var(--yellow); }
.choice:disabled, .pick-btn:disabled { cursor: default; }
.choice.right, .pick-btn.right { border-color: var(--good); background: rgba(46, 158, 91, 0.2); }
.choice.wrong, .pick-btn.wrong { border-color: var(--miss); opacity: 0.7; }
.choice .why { display: block; font-size: 0.9rem; color: var(--muted); }
.pick { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pick-btn {
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.15rem;
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}
.pick-btn.navy { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.pick-btn.wrong { background: transparent; color: var(--paper); }
.pick-label { margin: 0; font-size: 0.95rem; color: var(--muted); grid-column: 1 / -1; }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(17, 24, 32, 0.55);
  overflow-y: auto;
}

.overlay.start {
  top: var(--band-h);
  place-items: start center;
  background: var(--concrete);
}

.start-inner {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 28px;
  padding: 24px 0 40px;
  align-items: start;
}

.start-intro h1 {
  margin: 0 0 12px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: clamp(2.4rem, 3.9vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.lede { margin: 0 0 18px; font-size: 1.08rem; max-width: 30em; }

.how {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: how;
}
.how li {
  counter-increment: how;
  position: relative;
  padding: 8px 0 8px 40px;
  border-top: 1px solid rgba(17, 20, 23, 0.12);
}
.how li::before {
  content: counter(how);
  position: absolute;
  left: 0;
  top: 9px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 4px;
  font-family: var(--sign);
  font-weight: 700;
}
.engine-note {
  margin: 0;
  font-size: 0.92rem;
  color: #3d4a57;
  max-width: 32em;
}

.board {
  background: var(--navy);
  color: var(--paper);
  border-radius: var(--radius-panel);
  padding: 18px 18px 20px;
  box-shadow: 0 0 0 6px #22262b inset, 0 20px 40px -24px rgba(10, 16, 24, 0.6);
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px 10px;
  border-bottom: 2px solid rgba(247, 248, 245, 0.15);
}
.board-head h2 {
  margin: 0;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 2rem;
  color: var(--paper);
}
.board-head p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.board-rows {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.board-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(247, 248, 245, 0.1);
}
.board-row .n {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 4px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.1rem;
}
.board-row .name {
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.1;
}
.board-row .what { display: block; font-family: var(--text); font-weight: 400; font-size: 0.9rem; color: var(--muted); }
.board-row button {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(247, 248, 245, 0.35);
  border-radius: var(--radius-sign);
  padding: 4px 10px;
  font-size: 0.88rem;
  white-space: nowrap;
}
.board-row button:hover { border-color: var(--yellow); color: var(--yellow); }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.2rem;
}
.board .primary { width: 100%; }
.primary:hover { background: var(--yellow-deep); }

.secondary {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  font-family: var(--sign);
  font-weight: 600;
  font-size: 1.05rem;
}
.secondary:hover { background: rgba(17, 20, 23, 0.06); }

.settings {
  background: var(--paper);
  border-radius: var(--radius-panel);
  padding: 18px 18px 20px;
  border: 1px solid rgba(17, 20, 23, 0.1);
}
.settings h2 {
  margin: 0 0 12px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.35rem;
}
.segmented {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.segmented legend {
  padding: 0;
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 0.95rem;
}
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}
.seg label {
  position: relative;
  text-align: center;
  padding: 8px 4px;
  font-size: 0.92rem;
  border-left: 2px solid var(--ink);
  cursor: pointer;
}
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--ink); color: var(--yellow); font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--yellow); outline-offset: -3px; }
.setting-note { margin: 6px 0 12px; font-size: 0.88rem; color: #46525e; }
.setting-note:empty { display: none; }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(17, 20, 23, 0.1);
  cursor: pointer;
}
.switch input {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #b9c1c8;
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background 0.15s;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); background: var(--yellow); }
.settings .secondary { margin-top: 10px; width: 100%; }

.card {
  width: min(560px, 100%);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-panel);
  padding: 26px 28px 24px;
  border-top: 10px solid var(--yellow);
  box-shadow: 0 30px 60px -30px rgba(10, 16, 24, 0.7);
}
.card-kicker { margin: 0 0 2px; font-size: 0.95rem; color: #46525e; }
.card h2 {
  margin: 0 0 10px;
  font-family: var(--sign);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.05;
}
.card p { margin: 0 0 18px; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 16px;
  margin: 0 0 14px;
}
.stats dt, .stats dd {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid rgba(17, 20, 23, 0.12);
}
.stats dt {
  font-family: var(--sign);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  text-align: right;
  min-width: 2.2em;
}
.stats dd { align-self: center; }

.drawer {
  position: fixed;
  top: var(--band-h);
  right: 0;
  bottom: 0;
  width: min(380px, 100%);
  z-index: 25;
  background: var(--paper);
  border-left: 1px solid rgba(17, 20, 23, 0.15);
  box-shadow: -20px 0 40px -30px rgba(10, 16, 24, 0.6);
  overflow-y: auto;
  padding: 16px 18px 24px;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.drawer-head h2 { margin: 0; font-family: var(--sign); font-size: 1.6rem; }
.drawer .ghost { color: var(--ink); border-color: rgba(17, 20, 23, 0.3); }
.gloss-station { margin: 14px 0 4px; font-family: var(--sign); font-weight: 700; font-size: 1.15rem; }
.gloss-station.current::after { content: " (this station)"; font-family: var(--text); font-weight: 400; font-size: 0.85rem; color: #46525e; }
.gloss-list { list-style: none; margin: 0; padding: 0; }
.gloss-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid rgba(17, 20, 23, 0.1);
}
.gloss-list .w { font-weight: 700; }
.gloss-list .m { grid-column: 1; font-size: 0.92rem; color: #46525e; }
.gloss-list button {
  grid-row: 1 / span 2;
  grid-column: 2;
  background: none;
  border: 1px solid rgba(17, 20, 23, 0.25);
  border-radius: var(--radius-sign);
  padding: 4px 8px;
  font-size: 0.85rem;
}

.noscript { padding: 100px 20px; text-align: center; }

/* ---------- Small screens ---------- */

@media (max-width: 1080px) {
  .start-inner { grid-template-columns: 1fr 1fr; }
  .start-intro { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .band-brand { display: none; }
  .stop { padding: 0 10px; font-size: 1.05rem; }
  .stop:not([aria-current="step"]) .label { display: none; }
  .journey { justify-content: flex-start; }
}

@media (max-width: 680px) {
  :root { --band-h: 56px; }
  .band { gap: 8px; padding: 0 8px; }
  .stop .num { display: none; }
  body { font-size: 16px; }
  .start-inner { grid-template-columns: 1fr; }
  .stop { padding: 0 8px; }
  .stop svg { width: 22px; height: 22px; }
  .tool { padding: 3px 8px; font-size: 0.9rem; }
  .panel { bottom: 10px; width: calc(100% - 20px); max-height: 62%; }
  .line { padding: 12px 16px 10px; }
  .task { padding: 12px 16px 14px; }
  .de { font-size: 1.25rem; }
  .ptt { min-height: 52px; font-size: 1.1rem; }
}

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