/* Layout: night-at-the-strip console. Lane (portrait canvas + tree + pedals) on the left,
   crew panel (timeslip / garage / board) on the right; one column with tabs on phones. */
:root {
  color-scheme: dark;
  --asphalt: #0b0d10;
  --pit: #13161b;
  --raised: #1b1f26;
  --rule: #2a303a;
  --fg: #ece8df;
  --muted: #8e95a2;
  --amber: #ffb31a;
  --go: #3ddc6a;
  --stop: #ff4a36;
  --ghost: #4cc3ff;
  --paper: #f1ede2;
  --paper-ink: #1c1b18;
  --paper-rule: #cfc8b6;
  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
html, body { height: 100%; }
body { background: var(--asphalt); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.4; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.app { height: 100%; display: flex; flex-direction: column; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
header.top { display: flex; align-items: center; gap: 12px; padding-block: 8px; flex-wrap: wrap; }
.logo { font-family: var(--f-display); font-weight: 900; font-style: italic; font-size: 30px; letter-spacing: 0.01em; line-height: 1; color: var(--amber); text-shadow: 0 0 18px rgba(255,179,26,.25); }
.logo small { font-family: var(--f-body); font-style: normal; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: .12em; margin-left: 6px; text-transform: uppercase; }
.dayChip { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dayChip b { color: var(--fg); font-weight: 600; }
.iconBtn { background: var(--raised); border: 1px solid var(--rule); border-radius: 6px; padding: 4px 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; color: var(--muted); }
.iconBtn[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }

.main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 14px; padding-bottom: 10px; }
.laneCol { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.panelCol { min-height: 0; display: flex; flex-direction: column; min-width: 0; }
nav.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); }
nav.tabs button { background: none; border: 0; padding: 8px 14px 9px; font-family: var(--f-display); font-weight: 800; font-size: 17px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
nav.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--amber); }
nav.tabs .laneTab { display: none; }
.panel { flex: 1; min-height: 0; overflow-y: auto; padding-block: 14px; }

/* lane */
.laneWrap { position: relative; flex: 1; min-height: 300px; border-radius: 10px; overflow: hidden; background: #050607; border: 1px solid var(--rule); }
#lane { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 10px 12px; pointer-events: none; background: linear-gradient(transparent, rgba(5,6,7,.75)); }
.hud .spd { font-family: var(--f-display); font-weight: 800; font-size: 40px; line-height: .9; font-variant-numeric: tabular-nums; }
.hud .spd small, .hud .rpmBox small { font-family: var(--f-body); font-size: 11px; color: var(--muted); letter-spacing: .1em; display: block; text-transform: uppercase; }
.hud .rpmBox { text-align: right; font-family: var(--f-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.rpmBar { width: 120px; height: 6px; background: #22262d; border-radius: 3px; margin-top: 4px; overflow: hidden; margin-left: auto; }
.rpmBar i { display: block; height: 100%; width: 0; background: var(--amber); }
.shiftLight { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #3a2a10; margin-left: 6px; vertical-align: middle; }
.shiftLight.on { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

/* christmas tree */
.tree { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: #0e1013; border: 1px solid #2c3139; border-radius: 8px; padding: 6px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.6); }
.tree .lbl { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 9px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.bulbPair { display: flex; gap: 3px; justify-content: center; }
.bulb { width: 14px; height: 14px; border-radius: 50%; background: #2a2414; }
.bulb.small { width: 9px; height: 9px; background: #2b2a24; }
.bulb.small.on { background: #fff3c4; box-shadow: 0 0 8px #ffe9a0; }
.bulb.amber.on { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.bulb.green { background: #10291a; } .bulb.green.on { background: var(--go); box-shadow: 0 0 14px var(--go); }
.bulb.red { background: #2a1210; } .bulb.red.on { background: var(--stop); box-shadow: 0 0 14px var(--stop); }
.treeCol { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.status { min-height: 22px; font-size: 14px; color: var(--muted); text-align: center; }
.status b { color: var(--fg); }
.pedals { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.pedal { border: 0; border-radius: 10px; padding: 18px 10px; font-family: var(--f-display); font-weight: 900; font-size: 26px; letter-spacing: .08em; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; transition: transform .05s, filter .1s; }
.pedal.brake { background: #3a1613; color: #ffb4a8; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); }
.pedal.gas { background: #11361f; color: #a8f5bf; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); }
.pedal.down { transform: translateY(2px); filter: brightness(1.5); }
.keys { text-align: center; font-size: 12px; color: var(--muted); }
.keys kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--rule); border-radius: 4px; padding: 0 4px; }

/* timeslip */
.slipWrap { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.empty { color: var(--muted); padding: 24px 4px; max-width: 46ch; }
.empty h3 { font-family: var(--f-display); font-size: 24px; color: var(--fg); margin: 0 0 6px; letter-spacing: .03em; text-transform: uppercase; }
.receipt { background: var(--paper); color: var(--paper-ink); border-radius: 3px; padding: 16px 18px 18px; font-family: var(--f-mono); box-shadow: 0 10px 30px rgba(0,0,0,.45); position: relative; }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: linear-gradient(-45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 8px repeat-x, linear-gradient(45deg, transparent 6px, var(--paper) 0) 0 0 / 12px 8px repeat-x; }
.rHead { display: flex; justify-content: space-between; font-size: 11px; color: #6b665a; border-bottom: 1px dashed var(--paper-rule); padding-bottom: 8px; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.totals { display: grid; gap: 10px; margin-bottom: 8px; }
.totals.two { grid-template-columns: 1fr 1fr; }
.tot .lane { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6b665a; }
.tot .big { font-family: var(--f-display); font-weight: 900; font-size: 58px; line-height: .95; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tot .cap { font-size: 10px; color: #6b665a; letter-spacing: .08em; text-transform: uppercase; }
.badge { display: inline-block; font-family: var(--f-body); font-weight: 700; font-size: 12px; letter-spacing: .1em; padding: 2px 8px; border-radius: 3px; vertical-align: middle; margin-left: 6px; text-transform: uppercase; }
.badge.win { background: var(--paper-ink); color: var(--paper); }
.badge.red { background: var(--stop); color: #fff; }
.badge.hole { background: #e4dcc6; color: var(--paper-ink); }
.margin { font-size: 12px; text-align: center; border-top: 1px dashed var(--paper-rule); padding-top: 6px; margin-bottom: 4px; }
table.rows { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.rows td { padding: 2px 0; }
table.rows td:first-child { color: #6b665a; width: 70px; }
table.rows td.v { text-align: right; }
table.rows tr.big td { font-size: 20px; font-weight: 600; color: var(--paper-ink); padding-top: 6px; }
table.rows th { font-size: 10px; letter-spacing: .14em; text-align: right; color: #6b665a; font-weight: 500; text-transform: uppercase; }
.rl { color: #c4291a; }

.crew { background: var(--pit); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.crew h4, .card h4 { margin: 0 0 8px; font-family: var(--f-display); font-weight: 800; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.crewGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }
.crewGrid div { min-width: 0; }
.crewGrid span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.crewGrid b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--rule); color: var(--muted); }
.chip.bad { border-color: #6b2a22; color: #ff9a8a; }
.chip.ok { border-color: #1f5a33; color: #8eeaa9; }
#graph { width: 100%; height: 170px; display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--rule); background: var(--raised); border-radius: 7px; padding: 9px 14px; font-weight: 600; cursor: pointer; letter-spacing: .02em; }
.btn.primary { background: var(--amber); color: #1a1205; border-color: var(--amber); }
.btn.go { background: #16462a; border-color: #2a7a48; color: #c9f7d7; }
.btn:disabled { opacity: .45; cursor: default; }
.note { font-size: 13px; color: var(--muted); }

/* garage */
.garage { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.card { background: var(--pit); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.condGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px 12px; }
.condGrid span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.condGrid b { font-variant-numeric: tabular-nums; font-weight: 600; }
.trackName { font-family: var(--f-display); font-size: 24px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.tuneRow { display: grid; grid-template-columns: 132px minmax(0, 1fr) 96px 28px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid #20252d; }
.tuneRow:first-of-type { border-top: 0; }
.tuneRow label { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuneRow output { font-family: var(--f-mono); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tuneRow .q { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; }
.tuneRow .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -2px; }
.guide { grid-column: 1 / -1; background: var(--raised); border-radius: 6px; padding: 10px 12px; font-size: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.guide p { margin: 0; }
.guide .what, .guide .tip { grid-column: 1 / -1; }
.guide .tip { font-style: italic; color: var(--muted); }
.guide b { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.guide .more b { color: var(--amber); } .guide .less b { color: var(--ghost); }
input[type=range] { width: 100%; accent-color: var(--amber); height: 22px; }
.saveRow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.saveRow select { background: var(--raised); color: var(--fg); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 8px; font: inherit; }
.lastPass { font-family: var(--f-mono); font-size: 13px; }

/* board */
.board { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 14px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
.lbWrap { overflow-x: auto; }
table.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 520px; }
table.lb th { text-align: left; font-size: 11px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
table.lb td { padding: 8px; border-bottom: 1px solid #1e232a; vertical-align: middle; }
table.lb tr.me td { background: rgba(255,179,26,.06); }
table.lb .pos { font-family: var(--f-display); font-weight: 900; font-size: 22px; color: var(--muted); width: 36px; }
table.lb tr:first-child .pos { color: var(--amber); }
table.lb .tot { font-family: var(--f-display); font-weight: 800; font-size: 24px; }
table.lb .drv { display: flex; align-items: center; gap: 8px; min-width: 0; }
table.lb .drv img { width: 24px; height: 24px; border-radius: 50%; flex: none; }
table.lb .mono { font-family: var(--f-mono); font-size: 13px; }
.ver { font-size: 11px; color: var(--muted); }
.ver.ok { color: var(--go); } .ver.bad { color: var(--stop); }
.small { font-size: 12px; }

@media (max-width: 860px) {
  .main { display: flex; flex-direction: column; gap: 8px; }
  .laneCol { flex: 1; }
  .panelCol { order: -1; flex: none; }
  .panel { display: none; }
  nav.tabs .laneTab { display: inline-block; }
  .app:not([data-tab="lane"]) .laneCol { display: none; }
  .app:not([data-tab="lane"]) .panelCol { flex: 1; min-height: 0; }
  .app:not([data-tab="lane"]) .panel.active { display: block; }
  .tot .big { font-size: 48px; }
  .tuneRow { grid-template-columns: 104px minmax(0, 1fr) 84px 26px; gap: 6px; }
  .tuneRow label { font-size: 13px; }
  header.top { gap: 6px 10px; padding-block: 6px; }
  .logo { font-size: 24px; }
  .logo small { display: none; }
  .dayChip { margin-left: 0; order: 3; width: 100%; font-size: 12px; gap: 8px; }
  #soundBtn { margin-left: auto; }
  nav.tabs { overflow-x: auto; scrollbar-width: none; }
  nav.tabs button { font-size: 15px; padding: 7px 10px 8px; flex: none; }
  .pedal { padding: 14px 8px; font-size: 22px; }
}
@media (min-width: 861px) { .panel:not(.active) { display: none; } }
@media (prefers-reduced-motion: reduce) { .pedal { transition: none; } }
