:root {
  --tfl-blue: #0019a8;
  --tfl-red: #dc241f;

  --ink: #10141c;
  --ink-soft: #4a5160;
  --paper: #fbfaf7;
  --panel: #f2f0ea;
  --rule: #d5d2c8;
  --rule-strong: #b4b0a4;

  --board: #14181f;
  --board-text: #ffb000;
  --board-dim: #8a8578;

  --player: var(--tfl-red);
  --optimal: #007d32;
  --focus: #0019a8;

  --font-multiplier: 1;
  --font-base: clamp(14px, 2.5vw, 18px);

  --ease: cubic-bezier(0.2, 0, 0.15, 1);
  --fast: 160ms;
  --medium: 240ms;

  font-size: calc(var(--font-base) * var(--font-multiplier));
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Gill Sans Nova', 'Gill Sans MT', 'Gill Sans', Calibri, 'Avenir Next', Avenir,
    'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: var(--tfl-blue);
  color: #fff;
  flex-wrap: wrap;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
}

.roundel {
  width: 1.9rem;
  height: 1.48rem;
  color: var(--tfl-red);
  flex: none;
  background: transparent;
}

.roundel rect {
  fill: #fff;
}

.wordmark-text {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: 0.5rem;
}

.topnav button {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.topnav button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

main {
  flex: 1;
  padding: 1.25rem;
  min-width: 0;
}

h2 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.5rem 0 0.6rem;
}

h2:first-of-type {
  margin-top: 0.5rem;
}

.lede {
  font-size: 1.25rem;
  margin: 0 0 1.5rem;
  max-width: 34ch;
  line-height: 1.25;
}

button,
input[type='range'] {
  font: inherit;
  min-height: 45px;
}

