:root {
  color-scheme: dark;
  --ink: #f2f1e9;
  --muted: #98a49f;
  --panel: rgba(13, 21, 20, 0.91);
  --line: rgba(226, 236, 229, 0.14);
  --acid: #d7fa45;
  --orange: #ff5b3d;
  --cyan: #62d5d1;
  --shadow: #09100f;
  font-family: Inter, "Arial Narrow", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #24392e; }

body { color: var(--ink); -webkit-font-smoothing: antialiased; }

button, input { font: inherit; }

button { color: inherit; }

.sim-shell { position: relative; width: 100%; height: 100%; min-height: 600px; isolation: isolate; }

#track-canvas, #scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #658557; }
#track-canvas[hidden], #scene-canvas[hidden] { display: none; }

.rain-overlay { position: absolute; z-index: 2; inset: 0; pointer-events: none; opacity: .42; background-image: repeating-linear-gradient(112deg, transparent 0 25px, rgba(210,239,240,.32) 26px 27px, transparent 28px 48px); background-size: 180px 180px; animation: rain-slide .38s linear infinite; }
.rain-overlay[hidden] { display: none; }
@keyframes rain-slide { to { background-position: -38px 82px; } }

.panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 7px 7px 0 rgba(5, 11, 10, 0.42);
  backdrop-filter: blur(10px);
}

