/* A calm overlay for a TV across the room or an iPad in the hand. The scene fills the screen; text
   floats over it on soft shades, sheets are rounded and translucent like the system's own, and the
   focused control grows and turns bright, as on tvOS and Google TV. One accent colour per venue,
   used sparingly; everything else is white at a few levels of brightness. */
:root {
  --accent: #ffd100; --on-accent: #0b0d0e;
  --text: #f5f5f2; --dim: rgba(245, 245, 242, 0.62); --faint: rgba(245, 245, 242, 0.38); --rule: rgba(255, 255, 255, 0.08);
  --sheet: rgba(16, 18, 20, 0.66); --sheet-edge: rgba(255, 255, 255, 0.09); --lift: rgba(255, 255, 255, 0.1);
  --panel: var(--sheet);
  --late: #ff8a6b; --runway: rgba(44, 50, 52, 0.75);
  --sans: "Geist", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --narrow: var(--sans);
  --edge: max(1.2rem, 3.2vmin);
  --top: max(var(--edge), env(safe-area-inset-top));
  --bottom: max(var(--edge), env(safe-area-inset-bottom));
  --left: max(var(--edge), env(safe-area-inset-left));
  --right: max(var(--edge), env(safe-area-inset-right));
  --tap: max(44px, 2.8rem);
  --radius: 1.6rem;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --material: blur(28px) saturate(1.6);
  font: 400 clamp(15px, 0.5vw + 9px, 30px)/1.3 var(--sans);
  font-feature-settings: "tnum", "ss01";
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #0b0d0e; -webkit-tap-highlight-color: transparent; }
body { -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, summary { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus { outline: none; }

#scene { z-index: 0; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
/* Soft shades at the top and bottom keep text readable over any part of the scene. */
#app::before, #app::after { content: ''; position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; }
/* Everything over the scene sits above the shades. */
#app > :where(:not(#scene)) { z-index: 2; }
#app::before { top: 0; height: 34%; background: linear-gradient(rgba(5, 7, 8, 0.62), rgba(5, 7, 8, 0.25) 55%, transparent); }
#app::after { bottom: 0; height: 28%; background: linear-gradient(transparent, rgba(5, 7, 8, 0.6)); }

/* Sheets: rounded translucent material, no hard borders. */
.panel { position: absolute; background: var(--sheet); color: var(--text); border-radius: var(--radius);
  backdrop-filter: var(--material); -webkit-backdrop-filter: var(--material); box-shadow: inset 0 0 0 1px var(--sheet-edge), 0 1.5rem 3rem rgba(0, 0, 0, 0.35); }
.sign { min-height: var(--tap); padding: 0 1.3em; border-radius: 999px; background: var(--text); color: #0b0d0e; font-weight: 600; transition: transform 0.2s var(--ease); }
/* Focus, as on a TV: the control grows a little and turns bright. */
button:focus-visible, summary:focus-visible, [role=button]:focus-visible { background: var(--text) !important; color: #0b0d0e !important; transform: scale(1.06); box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.45); }

/* The venue at a glance, floating over the shade. */
#identity { position: absolute; left: var(--left); top: var(--top); pointer-events: none; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35); }
#identity h1 { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); pointer-events: auto; }
#identity h1.switch { display: inline-flex; align-items: center; gap: 0.5rem; min-height: var(--tap); margin: -0.8rem -0.8rem -0.6rem; padding: 0 0.8rem; border-radius: 999px; cursor: pointer; transition: transform 0.2s var(--ease); }
#identity h1.switch::after { content: ''; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-0.15em); }
#identity .now { display: flex; align-items: baseline; gap: 1rem; margin-top: 0.2rem; }
#clock { font-size: 4.4rem; font-weight: 250; line-height: 1; letter-spacing: -0.04em; }
#weather { font-size: 1.05rem; color: var(--dim); font-weight: 400; }
#people { margin-top: 0.9rem; font-size: 1rem; color: var(--dim); }
#people b { font-size: 1.7rem; font-weight: 300; color: var(--text); margin-right: 0.45rem; letter-spacing: -0.02em; }
#people small { margin-left: 0.5rem; padding: 0.1em 0.5em; border-radius: 999px; background: var(--lift); font-size: 0.68rem; color: var(--dim); letter-spacing: 0.04em; }
#runways { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.8rem; font-size: 0.85rem; color: var(--dim); }
#runways b { margin: 0 0.15rem 0 0.6rem; font-weight: 400; }
#runways b:first-child { margin-left: 0; }
#runways span { padding: 0.15em 0.55em; border-radius: 0.5em; background: var(--runway); color: #fff; font-weight: 600; font-size: 0.82rem; }
#status { margin-top: 0.6rem; font-size: 0.85rem; color: var(--late); }

#venues { left: var(--left); top: calc(var(--top) + 2.6rem); min-width: 18rem; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.2rem; }
#venues { max-height: calc(100dvh - var(--top) - var(--bottom) - 4rem); overflow-y: auto; }
#venues button { flex-shrink: 0; }
#app > .city-marker { position: absolute; z-index: 1; transform: translate(-50%, -100%); border-radius: 1rem; padding: 0.4rem 0.8rem; background: var(--sheet); color: var(--text); }
#venues button { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; min-height: var(--tap); padding: 0 1rem; border-radius: 1rem; text-align: left; font-size: 1rem; transition: transform 0.2s var(--ease); }
.beta-tag { font-size: .72rem; font-weight: 600; padding: .12em .5em; border: 1px solid currentColor; border-radius: .4em; }
#venues button[aria-current=true] { background: var(--lift); font-weight: 600; }

/* The board: a sheet on the right with a segmented control for its pages. */
#board { right: var(--right); top: var(--top); width: min(30rem, 34vw); max-height: calc(100% - var(--top) - var(--bottom) - 5.5rem); display: flex; flex-direction: column; overflow: hidden; padding: 0.6rem; animation: sheet-in 0.4s var(--ease) both; }
#board-tabs { display: flex; gap: 0.2rem; padding: 0.25rem; margin: 0.2rem 0.2rem 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
#board-tabs button { flex: 1; min-height: calc(var(--tap) - 0.4rem); padding: 0 0.8rem; border-radius: 999px; font-size: 0.9rem; font-weight: 500; color: var(--dim); transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.2s var(--ease); }
#board-tabs button[aria-selected=true] { background: rgba(255, 255, 255, 0.16); color: var(--text); }
#board-body { overflow: auto; overscroll-behavior: contain; padding: 0 0 0.4rem; }
#board h3 { display: flex; justify-content: space-between; margin: 1rem 0.9rem 0.3rem; font-size: 0.72rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; }
.row { display: grid; grid-template-columns: 3.8rem 1fr auto; gap: 0 0.9rem; align-items: baseline; width: 100%; min-height: var(--tap); padding: 0.55rem 0.9rem;
  border-radius: 1rem; text-align: left; font-size: 1.05rem; transition: background 0.2s var(--ease), transform 0.2s var(--ease); }
.row.no-end b, .row.no-end small { grid-column: 2 / -1; }
.row.fresh { animation: row-in 0.45s var(--ease) both; }
.row .t { font-weight: 400; color: var(--dim); }
.row b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row small { grid-column: 2 / 4; margin-top: 0.1rem; font-size: 0.8rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; color: var(--dim); }
.row .end.strong { color: var(--text); font-weight: 500; }
.row .late { color: var(--late); }
.row.gone { color: var(--faint); }
.row.gone b { text-decoration: line-through; }
.row .line { justify-self: start; min-width: 2.6rem; padding: 0.1rem 0.45rem; border-radius: 0.5rem; font-weight: 600; text-align: center; color: #fff; }
button.row:disabled { cursor: default; }
#board-note { padding: 0.5rem 0.9rem 0.4rem; font-size: 0.75rem; color: var(--faint); }
#board-note:empty { display: none; }
@media (hover: hover) { button.row:enabled:hover, #venues button:hover, #controls button:hover { background: var(--lift); } }

/* Today: big figures, each with one small chart. Take-offs in the accent, landings in white, late in the warning colour. */
.today { padding-bottom: 0.4rem; }
.today h3 .legend { display: flex; align-items: center; gap: 0.4rem; text-transform: none; letter-spacing: 0; }
.today h3 .legend i { width: 0.6rem; height: 0.6rem; border-radius: 1px; background: var(--text); }
.today h3 .legend i.up { background: var(--accent); }
.today h3 .legend i + i { margin-left: 0.5rem; }
.today .figures { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; padding: 0.1rem 1.1rem 0.5rem; }
.today .figure { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: baseline; column-gap: 0.5rem; }
.today .figure b { font-size: 3rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.today .figure span { font-size: 0.95rem; color: var(--dim); }
.today .figure small { grid-column: 1 / 3; margin-top: 0.25rem; font: 400 0.85rem var(--narrow); color: var(--dim); }
.today .chart { padding: 0.2rem 1.1rem 0.4rem; }
.today .bars { display: flex; gap: 2px; align-items: stretch; height: 4.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.35); }
.today .bars.small { height: 2.2rem; }
.today .bars span { flex: 1; display: flex; flex-direction: column-reverse; }
.today .bars span.missing { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 5px) bottom / 100% 2px no-repeat; }
.today .bars i { display: block; flex: none; background: var(--text); }
.today .bars i.up { background: var(--accent); }
.today .bars i.late { background: var(--late); }
.today .bars i.gone { background: var(--late); opacity: 0.45; }
.today .bars i.dim { background: var(--dim); }
.today .axis { display: flex; gap: 2px; margin-top: 0.2rem; font: 400 0.7rem var(--narrow); color: var(--dim); }
.today .axis span { flex: 1; white-space: nowrap; }
.today .chips { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; padding: 0.2rem 1.1rem 0.5rem; font: 600 1.6rem var(--narrow); }
.today .chip { display: inline-flex; align-items: center; gap: 0.45rem; }
/* The runway designator as a holding sign, white on red, as in the corner. */
.today .chip b { padding: 0.05em 0.35em; border-radius: 2px; background: var(--runway); color: #fff; font-size: 0.75em; letter-spacing: 0.02em; }
.today-wait { padding: 1rem 1.1rem; color: var(--dim); }

/* The selected aircraft or train. */
#inspector { left: var(--left); top: calc(var(--top) + 12rem); width: min(24rem, calc(100% - var(--left) - var(--right))); padding: 1.3rem 1.4rem; animation: sheet-in 0.4s var(--ease) both; }
#inspector header { display: flex; gap: 0.9rem; align-items: flex-start; }
#inspector header div { flex: 1; min-width: 0; }
#swatch { width: 0.35rem; align-self: stretch; border-radius: 999px; background: #888; }
#inspector h2 { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
#airline { margin-top: 0.25rem; font-size: 0.9rem; color: var(--dim); }
#close { width: var(--tap); height: var(--tap); margin: -0.6rem -0.6rem 0 0; border-radius: 999px; background: var(--lift); color: var(--dim); font-size: 0.9rem; transition: transform 0.2s var(--ease); }
#route { margin-top: 1rem; font-size: 1.1rem; font-weight: 500; }
#route:empty { display: none; }
#figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.9rem 1rem; margin-top: 1.1rem; }
#figures div { display: flex; flex-direction: column-reverse; }
#figures dt { margin-top: 0.15rem; font-size: 0.72rem; color: var(--faint); }
#figures dd { font-size: 1.6rem; font-weight: 300; line-height: 1.1; letter-spacing: -0.02em; }
#figures dd small { font-size: 0.6em; color: var(--dim); margin-left: 0.2em; letter-spacing: 0; }
#readings { margin-top: 1rem; font-size: 0.85rem; }
#readings summary { min-height: var(--tap); display: flex; align-items: center; padding: 0 0.8rem; margin: 0 -0.8rem; border-radius: 1rem; color: var(--dim); cursor: pointer; list-style: none; }
#flight-fields { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; padding-top: 0.3rem; }
#flight-fields dt { color: var(--faint); }
#inspector footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2rem; }
#kind { font-size: 0.72rem; color: var(--faint); }
#follow[aria-pressed=true] { background: var(--lift); color: var(--text); }

/* Watch mode: the aircraft's name in large type over the bottom shade, no box. */
#caption { position: absolute; left: var(--left); bottom: calc(var(--bottom) + 4.5rem); display: grid; grid-template-columns: auto auto; column-gap: 1.2rem; align-items: baseline;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45); animation: rise 0.6s var(--ease) both; }
#caption .tag { grid-column: 1 / 3; display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
#caption .tag::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0.8rem currentColor; animation: pulse 2s ease-in-out infinite; }
#caption .title { font-size: 3.2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
#caption .figures { font-size: 1.5rem; font-weight: 300; color: var(--dim); }
#caption .meta { grid-column: 1 / 3; margin-top: 0.4rem; font-size: 1rem; color: var(--dim); }

/* The pulse: the last hour left of now, the next hour right of it. */
#pulse { position: absolute; left: var(--left); right: var(--right); bottom: var(--bottom); height: 3rem; display: grid; grid-template-columns: auto 1fr auto; gap: 1.6rem; align-items: center; pointer-events: none; }
#pulse .side { font-size: 1rem; font-weight: 500; white-space: nowrap; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
#pulse .side small { display: block; margin-top: 0.1rem; font-size: 0.72rem; font-weight: 400; color: var(--faint); }
#pulse .next { text-align: right; }
#pulse .track { position: relative; height: 100%; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
#pulse .track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255, 255, 255, 0.22); }
#pulse .now-mark { position: absolute; top: 10%; bottom: 10%; width: 2px; border-radius: 1px; background: var(--text); left: var(--now, 50%); box-shadow: 0 0 0.8rem rgba(255, 255, 255, 0.6); }
#pulse .tick { position: absolute; width: 3px; border-radius: 3px; transition: left 2s linear; animation: tick-in 0.7s var(--ease) both; }
#pulse .tick.up { bottom: calc(50% + 3px); height: 34%; background: var(--accent); }
#pulse .tick.down { top: calc(50% + 3px); height: 34%; background: var(--text); }
#pulse .tick.small { height: 18%; width: 2px; opacity: 0.5; }
#pulse .tick.late { background: var(--late); }
#pulse .tick.gone { opacity: 0.25; }

/* Controls: a floating bar, shown when the screen is touched or a remote key is pressed. */
#controls { position: absolute; left: 50%; bottom: calc(var(--bottom) + 4rem); transform: translate(-50%, 1rem) scale(0.98); display: flex; gap: 0.3rem; padding: 0.4rem;
  border-radius: 999px; background: var(--sheet); backdrop-filter: var(--material); -webkit-backdrop-filter: var(--material); box-shadow: inset 0 0 0 1px var(--sheet-edge), 0 1.5rem 3rem rgba(0, 0, 0, 0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); }
body.active #controls { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
#controls button { min-height: var(--tap); padding: 0 1.4rem; border-radius: 999px; font-size: 0.95rem; font-weight: 500; white-space: nowrap; transition: background 0.2s var(--ease), transform 0.2s var(--ease); }
#controls button[aria-pressed=true] { background: rgba(255, 255, 255, 0.18); }

#help { left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1.6rem 1.8rem; min-width: 24rem; }
#help h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; }
#help dl { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem 1.4rem; font-size: 0.95rem; }
#help dt { font-weight: 600; }
#help dd { color: var(--dim); }

/* Labels in the scene: small soft tags; the selected one bright. */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels span { position: absolute; left: 0; top: 0; padding: 0.15rem 0.45rem; border-radius: 0.45rem; background: rgba(12, 14, 16, 0.62); color: var(--text);
  font-size: 0.72rem; font-weight: 500; white-space: nowrap; will-change: transform; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#labels span.selected { background: var(--text); color: #0b0d0e; font-weight: 600; }
/* Inside: labels that read like the station's own signs. Platform numbers dark on white, as the
   focused controls; each train as a platform display, joined to its train by a short line. */
#labels .inside-train, #labels .inside-platform, #labels .inside-exit { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
#labels .inside-train { display: grid; grid-template-columns: auto auto auto; column-gap: 0.6rem; align-items: baseline; padding: 0.4rem 0.85rem 0.45rem 0.45rem;
  border-radius: 0.8rem; background: rgba(12, 14, 16, 0.74); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.inside-train .ref, .inside-platform b { display: grid; place-items: center; min-width: 2.1rem; height: 2.1rem; padding: 0 0.35rem; border-radius: 0.5rem;
  background: var(--text); color: #0b0d0e; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.inside-train .ref { grid-row: 1 / 3; align-self: center; }
.inside-train strong { grid-column: 2 / 4; font-size: 1.1rem; font-weight: 600; }
.inside-train small { grid-column: 2; font-size: 0.8rem; color: var(--dim); }
.inside-train small.late { grid-column: 3; color: var(--late); font-weight: 600; }
#labels .stem { position: absolute; left: 100%; top: 50%; height: 1.5px; background: rgba(255, 255, 255, 0.6); transform-origin: 0 50%; }
#labels .inside-platform .stem { left: 0; }
.inside-train.selected { background: var(--text); color: #0b0d0e; }
.inside-train.selected .ref { background: #0b0d0e; color: var(--text); }
.inside-train.selected small { color: rgba(11, 13, 14, 0.62); }
#labels .inside-platform b { box-shadow: 0 0.3rem 1rem rgba(0, 0, 0, 0.35); }
#labels .inside-exit { padding: 0.2rem 0.6rem; border-radius: 999px; background: rgba(12, 14, 16, 0.6); color: var(--dim); font-size: 0.8rem; font-weight: 600; }

#loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem;
  background: #0b0d0e; color: var(--dim); font-size: 0.9rem; letter-spacing: 0.14em; text-transform: uppercase; transition: opacity 0.6s var(--ease); }
#loading.done { opacity: 0; pointer-events: none; }
#loading b { width: min(16rem, 60vw); height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#loading i { display: block; width: 0; height: 100%; background: var(--text); transition: width 0.3s var(--ease); }
#load-actions { display: flex; gap: 1rem; align-items: center; text-transform: none; letter-spacing: 0; }
#load-actions a { color: var(--dim); }
.credit a { color:inherit; text-decoration:none; }
.credit { display:flex; gap:.55em; z-index:2; position: absolute; right: var(--right); bottom: 0.3rem; font-size: 0.6rem; color: var(--faint); text-decoration: none; }

@keyframes row-in { from { opacity: 0; transform: translateY(0.5rem); } }
@keyframes tick-in { from { opacity: 0; transform: scaleY(0.2); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(0.8rem) scale(0.985); } }
@keyframes rise { from { opacity: 0; transform: translateY(1.2rem); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* Narrow screens (iPad split view, phones): sheets rise from the bottom. */
@media (max-width: 820px) {
  #board, #inspector { left: var(--left); right: var(--right); width: auto; top: auto; bottom: calc(var(--bottom) + 7.5rem); max-height: 48%; }
  #clock { font-size: 3.2rem; }
  #caption .title { font-size: 2.2rem; }
  .credit { font-size:.5rem; }
}
/* TVs: wider margins against overscan. */
@media (min-width: 1700px) and (hover: none) { :root { --edge: 5vmin; } }

#stations { left: var(--left); bottom: calc(var(--bottom) + 4.2rem); width: min(26rem, calc(100% - 2 * var(--left))); padding: .65rem; }
#stations input { width: 100%; padding: .7rem; font: inherit; color: inherit; background: var(--lift); border: 0; border-radius: .5rem; }
.station-list { overflow: auto; max-height: min(48dvh, 26rem); margin: .45rem 0; overscroll-behavior: contain; }
.station-list button { display: flex; gap: 1rem; align-items: center; justify-content: space-between; text-align: left; width: 100%; min-height: var(--tap); padding: .45rem .7rem; }
.station-list button:hover, .station-list button:focus-visible { background: var(--lift); }
.station-list span, #stations small { font-size: .74rem; color: var(--faint); }


#app > .landmark-label { position: absolute; z-index: 1; transform: translate(-50%, -100%); pointer-events: none; font-size: .78rem; color: #fff; background: var(--sheet); padding: .2rem .45rem; border-radius: .3rem; }
