@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --black: #050806;
  --phosphor: #b8efbd;
  --phosphor-hot: #e1ffe2;
  --phosphor-dim: #668f6b;
  --phosphor-faint: #355a3b;
  --amber: #f2ab4f;
  --window: #d9a357;
  --red: #ef5d4d;
  --edge: rgba(184, 239, 189, 0.28);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-width: 20rem; min-height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--black);
  color: var(--phosphor);
  font-family: var(--mono);
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

button, a { color: inherit; font: inherit; }
button { border: 0; background: transparent; }
a { text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
:where(button, a):focus-visible { outline: 1px solid var(--amber); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 1rem;
  left: 1rem;
  padding: .7rem .85rem;
  background: var(--phosphor-hot);
  color: var(--black);
  font-size: .72rem;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.terminal {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 30rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: radial-gradient(circle at 52% 43%, rgba(54, 102, 62, .075), transparent 42%), var(--black);
}

.terminal::before, .terminal::after {
  content: "";
  position: absolute;
  z-index: 20;
  inset: 0;
  pointer-events: none;
}
.terminal::before {
  opacity: .14;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, #000 3px 4px);
  mix-blend-mode: multiply;
}
.terminal::after { box-shadow: inset 0 0 7rem 1rem rgba(0, 0, 0, .88); }

.terminal-header, .terminal-console {
  position: relative;
  z-index: 30;
  border: 1px solid var(--edge);
}

.terminal-header {
  min-height: 3.4rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 3rem);
  padding: .65rem clamp(.75rem, 1.8vw, 1.45rem);
  font-size: clamp(.55rem, .67vw, .69rem);
  letter-spacing: .12em;
}

.wordmark { display: inline-flex; align-items: center; gap: .68rem; width: max-content; color: var(--phosphor-hot); }
.wordmark i { color: var(--red); font-style: normal; }
.telemetry { display: flex; gap: clamp(1rem, 2.5vw, 2.8rem); color: var(--phosphor-dim); }
.quiet-button { min-width: 4.4rem; min-height: 2.75rem; padding: .45rem 0; cursor: pointer; color: var(--phosphor-dim); letter-spacing: .1em; transition: color .15s ease; }
.quiet-button:hover { color: var(--phosphor-hot); }
.quiet-button b { color: var(--amber); font-weight: 400; }

.ansi-viewport {
  position: relative;
  z-index: 5;
  min-height: 0;
  overflow: hidden;
  border-inline: 1px solid var(--edge);
  background: radial-gradient(ellipse at 50% 67%, rgba(70, 120, 78, .09), transparent 57%);
}
.character-field, .character-layer { position: absolute; inset: 0; }
.character-field { overflow: hidden; opacity: .92; }
.character-layer {
  margin: 0;
  width: max-content;
  height: max-content;
  overflow: visible;
  font-family: var(--mono);
  font-variant-ligatures: none;
  white-space: pre;
  user-select: none;
}
.character-layer--base { color: var(--phosphor-faint); text-shadow: 0 0 .6rem rgba(93, 171, 102, .08); }
.character-layer--skyline {
  z-index: 1;
  color: #426c48;
  font-family: "Cascadia Mono", "Segoe UI Symbol", var(--mono);
  text-shadow: 0 0 .55rem rgba(103, 185, 114, .12);
}
.character-layer--lights {
  z-index: 2;
  color: var(--window);
  opacity: .3;
  font-family: "Cascadia Mono", "Segoe UI Symbol", var(--mono);
  text-shadow: 0 0 .45rem rgba(242, 171, 79, .2);
  transition: color .45s ease, opacity .45s ease, text-shadow .45s ease;
}
.is-passing .character-layer--lights {
  color: var(--amber);
  opacity: .88;
  text-shadow: 0 0 .7rem rgba(242, 171, 79, .48);
}
.character-layer--accent { z-index: 3; color: var(--amber); text-shadow: 0 0 .45rem rgba(242, 171, 79, .44); }

.train-sprite {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: max-content;
  height: max-content;
  margin: 0;
  color: var(--amber);
  font-family: var(--mono);
  font-variant-ligatures: none;
  white-space: pre;
  text-shadow: 0 0 .45rem rgba(242, 171, 79, .44);
  pointer-events: none;
  user-select: none;
}
.is-passing .train-sprite { text-shadow: 0 0 .8rem rgba(242, 171, 79, .62); }

.train-sprite[hidden] { display: none; }

.identity {
  position: absolute;
  z-index: 8;
  top: clamp(2.1rem, 9vh, 6.7rem);
  left: clamp(1.3rem, 5vw, 5.25rem);
  pointer-events: none;
}
.identity p { margin: 0; }
.identity-code, .identity-role {
  color: var(--phosphor-dim);
  font-size: clamp(.55rem, .62vw, .67rem);
  line-height: 1.75;
  letter-spacing: .16em;
}
.identity h1 {
  margin: .65rem 0 .85rem;
  color: var(--phosphor-hot);
  font-size: clamp(2.2rem, 4.8vw, 5.15rem);
  font-weight: 400;
  line-height: .76;
  letter-spacing: -.075em;
  text-shadow: 0 0 1.5rem rgba(155, 244, 168, .08);
}

.route-card {
  position: absolute;
  z-index: 8;
  top: clamp(2rem, 8vh, 5rem);
  right: clamp(1.3rem, 4vw, 4rem);
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--phosphor-dim);
  font-size: .57rem;
  letter-spacing: .12em;
}
.route-card i { width: clamp(1rem, 2.5vw, 2.5rem); height: 1px; background: var(--phosphor-faint); }
.route-card span:last-child { color: var(--red); }

