:root {
  --bg-primary: #000000; /* black = transparent on the additive display */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #707080;
  --accent-primary: #00d4ff;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --ok: #00ff88;
  --warn: #ffaa00;
  --down: #ff4466;
  --info: #00d4ff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
button { color: inherit; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg-primary); color: var(--text-primary); width: 600px; height: 600px; overflow: hidden; }
#app { width: 100%; height: 100%; position: relative; }

.screen { width: 100%; height: 100%; display: flex; flex-direction: column; position: absolute; top: 0; left: 0; }
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* Header */
.header { display: flex; align-items: center; padding: 14px 20px; background: var(--bg-secondary); gap: 12px; flex-shrink: 0; }
.header h1 { font-size: 24px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-meta { font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
#board-updated { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.back-btn { background: transparent; color: var(--text-primary); font-size: 22px; padding: 8px 10px; border-radius: var(--radius-sm); border: 2px solid transparent; }

/* Status pill */
.status-pill { padding: 4px 12px; border-radius: 20px; font-weight: 700; background: rgba(255,170,0,.16); color: var(--warn); }
.status-pill.lvl-ok { background: rgba(0,255,136,.16); color: var(--ok); }
.status-pill.lvl-warn { background: rgba(255,170,0,.18); color: var(--warn); }
.status-pill.lvl-down { background: rgba(255,68,102,.20); color: var(--down); }
.status-pill.lvl-info { background: rgba(0,212,255,.16); color: var(--info); }

/* Tabs (Maison <-> Travail), switched by Left/Right swipe */
.tabs { display: flex; gap: 8px; padding: 2px 16px 10px; background: var(--bg-secondary); flex-shrink: 0; }
.tab { flex: 1; text-align: center; padding: 9px 6px; border-radius: var(--radius-md); background: var(--bg-tertiary); color: var(--text-secondary); font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: rgba(0, 212, 255, 0.18); color: var(--accent-primary); box-shadow: inset 0 -3px 0 var(--accent-primary); }

/* Content */
/* min-height:0 lets this flex child shrink below its content and actually
   scroll (instead of overflowing the 600px screen and getting clipped). */
.content { flex: 1; min-height: 0; padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
/* Board = 2-col grid: multi-trip cards span the full width, single-trip cards
   take one column so two of them sit side by side. */
/* align-items/grid-auto-rows: cards keep their natural content height and are
   never squashed by the grid distributing the container height across rows. */
.board-content { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; align-items: start; grid-auto-rows: auto; }
.line-card.full { grid-column: 1 / -1; }
.loading { color: var(--text-muted); font-size: 16px; padding: 18px 4px; text-align: center; }

/* Focus */
.focusable { transition: border-color .12s ease, box-shadow .12s ease, background .12s ease; border: 2px solid transparent; cursor: pointer; min-height: 44px; }
.focusable:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }

/* Nav bar */
.nav-bar { display: flex; gap: 8px; padding: 12px 18px; background: var(--bg-secondary); flex-shrink: 0; }
.nav-item { flex: 1; padding: 14px 10px; background: var(--bg-tertiary); border-radius: var(--radius-md); color: var(--text-primary); font-size: 15px; font-weight: 500; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nav-item:focus { background: var(--bg-card); }

/* Line badge (Citymapper style) */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px; font-weight: 800; font-size: 22px; flex-shrink: 0; }
.badge.mode-rail, .badge.mode-metro { border-radius: 50%; }

/* ===== Board: one card per line, a sub-row per watch (stop -> direction) ===== */
/* flex-shrink:0 so a card keeps its natural height (per number of watch rows)
   instead of being squashed by the column flex container -> the board scrolls. */
.line-card { display: flex; flex-direction: column; gap: 9px; width: 100%; padding: 12px 14px; background: var(--bg-tertiary); border-radius: var(--radius-md); text-align: left; border-left: 5px solid transparent; flex-shrink: 0; }
.line-card.lvl-warn { border-left-color: var(--warn); }
.line-card.lvl-down { border-left-color: var(--down); }
.lc-head { display: flex; align-items: center; gap: 10px; }
.lc-head .badge { min-width: 36px; height: 36px; font-size: 17px; }
.lc-name { flex: 1; font-size: 18px; font-weight: 700; }
/* Trips laid out as columns inside the card (trip on top, next times below).
   Single-trip card = 1 column; multi-trip (wide) card = 2 columns. */
.lc-watches { display: grid; grid-template-columns: 1fr; gap: 10px 14px; }
.line-card.multi .lc-watches { grid-template-columns: 1fr 1fr; }
.trip-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tc-route { font-size: 15px; color: var(--text-primary); line-height: 1.3; }
.tc-times { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.tc-times .u { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.tc-times.none { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.watch { display: flex; align-items: baseline; gap: 10px; }
.w-where { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-stop { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.w-arr { color: var(--text-muted); }
.w-label { font-size: 14px; color: var(--text-secondary); }
.w-deps { flex-shrink: 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.w-deps .u { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.w-deps.none { font-size: 16px; font-weight: 600; color: var(--text-muted); }
.dot { width: 13px; height: 13px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.dot.lvl-warn { background: var(--warn); } .dot.lvl-down { background: var(--down); } .dot.lvl-info { background: var(--info); } .dot.lvl-ok { background: var(--ok); }

/* ===== Line detail ===== */
.stop-bar { display: flex; align-items: baseline; gap: 10px; background: var(--bg-card); border-radius: var(--radius-md); padding: 12px 16px; }
.stop-label { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.stop-name { font-size: 20px; font-weight: 700; flex: 1; }
.stop-dist { font-size: 13px; color: var(--text-muted); }

.disruption { border-radius: var(--radius-md); padding: 12px 16px; font-size: 15px; line-height: 1.4; }
.disruption.lvl-warn { background: rgba(255,170,0,.14); border: 1px solid rgba(255,170,0,.4); }
.disruption.lvl-down { background: rgba(255,68,102,.16); border: 1px solid rgba(255,68,102,.45); }
.disruption.lvl-info { background: rgba(0,212,255,.12); border: 1px solid rgba(0,212,255,.35); }
.disruption .dz-title { font-weight: 800; margin-bottom: 6px; }
.disruption .dz-msg { color: var(--text-secondary); margin-top: 6px; }

.departures { display: flex; flex-direction: column; gap: 12px; }
.dep-group { background: var(--bg-card); border-radius: var(--radius-md); padding: 12px 14px; flex-shrink: 0; }
.dep-group .dg-dest { margin-bottom: 8px; }
.dg-stop { font-size: 17px; font-weight: 700; }
.dg-label { font-size: 14px; color: var(--text-secondary); }
.dep-none { color: var(--text-muted); font-size: 15px; }
.dep-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--bg-card); border-radius: 10px; padding: 8px 14px; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chip .u { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-left: 3px; }
.chip.soon { color: var(--ok); }
.chip.cancelled { color: var(--down); text-decoration: line-through; }

/* Toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-120px); background: var(--bg-card); color: var(--text-primary); padding: 12px 24px; border-radius: 24px; font-size: 15px; border: 1px solid var(--accent-primary); transition: transform .3s ease; z-index: 100; pointer-events: none; max-width: 80%; text-align: center; }
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--down); }
