@font-face {
  font-family: 'Display';
  src: url(/fonts/display.woff2) format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Mono';
  src: url(/fonts/mono.woff2) format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #07090d;
  --bg-2: #0c1017;
  --panel: #10151d;
  --panel-2: #161c26;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --ink: #f3efe6;
  --dim: #98a0ad;
  --faint: #5d6573;
  /* LED board amber; the film's route orange; a clear signal green. */
  --amber: #ffb547;
  --amber-glow: rgba(255, 181, 71, 0.35);
  --orange: #fc5200;
  --green: #3ddc84;
  --red: #ff6a5c;
  --radius: 14px;
  --display: 'Display', system-ui, sans-serif;
  --mono: 'Mono', ui-monospace, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--display);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  /* A faint dot-matrix sky and a warm glow over the platform. */
  background:
    radial-gradient(
      60rem 30rem at 70% -10%,
      rgba(252, 82, 0, 0.13),
      transparent 70%
    ),
    radial-gradient(
      40rem 24rem at 10% 10%,
      rgba(255, 181, 71, 0.07),
      transparent 70%
    ),
    radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1.4px) 0 0 /
      22px 22px,
    var(--bg);
}
.defs {
  position: absolute;
}
/* Phones: no text inflation on rotation, no double-tap-zoom wait on taps. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button,
a,
input {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: var(--amber);
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 6px;
}
/* Headings app.js focuses for screen readers: not a control, no ring. */
[tabindex='-1']:focus {
  outline: none;
}

/* ---------- header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.32em;
  font-size: 1.05rem;
}
.brand-mark {
  width: 2.4rem;
  height: 1.2rem;
  color: var(--orange);
}
.top-note {
  font: 500 0.78rem var(--mono);
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ---------- hero */
.hero {
  padding: 3.2rem 0 2.2rem;
  max-width: 46rem;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
  font: 600 0.78rem var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}
.lamp {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: blink 2.4s ease-in-out infinite;
}
h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2.2rem, 5.4vw, 3.9rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}
h1 em {
  font-style: normal;
  color: transparent;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
}
.lede {
  margin: 1.3rem 0 0;
  color: var(--dim);
  font-size: 1.08rem;
  max-width: 38rem;
}

/* ---------- the departure board */
.board {
  position: relative;
  padding: 2.2rem clamp(1.2rem, 4vw, 2.6rem) 1.8rem;
  border-radius: 20px;
  background:
    radial-gradient(rgba(255, 181, 71, 0.06) 1px, transparent 1.3px) 0 0 / 7px
      7px,
    linear-gradient(180deg, #121821, #0b0f15);
  border: 1px solid var(--line-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.55);
}
.screw {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #5b6472, #252b34);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.screw.tl {
  top: 12px;
  left: 12px;
}
.screw.tr {
  top: 12px;
  right: 12px;
}
.screw.bl {
  bottom: 12px;
  left: 12px;
}
.screw.br {
  bottom: 12px;
  right: 12px;
}
.board-cap {
  margin: 0 0 1.4rem;
  font: 600 0.75rem var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}
.lookup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem 1.6rem;
}
.flap-label {
  font: 700 0.85rem var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}
/* The train number: a real input over five split-flap cells.
   ⚠️ Everything is in `ch` of the one monospace font, so the input's digits
   land in the cells: a cell is 1.65ch with 0.35ch between, i.e. one digit
   every 2ch = 1ch of glyph + 1ch of letter-spacing, and the 0.325ch of left
   padding centres each glyph in its cell. Change one number, change them all. */
