:root {
  --bg: #101c33;
  --panel: #17274a;
  --panel-raised: #1d3057;
  --rule: #2c3f6b;
  --amber: #f4a300;
  --rust: #c1440e;

  @media DISABLED {
  --bg: #1f1229;          /* was #101c33 — deep plum instead of navy */
  --panel: #2b1a3a;        /* was #17274a */
  --panel-raised: #38224a; /* was #1d3057 */
  --rule: #4a2f5e;         /* was #2c3f6b */
  --amber: #f6891f;        /* was #f4a300 — this is the real TfNSW train-orange */
  --rust: #732a82;         /* was #c1440e — this is the real TfNSW coach-purple */
  }
  
  --cream: #ede6d6;
  --cream-dim: #b9c0d6;
  --bush: #4c9a6a;
  --font-display: "Big Shoulders Display", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --radius: 4px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.15), transparent 200px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 3px);
  color: var(--cream);
  font-family: var(--font-mono);
  display: flex;
  justify-content: center;
  padding: 24px 16px 60px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.board {
  width: 100%;
  max-width: 720px;
}

/* ---------- Header ---------- */

.board__header {
  text-align: center;
  margin-bottom: 22px;
}

.board__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  letter-spacing: 0.04em;
  line-height: 0.9;
  display: inline-flex;
  gap: 0.35em;
}

.board__flap {
  color: var(--cream);
  text-shadow: 0 0 18px rgba(244,163,0,0.15);
}

.board__flap--accent { color: var(--amber); }

.board__tag {
  margin: 6px 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  text-transform: uppercase;
}

.board__meta {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--cream-dim);
  letter-spacing: 0.04em;
}

.board__dot { margin: 0 8px; color: var(--rule); }

/* ---------- Layout ---------- */

.board__main {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
}

.panel__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 600;
}

/* ---------- Shape stage ---------- */

.shape {
  position: relative;
  background: #0c1526;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

#routeSvg { width: 100%; height: 100%; display: block; }

.map { position: absolute; inset: 0; }
.map .leaflet-container { background: #0c1526; }

.map__caption {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 500;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: var(--cream-dim);
  background: rgba(12,21,38,0.75);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 10px;
  pointer-events: none;
}

.hints {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint {
  font-size: 0.72rem;
  background: var(--panel-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--cream-dim);
  letter-spacing: 0.02em;
}

.hint strong { color: var(--cream); font-weight: 600; }

/* ---------- Guess form ---------- */

.guessForm {
  display: flex;
  gap: 8px;
  position: relative;
}

.combobox { position: relative; flex: 1; }

#guessInput {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 11px 12px;
}

#guessInput:focus {
  outline: none;
  border-color: var(--amber);
}

.combobox__list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.combobox__list li {
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.combobox__list li[aria-selected="true"],
.combobox__list li:hover {
  background: rgba(244,163,0,0.14);
}

.combobox__list .num { color: var(--amber); font-weight: 600; }

#guessSubmit {
  background: var(--amber);
  color: #14213d;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  padding: 0 18px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

#guessSubmit:hover { background: #ffb524; }
#guessSubmit:active { transform: scale(0.97); }
#guessSubmit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Ticket list ---------- */

.ticketList {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticket {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-raised);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rust);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 0.82rem;
  animation: punch 0.25s ease;
}

.ticket.is-correct { border-left-color: var(--bush); }

@keyframes punch {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ticket__mark {
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.ticket__text { color: var(--cream-dim); }
.ticket__text strong { color: var(--cream); }

/* ---------- Result panel ---------- */

.resultPanel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}

.resultPanel h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0 0 6px;
  color: var(--amber);
}

.resultPanel p {
  margin: 0 0 12px;
  color: var(--cream-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

.resultPanel__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#shareBtn {
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 8px 14px;
  cursor: pointer;
}

#shareBtn:hover { background: rgba(244,163,0,0.1); }

.resultPanel__next {
  font-size: 0.72rem;
  color: var(--cream-dim);
  letter-spacing: 0.03em;
}

/* ---------- Footer ---------- */

.board__footer {
  margin-top: 22px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--cream-dim);
  opacity: 0.7;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .guessForm { flex-direction: column; }
  #guessSubmit { padding: 11px; }
}