button {
  padding: 0.5rem 0.9rem;
  min-width: 44px;
  border: 2px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

button:hover {
  border-color: var(--ink);
}

button:focus-visible,
.station:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button.primary {
  background: var(--tfl-blue);
  color: #fff;
  border-color: var(--tfl-blue);
  font-weight: 600;
}

button.primary:hover {
  background: #001580;
  border-color: #001580;
}

button:disabled {
  color: #8b8b8b;
  border-color: var(--rule);
  background: var(--panel);
  cursor: not-allowed;
}

.icon-button {
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 0.5rem;
}

.start-button {
  margin-top: 1.5rem;
  padding-inline: 1.75rem;
}

.cost {
  font-variant-numeric: tabular-nums;
  color: var(--tfl-red);
  font-weight: 600;
}

button:disabled .cost {
  color: inherit;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.6rem;
  max-width: 58rem;
}

.choice {
  display: block;
  text-align: left;
  padding: 0.85rem 1rem;
  border-left-width: 5px;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.choice[aria-pressed='true'] {
  border-color: var(--tfl-blue);
  background: #fff;
}

.choice-name {
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
}

.choice-note {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  padding: 0.7rem 1rem;
  background: var(--board);
  color: var(--board-text);
  border-radius: 2px;
}

.hud-label {
  display: block;
  font-size: 0.65rem;
  color: var(--board-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hud-value {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.hud-mode .hud-value {
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.02em;
}

#hud-score {
  transition: color var(--fast) var(--ease);
}

#hud-score.is-changing {
  color: #fff;
}

.journey {
  margin: 0.9rem 0 0.75rem;
  font-size: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.journey-label {
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.journey-arrow {
  color: var(--tfl-blue);
  font-weight: 600;
}

.game-layout,
.summary-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

:root[data-tier='desktop'] .game-layout {
  grid-template-columns: minmax(0, 1fr) 21rem;
}

:root[data-tier='desktop'] .summary-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.map-panel,
.side-panel,
.summary-map-panel,
.summary-detail {
  min-width: 0;
}

.map-container {
  border: 1px solid var(--rule);
  background: #fff;
  height: 44vh;
  overflow: hidden;
  touch-action: none;
  border-radius: 2px;
}

:root[data-tier='phone'] .map-container {
  height: 42vh;
}

:root[data-tier='desktop'] .map-container {
  height: 48vh;
}

.summary-map {
  height: 38vh;
}

#tube-map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#tube-map.is-panning {
  cursor: grabbing;
}

.edge {
  stroke-width: 2.4;
  stroke-linecap: round;
  transition: opacity var(--fast) var(--ease);
}

.edge.is-hidden {
  display: none;
}

.station {
  fill: transparent;
  pointer-events: all;
  cursor: pointer;
}

.station-dot {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.1;
  pointer-events: none;
  transition: fill var(--fast) var(--ease), stroke var(--fast) var(--ease);
}

.station-group.is-start .station-dot {
  fill: var(--optimal);
  stroke: #005a24;
  stroke-width: 2;
}

.station-group.is-goal .station-dot {
  fill: var(--player);
  stroke: #9c1a16;
  stroke-width: 2;
}

.station-group.is-hinted .station-dot {
  fill: #ffce00;
  stroke: #8a6d00;
  stroke-width: 2;
}

.player-route {
  stroke: var(--player);
  stroke-width: 5;
  stroke-linecap: round;
  fill: none;
}

.optimal-route {
  stroke: var(--optimal);
  stroke-width: 11;
  stroke-linecap: butt;
  stroke-dasharray: 3 7;
  opacity: 0.85;
  fill: none;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  flex-wrap: wrap;
}

.zoom-slider {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.zoom-slider input {
  width: 100%;
  accent-color: var(--tfl-blue);
}

.zoom-readout {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 0.8rem;
  min-width: 3.5rem;
}

.side-heading {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.error {
  color: #8c1512;
  background: #fdeaea;
  border-left: 5px solid var(--player);
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  border-radius: 0 2px 2px 0;
  animation: nudge var(--medium) var(--ease);
}

@keyframes nudge {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
}

.route-so-far {
  font-size: 0.9rem;
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}

.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.legend-wrap {
  margin-top: 1.25rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.35rem;
}

.legend-wrap summary {
  cursor: pointer;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.legend-hint {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  background: none;
  padding: 0.2rem 0.25rem;
  text-align: left;
  font-size: 0.82rem;
  min-height: 44px;
  transition: opacity var(--fast) var(--ease);
}

.legend-item[aria-pressed='false'] {
  opacity: 0.35;
  text-decoration: line-through;
}

.legend-swatch {
  width: 1.4rem;
  height: 0.35rem;
  border-radius: 3px;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.final-score {
  margin: 0 0 1rem;
}

.final-score-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.final-score strong {
  font-size: 3rem;
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.05;
  color: var(--tfl-blue);
}

.route-key {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.route-key-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.route-key-swatch {
  width: 1.6rem;
  height: 0.3rem;
  border-radius: 3px;
  flex: none;
}

.route-key-swatch.is-player {
  background: var(--player);
}

.route-key-swatch.is-optimal {
  background: repeating-linear-gradient(to right, var(--optimal) 0 3px, transparent 3px 10px);
  height: 0.55rem;
}

.floored-note,
.empty-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.explanation {
  max-width: 52ch;
  font-size: 1rem;
  border-left: 5px solid var(--tfl-blue);
  padding: 0.5rem 0 0.5rem 0.8rem;
  margin: 1rem 0 1.25rem;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 40rem;
}

th,
td {
  border-bottom: 1px solid var(--rule);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-size: 0.88rem;
}

td {
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  padding-bottom: 0.4rem;
}

thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom-color: var(--rule-strong);
}

.breakdown-total th,
.breakdown-total td {
  font-weight: 600;
  border-top: 2px solid var(--ink);
  font-size: 1rem;
}

.leaderboard tr.is-best {
  background: #fff6d6;
}

.leaderboard tr.is-best td,
.leaderboard tr.is-best th {
  font-weight: 600;
}

.mode-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.mode-tabs button {
  border-color: transparent;
  border-bottom-color: var(--rule);
}

.mode-tabs button[aria-selected='true'] {
  border-bottom-color: var(--tfl-blue);
  color: var(--tfl-blue);
  font-weight: 600;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.settings-overlay[hidden] {
  display: none;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 28, 0.55);
  animation: fade var(--medium) var(--ease);
}

.settings-modal {
  position: relative;
  background: var(--paper);
  border-top: 5px solid var(--tfl-blue);
  border-radius: 2px;
  padding: 1.25rem;
  width: min(28rem, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(16, 20, 28, 0.3);
  animation: rise var(--medium) var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.settings-head h2 {
  margin: 0;
}

.setting {
  margin-top: 1.25rem;
}

.setting label,
.setting-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.setting-row input[type='range'] {
  flex: 1;
  min-width: 0;
  accent-color: var(--tfl-blue);
}

.setting-row output {
  font-variant-numeric: tabular-nums;
  min-width: 3.5rem;
  text-align: right;
}

.setting-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0.35rem 0 0;
}

.settings-foot {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.app-error {
  margin: 0;
  padding: 0.65rem 1.25rem;
  background: #fdeaea;
  border-bottom: 3px solid var(--player);
  color: #8c1512;
  font-weight: 600;
  font-size: 0.9rem;
}

.offline-banner {
  margin: 0;
  padding: 0.65rem 1.25rem;
  background: #fff4d6;
  border-bottom: 3px solid #b58100;
  color: #5c4200;
  font-size: 0.9rem;
}

.screen:not([hidden]) {
  animation: screen-in var(--medium) var(--ease);
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.attribution {
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--rule);
  background: var(--panel);
  font-size: 0.75rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:root[data-tier='phone'] .topbar {
  padding: 0.5rem 0.9rem;
}

:root[data-tier='phone'] main {
  padding: 0.9rem;
}

:root[data-tier='phone'] .lede {
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

:root[data-tier='phone'] .hud {
  gap: 1rem;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
}

:root[data-tier='phone'] .hud-value {
  font-size: 1.25rem;
}

:root[data-tier='phone'] .choice-grid {
  grid-template-columns: 1fr;
}

:root[data-tier='phone'] .final-score strong {
  font-size: 2.4rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.map-container {
  position: relative;
}

.station-fact {
  position: absolute;
  z-index: 5;
  max-width: min(24rem, calc(100% - 1rem));
  padding: 0.55rem 2rem 0.6rem 0.7rem;
  background: var(--board);
  color: #f4f1e8;
  border-radius: 2px;
  border-left: 3px solid var(--board-text);
  box-shadow: 0 6px 18px rgb(16 20 28 / 28%);
  font-size: 0.82rem;
  line-height: 1.45;
  animation: fact-in var(--fast) var(--ease);
  pointer-events: none;
}

.station-fact-name {
  display: block;
  color: var(--board-text);
  letter-spacing: 0.02em;
  font-size: 0.8rem;
}

.station-fact-text {
  display: block;
  margin-top: 0.15rem;
  color: #ddd8cb;
}

.station-fact-close {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--board-dim);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.station-fact-close:hover {
  color: #f4f1e8;
}

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

.edge.is-dimmed {
  opacity: 0.1;
  transition: opacity var(--medium) var(--ease);
}

.station-group.is-dimmed .station-dot,
.station.is-dimmed {
  opacity: 0.18;
  transition: opacity var(--medium) var(--ease);
}

#line-focus {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
}

.focus-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

#line-focus-select {
  width: 100%;
  min-height: 44px;
  padding: 0 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.optional-tag {
  margin-left: 0.4rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  vertical-align: middle;
}

.modifier-note {
  margin-top: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid var(--optimal);
  background: var(--panel);
  font-size: 0.85rem;
}

.hud-best .hud-value {
  font-size: 0.85em;
  color: var(--board-dim);
}

.pb-callout {
  margin-top: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--board-text);
  background: var(--board);
  color: var(--board-text);
  font-size: 0.87rem;
  letter-spacing: 0.01em;
}

.realworld {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}

.realworld h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.realworld-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0.2rem 0;
  font-size: 0.92rem;
}

.realworld-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.realworld-delta {
  margin-top: 0.45rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.wordmark-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.3rem;
  margin: -0.2rem -0.3rem;
  background: none;
  border: 0;
  border-radius: 2px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}

.wordmark-button:hover .wordmark-text {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wordmark-button:focus-visible {
  outline: 3px solid var(--board-text);
  outline-offset: 2px;
}

.endpoint-key {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: baseline;
}

.endpoint-key-start { background: var(--optimal); }
.endpoint-key-goal  { background: var(--player); }

.endpoint-label {
  font-weight: 700;
  letter-spacing: 0.06em;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-linejoin: round;
  pointer-events: none;
}

.endpoint-label.is-start { fill: #005a24; }
.endpoint-label.is-goal  { fill: #9c1a16; }

.station-group.is-start .station-dot,
.station-group.is-goal .station-dot {
  stroke-width: 2.5;
}

.station-group.is-line-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--medium) var(--ease);
}

.station-chooser {
  position: absolute;
  z-index: 6;
  min-width: 11rem;
  max-width: min(18rem, calc(100% - 1rem));
  padding: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  box-shadow: 0 8px 22px rgb(16 20 28 / 22%);
  animation: chooser-in var(--fast) var(--ease);
}

.station-chooser-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.station-chooser-option,
.station-chooser-cancel {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 0.6rem;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.station-chooser-option + .station-chooser-option,
.station-chooser-cancel {
  margin-top: 0.3rem;
}

.station-chooser-option:hover {
  background: var(--tfl-blue);
  border-color: var(--tfl-blue);
  color: #fff;
}

.station-chooser-cancel {
  background: none;
  border-style: dashed;
  color: var(--ink-soft);
  text-align: center;
}

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

.controls .quiet {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}

.controls .quiet:hover {
  border-color: var(--tfl-red);
  color: var(--tfl-red);
}

.replay-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
}

.replay-tracks {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.replay-tracks legend {
  float: left;
  margin-right: 0.6rem;
  padding: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.replay-tracks label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.replay-speed {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.replay-speed output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0;
}

#replay-speed {
  flex: 1 1 8rem;
  min-width: 7rem;
}

:root[data-tier='phone'] .replay-controls {
  flex-direction: column;
  align-items: stretch;
}

.field-hint {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.name-input {
  width: min(22rem, 100%);
  min-height: 44px;
  padding: 0 0.7rem;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

.name-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.field-heading {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.5rem 0 0.6rem;
  cursor: pointer;
}

.challenge-create {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}

.challenge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.rounds-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

#challenge-rounds {
  min-height: 44px;
  padding: 0 0.6rem;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink);
  font: inherit;
}

.link-box {
  margin-top: 0.9rem;
  padding: 0.8rem;
  background: var(--panel);
  border-left: 3px solid var(--tfl-blue);
}

.link-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.link-row {
  display: flex;
  gap: 0.5rem;
}

.link-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.6rem;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-soft);
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.link-status {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: var(--optimal);
  min-height: 1.1em;
}

.challenge-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}

.challenge-meta { margin: 0; }

.challenge-deadline {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.deadline-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.compare-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.compare-table caption {
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
}

.compare-table th,
.compare-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  text-align: right;
}

.compare-table thead th,
.compare-table tbody th {
  text-align: left;
  font-weight: 600;
}

.compare-table tbody tr.is-my-round td:nth-child(2) {
  font-weight: 700;
  color: var(--optimal);
  box-shadow: inset 3px 0 0 var(--optimal);
}

.compare-table tbody tr.is-their-round td:nth-child(3) {
  font-weight: 700;
  color: var(--tfl-red);
  box-shadow: inset 3px 0 0 var(--tfl-red);
}

.compare-total th,
.compare-total td {
  border-top: 2px solid var(--rule-strong);
  border-bottom: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.compare-verdict {
  margin-top: 0.9rem;
  padding: 0.6rem 0.75rem;
  background: var(--board);
  border-left: 3px solid var(--board-text);
  color: var(--board-text);
  font-size: 0.9rem;
}

:root[data-tier='phone'] .challenge-summary {
  flex-direction: column;
  align-items: flex-start;
}