.lookup .flap-label {
  flex-basis: 100%;
}
.slot-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.slot {
  position: relative;
  /* ≥ 16px, or iOS Safari zooms the page when the field is tapped. */
  font: 700 clamp(2.3rem, 10.5vw, 3.4rem) / 1 var(--mono);
}
.cells {
  display: flex;
  gap: 0.35ch;
}
.cells i {
  position: relative;
  width: 1.65ch;
  height: 1.45em;
  border-radius: 0.16em;
  background: linear-gradient(180deg, #1d2430 0 50%, #171d27 50% 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 18px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.15s ease;
}
/* The hinge. */
.cells i::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 2px;
  margin-top: -1px;
  background: #06080b;
}
/* The cell the next digit goes into (app.js keeps data-len). */
.slot:focus-within[data-len='0'] .cells i:nth-child(1),
.slot:focus-within[data-len='1'] .cells i:nth-child(2),
.slot:focus-within[data-len='2'] .cells i:nth-child(3),
.slot:focus-within[data-len='3'] .cells i:nth-child(4),
.slot:focus-within[data-len='4'] .cells i:nth-child(5) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -3px 0 var(--amber),
    0 8px 18px rgba(0, 0, 0, 0.55);
}
#train {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  /* Wider than the cells: the fifth digit's trailing spacing must fit, or
     the field scrolls and every digit slips out of its cell. */
  width: calc(100% + 1.2ch);
  padding: 0 0 0 0.325ch;
  border: 0;
  background: transparent;
  font: inherit;
  letter-spacing: 1ch;
  color: var(--amber);
  text-shadow: 0 0 18px var(--amber-glow);
  caret-color: var(--amber);
  outline: none;
}
#train::placeholder {
  color: #2f3744;
  text-shadow: none;
  opacity: 1;
}
.slot:has(#train:focus-visible) {
  outline: 2px solid var(--amber);
  outline-offset: 6px;
  border-radius: 10px;
}
.slot-clear {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  font: 400 1.5rem/1 var(--display);
  cursor: pointer;
}
.slot-clear:hover {
  color: var(--ink);
  border-color: var(--dim);
}
.hint {
  margin: 1.1rem 0 0;
  color: var(--dim);
  font-size: 0.92rem;
}
/* Trains to tap instead of type: yours (app.js, this browser only), and a few. */
.picks {
  margin-top: 1.2rem;
}
.picks-cap {
  margin: 0 0 0.5rem;
  font: 600 0.72rem var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}
