/* Schranke Mettenheim — "Klar und groß" with comic trains.
   Light paper, comic panels (ink outline + offset shadow), the status card filled with the state
   colour, the line Alsheim – Mettenheim – Osthofen as a strip with drawn trains. The panels stay
   paper-light in the dark theme too, like printed comics on a dark table. */

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1a1814;
  --ink-2: #4d4639;
  --ink-3: #6b6352;
  --paper: #fbf8f1;
  --panel: #fffdf8;
  --line: #ddd0b3;

  /* state colours: the whole status card takes them */
  --red: #d93a2b;
  --yellow: #ffc629;
  --green: #178a4c;
  --grey: #6b7280;
  --lamp-red: #ff4b33;
  --lamp-yellow: #ffc629;
  --lamp-off: #4a4a4a;
  --go: #3cc77a;

  --t-red: #b3261e;
  --t-green: #1c6e40;
  --t-yellow: #7d5300;
  --link: #1e4076;
  --navy: #1e4076;

  --bg: var(--paper);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
  --rule: var(--line);

  --stroke: 3px;
  --pop: 5px 5px 0 var(--ink);
  --pop-s: 3px 3px 0 var(--ink);
  --radius: 24px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-place: "Playfair Display", Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #16130f;
  --text: #f1e9d8;
  --text-2: #cfc6b4;
  --text-3: #a59b88;
  --rule: #3a3328;
  --link: #e3c674;
  --t-red: #ff8f85;
  --t-green: #74d9a0;
  --t-yellow: #f2c45a;
  --pop: 5px 5px 0 #000;
  --pop-s: 3px 3px 0 #000;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16130f;
    --text: #f1e9d8;
    --text-2: #cfc6b4;
    --text-3: #a59b88;
    --rule: #3a3328;
    --link: #e3c674;
    --t-red: #ff8f85;
    --t-green: #74d9a0;
    --t-yellow: #f2c45a;
    --pop: 5px 5px 0 #000;
    --pop-s: 3px 3px 0 #000;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */

[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 60px;
  scrollbar-color: var(--rule) transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--yellow);
  color: var(--ink);
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

symbol .fill {
  fill: currentColor;
  stroke: none;
}

.icon-inline {
  width: 1em;
  height: 1em;
}

.sprite,
.art-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
}

.skip:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ layout */

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

.masthead {
  padding: 4px 2px 14px;
}

.masthead h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
}

.masthead-place {
  font: 600 1.7rem/1.1 var(--font-place);
  letter-spacing: -0.01em;
}

.masthead-what {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-2);
}

.masthead-sub {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-3);
}

main {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 960px) {
  main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-flow: row dense;
    column-gap: 40px;
  }

  .hero,
  .strip,
  .underhero {
    grid-column: 1 / -1;
  }

  .report,
  .hour,
  .quiz {
    grid-column: 1;
  }

  .closures,
  .departures,
  .info {
    grid-column: 2;
  }

  .masthead-place {
    font-size: 2.2rem;
  }
}

/* ------------------------------------------------------------------ the status card */

.hero {
  --hero-bg: var(--grey);
  --hero-fg: #fff;
  --hero-dim: rgb(255 255 255 / 0.88);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  min-height: 300px;
  padding: 20px 16px 18px 20px;
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius);
  background-color: var(--hero-bg);
  box-shadow: var(--pop);
  color: var(--hero-fg);
  overflow: hidden;
  isolation: isolate;
  transition: background-color 400ms var(--ease-out);
}

/* comic dot screen, fading in towards the lower right corner */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle, rgb(0 0 0 / 0.13) 1.4px, transparent 1.7px) 0 0 / 9px 9px;
  -webkit-mask-image: linear-gradient(120deg, transparent 45%, #000 95%);
  mask-image: linear-gradient(120deg, transparent 45%, #000 95%);
}

.hero[data-lamp="red"] {
  --hero-bg: var(--red);
}

.hero[data-lamp="yellow"] {
  --hero-bg: var(--yellow);
  --hero-fg: var(--ink);
  --hero-dim: rgb(26 24 20 / 0.82);
}

.hero[data-lamp="green"] {
  --hero-bg: var(--green);
}

.hero-text {
  min-width: 0;
}

.hero-where {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--hero-dim);
}

