/* Cabin — large touch targets for a 15" 1920×1200 landscape car screen. */
:root {
  --bg: #0b0d12; --panel: #151922; --panel2: #1d2230; --line: #2a3142;
  --fg: #eef2f8; --muted: #8b94a7; --accent: #3fd2ff; --accent2: #ff6a2b; --danger: #ff3b4f;
  --r: 18px; --tap: 88px;
  font-size: 24px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; user-select: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .75rem; }
code { background: var(--panel2); padding: 2px 8px; border-radius: 6px; font-size: .8em; }
h2 { font-size: 1.25rem; margin: 28px 0 14px; }

/* Top bar */
.topbar { height: 96px; display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: #0f1219; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.4rem; letter-spacing: .02em; color: var(--accent); }
.tabs { display: flex; gap: 10px; flex: 1; }
.tab { height: 72px; padding: 0 30px; border-radius: 14px; border: 0; background: transparent; color: var(--muted);
  font-size: 1.05rem; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--panel2); color: var(--fg); }
.mini-status { color: var(--muted); font-size: .8rem; text-align: right; }

main { height: calc(100% - 96px); }
.view { display: none; height: 100%; overflow: auto; }
.view.active { display: block; }
.pad { padding: 24px 32px; } .narrow { max-width: 1100px; }