.picks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pick {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  font: 500 0.9rem var(--display);
  text-align: left;
  cursor: pointer;
}
.pick b {
  font: 700 0.95rem var(--mono);
  color: var(--amber);
}
.pick span {
  max-width: 16rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--dim);
}
.pick:hover {
  border-color: var(--amber);
}
/* ---------- the password screen (web/login.html) */
.lamp-stop {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}
.pass {
  flex: 1 1 14rem;
  max-width: 22rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #1d2430, #171d27);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  font: 700 1.3rem var(--mono);
  letter-spacing: 0.2em;
  color: var(--amber);
  caret-color: var(--amber);
}
.pass:focus {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.status {
  min-height: 1.5em;
  margin: 0.8rem 0 0;
  font: 500 0.9rem var(--mono);
  color: var(--dim);
}
.status.error {
  color: var(--red);
}

/* ---------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font: 700 0.92rem var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-amber {
  background: var(--amber);
  color: #1b1102;
}
.btn-amber:hover:not(:disabled) {
  background: #ffc670;
}
.btn-go {
  padding: 1.05rem 1.7rem;
  font-size: 1.05rem;
  background: var(--orange);
  color: #fff;
  box-shadow: 0 10px 30px rgba(252, 82, 0, 0.35);
}
.btn-go:hover:not(:disabled) {
  background: #ff6a1f;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-ghost:hover {
  border-color: var(--ink);
}
.rec {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* ---------- the ticket */
.ticket-wrap {
  margin-top: 2.4rem;
  animation: rise 0.45s ease-out both;
}
.ticket {
  display: grid;
  grid-template-columns: 1fr 17rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f6efdf, #ece2cc);
  color: #191510;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.ticket-main {
  padding: 1.6rem 1.8rem 1.5rem;
}
.ticket-kicker {
  margin: 0;
  font: 700 0.72rem var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a4b12;
}
.ticket-title {
  margin: 0.35rem 0 1.2rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.t-num {
  font-family: var(--mono);
  color: var(--orange);
}
.ticket-route {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}
.end {
  display: grid;
}
.end-right {
  text-align: right;
}
.end-time {
  font-size: 1.55rem;
  font-weight: 700;
}
.end-time small {
  margin-left: 0.25rem;
  font-size: 0.7rem;
  color: #7b6d58;
}
.end-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.ticket-line {
  position: relative;
  height: 2rem;
  background: linear-gradient(90deg, #191510 50%, transparent 50%) 0 50% / 10px
    2px repeat-x;
}
.ticket-loco {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3rem;
  height: 1.5rem;
  transform: translate(-50%, -62%);
  color: var(--orange);
  background: #f1e8d5;
  padding: 0 0.3rem;
  box-sizing: content-box;
}
.facts {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0.4rem 2rem;
  margin: 1.3rem 0 0;
  padding-top: 1rem;
  border-top: 1px dashed rgba(25, 21, 16, 0.3);
}
.facts dt {
  font: 600 0.68rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7b6d58;
}
.facts dd {
  margin: 0.1rem 0 0;
  font-weight: 700;
  font-size: 1.02rem;
}
.ticket-states {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: #5e5243;
}
/* The perforated tear line between ticket and stub. */
.ticket-stub {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.6rem;
  padding: 1.1rem 1.1rem 1rem 1.5rem;
  background: #1b2029;
  color: var(--ink);
}
.ticket-stub::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 -6px;
  width: 12px;
  background: radial-gradient(circle, var(--bg) 4.5px, transparent 5px) 0 0 /
    12px 16px repeat-y;
}
.minimap {
  width: 100%;
  height: 100%;
  min-height: 12rem;
}
.minimap .land {
  fill: #2a3240;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.minimap .route {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(252, 82, 0, 0.8));
}
.minimap .stop {
  fill: #ffe2cc;
}
.minimap .terminal {
  fill: var(--amber);
}
.stub-cap {
  font: 600 0.68rem var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}
.roll {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.4rem;
  margin-top: 1.5rem;
}
.roll-note {
  margin: 0;
  max-width: 30rem;
  color: var(--dim);
  font-size: 0.9rem;
}

/* ---------- progress: the train's own halts on a track */
.progress-wrap {
  margin-top: 2.4rem;
  padding: 1.6rem clamp(1.2rem, 3vw, 2rem) 1.4rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.45s ease-out both;
}
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.progress-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}
.progress-title span {
  color: var(--amber);
}
.track {
  position: relative;
  height: 5.2rem;
  margin: 1.6rem 0.4rem 0.6rem;
}
.rails {
  position: absolute;
  inset: auto 0 1rem;
  height: 0.9rem;
  border-top: 2px solid #3a4352;
  border-bottom: 2px solid #3a4352;
  background: linear-gradient(90deg, #2a313c 3px, transparent 3px) 0 0 / 14px
    100% repeat-x;
}
.trail {
  position: absolute;
  left: 0;
  bottom: 1rem;
  height: 0.9rem;
  width: 0;
  border-top: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
  box-shadow: 0 0 14px rgba(252, 82, 0, 0.5);
  transition: width 0.4s linear;
}
.posts {
  position: absolute;
  inset: 0 0 2.3rem;
}
.post {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 0.8rem;
  background: #4a5363;
  transform: translateX(-1px);
}
.post.terminal {
  height: 1.5rem;
  background: var(--amber);
}
.post b {
  position: absolute;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  font: 600 0.68rem var(--mono);
  color: var(--dim);
  white-space: nowrap;
}
.post:first-child b {
  left: 0;
  transform: none;
}
.post:last-child b {
  left: auto;
  right: 0;
  transform: none;
}
.post.passed {
  background: var(--orange);
}
.track-loco {
  position: absolute;
  left: 0;
  bottom: 1.85rem;
  width: 3.2rem;
  height: 1.6rem;
  color: var(--orange);
  transform: translateX(-50%);
  transition: left 0.4s linear;
  filter: drop-shadow(0 0 8px rgba(252, 82, 0, 0.6));
}
.track.waiting .track-loco {
  animation: idle 1.6s ease-in-out infinite;
}
.progress-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.phase,
.eta {
  margin: 0;
  font-size: 0.95rem;
}
.phase {
  color: var(--ink);
}
.eta {
  color: var(--amber);
}

/* ---------- the finished film */
.film-wrap {
  margin-top: 2.4rem;
  animation: rise 0.5s ease-out both;
}
.film-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 800;
}
/* The still is the film's own shape, 9:16: beside the actions on a wide
   screen, above them on a phone, never taller than ~60% of the screen. */
.film-body {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.5rem 2.4rem;
}
.filmstrip {
  position: relative;
  justify-self: center;
  padding: 0 1.6rem;
  border-radius: 10px;
  background:
    radial-gradient(
        circle at 50% 50%,
        var(--bg) 0 0.32rem,
        transparent 0.34rem
      )
      0.4rem 0 / 0.8rem 1.4rem repeat-y,
    radial-gradient(
        circle at 50% 50%,
        var(--bg) 0 0.32rem,
        transparent 0.34rem
      )
      calc(100% - 0.4rem) 0 / 0.8rem 1.4rem repeat-y,
    #15181e;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.filmstrip img {
  display: block;
  height: min(60vh, 34rem);
  width: auto;
  aspect-ratio: 9 / 16;
  background: #000;
}
.film-meta {
  margin: 0;
  color: var(--dim);
}
.film-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.3rem;
}
.film-actions .mono {
  font-weight: 500;
  opacity: 0.7;
}
.film-note {
  margin: 1rem 0 0;
  color: var(--dim);
  font-size: 0.9rem;
}