.state {
  margin-top: 2px;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.countdown {
  margin-top: 12px;
}

.countdown-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--hero-dim);
}

.countdown-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.countdown-value {
  font-size: clamp(4.2rem, 21vw, 6rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  transform-origin: left 70%;
}

/* the last ten seconds tick with a small pop per second */
.countdown-value.is-ticking {
  animation: tickpulse 1s ease-out infinite;
}

@keyframes tickpulse {
  0% {
    scale: 1.06;
  }

  30%,
  100% {
    scale: 1;
  }
}

.countdown-unit {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--hero-dim);
}

.reason {
  margin-top: 12px;
  max-width: 34ch;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.live,
.demo-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  margin-right: 6px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
}

.live strong {
  font-weight: 900;
}

.live[data-closed="true"] strong {
  color: #b3261e;
}

.live[data-closed="false"] strong {
  color: #1c6e40;
}

.demo-flag {
  background: var(--yellow);
}

/* freight-train note, shown on the card while the forecast is green */
.freight {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  max-width: 36ch;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--hero-dim);
}

.freight .icon {
  margin-top: 2px;
}

.hero-art {
  position: relative;
  width: clamp(128px, 36vw, 230px);
  align-self: end;
  margin: 0 -6px -10px 0;
}

/* comic dust puff where the barrier arm lands */
.hero-art::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 16%;
  width: 42px;
  height: 22px;
  background:
    radial-gradient(circle at 25% 65%, rgb(255 255 255 / 0.95) 0 7px, transparent 8px),
    radial-gradient(circle at 55% 40%, rgb(255 255 255 / 0.9) 0 8px, transparent 9px),
    radial-gradient(circle at 84% 68%, rgb(255 255 255 / 0.85) 0 6px, transparent 7px);
  opacity: 0;
  pointer-events: none;
}

.hero[data-puff="1"] .hero-art::after {
  animation: puff 650ms ease-out;
}

@keyframes puff {
  0% {
    opacity: 0;
    scale: 0.3;
    translate: 2px 5px;
  }

  25% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    scale: 1.3;
    translate: -8px -12px;
  }
}

/* the sent report flying up to the status card */
.report-fly {
  position: fixed;
  z-index: 30;
  translate: -50% -100%;
  padding: 3px 11px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink);
  pointer-events: none;
}

.bell {
  grid-column: 1 / -1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 12px;
  padding: 0 16px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: var(--pop-s);
  cursor: pointer;
  transition: transform 90ms, box-shadow 90ms;
}

.bell:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.bell[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

@media (min-width: 960px) {
  .hero {
    min-height: 340px;
    padding: 28px 36px 26px;
  }

  .state {
    font-size: 3.4rem;
  }

  .hero-art {
    width: 250px;
  }
}

/* the drawn crossing */
.crossing-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.crossing-art .ground {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.crossing-art .lamp-y,
.crossing-art .lamp-r,
.mini-lamp .lamp-y,
.mini-lamp .lamp-r {
  fill: var(--lamp-off);
  transition: fill 200ms;
}

[data-lamp="yellow"] .crossing-art .lamp-y {
  fill: url(#glow-yellow);
}

[data-lamp="red"] .crossing-art .lamp-r {
  fill: url(#glow-red);
}

.crossing-art .rays path {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}

.crossing-art .rays {
  opacity: 0;
  transition: opacity 200ms;
}

[data-lamp="yellow"] .crossing-art .rays-yellow,
[data-lamp="red"] .crossing-art .rays-red {
  opacity: 1;
}

.crossing-art .arm {
  transform-box: view-box;
  transform-origin: 163px 152.5px;
  transition: transform 1500ms cubic-bezier(0.45, 0, 0.2, 1);
}

[data-boom="up"] .crossing-art .arm {
  transform: rotate(82deg);
}

.crossing-art .ding {
  font: 900 14px/1 var(--font);
  fill: var(--ink);
  opacity: 0;
}

.hero[data-phase="closing"] .crossing-art .ding {
  opacity: 1;
  animation: ding 700ms steps(2) infinite;
}

.hero[data-phase="closing"] .crossing-art .ding-2 {
  animation-delay: 350ms;
}

@keyframes ding {
  50% {
    transform: translate(1px, -2px);
  }
}

/* ------------------------------------------------------------------ the strip */

.strip {
  border: var(--stroke) solid var(--ink);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--pop);
  color: var(--ink);
  overflow: hidden;
}

.strip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 14px 16px 0;
}

.strip-head h2 {
  font-size: 1.15rem;
  font-weight: 900;
}

.strip-sub {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-3);
}

.strip-stage {
  position: relative;
  height: 236px;
}

/* the scene follows the time of day: a warm wash at dusk, a blue night with moon and stars */
.strip-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1500ms var(--ease-out);
}