/* Controls */
.row { display: flex; gap: 16px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.row.center { justify-content: center; }
.big-input { flex: 1; min-width: 300px; height: var(--tap); padding: 0 28px; font-size: 1.15rem;
  border-radius: var(--r); border: 2px solid var(--line); background: var(--panel); color: var(--fg); user-select: text; }
.big-input:focus { outline: none; border-color: var(--accent); }
.btn { min-height: var(--tap); min-width: var(--tap); padding: 0 32px; border-radius: var(--r); border: 0;
  background: var(--panel2); color: var(--fg); font-size: 1.05rem; font-weight: 650; cursor: pointer; touch-action: manipulation; }
.btn:active { transform: scale(.97); filter: brightness(1.2); }
.btn.primary { background: var(--accent); color: #031018; }
.btn.huge { min-height: 110px; font-size: 1.3rem; width: 100%; }
.btn.icon { font-size: 1.35rem; min-width: 140px; }
.btn.small { min-height: 64px; padding: 0 22px; font-size: .9rem; }
.msg { min-height: 1.4em; color: #ffd36a; }

/* Segmented buttons */
.seg { display: flex; background: var(--panel); border-radius: var(--r); padding: 6px; gap: 6px; margin: 10px 0; }
.seg button { flex: 1; height: 76px; border: 0; border-radius: 13px; background: transparent; color: var(--muted);
  font-size: 1rem; font-weight: 650; cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--fg); box-shadow: inset 0 0 0 2px var(--accent); }

/* Range sliders with fat thumbs */
.vol { display: flex; align-items: center; gap: 16px; font-size: 1rem; color: var(--muted); }
.vol.wide { margin: 14px 0; } .vol.wide input { flex: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 16px; border-radius: 8px; background: var(--panel2); min-width: 220px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); border: 4px solid #0b0d12; }

/* Video cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px; }
.card { background: var(--panel); border-radius: var(--r); overflow: hidden; cursor: pointer; position: relative; }
.card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.card .t { padding: 14px 18px 18px; font-size: .9rem; line-height: 1.3; max-height: 4.2em; overflow: hidden; }
.card .prog { height: 8px; background: #000; } .card .prog i { display: block; height: 100%; background: var(--danger); }
.card .x { position: absolute; top: 8px; right: 8px; width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 1.2rem; }

/* Player stage */
.stage { display: flex; flex-direction: column; height: 100%; position: relative; }
.player-box { flex: 1; background: #000; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.player-box iframe, #yt-player { width: 100%; height: 100%; border: 0; }
#view-canvas.active { display: flex; flex-direction: column; overflow: hidden; }
#view-canvas .stage { flex: 1; min-height: 0; height: auto; }
#cv-host { min-height: 0; } #cv-host canvas { width: 100%; height: 100%; object-fit: contain; }
.controls { height: 128px; display: flex; gap: 18px; align-items: center; justify-content: center; padding: 0 24px;
  background: #0f1219; border-top: 1px solid var(--line); }
.banner { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); width: min(1300px, 92%);
  background: #2b2110; border: 2px solid #ffb648; color: #ffe1a8; border-radius: var(--r);
  padding: 18px 24px; display: flex; gap: 16px; align-items: center; font-size: .95rem; z-index: 5; }

/* Engine */
.engine-grid { display: grid; grid-template-columns: 1fr 760px; height: 100%; gap: 24px; padding: 20px 28px; }
.tach-wrap { display: flex; align-items: center; justify-content: center; min-height: 0; }
#tach { width: min(100%, 980px); aspect-ratio: 1; max-height: 100%; }
.engine-side { overflow: auto; padding-right: 6px; }
.readouts { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 14px; }
.readout { background: var(--panel); border-radius: var(--r); padding: 12px 18px; text-align: center; }
.ro-big { font-size: 5rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ro-big.gear { color: var(--accent2); }
.ro-mid { font-size: 3.2rem; font-weight: 750; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ro-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.loadbar { position: relative; height: 26px; background: var(--panel); border-radius: 13px; margin: 14px 0; overflow: hidden; }
.loadbar div { height: 100%; width: 0; background: linear-gradient(90deg, #2bd47d, #ffcf3f, #ff3b4f); transition: width .1s; }
.loadbar span { position: absolute; right: 12px; top: 0; font-size: .7rem; color: var(--muted); line-height: 26px; }
.panel { background: var(--panel); border-radius: var(--r); padding: 6px 18px; margin: 10px 0; }
.panel .btn { flex: 1; }
#sim-brake.held { background: var(--danger); }

/* Car check */
.dt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 18px 0; }
.dt-tile { background: var(--panel); border-radius: var(--r); overflow: hidden; }
.dt-media { aspect-ratio: 16/9; background: #000; display: flex; } .dt-media > * { width: 100%; height: 100%; }
.dt-media video, .dt-media canvas, .dt-media iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
.dt-cap { padding: 14px 18px; font-size: .9rem; } .dt-cap span.ok { color: #2bd47d; } .dt-cap span.bad { color: var(--danger); }
.log { background: #07080b; border-radius: var(--r); padding: 16px; height: 220px; overflow: auto; font-size: .7rem; color: #b9c2d3; user-select: text; }
.feat { border-collapse: collapse; font-size: .75rem; width: 100%; }
.feat td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; } .feat td:first-child { color: var(--muted); width: 340px; }
.field { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; color: var(--muted); }

/* Passenger modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { width: min(1100px, 90%); background: var(--panel); border-radius: 28px; padding: 44px 56px; text-align: center; border: 2px solid #ffb648; }
.modal-card h2 { font-size: 2rem; margin: 10px 0 18px; } .modal-card p { font-size: 1.05rem; line-height: 1.5; color: #cfd6e3; }
.modal-icon { font-size: 4rem; }
.modal-card .btn.huge { width: auto; flex: 1; }

/* Own videos: built-in test clip */
.cv-top { padding-bottom: 8px; }
.cv-test { display: flex; gap: 22px; align-items: center; background: var(--panel); border-radius: var(--r); padding: 14px 18px; }
.cv-thumb { width: 200px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.cv-test-text { flex: 1; font-size: 1rem; }
.credit { color: var(--muted); font-size: .72rem; margin-top: 6px; } .credit a { color: var(--accent); }
.seg.grow { flex: 1; margin: 0; }
#view-canvas .row { margin: 10px 0; }
#view-canvas .big-input { height: 76px; }