/* ---------- motion */
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
@keyframes fold {
  to {
    transform: rotateX(-90deg);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes idle {
  50% {
    transform: translateX(-50%) translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- small screens: an iPhone 13 is 390 × 844 points */
@media (max-width: 760px) {
  /* The notch and home bar, in landscape and in a home-screen app. */
  .top,
  main {
    padding-left: max(1.1rem, env(safe-area-inset-left));
    padding-right: max(1.1rem, env(safe-area-inset-right));
  }
  .top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  main {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
  /* The number field in the first screen, not under a headline. */
  .hero {
    padding: 1.6rem 0 1.3rem;
  }
  .kicker {
    margin-bottom: 0.8rem;
  }
  h1 {
    font-size: 2rem;
  }
  .lede {
    margin-top: 0.8rem;
    font-size: 0.98rem;
  }
  .board {
    padding: 1.5rem 1.1rem 1.3rem;
  }
  .board-cap {
    margin-bottom: 1rem;
  }
  .lookup {
    gap: 0.8rem;
  }
  .lookup .btn,
  .roll .btn,
  .film-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .picks-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .pick {
    min-width: 0;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.75rem;
  }
  .pick span {
    max-width: 100%;
    font-size: 0.84rem;
  }
  .progress-head {
    align-items: flex-start;
  }
  .progress-title {
    font-size: 1.15rem;
  }
  .progress-head .btn {
    padding: 0.6rem 0.9rem;
  }
  .film-body {
    grid-template-columns: 1fr;
  }
  .filmstrip img {
    height: min(58vh, 30rem);
  }
  .ticket {
    grid-template-columns: 1fr;
  }
  .ticket-stub::before {
    inset: -6px 0 auto;
    width: auto;
    height: 12px;
    background: radial-gradient(circle, var(--bg) 4.5px, transparent 5px) 0 0 /
      16px 12px repeat-x;
  }
  .facts {
    grid-template-columns: repeat(2, auto);
  }
  .top-note {
    display: none;
  }
}