[data-daylight="dusk"] .strip-stage::after {
  opacity: 1;
  background: linear-gradient(rgb(255 150 60 / 0.16), rgb(80 60 120 / 0.12) 70%, transparent);
}

[data-daylight="night"] .strip-stage::after {
  opacity: 1;
  background:
    radial-gradient(circle at 84% 16%, rgb(255 244 200 / 0.95) 0 7px, rgb(255 244 200 / 0.25) 8px, transparent 11px),
    radial-gradient(circle at 12% 20%, rgb(255 255 255 / 0.8) 0 1.2px, transparent 2px),
    radial-gradient(circle at 30% 10%, rgb(255 255 255 / 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 55% 22%, rgb(255 255 255 / 0.7) 0 1px, transparent 1.8px),
    radial-gradient(circle at 70% 8%, rgb(255 255 255 / 0.6) 0 1px, transparent 1.8px),
    radial-gradient(circle at 94% 34%, rgb(255 255 255 / 0.6) 0 1px, transparent 1.8px),
    linear-gradient(rgb(24 30 72 / 0.34), rgb(26 28 58 / 0.18) 75%, transparent);
}

/* at night the train windows are lit */
[data-daylight="night"] .train-art rect[fill="#1a1814"] {
  fill: #ffdf8e;
}

.strip-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.strip-scene .rail {
  stroke: var(--ink);
  stroke-width: 2.2;
}

.strip-scene .sleeper {
  stroke: #b9ae97;
  stroke-width: 3;
}

.strip-scene .road {
  fill: #ddd6c6;
}

.strip-scene .road-mid {
  stroke: #fff;
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.strip-scene .platform {
  fill: #e6dfce;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.strip-scene .board {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2;
}

.strip-scene .board-home {
  fill: var(--yellow);
}

.strip-scene .board-post {
  stroke: var(--ink);
  stroke-width: 2;
}

.strip-scene .board-text {
  font: 800 11px/1 var(--font);
  fill: var(--ink);
}

.strip-scene .dir-label,
.strip-scene .road-label {
  font: 700 10px/1 var(--font);
  fill: var(--ink-3);
}

.strip-trains {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.strip-train {
  position: absolute;
  left: 0;
  top: 0;
  transition: transform 1000ms linear;
  will-change: transform;
}

.strip-train-body {
  position: relative;
}

.strip-train.is-north .strip-train-body {
  transform: scaleX(-1);
}

.strip-train.is-moving .strip-train-body {
  animation: bob 520ms ease-in-out infinite alternate;
}

/* motion lines behind a moving train (the body is mirrored for northbound trains) */
.strip-train.is-moving .strip-train-body::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 30%;
  width: 18px;
  height: 14px;
  margin-right: 3px;
  background: linear-gradient(var(--ink) 0 2px, transparent 2px 6px, var(--ink) 6px 8px, transparent 8px 12px, var(--ink) 12px 14px);
  opacity: 0.55;
}

.train-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.strip-train.is-moving .wheel path {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bob {
  to {
    translate: 0 -1.5px;
  }
}

.bubble {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  padding: 2px 8px 3px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink);
}

.bubble b {
  font-weight: 900;
}

.bubble i {
  font-style: normal;
  font-weight: 800;
  color: #b3261e;
}

.bubble::after {
  content: "";
  position: absolute;
  left: calc(50% - 6px);
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--ink);
  border-top: 0;
  border-left: 0;
}

/* bubbles sit between the tracks: southbound ones under their train, northbound ones above */
.is-south .bubble {
  top: calc(100% + 4px);
}

.is-south .bubble::after {
  bottom: calc(100% - 4px);
  rotate: -135deg;
}

.is-north .bubble {
  bottom: calc(100% + 4px);
}

.is-north .bubble::after {
  top: calc(100% - 4px);
  rotate: 45deg;
}

/* second row for a bubble that would overlap its neighbour */
.is-south .bubble[data-row="1"] {
  top: calc(100% + 30px);
}

.is-north .bubble[data-row="1"] {
  bottom: calc(100% + 30px);
}

.bubble[data-row="1"]::after {
  display: none;
}

.strip-lamp {
  position: absolute;
  width: 13px;
}

.mini-lamp {
  display: block;
  width: 100%;
  height: auto;
}

.strip-lamp[data-lamp="yellow"] .lamp-y {
  fill: var(--lamp-yellow);
}

.strip-lamp[data-lamp="red"] .lamp-r {
  fill: var(--lamp-red);
}

.strip-announce {
  position: absolute;
  max-width: 46%;
  padding: 3px 9px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 2px 2px 0 var(--ink);
}

.strip-announce b {
  font-weight: 900;
}

.strip-announce-south {
  left: 10px;
  top: 6px;
}

.strip-announce-north {
  right: 10px;
  top: 6px;
}

.neighbour {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 14px;
  border-top: 2px solid var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.neighbour-dot {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lamp-off);
}

.neighbour[data-lamp="red"] .neighbour-dot {
  background: var(--lamp-red);
}

.neighbour[data-lamp="yellow"] .neighbour-dot {
  background: var(--lamp-yellow);
}

.neighbour[data-lamp="green"] .neighbour-dot {
  background: var(--go);
}

/* ------------------------------------------------------------------ under the card */

.underhero {
  display: grid;
  gap: 6px;
  margin-top: -4px;
  padding: 0 4px;
}

/* official DWD warning, only shown while one is active */
.weather-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 5px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
}

