/*
 * steam.stramme.cloud — a steam railway station at night. The open games arrive on a split-flap
 * departure board, the open game stands on the platform with its ticket, and "Gesehen" punches
 * the ticket before the game leaves in a puff of steam.
 */

@font-face {
  font-family: "Barlow Condensed";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/barlow-condensed-500.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/barlow-condensed-700.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/barlow-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/barlow-600.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --night: #091014;
  --night-2: #0e181d;
  --iron: #1c262b;
  --iron-light: #2c393f;
  --rivet: #4a585e;
  --flap: #121314;
  --flap-top: #1b1c1e;
  --flap-text: #f3ead2;
  --amber: #ffb52e;
  --amber-glow: rgb(255 181 46 / 0.45);
  --signal-green: #47d98a;
  --signal-red: #ff5a45;
  --enamel: #173f8f;
  --enamel-dark: #0d2a63;
  --enamel-rim: #e9eef7;
  --ticket: #eadcb4;
  --ticket-dark: #c9b688;
  --ticket-ink: #2e2618;
  --stamp: #6b2fa3;
  --brass: #c99a4a;
  --brass-light: #f0cd84;
  --text: #e8e4da;
  --muted: #9aa5a8;
  --condensed: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 0.6rem;
  --header: 3.75rem;
  --board-width: clamp(20rem, 27vw, 28rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  font: 400 1rem/1.5 var(--sans);
  background:
    radial-gradient(120% 70% at 50% -10%, rgb(255 190 90 / 0.09), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, rgb(40 90 120 / 0.18), transparent 70%),
    linear-gradient(180deg, #0b1519, var(--night) 40%, #060b0d);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05em 0.4em;
  border: 1px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 0.3em;
  font: 600 0.72em/1.4 var(--sans);
  text-align: center;
  opacity: 0.7;
}

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

/* ── Steam, drifting through the hall ───────────────────────────────────────────────────── */

.steam {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.steam i {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(220 230 235 / 0.07), transparent);
  filter: blur(10px);
  animation: drift 60s linear infinite;
}

.steam i:nth-child(1) { left: -20vmax; top: 30%; }
.steam i:nth-child(2) { left: 40%; top: 60%; animation-duration: 80s; animation-delay: -30s; }
.steam i:nth-child(3) { left: 70%; top: -10%; animation-duration: 70s; animation-delay: -10s; }
.steam i:nth-child(4) { left: 10%; top: -30%; animation-duration: 90s; animation-delay: -50s; }

@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(8vmax, -10vmax, 0) scale(1.15); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* ── The enamel station sign ────────────────────────────────────────────────────────────── */

.sign {
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0.18rem;
  border-radius: 0.45rem;
  background: var(--enamel-rim);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.4) inset,
    0 6px 18px rgb(0 0 0 / 0.5);
  color: var(--enamel-rim);
  text-decoration: none;
}

.sign span {
  display: block;
  padding: 0.05rem 0.9rem 0.1rem;
  border: 2px solid var(--enamel);
  border-radius: 0.32rem;
  background:
    radial-gradient(120% 140% at 30% 0%, rgb(255 255 255 / 0.16), transparent 50%),
    linear-gradient(180deg, var(--enamel), var(--enamel-dark));
  box-shadow: 0 0 0 2px var(--enamel-rim) inset;
  font: 700 1.45rem/1.15 var(--condensed);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── The gate: the page without a ticket ────────────────────────────────────────────────── */

.gate-page {
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

.gate {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2.25rem;
  text-align: center;
}

.gate .sign span {
  padding: 0.2rem 2.2rem 0.3rem;
  font-size: clamp(2.6rem, 12vw, 4.5rem);
  letter-spacing: 0.1em;
}

.ticket-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 17rem;
  padding: 1.1rem 2.2rem;
  color: var(--ticket-ink);
  text-decoration: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 0.6rem, rgb(46 38 24 / 0.05) 0.6rem 0.65rem),
    linear-gradient(180deg, #f3e7c4, var(--ticket));
  border-radius: 0.35rem;
  /* The notches of a cardboard ticket. */
  mask:
    radial-gradient(circle at 0 50%, transparent 0.55rem, #000 0.6rem) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 0.55rem, #000 0.6rem) right / 51% 100% no-repeat;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  font: 700 1.25rem/1.2 var(--condensed);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 160ms ease, filter 160ms ease;
}

.ticket-button::before {
  content: "";
  position: absolute;
  inset: 0.45rem 1.1rem;
  border: 1px dashed rgb(46 38 24 / 0.4);
  border-radius: 0.2rem;
}

.ticket-button:hover,
.ticket-button:focus-visible {
  transform: translateY(-2px) rotate(-1deg);
  filter: brightness(1.05);
}

.refused {
  max-width: 22rem;
  margin: 0;
  color: var(--signal-red);
  font: 600 1rem/1.4 var(--sans);
}

/* ── The concourse: sign, lists, timetable, clock ───────────────────────────────────────── */

.station {
  display: grid;
  grid-template-rows: var(--header) minmax(0, 1fr);
  height: 100svh;
}

.concourse {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1.25rem;
  /* The iron of the hall: a girder with rivets. */
  background:
    radial-gradient(circle, var(--rivet) 0 1.6px, transparent 2.2px) 0 calc(100% - 4px) / 1.4rem 8px repeat-x,
    linear-gradient(180deg, var(--iron-light), var(--iron) 60%, #141c20);
  border-bottom: 1px solid #000;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.45);
}

.concourse .sign span {
  font-size: 1.2rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 0.55rem;
  background: rgb(0 0 0 / 0.35);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.06);
}

.tab {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border: 0;
  border-radius: 0.38rem;
  background: transparent;
  color: var(--muted);
  font: 700 1.05rem/1.2 var(--condensed);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab b {
  min-width: 1.6em;
  padding: 0 0.3em;
  border-radius: 0.25em;
  background: var(--flap);
  color: var(--flap-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tab[aria-pressed="true"] {
  background: linear-gradient(180deg, #2b363b, #1b2327);
  color: var(--flap-text);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.08) inset, 0 0 0 1px #000;
}

.tab[aria-pressed="true"] b {
  color: var(--amber);
  text-shadow: 0 0 8px var(--amber-glow);
}

.board-toggle {
  display: none;
}

.timetable {
  margin: 0 0 0 auto;
  color: var(--muted);
  font: 500 0.95rem/1.2 var(--condensed);
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
}

.timetable .live {
  color: var(--amber);
}

.timetable .fault {
  color: var(--signal-red);
}

/* A station clock: white face, black bars, the red second hand with its disc. */
.clock {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from -1.5deg, #111 0 3deg, transparent 3deg 30deg),
    #f4f4f0;
  box-shadow:
    0 0 0 3px #2a2f31,
    0 0 0 4px #000,
    0 4px 10px rgb(0 0 0 / 0.6);
}

.clock::before {
  content: "";
  position: absolute;
  inset: 0.32rem;
  border-radius: 50%;
  background: #f4f4f0;
}

.clock i {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--angle, 0deg));
  background: #111;
}

.clock .hour { width: 3px; height: 28%; }
.clock .minute { width: 2px; height: 40%; }
.clock .second {
  width: 1px;
  height: 38%;
  background: #d0201a;
}
.clock .second::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d0201a;
  transform: translateX(-50%);
}

.help-button,
.logout button {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 50%;
  background: rgb(0 0 0 / 0.25);
  color: var(--muted);
  font: 700 1rem/1 var(--condensed);
  cursor: pointer;
}

.help-button:hover,
.logout button:hover {
  color: var(--flap-text);
  border-color: rgb(255 255 255 / 0.3);
}

.logout {
  margin: 0;
}

.logout svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* ── The platform: board and game side by side ──────────────────────────────────────────── */

.platform {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--board-width) minmax(0, 1fr);
  min-height: 0;
}

/* ── The split-flap board ───────────────────────────────────────────────────────────────── */

.board {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  margin: 0.9rem 0 0.9rem 0.9rem;
  padding: 0.55rem;
  border-radius: 0.7rem;
  /* The housing: dark steel with a rivet in each corner. */
  background:
    radial-gradient(circle at 0.55rem 0.55rem, var(--rivet) 0 2px, transparent 3px),
    radial-gradient(circle at calc(100% - 0.55rem) 0.55rem, var(--rivet) 0 2px, transparent 3px),
    radial-gradient(circle at 0.55rem calc(100% - 0.55rem), var(--rivet) 0 2px, transparent 3px),
    radial-gradient(circle at calc(100% - 0.55rem) calc(100% - 0.55rem), var(--rivet) 0 2px, transparent 3px),
    linear-gradient(180deg, #23292c, #15191b);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.08) inset,
    0 0 0 1px #000,
    0 18px 40px rgb(0 0 0 / 0.55);
}

.board-head {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr) 3.3rem;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem 0.45rem;
  color: var(--amber);
  font: 700 0.78rem/1 var(--condensed);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.board-head span:last-child {
  text-align: right;
}

.rows {
  min-height: 0;
  margin: 0;
  padding: 0.15rem 0.2rem 0.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #3a4246 transparent;
}

.arrival {
  position: sticky;
  top: -0.15rem;
  z-index: 1;
  margin: 0.55rem 0 0.25rem;
  padding: 0.2rem 0.4rem;
  background: #171b1d;
  color: var(--amber);
  font: 700 0.78rem/1.3 var(--condensed);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 6px 8px -6px #000;
}

.arrival:first-child {
  margin-top: 0;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) 2.9rem;
  gap: 0.25rem;
  width: 100%;
  margin: 0 0 0.25rem;
  padding: 0 0.15rem 0 0.55rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

/* The lamp of the selected train. */
.row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: #2a2f31;
  transform: translateY(-50%);
}

.row[aria-current="true"]::before {
  background: var(--amber);
  box-shadow: 0 0 6px 2px var(--amber-glow);
}

.flap {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0.28rem 0.4rem 0.22rem;
  border-radius: 0.2rem;
  /* Two leaves: the upper half a shade lighter, the split a hairline of black. */
  background:
    linear-gradient(180deg, var(--flap-top) 0 calc(50% - 0.5px), #000 calc(50% - 0.5px) calc(50% + 0.5px), var(--flap) calc(50% + 0.5px));
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.05) inset,
    0 1px 2px rgb(0 0 0 / 0.8);
  color: var(--flap-text);
  font: 700 1.08rem/1.25 var(--condensed);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform-origin: 50% 50%;
}

.flap.rank,
.flap.score {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.flap.rank {
  color: var(--amber);
}

.flap.rank.gone {
  color: #5b6266;
}

.flap.score.good { color: var(--signal-green); }
.flap.score.fair { color: var(--amber); }
.flap.score.poor { color: var(--signal-red); }
.flap.score.none { color: #5b6266; }

.row:hover .flap {
  background:
    linear-gradient(180deg, #232427 0 calc(50% - 0.5px), #000 calc(50% - 0.5px) calc(50% + 0.5px), #18191b calc(50% + 0.5px));
}

.row[aria-current="true"] .flap {
  background:
    linear-gradient(180deg, #2d2a22 0 calc(50% - 0.5px), #000 calc(50% - 0.5px) calc(50% + 0.5px), #23201a calc(50% + 0.5px));
  box-shadow:
    0 0 0 1px rgb(255 181 46 / 0.45),
    0 1px 2px rgb(0 0 0 / 0.8);
}

.row[aria-current="true"] .flap.name {
  color: #fff6dc;
}

/* The leaves fall once when the board fills. */
.rows.flipping .flap {
  animation: flip 420ms cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--n, 0) * 14ms);
}

@keyframes flip {
  0% { transform: perspective(300px) rotateX(-88deg); filter: brightness(2); }
  100% { transform: perspective(300px) rotateX(0); filter: none; }
}

.board-empty {
  padding: 2rem 0.8rem;
  color: var(--muted);
  font: 700 1.1rem/1.3 var(--condensed);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

/* ── The game on the platform ───────────────────────────────────────────────────────────── */

.detail {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.9rem 1.25rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: #3a4246 transparent;
}

/* The game's own key art, far behind, in the steam. */
.backdrop {
  position: fixed;
  inset: var(--header) 0 0 var(--board-width);
  z-index: -1;
  background-image: var(--hero, none);
  background-size: cover;
  background-position: center 30%;
  opacity: 0.22;
  filter: saturate(0.8) blur(2px);
  mask: linear-gradient(180deg, #000 10%, transparent 85%);
  transition: opacity 300ms ease;
  pointer-events: none;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 1fr);
  grid-template-areas: "media info";
  gap: 1.25rem;
  align-items: start;
  max-width: 110rem;
}

.media {
  grid-area: media;
  display: grid;
  gap: 0.6rem;
}

/* A carriage window: brass rim, rounded corners, the glass a little reflective. */
.window {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 1rem;
  background: #000;
  box-shadow:
    0 0 0 3px #3a3020,
    0 0 0 5px var(--brass),
    0 0 0 7px #2a2216,
    0 20px 50px rgb(0 0 0 / 0.6);
  cursor: pointer;
}

.window::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgb(255 255 255 / 0.08), transparent 35%);
  pointer-events: none;
}

.window img,
.window video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-counter {
  position: absolute;
  right: 0.6rem;
  bottom: 0.55rem;
  z-index: 1;
  padding: 0.05rem 0.45rem;
  border-radius: 0.25rem;
  background: rgb(0 0 0 / 0.65);
  color: var(--flap-text);
  font: 700 0.85rem/1.4 var(--condensed);
  letter-spacing: 0.06em;
}

.media-counter .clip {
  color: var(--amber);
}

.strip {
  touch-action: pan-x pan-y;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.25rem 0.15rem 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: #3a4246 transparent;
}

.thumb {
  position: relative;
  flex: none;
  width: 6.4rem;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.3rem;
  background: #000;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 120ms ease, transform 120ms ease;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.clip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border: 0.45rem solid transparent;
  border-left: 0.75rem solid #fff;
  border-right: 0;
  transform: translate(-35%, -50%);
  filter: drop-shadow(0 0 3px #000);
}

.thumb:hover {
  opacity: 0.85;
}

.thumb[aria-current="true"] {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--amber);
}

.info {
  grid-area: info;
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.title {
  margin: 0;
  color: #fff8e6;
  font: 700 clamp(1.8rem, 2.6vw, 2.7rem)/1.02 var(--condensed);
  letter-spacing: 0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.makers {
  margin: -0.45rem 0 0;
  color: var(--muted);
  font: 500 1rem/1.3 var(--condensed);
  letter-spacing: 0.03em;
}

/* Tags as little enamel route plates. */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.08rem 0.5rem 0.12rem;
  border-radius: 0.22rem;
  background: linear-gradient(180deg, #1e4ba3, var(--enamel-dark));
  box-shadow: 0 0 0 1px rgb(233 238 247 / 0.55) inset, 0 2px 4px rgb(0 0 0 / 0.4);
  color: var(--enamel-rim);
  font: 600 0.86rem/1.35 var(--condensed);
  letter-spacing: 0.03em;
}

.tags li:nth-child(n + 4) {
  background: linear-gradient(180deg, #2a3438, #1c2427);
  box-shadow: 0 0 0 1px rgb(233 238 247 / 0.16) inset;
  color: #c9d0d2;
}

.description {
  margin: 0;
  color: #d9d4c6;
  font-size: 1.02rem;
  line-height: 1.55;
}

/* ── The ticket ─────────────────────────────────────────────────────────────────────────── */

.ticket {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 1rem;
  padding: 0.85rem 1.1rem 0.9rem 0.9rem;
  border-radius: 0.4rem;
  color: var(--ticket-ink);
  background:
    repeating-linear-gradient(0deg, transparent 0 1.55rem, rgb(46 38 24 / 0.07) 1.55rem calc(1.55rem + 1px)),
    linear-gradient(180deg, #f4e8c6, var(--ticket));
  mask:
    radial-gradient(circle at 0 50%, transparent 0.6rem, #000 0.65rem) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 0.6rem, #000 0.65rem) right / 51% 100% no-repeat;
  box-shadow: 0 12px 26px rgb(0 0 0 / 0.45);
}

.ticket-rank {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 4.4rem;
  padding: 0.1rem 0.9rem 0.1rem 0.6rem;
  border-right: 1px dashed rgb(46 38 24 / 0.45);
  font: 700 0.72rem/1 var(--condensed);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ticket-rank strong {
  font: 700 2.7rem/1 var(--condensed);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.ticket-rank small {
  margin-top: 0.15rem;
  font: 600 0.78rem/1.1 var(--condensed);
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: center;
}

.ticket-rank .up { color: #1f7a45; }
.ticket-rank .down { color: #a3291c; }

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.1rem 0.8rem;
  margin: 0;
  align-content: center;
}

.facts dt {
  font: 700 0.72rem/1.75 var(--condensed);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.65;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font: 600 0.98rem/1.4 var(--condensed);
  letter-spacing: 0.02em;
}

.facts .good { color: #1f7a45; }
.facts .fair { color: #8a5a00; }
.facts .poor { color: #a3291c; }

.facts .count {
  font-weight: 500;
  opacity: 0.6;
}

.facts s {
  opacity: 0.55;
}

.facts .discount {
  padding: 0 0.3em;
  border-radius: 0.2em;
  background: #4c6b22;
  color: #eef7d8;
}

/* The punch's stamp, as an Entwerter leaves it: violet ink, slightly crooked, a little patchy. */
.stamp {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  display: grid;
  justify-items: center;
  padding: 0.25rem 0.7rem 0.3rem;
  border: 3px double var(--stamp);
  border-radius: 0.3rem;
  color: var(--stamp);
  font: 700 1.35rem/1 var(--condensed);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateY(-50%) rotate(-9deg);
  mask: repeating-radial-gradient(circle at 30% 40%, #000 0 2px, rgb(0 0 0 / 0.7) 2px 3px);
  opacity: 0.9;
  pointer-events: none;
}

/* A punched ticket keeps room for its stamp. */
.ticket.stamped {
  padding-right: 7.4rem;
}

.stamp small {
  font: 600 0.72rem/1.2 var(--condensed);
  letter-spacing: 0.1em;
}

/* ── Actions ────────────────────────────────────────────────────────────────────────────── */

.actions {
  /* Whatever the description's length, the levers stay in sight at the foot of the pane. */
  position: sticky;
  bottom: 0.6rem;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.5rem 1.1rem;
  border: 0;
  border-radius: 0.55rem;
  font: 700 1.2rem/1 var(--condensed);
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 100ms ease, filter 120ms ease;
}

.action:active {
  transform: translateY(1px) scale(0.99);
}

.action svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The punch lever: brass. */
.action.punch {
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 55%, #9c7531);
  color: #2a1d08;
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.5) inset,
    0 -2px 0 rgb(0 0 0 / 0.25) inset,
    0 8px 20px rgb(0 0 0 / 0.45);
}

.action.punch:hover {
  filter: brightness(1.06);
}

.action.back-in {
  background: linear-gradient(180deg, #3c474c, #262f33);
  color: var(--flap-text);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1) inset, 0 8px 20px rgb(0 0 0 / 0.45);
}

.action.to-steam {
  background: linear-gradient(180deg, #1e4ba3, var(--enamel-dark));
  color: var(--enamel-rim);
  box-shadow: 0 0 0 1px rgb(233 238 247 / 0.5) inset, 0 8px 20px rgb(0 0 0 / 0.45);
}

.action.to-steam:hover {
  filter: brightness(1.15);
}

.action.step {
  display: none;
}

/* ── Departing: the punched ticket leaves, the next one is already there ───────────────── */

.departing {
  position: fixed;
  z-index: 5;
  margin: 0;
  pointer-events: none;
  animation: depart 520ms cubic-bezier(0.5, 0, 0.75, 0) 160ms both;
}

.departing .stamp {
  animation: punch 170ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes punch {
  0% { transform: translateY(-50%) rotate(-9deg) scale(1.9); opacity: 0; }
  100% { transform: translateY(-50%) rotate(-9deg) scale(1); opacity: 0.9; }
}

@keyframes depart {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(-45vw, -6vh) rotate(-7deg); opacity: 0; }
}

.puff {
  position: fixed;
  z-index: 6;
  width: 7rem;
  height: 7rem;
  margin: -3.5rem 0 0 -3.5rem;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(235 240 242 / 0.55), rgb(235 240 242 / 0.15) 60%, transparent);
  filter: blur(3px);
  pointer-events: none;
  animation: puff 700ms ease-out both;
}

@keyframes puff {
  0% { transform: scale(0.3); opacity: 0.9; }
  100% { transform: translate(var(--dx, 0), -4rem) scale(2.2); opacity: 0; }
}

/* ── An empty platform ──────────────────────────────────────────────────────────────────── */

.quiet {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1.1rem;
  min-height: 70%;
  padding: 3rem 1rem;
  text-align: center;
}

.quiet .flaps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem;
}

.quiet .flaps span {
  min-width: 1.6em;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  text-align: center;
}

.quiet .flaps .blank {
  min-width: 0.7em;
  background: none;
  box-shadow: none;
}

.quiet p {
  margin: 0;
  color: var(--muted);
  font: 500 1.15rem/1.4 var(--condensed);
  letter-spacing: 0.04em;
}

/* ── Toast and help ─────────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: min(36rem, calc(100vw - 2rem));
  padding: 0.55rem 0.6rem 0.55rem 1rem;
  border-radius: 0.55rem;
  background: #111517;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 14px 30px rgb(0 0 0 / 0.6);
  color: var(--flap-text);
  font: 600 1rem/1.3 var(--condensed);
  letter-spacing: 0.03em;
  transform: translateX(-50%);
}

.toast[hidden] {
  display: none;
}

.toast span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast.fault {
  color: var(--signal-red);
}

.toast button {
  flex: none;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 0.35rem;
  background: #2a3236;
  color: var(--amber);
  font: 700 0.95rem/1 var(--condensed);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.help {
  padding: 1.25rem 1.5rem;
  border: 0;
  border-radius: 0.7rem;
  background: #15191b;
  color: var(--text);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12), 0 30px 60px rgb(0 0 0 / 0.7);
}

.help::backdrop {
  background: rgb(0 0 0 / 0.55);
}

.help dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.55rem 1.25rem;
  margin: 0;
}

.help dt {
  text-align: right;
  white-space: nowrap;
}

.help dd {
  margin: 0;
  color: var(--muted);
}

/* ── Narrower desks: a smaller window, the ticket and the levers still in sight ─────────── */

@media (max-width: 87.5rem) {
  .stage {
    grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 1fr);
    gap: 1rem;
  }

  .title {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  }

  .description {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .thumb {
    width: 5.2rem;
  }
}

@media (max-width: 75rem) {
  :root {
    --board-width: 17rem;
  }

  .stage {
    grid-template-columns: minmax(0, 1.2fr) minmax(17rem, 1fr);
  }

  .board-head,
  .row {
    grid-template-columns: 2.3rem minmax(0, 1fr) 2.5rem;
  }

  .ticket-rank {
    min-width: 3.6rem;
    padding: 0.1rem 0.7rem 0.1rem 0.3rem;
  }

  .ticket-rank strong {
    font-size: 2.2rem;
  }

  .board-head {
    letter-spacing: 0.06em;
  }
}

/* ── Phones and small tablets: one game at a time, the board on demand ──────────────────── */

@media (max-width: 62.5rem) {
  :root {
    --header: 3.4rem;
  }

  .station {
    display: block;
    height: auto;
  }

  .concourse {
    position: sticky;
    top: 0;
    gap: 0.5rem;
    height: var(--header);
    padding: 0 0.75rem;
  }

  .concourse .sign span {
    padding: 0.05rem 0.55rem 0.1rem;
    font-size: 1.05rem;
  }

  .tab {
    padding: 0.3rem 0.5rem;
    font-size: 0.98rem;
  }

  .timetable,
  .clock,
  .help-button {
    display: none;
  }

  .board-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    padding: 0.4rem 0.7rem;
    border: 1px solid rgb(255 181 46 / 0.5);
    border-radius: 0.4rem;
    background: var(--flap);
    color: var(--amber);
    font: 700 0.98rem/1 var(--condensed);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .board-toggle svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
  }

  .board-toggle[aria-expanded="true"] {
    background: var(--amber);
    color: #1a1204;
  }

  .platform {
    display: block;
  }

  .board {
    position: fixed;
    inset: var(--header) 0 0;
    z-index: 4;
    display: none;
    margin: 0;
    border-radius: 0;
  }

  .board.open {
    display: grid;
  }

  .detail {
    /* Sideways is the swipe, up and down still scrolls. */
    touch-action: pan-y;
    overflow: visible;
    padding: 0.75rem 0.75rem calc(5.4rem + env(safe-area-inset-bottom));
  }

  .backdrop {
    inset: var(--header) 0 0 0;
  }

  .stage,
  .info {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .stage {
    grid-template-areas: "media" "info";
  }

  .window {
    border-radius: 0.7rem;
  }

  .thumb {
    width: 5.2rem;
  }

  .title {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
  }

  .ticket {
    padding: 0.7rem 0.9rem 0.75rem 0.75rem;
  }

  .ticket.stamped {
    padding-right: 5.6rem;
  }

  .stamp {
    right: 0.5rem;
    padding: 0.2rem 0.45rem 0.25rem;
    font-size: 1rem;
    letter-spacing: 0.1em;
  }

  .ticket-rank {
    min-width: 3.6rem;
    padding: 0.1rem 0.7rem 0.1rem 0.4rem;
  }

  .ticket-rank strong {
    font-size: 2.2rem;
  }

  /* The levers stay under the thumb. */
  .actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    grid-template-columns: 3.1rem minmax(0, 1fr) 3.1rem 3.1rem;
    gap: 0.45rem;
    padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgb(9 16 20 / 0), rgb(9 16 20 / 0.92) 30%);
  }

  .action {
    min-height: 3.3rem;
    padding: 0.5rem;
  }

  .action.step {
    display: inline-flex;
    background: linear-gradient(180deg, #2f393d, #1d2528);
    color: var(--flap-text);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1) inset;
  }

  .action.punch,
  .action.back-in {
    order: 2;
  }

  .action.step.previous {
    order: 1;
  }

  .action.step.next {
    order: 3;
  }

  .action.to-steam {
    order: 4;
  }

  .action .label-steam,
  .action kbd {
    display: none;
  }

  .toast {
    bottom: calc(5.2rem + env(safe-area-inset-bottom));
  }

  .detail.swiping .stage {
    transition: none;
  }

  .stage {
    transition: transform 180ms ease, opacity 180ms ease;
  }
}

@media (max-width: 26rem) {
  .tab {
    gap: 0.3rem;
    padding: 0.3rem 0.4rem;
    letter-spacing: 0.02em;
  }

  .concourse .sign span {
    letter-spacing: 0.02em;
  }

  .logout button {
    width: 2rem;
    height: 2rem;
  }

  .board-toggle span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .steam i,
  .rows.flipping .flap,
  .departing,
  .departing .stamp,
  .puff {
    animation: none;
  }

  .departing,
  .puff {
    display: none;
  }
}
