/* Crew Board app. iPhone first: system font, large titles, bottom tab bar, slides between tabs.
   Light and dark follow the phone. The motorway sign stays motorway blue in both. */
:root {
  --bg: #f2f3f7;
  --card: #ffffff;
  --card-line: #0000000f;
  --ink: #0d1016;
  --dim: #6b7280;
  --faint: #00000014;
  --tabbar: #f9f9fbd9;
  --tab-off: #8e8e93;
  --accent: #e8890c;      /* sodium amber, darkened for light mode contrast */
  --accent-ink: #ffffff;
  --go: #1f9d55;
  --warn: #d4461f;
  --sign: #0b4fa8;
  --sign-ink: #ffffff;
  --shadow: 0 1px 2px #0000000d, 0 6px 20px #0000000a;
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070a12;
    --card: #121826;
    --card-line: #ffffff14;
    --ink: #f1f4fa;
    --dim: #9eaabf;
    --faint: #ffffff1a;
    --tabbar: #0a0e16d9;
    --tab-off: #7d879a;
    --accent: #ffb04a;
    --accent-ink: #241400;
    --go: #45c97a;
    --warn: #ff7a59;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Panes slide sideways like a native tab pager */
.viewport { flex: 1; overflow: hidden; position: relative; }
.track { display: flex; height: 100%; width: 100%; transition: transform .42s cubic-bezier(.22, .9, .2, 1); will-change: transform; }
.track.dragging { transition: none; }
.pane {
  flex: 0 0 100%; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 16px;
}
.pane > * { width: 100%; max-width: 620px; margin-left: auto; margin-right: auto; }

.big-head { padding: 6px 4px 2px; }
.big-head h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: .01em; }
.kicker { margin: 0 0 2px; color: var(--dim); font-size: 15px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.card h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.card-h { font-size: 13px !important; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.fine { margin: 0; color: var(--dim); font-size: 14px; }
.fine:empty { display: none; }
.center { text-align: center; }

/* Motorway sign */
.sign { background: var(--sign); color: var(--sign-ink); border-radius: 16px; padding: 16px 18px 14px; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--sign), var(--shadow); display: grid; gap: 12px; margin-top: 3px; }
.sign-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sign-k { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.sign-dest { margin: 2px 0 0; font-size: 24px; font-weight: 800; line-height: 1.1; }
.sign-pct { font-size: 52px; line-height: .9; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sign-next { margin: 0; font-weight: 600; font-size: 16px; }
.road { --f: 0; position: relative; height: 30px; border-radius: 15px; background: #06274f; box-shadow: inset 0 0 0 2px #ffffff55; overflow: hidden; }
.road::before { content: ''; position: absolute; left: 16px; right: 16px; top: 50%; height: 3px; margin-top: -1.5px; background: repeating-linear-gradient(90deg, #fff 0 14px, transparent 14px 28px); opacity: .5; }
.road-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(19px + (100% - 38px) * var(--f)); background: linear-gradient(90deg, #ffb04a00, #ffb04a99); border-radius: 15px; transition: width 1.6s cubic-bezier(.2, .9, .1, 1); }
.car { position: absolute; top: 3px; left: calc((100% - 38px) * var(--f) + 2px); transition: left 1.6s cubic-bezier(.2, .9, .1, 1); filter: drop-shadow(8px 0 8px #ffb04a99); }
.car svg { display: block; }

/* Buzz card */
.buzz-row { display: flex; gap: 14px; align-items: center; }
.buzz-ico { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.buzz.on .buzz-ico { background: color-mix(in srgb, var(--go) 18%, transparent); color: var(--go); }
.buzz.err .buzz-ico { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.buzz-tx { min-width: 0; }
.buzz-tx p { margin: 2px 0 0; color: var(--dim); font-size: 15px; }

.btn { border: 0; border-radius: 14px; min-height: 50px; padding: 12px 18px; font-weight: 700; font-size: 17px; cursor: pointer; transition: transform .12s ease, opacity .2s; touch-action: manipulation; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; }
.btn.quiet { background: transparent; color: var(--dim); min-height: 44px; font-weight: 600; font-size: 15px; padding: 8px; }

/* Install steps */
.install { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; font-size: 16px; }
.steps .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--sign); color: #fff; font-weight: 800; font-size: 14px; }
.inl { vertical-align: -3px; color: #0a84ff; }

.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.next-list li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; font-size: 16px; }
.next-list i { font-style: normal; color: var(--dim); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--faint); margin-top: 4px; }
.dot.done { background: var(--go); border-color: var(--go); }
.dot.now { border-color: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); } }

/* Lanes */
.lanes { display: grid; gap: 12px; }
.lane-card { --hue: #ffb04a; position: relative; display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: linear-gradient(180deg, color-mix(in srgb, var(--hue) 14%, transparent), transparent 70%), var(--card); border: 1px solid color-mix(in srgb, var(--hue) 40%, var(--card-line)); box-shadow: var(--shadow); }
.lane-card.later { opacity: .6; }
.l-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.l-top b { font-size: 22px; font-weight: 800; }
.l-pct { font-size: 26px; font-weight: 800; color: var(--hue); font-variant-numeric: tabular-nums; }
.l-note { margin: 0; color: var(--dim); font-size: 15px; }
.segs { display: flex; gap: 4px; height: 8px; }
.seg { flex: 1; border-radius: 4px; background: var(--faint); }
.seg.done { background: var(--hue); }
.seg.now { background: var(--hue); animation: segp 1.2s ease-in-out infinite; }
@keyframes segp { 50% { opacity: .3; } }

/* To-do empty state */
.empty { text-align: center; justify-items: center; padding: 28px 20px; }
.empty p { margin: 0; color: var(--dim); }
.empty-ico { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: color-mix(in srgb, var(--go) 16%, transparent); color: var(--go); }

/* Crew */
.crew { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.crew li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 11px 16px; min-height: 64px; }
.crew li + li { box-shadow: inset 72px 1px 0 -71px var(--faint); border-top: 1px solid var(--faint); }
.av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #0a0e16; background: radial-gradient(circle at 35% 30%, #ffffff8c, transparent 50%), var(--av, #9eaabf); }
.crew b { display: block; font-size: 17px; }
.crew small { display: block; color: var(--dim); font-size: 14px; }

/* Bottom tab bar */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--tabbar); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border-top: .5px solid var(--faint);
}
.tab { flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 4px 0; border: 0; background: none; color: var(--tab-off); cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: .01em; touch-action: manipulation; }
.tab svg { transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: scale(1.08); }
.tab:active svg { transform: scale(.88); }

.toast { position: absolute; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 20; margin: 0 auto; max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; box-shadow: 0 10px 30px #0005; animation: up .35s cubic-bezier(.2, .9, .2, 1); }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .track, .road-fill, .car, .tab svg { transition: none; }
  .dot.now, .seg.now, .toast { animation: none; }
}