.weather-warning[data-severity="severe"],
.weather-warning[data-severity="extreme"] {
  background: var(--red);
  color: #fff;
}

.disclaimer {
  display: flex;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-2);
}

.disclaimer .icon {
  margin-top: 2px;
}

.freshness {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.demo-badge {
  display: inline-block;
  margin-right: 4px;
  padding: 0 7px;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--link);
  font-weight: 700;
  cursor: pointer;
}

.link-button[aria-busy="true"] .icon {
  animation: spin 900ms linear infinite;
}

/* ------------------------------------------------------------------ sections */

.block {
  padding: 22px 2px 6px;
  border-top: 1px solid var(--rule);
}

.block h2 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.block-lead {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--text-2);
  max-width: 62ch;
}

.fineprint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* comic buttons */
.button,
.report-btn,
.chip,
.quiz-option {
  border: 2.5px solid var(--ink);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--pop-s);
  cursor: pointer;
  transition: transform 90ms, box-shadow 90ms, background 150ms;
}

.button:active,
.report-btn:active:not(:disabled),
.chip:active,
.quiz-option:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

/* the report block is a comic panel of its own: reporting is the one thing visitors can do here */
.report {
  margin-top: 16px;
  padding: 18px 18px 14px;
  border: var(--stroke) solid var(--ink);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--pop);
  color: var(--ink);
}

.report .block-lead {
  color: var(--ink-2);
}

.report .fineprint {
  color: var(--ink-3);
}

.report .fineprint a {
  color: #1e4076;
}

.report .report-status {
  color: #1c6e40;
}

.report .report-status[data-error="true"] {
  color: #b3261e;
}

.report-impact {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
  font-variant-numeric: tabular-nums;
}

.report-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.report-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 14px;
  border-radius: 16px;
  text-align: left;
  font-weight: 800;
  line-height: 1.2;
}