.train-status {
  position: absolute;
  z-index: 8;
  right: clamp(1.3rem, 4vw, 4rem);
  bottom: 3rem;
  margin: 0;
  color: var(--phosphor-dim);
  font-size: clamp(.54rem, .62vw, .66rem);
  letter-spacing: .13em;
}
.is-passing .train-status { color: var(--amber); }

.terminal-console {
  min-height: 4.65rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .65rem clamp(.75rem, 1.8vw, 1.45rem);
}
.terminal-nav { display: flex; align-items: center; gap: clamp(.8rem, 2vw, 2rem); }
.terminal-nav button, .call-train { cursor: pointer; color: var(--phosphor-dim); font-size: clamp(.57rem, .67vw, .69rem); letter-spacing: .1em; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
kbd { color: var(--phosphor); font: inherit; }
.terminal-nav button { min-height: 2.75rem; padding: .55rem .1rem; white-space: nowrap; }
.terminal-nav button:hover, .terminal-nav button:focus-visible { color: var(--phosphor-hot); }

.call-train {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-height: 2.8rem;
  padding: 0 1.1rem;
  border: 1px solid var(--amber);
  color: var(--amber);
}
.call-train:hover, .call-train:focus-visible { background: var(--amber); color: var(--black); }
.call-train:active { transform: translateY(1px); }
.call-train[aria-disabled="true"], .call-train[aria-disabled="true"]:hover { border-color: var(--phosphor-faint); background: transparent; color: var(--phosphor-dim); cursor: progress; }
.console-hint { justify-self: end; margin: 0; color: var(--phosphor-faint); font-size: clamp(.5rem, .58vw, .6rem); letter-spacing: .1em; text-align: right; }

.info-panel {
  width: min(43rem, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--amber);
  background: rgba(5, 8, 6, .97);
  color: var(--phosphor);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .72), 0 0 4rem rgba(242, 171, 79, .1);
}
.info-panel::backdrop { background: rgba(0, 0, 0, .72); }
.info-panel__bar { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--edge); color: var(--phosphor-dim); font-size: .62rem; letter-spacing: .12em; }
.info-panel__bar button { min-height: 2.75rem; padding: .45rem; cursor: pointer; color: var(--amber); }
.info-panel__content { padding: clamp(1.5rem, 5vw, 3.5rem); }
.panel-kicker { margin: 0 0 1rem; color: var(--red); font-size: .62rem; letter-spacing: .16em; }
.info-panel h2 { max-width: 24ch; margin: 0; color: var(--phosphor-hot); font-size: clamp(1.5rem, 4vw, 2.8rem); font-weight: 400; line-height: 1.12; letter-spacing: -.045em; }
.info-panel__content > p:last-child { max-width: 58ch; margin: 1.5rem 0 0; color: var(--phosphor-dim); font-size: .78rem; line-height: 1.8; }
.panel-links { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.panel-links a { color: var(--amber); }
.panel-links a:hover { color: var(--phosphor-hot); }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.noscript { position: fixed; z-index: 90; left: 1rem; right: 1rem; bottom: 1rem; margin: 0; padding: 1rem; background: var(--amber); color: var(--black); font-size: .75rem; }

@media (max-width: 720px) {
  .terminal { min-height: 36rem; }
  .terminal-header { grid-template-columns: 1fr auto; min-height: 3.1rem; }
  .telemetry { display: none; }
  .identity { top: 2rem; left: 1.2rem; }
  .identity h1 { margin-block: .6rem .8rem; font-size: clamp(2.4rem, 12.5vw, 3.8rem); }
  .route-card { top: auto; right: auto; bottom: 1.15rem; left: 1.2rem; }
  .train-status { right: 1.15rem; bottom: 4.25rem; }
  .terminal-console { min-height: 7.1rem; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: .5rem 1rem; }
  .terminal-nav { gap: .9rem; }
  .terminal-nav button { font-size: .58rem; }
  .call-train { grid-row: 1 / 3; grid-column: 2; }
  .console-hint { justify-self: start; text-align: left; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .terminal { min-height: 20rem; }
  .terminal-header { min-height: 2.75rem; }
  .identity { top: 1.2rem; left: 1.5rem; }
  .identity h1 { font-size: clamp(2.4rem, 11vh, 3.8rem); }
  .identity-role { display: none; }
  .route-card { top: 1.35rem; right: 1.5rem; }
  .terminal-console { min-height: 3.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal::before { opacity: .07; }
  .character-layer--lights, .quiet-button, .terminal-nav button, .call-train { transition: none; }
}

@media (forced-colors: active) {
  .terminal, .info-panel { forced-color-adjust: none; }
}