.topbar {
  z-index: 5;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.brand { display: flex; align-items: center; min-width: 210px; }

.brand-mark { width: 41px; height: 41px; display: grid; place-items: center; margin-right: 11px; background: var(--acid); transform: skew(-5deg); }
.brand-mark svg { width: 31px; height: 31px; fill: #111a18; transform: skew(5deg); }
.brand-copy { display: grid; line-height: 1; letter-spacing: .04em; }
.brand-copy strong { font-weight: 950; font-stretch: condensed; font-size: 19px; }
.brand-copy small { color: var(--muted); font-weight: 800; letter-spacing: .22em; font-size: 9px; margin-top: 5px; }

.track-facts { margin: 0 auto; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.track-facts b { color: var(--ink); font-size: 12px; }
.track-facts i { width: 1px; height: 18px; background: var(--line); }

.view-switch, .camera-switch { display: grid; grid-auto-flow: column; gap: 3px; padding: 3px; margin-left: 20px; background: #070c0b; }
.view-switch button, .camera-switch button { height: 34px; min-width: 68px; padding: 0 10px; border: 0; background: #1b2522; color: #89948f; cursor: pointer; font-size: 9px; font-weight: 950; letter-spacing: .08em; }
.view-switch button span { display: block; margin-top: 2px; font-size: 6px; letter-spacing: .13em; }
.camera-switch button { min-width: 88px; font-size: 6.5px; }
.view-switch button:hover, .camera-switch button:hover { color: var(--ink); }
.view-switch button.active, .camera-switch button.active { background: var(--acid); color: #101614; }

.icon-button, .modal-close { border: 1px solid var(--line); background: #17211f; cursor: pointer; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; }
.icon-button:hover, .modal-close:hover { background: var(--acid); color: #101614; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.telemetry { z-index: 4; left: 18px; top: 104px; width: 236px; padding: 15px; }
.session-row { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .14em; font-weight: 850; }
.session-row b { margin-left: auto; color: var(--ink); }
.live-dot { width: 7px; height: 7px; background: var(--orange); box-shadow: 0 0 0 3px rgba(255,91,61,.16); border-radius: 50%; }
.speed-readout { display: flex; align-items: baseline; padding: 5px 0 0; }
.speed-readout strong { font-family: "Arial Narrow", Impact, sans-serif; font-size: 72px; line-height: .98; letter-spacing: -.055em; font-weight: 900; }
.speed-readout span { color: var(--muted); font-weight: 800; font-size: 10px; margin-left: 7px; }
.meter { height: 4px; margin: 5px 0 14px; display: flex; background: #28312f; overflow: hidden; }
.meter span { display: block; height: 100%; transition: width 60ms linear; }
#throttle-meter { width: 0; background: var(--acid); }
#brake-meter { width: 0; background: var(--orange); margin-left: auto; }
.telemetry-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.telemetry-grid div { padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.telemetry-grid span, .spec-row span, .weather-title, .weather-data span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.telemetry-grid b { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 5px; font-size: 11px; white-space: nowrap; }
.surface-line { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 8px; letter-spacing: .12em; }
.surface-line span { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); }

.lapboard { z-index: 4; right: 18px; top: 104px; width: 252px; padding: 15px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.lapboard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.lapboard-head strong { display: block; margin-top: 5px; font-family: "Arial Narrow", Impact, sans-serif; font-size: 24px; letter-spacing: -.01em; }
.lapboard-list { flex: 1; min-height: 84px; overflow-y: auto; margin: 2px -4px; padding: 0 4px; scroll-behavior: smooth; }
.lapboard-empty { color: #6d7873; font-size: 9px; letter-spacing: .06em; padding: 16px 2px; margin: 0; }
.lap-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: baseline; gap: 6px; padding: 7px 4px; border-bottom: 1px solid rgba(226,236,229,.07); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.lap-row i { font-style: normal; color: var(--muted); font-size: 9px; }
.lap-row em { font-style: normal; font-size: 9px; color: var(--muted); }
.lap-row.is-best { color: var(--acid); }
.lap-row.is-best em { color: var(--acid); }
.lap-row.is-invalid { color: #8d9994; text-decoration: line-through; text-decoration-color: rgba(255,91,61,.7); }
.lap-row.is-invalid em { color: var(--orange); text-decoration: none; }
.lapboard-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.lapboard-foot span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.lapboard-foot b { display: block; margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.ghost-button { border: 1px solid var(--line); background: #17211f; color: var(--muted); cursor: pointer; font-size: 8px; font-weight: 900; letter-spacing: .1em; padding: 9px 12px; }
.ghost-button:hover { color: var(--ink); border-color: var(--acid); }
.ghost-button.small { padding: 7px 9px; font-size: 7px; }
.eyebrow { color: var(--acid); font-size: 8px; letter-spacing: .2em; font-weight: 900; }
.kart-summary { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: flex; align-items: center; padding: 12px 0; cursor: pointer; text-align: left; }
.kart-summary:hover strong { color: var(--acid); }
.kart-summary > span:nth-child(2) { display: grid; gap: 4px; }
.kart-summary small { color: var(--muted); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.kart-summary strong { font-size: 16px; font-weight: 950; letter-spacing: .04em; }
.kart-summary svg { margin-left: auto; width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.kart-swatch { position: relative; width: 44px; height: 27px; background: #ee6044; margin-right: 12px; border: 3px solid #202726; box-shadow: 3px 3px 0 #080d0c; transform: skew(-7deg); }
.kart-swatch::before, .kart-swatch::after { content: ""; position: absolute; top: 3px; width: 5px; height: 15px; background: #0d1110; }
.kart-swatch::before { left: -7px; }.kart-swatch::after { right: -7px; }
.spec-row { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; }
.spec-row b { font-size: 10px; }
.weather-title, .direction-title { display: flex; justify-content: space-between; margin: 18px 0 8px; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.weather-title small { color: #66706d; font-size: 8px; }
.direction-title { margin-top: 15px; }
.direction-title small { color: #66706d; font-size: 11px; }
.direction-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: #070c0b; }
.direction-switch button { height: 33px; border: 0; background: #1b2522; color: #8d9994; cursor: pointer; font-size: 7px; font-weight: 900; letter-spacing: .06em; }
.direction-switch button span { margin: 0 5px; font-size: 10px; }
.direction-switch button:hover { color: var(--ink); }
.direction-switch button.active { color: #111816; background: var(--acid); }
.weather-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: #070c0b; }
.weather-switch button { height: 48px; border: 0; background: #1b2522; cursor: pointer; color: #8d9994; font-size: 7px; font-weight: 900; letter-spacing: .06em; }
.weather-switch button span { display: block; height: 16px; color: #aab4b0; font-size: 12px; margin-bottom: 2px; }
.weather-switch button:hover { color: var(--ink); }
.weather-switch button.active { color: #111816; background: var(--acid); }
.weather-switch button.active span { color: #111816; }
.skill-switch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px 3px 0; background: #070c0b; }
.skill-switch button { height: 27px; border: 0; background: #1b2522; color: #8d9994; cursor: pointer; font-size: 6.5px; font-weight: 900; letter-spacing: .05em; }
.skill-switch button:hover { color: var(--ink); }
.skill-switch button.active { color: #111816; background: var(--acid); }
.skill-switch[aria-disabled="true"] { opacity: .38; pointer-events: none; }
.ideal-lap { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 1px 0; }
.ideal-lap span { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.ideal-lap b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--acid); }
.weather-data { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.weather-data div { text-align: center; padding: 7px 2px; border-right: 1px solid var(--line); }
.weather-data div:last-child { border: 0; }
.weather-data b { display: block; margin-top: 4px; font-size: 9px; }

.controls { z-index: 4; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; padding: 8px; gap: 8px; }
.controls > div { height: 38px; display: flex; align-items: center; gap: 4px; padding: 0 7px; border-right: 1px solid var(--line); }
.controls small { color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .12em; margin-left: 3px; }
.key { min-width: 24px; height: 24px; padding: 0 5px; display: inline-grid; place-items: center; border: 1px solid #57625e; background: #202a27; box-shadow: 0 2px 0 #050908; font-size: 9px; font-weight: 900; }
.key.wide { min-width: 26px; }
.controls button { height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 7px; font-weight: 900; letter-spacing: .1em; cursor: pointer; display: flex; align-items: center; gap: 7px; }
.controls button:hover { color: var(--ink); }
.sim-shell.is-3d[data-camera="cockpit"] .controls { display: none; }

.status-toast { position: absolute; z-index: 6; left: 50%; top: 104px; transform: translate(-50%, -12px); padding: 9px 15px; color: #111715; background: var(--acid); box-shadow: 4px 4px 0 rgba(4,8,7,.55); font-size: 8px; font-weight: 950; letter-spacing: .16em; opacity: 0; transition: .25s ease; pointer-events: none; }
.status-toast.show { opacity: 1; transform: translate(-50%, 0); }

.touch-controls { display: none; }

.modal { width: 100%; max-width: none; height: 100%; max-height: none; border: 0; padding: 0; background: rgba(5, 10, 9, .68); color: var(--ink); }
.modal[open] { display: grid; place-items: center; }
.modal::backdrop { background: rgba(5, 10, 9, .55); backdrop-filter: blur(4px); }
.modal-card { width: min(920px, calc(100vw - 40px)); max-height: calc(100vh - 40px); overflow: auto; padding: 24px; background: #111b19; border: 1px solid #48534f; box-shadow: 10px 10px 0 rgba(5, 8, 7, .7); }
.modal-card header { display: flex; align-items: start; justify-content: space-between; }
.modal-card h1 { margin: 5px 0 0; font-size: clamp(27px, 4vw, 48px); line-height: .95; letter-spacing: -.03em; font-family: "Arial Narrow", Impact, sans-serif; }
.modal-close { width: 38px; height: 38px; font-size: 24px; line-height: 1; }
.modal-lead { max-width: 680px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.kart-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 20px 0; }
.kart-card { min-height: 192px; position: relative; text-align: left; padding: 14px; border: 1px solid #34403c; background: #192320; cursor: pointer; overflow: hidden; }
.kart-card::after { content: ""; position: absolute; right: -24px; bottom: -32px; width: 104px; height: 104px; background: var(--kart-color); transform: rotate(24deg); opacity: .16; }
.kart-card:hover { border-color: #718079; transform: translateY(-2px); }
.kart-card.selected { border-color: var(--acid); box-shadow: inset 0 0 0 1px var(--acid); }
.kart-card .card-number { display: block; color: #69746f; font-size: 9px; font-weight: 900; }
.kart-card .mini-kart { position: relative; display: block; width: 76px; height: 45px; margin: 18px auto 20px; border: 4px solid #0a0f0e; background: var(--kart-color); box-shadow: 5px 5px 0 rgba(0,0,0,.32); transform: skew(-6deg); }
.kart-card .mini-kart::before, .kart-card .mini-kart::after { content: ""; position: absolute; top: 5px; width: 9px; height: 27px; background: #090d0c; }
.kart-card .mini-kart::before { left: -11px; }.kart-card .mini-kart::after { right: -11px; }
.kart-card strong { display: block; font-size: 15px; text-transform: uppercase; }
.kart-card small { display: block; color: var(--muted); margin-top: 4px; font-size: 8px; letter-spacing: .08em; }
.kart-card .card-specs { display: flex; gap: 12px; margin-top: 12px; }
.kart-card .card-specs span { color: var(--muted); font-size: 7px; letter-spacing: .08em; }
.kart-card .card-specs b { display: block; color: var(--ink); font-size: 10px; margin-top: 3px; }
.driver-mass { margin: 20px 0; }
.driver-mass label, .driver-mass > div { display: flex; justify-content: space-between; }
.driver-mass label span { font-size: 9px; letter-spacing: .14em; color: var(--muted); font-weight: 900; }
.driver-mass label b { font-size: 12px; }
.driver-mass input { width: 100%; accent-color: var(--acid); margin: 13px 0 3px; }
.driver-mass > div { color: #65706c; font-size: 8px; }
.primary-button { width: 100%; height: 52px; border: 0; background: var(--acid); color: #111715; font-weight: 950; font-size: 12px; letter-spacing: .13em; cursor: pointer; box-shadow: 5px 5px 0 #050908; }
.primary-button:hover { background: #e5ff7d; }
.primary-button span { margin-left: 7px; }

.info-modal .modal-card { max-width: 780px; }
.formula-block { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 18px 0; }
.formula-block code { padding: 12px; background: #0b1210; color: var(--acid); font-size: 10px; white-space: nowrap; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.method-grid > div { padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.method-grid span, .sources > span { display: block; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.method-grid b { display: block; margin-top: 6px; font-size: 19px; }
.method-grid p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.sources { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.sources > span { margin-right: auto; }
.sources a { color: var(--ink); border: 1px solid var(--line); padding: 8px 10px; text-decoration: none; font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.sources a:hover { border-color: var(--acid); color: var(--acid); }

@media (pointer: coarse) {
  /* Долгое нажатие на педаль не должно поднимать выделение текста и системное
     меню — на телефоне это игровой экран, а не документ. */
  * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  /* Шапка на телефоне не нужна: методика открывается из меню, а место на
     экране дороже. В телеметрии остаются только скорость и время круга. */
  .topbar { display: none; }
  .telemetry { top: 8px; left: 8px; width: auto; padding: 9px 12px; }
  .telemetry .session-row, .telemetry .meter, .telemetry .surface-line { display: none; }
  .telemetry .speed-readout { padding: 0; }
  .telemetry .speed-readout strong { font-size: 40px; }
  .telemetry-grid { grid-template-columns: 1fr; border: 0; margin-top: 4px; }
  .telemetry-grid div { display: none; padding: 4px 0 0; border: 0; }
  .telemetry-grid div:first-child { display: block; }
  .telemetry-grid div:first-child span { display: none; }
  .telemetry-grid b { margin: 0; font-size: 13px; }
  .lapboard { top: 8px; right: 8px; width: 132px; padding: 9px; max-height: 46vh; }
  .lapboard-head { padding-bottom: 0; border: 0; }
  .lapboard-head .eyebrow { display: none; }
  .lapboard-head strong { margin: 0; font-size: 15px; }
  .lapboard-foot, .lapboard-empty { display: none; }
  /* Список подстраивается под пройденные круги: пока их нет, панель — одна строка. */
  .lapboard-list { flex: 0 1 auto; min-height: 0; margin: 0 -3px; }
  .lapboard-list:not(:empty) { margin-top: 6px; }
  .lap-row { grid-template-columns: 16px 1fr auto; gap: 4px; padding: 4px 3px; font-size: 10px; }
  /* Телефон в горизонте ниже 600 px — жёсткий минимум растянул бы страницу
     под экран и увёл педали за нижний край. */
  .sim-shell { min-height: 0; }
  .controls { display: none; }
  .touch-controls { position: absolute; z-index: 7; display: block; inset: 0; pointer-events: none; }
  .touch-controls button { pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
  /* Педали занимают нижние углы: тормоз слева, газ справа — большие цели под
     большие пальцы, так что промахнуться на кочке невозможно. */
  .touch-pedal { position: absolute; bottom: 0; width: 32vw; max-width: 190px; height: 42vh; min-height: 130px; border: 0; display: grid; align-items: end; justify-items: center; padding-bottom: 16px; font-weight: 950; font-size: 11px; letter-spacing: .12em; }
  .touch-pedal span { display: block; padding: 7px 12px; border: 1px solid rgba(255,255,255,.3); }
  .touch-pedal.brake { left: 0; background: linear-gradient(to top left, rgba(255,91,61,.34), rgba(255,91,61,0) 62%); color: #ffd8cf; }
  .touch-pedal.throttle { right: 0; background: linear-gradient(to top right, rgba(215,250,69,.34), rgba(215,250,69,0) 62%); color: #eaffa8; }
  .touch-pedal:active span { background: rgba(255,255,255,.9); color: #101614; }
  .touch-steer { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 10px; }
  .touch-steer button { width: 64px; height: 58px; border: 1px solid rgba(255,255,255,.35); background: rgba(12,20,18,.82); font-size: 16px; font-weight: 900; }
  .touch-steer[hidden] { display: none; }
  .tilt-gauge { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 148px; height: 5px; background: rgba(12,20,18,.8); border: 1px solid rgba(255,255,255,.28); }
  .tilt-gauge[hidden] { display: none; }
  .tilt-gauge i { position: absolute; left: 50%; top: -4px; width: 1px; height: 13px; background: rgba(255,255,255,.45); }
  .tilt-gauge span { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; left: 50%; background: var(--acid); transition: left 60ms linear; }
}

/* Тесная раскладка панелей: и узкий экран, и низкий горизонтальный. */
@media (max-width: 820px), (max-height: 470px) {
  .sim-shell { min-height: 0; }
  .topbar { top: 8px; left: 8px; right: 8px; height: 56px; }
  .brand { min-width: 0; }.brand-mark { width: 34px; height: 34px; }.brand-mark svg { width: 26px; }
  .brand-copy strong { font-size: 15px; }.track-facts { display: none; }
  .view-switch { margin-left: auto; }.view-switch button { min-width: 48px; padding: 0 6px; }
  .camera-switch { position: absolute; top: 60px; right: 0; }.camera-switch button { min-width: 80px; }
  .icon-button { margin-left: auto; }
  .telemetry { top: 73px; left: 8px; width: 158px; padding: 10px; }
  .speed-readout strong { font-size: 48px; }.telemetry-grid { grid-template-columns: 1fr; }.telemetry-grid div:nth-child(3), .telemetry-grid div:nth-child(4) { display: none; }
  .kart-swatch { width: 32px; height: 22px; }.weather-data { display: none; }
  .controls { display: none; }
  .kart-grid { grid-template-columns: 1fr 1fr; }
  .formula-block { grid-template-columns: 1fr; }.method-grid { grid-template-columns: 1fr; }
  .sources { flex-wrap: wrap; }.sources > span { width: 100%; }
}

@media (max-height: 690px) and (min-width: 821px) {
  .telemetry-grid div:nth-child(3), .telemetry-grid div:nth-child(4), .weather-data { display: none; }
  .speed-readout strong { font-size: 55px; }
}

/* ── старт, отсчёт и результаты ─────────────────────────────────────────── */

.start-menu { position: absolute; z-index: 9; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6, 12, 11, .72); backdrop-filter: blur(7px); }
.start-menu[hidden] { display: none; }
.start-card { width: min(1120px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; background: #101a18; border: 1px solid #48534f; box-shadow: 10px 10px 0 rgba(5, 8, 7, .7); }
.start-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.start-head h1 { margin: 6px 0 0; font-family: "Arial Narrow", Impact, sans-serif; font-size: clamp(28px, 4vw, 46px); line-height: .95; letter-spacing: -.03em; }
.start-estimate { text-align: right; }
.start-estimate span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.start-estimate b { display: block; margin-top: 5px; color: var(--acid); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; }
.start-body { display: grid; grid-template-columns: 1.45fr 1fr 1fr; gap: 22px; margin-top: 22px; }
.start-column > .kart-grid { grid-template-columns: repeat(2, 1fr); margin: 0 0 14px; }
.field-title { display: flex; justify-content: space-between; margin: 16px 0 8px; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.field-title:first-child { margin-top: 0; }
.field-title small { color: #66706d; font-size: 8px; }
.laps-switch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; background: #070c0b; }
.laps-switch button { height: 40px; border: 0; background: #1b2522; color: #8d9994; cursor: pointer; font-size: 11px; font-weight: 950; letter-spacing: .04em; }
.laps-switch button[data-laps="endless"] { font-size: 7px; letter-spacing: .08em; }
.laps-switch button:hover { color: var(--ink); }
.laps-switch button.active { color: #111816; background: var(--acid); }
.start-summary { margin-top: 16px; padding: 12px; border: 1px solid var(--line); color: var(--muted); font-size: 9px; line-height: 1.65; letter-spacing: .03em; }
.start-summary b { color: var(--ink); }
.start-foot { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.start-foot .primary-button { width: auto; flex: 1; padding: 0 26px; }
.start-column .driver-mass { margin: 0; }

.countdown { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(6,12,11,.62), rgba(6,12,11,.18) 60%, transparent 78%); }
.countdown[hidden] { display: none; }
.countdown-label { color: var(--acid); font-size: 10px; font-weight: 950; letter-spacing: .38em; }
.countdown strong { font-family: "Arial Narrow", Impact, sans-serif; font-size: clamp(96px, 19vw, 220px); line-height: .82; letter-spacing: -.05em; color: var(--ink); text-shadow: 0 8px 34px rgba(5,10,9,.75); }
.countdown.is-go strong { color: var(--acid); }
.countdown-lights { display: flex; gap: 9px; }
.countdown-lights i { width: 16px; height: 16px; border-radius: 50%; background: #22302c; box-shadow: inset 0 0 0 1px rgba(226,236,229,.14); }
.countdown-lights i.lit { background: var(--orange); box-shadow: 0 0 14px rgba(255,91,61,.55); }
.countdown.is-go .countdown-lights i { background: var(--acid); box-shadow: 0 0 16px rgba(215,250,69,.6); }

.results-screen { position: absolute; z-index: 9; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6, 12, 11, .74); backdrop-filter: blur(7px); }
.results-screen[hidden] { display: none; }
.results-card { position: relative; width: min(980px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; background: #101a18; }
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.results-head h1 { margin: 6px 0 0; font-family: "Arial Narrow", Impact, sans-serif; font-size: clamp(24px, 3.4vw, 40px); line-height: .95; letter-spacing: -.03em; }
.results-hero { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 1px; margin: 20px 0 4px; background: var(--line); border: 1px solid var(--line); }
.results-hero > div { padding: 13px 14px; background: #0d1615; }
.results-hero span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.results-hero b { display: block; margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }
.hero-main strong { display: block; margin-top: 4px; color: var(--acid); font-family: "Arial Narrow", Impact, sans-serif; font-size: clamp(30px, 4.6vw, 48px); line-height: 1; letter-spacing: -.02em; }

.lap-figure { margin: 20px 0 0; }
.lap-figure figcaption { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; margin-bottom: 8px; }
.lap-plot { position: relative; background: #111a18; border: 1px solid var(--line); padding: 6px 4px 2px; }
.lap-plot svg { display: block; width: 100%; height: auto; }
.lap-hit { cursor: crosshair; }
.lap-tip { position: absolute; top: 8px; transform: translateX(-50%); padding: 7px 10px; background: #050a09; border: 1px solid #3d4a46; pointer-events: none; white-space: nowrap; }
.lap-tip[hidden] { display: none; }
.lap-tip b { display: block; font-size: 8px; letter-spacing: .12em; color: var(--muted); }
.lap-tip span { display: block; margin-top: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.lap-tip small { display: block; margin-top: 2px; font-size: 8px; color: var(--acid); letter-spacing: .06em; }

.results-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 20px; background: var(--line); border: 1px solid var(--line); }
.results-grid > div { padding: 12px 13px; background: #0d1615; }
.results-grid span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.results-grid b { display: block; margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.results-grid small { display: block; margin-top: 4px; color: #6d7873; font-size: 8px; letter-spacing: .04em; }

.results-block { margin-top: 22px; }
.results-block h2 { margin: 0 0 9px; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.sector-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.sector-row > div { padding: 11px 13px; background: #0d1615; }
.sector-row span { display: block; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.sector-row b { display: block; margin-top: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.lap-table { width: 100%; border-collapse: collapse; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.lap-table th { padding: 7px 9px; text-align: left; color: var(--muted); font-family: Inter, Arial, sans-serif; font-size: 7px; font-weight: 850; letter-spacing: .14em; border-bottom: 1px solid var(--line); }
.lap-table td { padding: 7px 9px; border-bottom: 1px solid rgba(226,236,229,.07); }
.lap-table tr.is-best td { color: var(--acid); }
.lap-table tr.is-invalid td { color: #7d8884; }
.lap-table tr.is-player td { color: var(--acid); }
.lap-table .dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; vertical-align: baseline; }

.results-note { margin: 0; color: #6d7873; font-size: 10px; letter-spacing: .04em; }
.results-actions { display: flex; gap: 12px; margin-top: 24px; }
.results-actions .primary-button { flex: 1; }
.results-actions .ghost-button { padding: 0 22px; }

@media (max-width: 1080px) {
  .start-body { grid-template-columns: 1fr 1fr; }
  .results-hero, .results-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .start-body { grid-template-columns: 1fr; }
  .start-card, .results-card { padding: 16px; }
  .lapboard { width: 158px; top: 73px; right: 8px; padding: 10px; }
  .results-hero, .results-grid { grid-template-columns: 1fr; }
  .lap-table th:nth-child(n+4), .lap-table td:nth-child(n+4) { display: none; }
}

.camera-group { grid-template-columns: 1fr 1fr; }
.camera-group button { height: 30px; font-size: 7px; }

.grid-switch { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; padding: 3px; background: #070c0b; }
.grid-switch button { height: 30px; border: 0; background: #1b2522; color: #8d9994; cursor: pointer; font-size: 9px; font-weight: 950; letter-spacing: .02em; }
.grid-switch button:hover { color: var(--ink); }
.grid-switch button.active { color: #111816; background: var(--acid); }
.grid-switch[aria-disabled="true"] { opacity: .38; pointer-events: none; }

/* Горизонтальный режим обязателен: в портрете панели и педали не помещаются. */
.rotate-hint { position: absolute; z-index: 11; inset: 0; display: none; place-content: center; justify-items: center; gap: 18px; text-align: center; background: #0b1210; }
.rotate-hint strong { font-size: 62px; line-height: 1; color: var(--acid); animation: rotate-nudge 1.9s ease-in-out infinite; }
.rotate-hint span { font-size: 11px; font-weight: 900; letter-spacing: .2em; line-height: 1.9; color: var(--muted); }
@keyframes rotate-nudge { 0%, 100% { transform: rotate(-16deg); } 50% { transform: rotate(74deg); } }
@media (orientation: portrait) and (pointer: coarse) {
  .rotate-hint:not([hidden]) { display: grid; }
}

/* Телефон в горизонте: экран низкий, поэтому меню сжимается в три колонки,
   карточки картов теряют картинку, а кнопка старта липнет к низу карточки. */
@media (max-height: 470px) and (pointer: coarse) {
  .start-menu { padding: 8px; }
  .start-card { padding: 14px; }
  .start-head h1 { font-size: 22px; }
  .start-estimate b { font-size: 15px; }
  .start-body { grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
  .start-column > .kart-grid { grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 10px; }
  .kart-card { min-height: 0; padding: 8px; }
  .kart-card .mini-kart, .kart-card .card-specs { display: none; }
  .kart-card strong { font-size: 12px; }
  .field-title { margin: 10px 0 6px; }
  .weather-switch button { height: 38px; }
  .direction-switch button { height: 30px; }
  .laps-switch button { height: 32px; }
  .driver-mass { margin: 8px 0 0; }
  .start-summary { display: none; }
  .start-foot { position: sticky; bottom: -14px; margin-top: 14px; padding: 12px 0; background: #101a18; }
  .primary-button { height: 44px; }
  .results-card, .start-card { max-height: calc(100vh - 16px); }
}

.tilt-switch { grid-template-columns: repeat(3, 1fr); }
.tilt-switch button { height: 28px; font-size: 7px; }