.report-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.report-lamp {
  flex: none;
  width: 16px;
  height: 30px;
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 28%, var(--c1, #5a5a5a) 0 4.5px, transparent 5px),
    radial-gradient(circle at 50% 72%, var(--c2, #5a5a5a) 0 4.5px, transparent 5px),
    var(--ink);
}

.report-btn[data-tone="closed"] .report-lamp {
  --c2: var(--lamp-red);
}

.report-btn[data-tone="moving-up"] .report-lamp {
  --c2: rgb(255 75 51 / 0.5);
}

.report-btn[data-tone="moving-down"] .report-lamp {
  --c1: var(--lamp-yellow);
}

.report-btn[data-tone="open"] .report-lamp {
  background:
    radial-gradient(circle at 50% 50%, var(--go) 0 4.5px, transparent 5px),
    var(--ink);
}

.report-btn[data-lit="true"] {
  background: var(--yellow);
}

.report-wait {
  position: absolute;
  right: 12px;
  bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.report-status {
  min-height: 1.4em;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--t-green);
}

.report-status[data-error="true"] {
  color: var(--t-red);
}

/* hour band: a track with the closures as red blocks */
.band-wrap {
  margin-top: 16px;
}

.band {
  position: relative;
  height: 52px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background:
    linear-gradient(transparent calc(50% - 1.5px), var(--ink) calc(50% - 1.5px), var(--ink) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    #fff;
  box-shadow: var(--pop-s);
  overflow: hidden;
  cursor: pointer;
  touch-action: pan-y;
}

.band-block {
  position: absolute;
  top: 9px;
  bottom: 9px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--red);
}

.band-block.is-maybe {
  background: var(--yellow);
}

.band-now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--ink);
}

.band-arrive {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 8px;
  margin-left: -4px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--yellow);
  transition: left 260ms var(--ease-out);
}

.band-scale {
  position: relative;
  height: 22px;
  margin-top: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.band-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.band-scale span:first-child {
  transform: none;
}

.band-scale span:last-child {
  transform: translateX(-100%);
}

.arrive {
  margin-top: 14px;
}

.arrive-q {
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  min-width: 54px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chip[aria-checked="true"] {
  background: var(--ink);
  color: #fff;
}

.arrive-answer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 1.06rem;
  line-height: 1.4;
}

.arrive-answer::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 0.25em;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lamp-off);
}

.arrive-answer[data-open="true"]::before {
  background: var(--go);
}

.arrive-answer[data-open="false"]::before {
  background: var(--lamp-red);
}

.arrive-answer[data-open="maybe"]::before {
  background: var(--lamp-yellow);
}

.arrive-answer > span {
  min-width: 0;
}

.arrive-answer strong {
  font-weight: 900;
}

/* closures: compact rows */
.closure-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.closure {
  display: grid;
  grid-template-columns: 6.6rem minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--rule);
}

.closure:first-child {
  border-top: 0;
}

.closure.is-now {
  margin: 0 -10px;
  padding: 11px 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 16%, transparent);
}

.closure.is-now + .closure {
  border-top-color: transparent;
}

.closure-time {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.closure-len {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-3);
}

.closure.is-now .closure-len {
  color: var(--t-red);
}

.closure-trains {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.closure-trains li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 7px;
  font-size: 0.92rem;
}

.line-badge {
  display: inline-block;
  min-width: 2.6em;
  padding: 0 6px;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.4;
}

.line-badge[data-cat="S"] {
  color: var(--t-green);
}

.line-badge[data-cat="RE"],
.line-badge[data-cat="RB"] {
  color: var(--t-red);
}

.line-badge[data-cat="IC"],
.line-badge[data-cat="ICE"],
.line-badge[data-cat="EC"] {
  color: var(--text-2);
}

.muted {
  color: var(--text-3);
}

.late {
  color: var(--t-red);
  font-weight: 800;
}

.ontime {
  color: var(--t-green);
  font-weight: 700;
}

.tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
}

.unsure {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--t-yellow);
}

.empty {
  padding: 10px 0;
  color: var(--text-3);
  font-size: 0.92rem;
}

/* departures */
.dep-columns {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

@media (min-width: 640px) and (max-width: 959px) {
  .dep-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.dep-col h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-2);
}

.dep-track {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
}

.dep-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.dep {
  display: grid;
  grid-template-columns: 3.4rem 3.3rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
  font-size: 0.94rem;
}

.dep:first-child {
  border-top: 0;
}

.dep-time {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.dep-dest {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep-via {
  display: block;
  font-size: 0.74rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.dep-info {
  text-align: right;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.dep.is-cancelled .dep-time,
.dep.is-cancelled .dep-dest {
  text-decoration: line-through;
  color: var(--text-3);
}

.platform-change {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

/* quiz */
.quiz-card {
  margin-top: 14px;
}

.quiz-progress {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.quiz-q {
  margin-top: 4px;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
}

.quiz-options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  text-align: left;
  font-weight: 600;
  line-height: 1.3;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option .icon {
  margin-left: auto;
}

.quiz-option[data-result="right"] {
  background: #c8f0d6;
}

.quiz-option[data-result="wrong"] {
  background: #ffd3cc;
}

.quiz-explain {
  margin-top: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-2);
  max-width: 62ch;
}

.quiz-explain a {
  font-size: 0.82rem;
}

.quiz-next {
  margin-top: 14px;
}

.quiz-done {
  font-size: 1.12rem;
  font-weight: 800;
}

.quiz-stats {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* folds */
.info {
  display: grid;
  align-content: start;
  margin-top: 8px;
}

.fold {
  border-top: 1px solid var(--rule);
}

.fold:last-child {
  border-bottom: 1px solid var(--rule);
}

.fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 4px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.fold summary::-webkit-details-marker {
  display: none;
}

.fold summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--text-3);
  border-bottom: 2.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 200ms var(--ease-out);
}

.fold[open] summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.fold-body {
  padding: 0 4px 20px;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text-2);
}

.fold-body > * + * {
  margin-top: 10px;
}

.fold-body h3 {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--text);
}

.fold-body ul,
.fold-body ol {
  padding-left: 1.2em;
}

.fold-body li + li {
  margin-top: 4px;
}

.timings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 14px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.timings dt {
  color: var(--text-2);
}

.timings dd {
  margin: 0;
  font-weight: 800;
  color: var(--text);
  text-align: right;
}

.legend {
  list-style: none;
  padding: 0 !important;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend .dot {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lamp-off);
}

.legend .dot[data-c="red"] {
  background: var(--lamp-red);
}

.legend .dot[data-c="yellow"] {
  background: var(--lamp-yellow);
}

.legend .dot[data-c="green"] {
  background: var(--go);
}

/* ------------------------------------------------------------------ sticky status line */

.ministatus {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: max(8px, env(safe-area-inset-top)) 18px 8px;
  border-bottom: var(--stroke) solid var(--ink);
  background: var(--grey);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  transform: translateY(-110%);
  transition: transform 280ms var(--ease-out);
}

.ministatus.is-shown {
  transform: none;
}

.ministatus[data-lamp="red"] {
  background: var(--red);
}

.ministatus[data-lamp="yellow"] {
  background: var(--yellow);
  color: var(--ink);
}

.ministatus[data-lamp="green"] {
  background: var(--green);
}

.ministatus-dot {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

/* ------------------------------------------------------------------ footer */

.footer {
  display: grid;
  gap: 10px;
  margin-top: 32px;
  padding: 24px 4px max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--text-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

symbol .mono-a {
  fill: none;
  stroke: var(--brand-a, #1e4076);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

symbol .mono-bar {
  fill: none;
  stroke: var(--brand-bar, #9a7a2e);
  stroke-width: 4;
  stroke-linecap: round;
}

:root[data-theme="dark"] .brand {
  --brand-a: #a9c2ee;
  --brand-bar: #c9a84c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand {
    --brand-a: #a9c2ee;
    --brand-bar: #c9a84c;
  }
}

.brand-pre {
  color: var(--text-3);
}

.brand-name {
  font: 600 1.05rem/1 var(--font-place);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.theme-switch {
  display: inline-flex;
  margin-left: auto;
  border: 2px solid var(--text-3);
  border-radius: 999px;
  padding: 2px;
}

.theme-switch button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.noscript {
  padding: 16px;
  text-align: center;
}

@media (max-width: 380px) {
  .report-btn {
    font-size: 0.92rem;
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation: none !important;
  }
}
