* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #141815;
  --surface: #1b211d;
  --raised: #222a24;
  --line: #343e35;
  --text: #eef2e8;
  --muted: #a8b3a7;
  --accent: #d0f568;
  --ink: #18200e;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
body { margin: 0; }
button, input, select { font: inherit; }
button { color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; cursor: pointer; }
button:hover { border-color: #829579; }
button:disabled { color: var(--muted); cursor: default; opacity: 0.65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 30px; height: 68px; border-bottom: 1px solid var(--line); gap: 12px; }
.brand, .top-actions, .device { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.05rem; letter-spacing: 0.04em; }
.brand h1 span { font-weight: 500; color: #c5cec1; letter-spacing: 0; }
.brand-mark { display: block; flex: 0 0 auto; }
.device { color: var(--muted); font-size: 0.83rem; gap: 7px; min-width: 0; }
.device span { max-width: 230px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.device i, .viewport-status i { background: #a6b6a3; width: 6px; height: 6px; border-radius: 100%; flex: 0 0 auto; }
.device.connected i, .viewport-status i { background: var(--accent); }
.top-actions button { font-size: 0.85rem; }
#compare-physics, .profile-actions a { color: var(--accent); font-size: 0.82rem; text-decoration: none; }
#compare-physics:hover, .profile-actions a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(345px, 386px); gap: 25px; width: min(1720px, 100%); margin: 0 auto; padding: 25px 30px; align-items: start; }
.layout.full-width { grid-template-columns: minmax(0, 1fr); }
.flight { min-width: 0; position: sticky; top: 16px; }
.flight-heading, .settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.flight-heading { margin-bottom: 12px; }
.stage-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; margin-bottom: 15px; color: var(--muted); }
.stage-controls label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.stage-controls p { flex-basis: 100%; font-size: 0.84rem; line-height: 1.4; }
.vehicle-speed { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; }
.vehicle-speed span { margin-right: 3px; }
.vehicle-speed button { padding: 4px 8px; min-width: 29px; }
.vehicle-speed output { min-width: 1.7em; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.eyebrow { color: var(--accent); font-weight: 650; text-transform: uppercase; font-size: 0.71rem; letter-spacing: 0.14em; margin-bottom: 5px; }
.flight-heading h2 { font-size: clamp(1.45rem, 3vw, 2.08rem); font-weight: 650; letter-spacing: -0.04em; }
.mode { display: flex; align-items: center; gap: 5px; }
kbd { font-family: ui-monospace, monospace; font-size: 0.74rem; color: var(--text); background: #2b342c; border: 1px solid #49584a; border-radius: 4px; padding: 2px 5px; min-width: 1.25rem; display: inline-block; text-align: center; }
.viewport { position: relative; height: clamp(350px, 58vh, 730px); overflow: hidden; border-radius: 13px; background: #141a16; isolation: isolate; border: 1px solid #526044; container-type: size; }
.flight-image { --fpv-aspect: calc(3 / 2); position: absolute; inset: 50% auto auto 50%;
  width: min(100cqw, calc(100cqh * var(--fpv-aspect))); aspect-ratio: var(--fpv-aspect);
  transform: translate(-50%, -50%); background: #677e87; }
#flight-view { width: 100%; height: 100%; display: block; }
#flight-view:focus-visible { outline-offset: -3px; }
.flight-shade { pointer-events: none; position: absolute; inset: 0; background: linear-gradient(180deg, #101b1796, transparent 24%, transparent 65%, #111a16cd); }
.viewport-status, .gate-count { border-radius: 7px; background: #17211cd9; border: 1px solid #dce6d242; }
.viewport:fullscreen, .viewport.fullscreen-fallback { width: 100%; height: 100%; border: 0; border-radius: 0; }
.viewport.fullscreen-fallback { position: fixed; inset: 0; z-index: 30; }
.viewport-status-stack { position: absolute; top: 16px; left: 16px; display: grid; gap: 7px; justify-items: start; max-width: calc(100% - 133px); }
.viewport-status { display: flex; align-items: center; gap: 7px; padding: 7px 10px; font-size: 0.82rem; }
.viewport-status:disabled { opacity: 1; }
.viewport-status:not(:disabled):hover { background: #283e2f; border-color: currentColor; }
.prop-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.prop-gauge { --condition: #a9ec74; position: relative; min-width: 132px; padding: 7px 8px; border: 1px solid #dce6d242;
  border-radius: 7px; background: #17211ce8; font-size: 0.71rem; }
.prop-gauge > div:first-child { display: flex; align-items: center; gap: 9px; justify-content: space-between; }
.prop-gauge strong { color: var(--condition); font-variant-numeric: tabular-nums; }
.prop-gauge-bars { display: flex; gap: 3px; margin-top: 6px; }
.prop-gauge-bars i { flex: 1; height: 4px; border-radius: 2px; background: var(--condition); }
.prop-gauge[data-level="1"] { --condition: #deeb7c; }
.prop-gauge[data-level="2"] { --condition: #ffc468; }
.prop-gauge[data-level="3"] { --condition: #ff9a63; }
.prop-gauge[data-level="4"] { --condition: #ff7179; }
.prop-gauge-bars .depleted { opacity: 0.18; }
.prop-gauge[data-disabled="true"] > div { opacity: 0.24; }
.prop-disabled { position: absolute; inset: 0; display: grid; place-items: center; color: #e0e8dd;
  font-size: 0.72rem; font-weight: 650; text-shadow: 0 1px 3px #17211c; }
.viewport-status.armed { color: #9efb83; font-weight: 650; }
.viewport-status.disarmed { color: #ff7086; font-weight: 650; border-color: #ff506d;
  text-shadow: 0 0 8px #ff284caa; box-shadow: 0 0 5px #ff284c80; animation: disarmed-pulse 1.35s ease-in-out infinite; }
.viewport-status.armed i, .viewport-status.disarmed i { background: currentColor; }
@keyframes disarmed-pulse {
  0%, 100% { text-shadow: 0 0 5px #ff284c80; box-shadow: 0 0 3px #ff284c60; }
  50% { text-shadow: 0 0 11px #ff284c; box-shadow: 0 0 12px #ff284c99, inset 0 0 6px #ff284c40; }
}
.viewport-tools { position: absolute; top: 16px; right: 16px; display: grid; gap: 7px; justify-items: end; }
.viewport-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.viewport-tools button, .aircraft-tools button, .prop-controls button { background: #17211cf2; padding: 6px 8px; font-size: 0.78rem; border-color: #dce6d242; }
.viewport-tools button:hover, .aircraft-tools button:hover, .prop-controls button:hover { border-color: #e4efdb; }
#pause-damage[data-paused="true"] { color: #ffe492; border-color: #ffe492; }
.cpu-test { width: min(430px, 96%); padding: 18px; color: var(--text); background: #17211c; border: 1px solid #6d856b; border-radius: 9px; }
.cpu-test::backdrop { background: #10161155; }
.cpu-test h2 { margin-bottom: 8px; }
.cpu-test p { margin: 9px 0; }
.cpu-test progress { width: 100%; accent-color: var(--accent); }
.cpu-test dl { display: grid; gap: 8px; margin: 12px 0; padding: 0; }
.cpu-test dl div { display: flex; justify-content: space-between; gap: 10px; }
.cpu-test dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.cpu-test [data-band="green"] { color: #a9ec74; }
.cpu-test [data-band="yellow"] { color: #ffe492; }
.cpu-test [data-band="red"] { color: #ff858e; }
.gate-count { padding: 6px 8px; font-size: 0.73rem; display: flex; gap: 9px; }
.gate-count div { display: grid; gap: 2px; }
.course-map { display: block; width: clamp(106px, 12vw, 146px); height: auto; background: #17211cd9; border: 1px solid #dce6d242; border-radius: 7px; pointer-events: none; }
.gate-count span, .view-data span { color: #d0dacd; }
.gate-count strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.reticle { position: absolute; top: 50%; left: 50%; width: 23px; height: 23px; transform: translate(-50%, -50%); pointer-events: none; }
.reticle i { position: absolute; background: #eff5dbe0; box-shadow: 0 0 2px #142010; }
.reticle i:nth-child(1), .reticle i:nth-child(2) { width: 6px; height: 1px; top: 11px; }
.reticle i:nth-child(2) { right: 0; }
.reticle i:nth-child(3), .reticle i:nth-child(4) { height: 6px; width: 1px; left: 11px; }
.reticle i:nth-child(4) { bottom: 0; }
.viewport-message { position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 12px; text-align: center; width: max-content; max-width: 96%; }
.viewport-message strong { font-size: 1.5rem; text-shadow: 0 2px 9px #182316; }
.viewport-message .race-countdown {
  min-width: 1.2em; line-height: 1.12; padding: 0.08em 0.2em; border-radius: 0.16em; color: #e5ff95;
  background: #162019ca; font-size: clamp(3.4rem, 10vw, 7rem); font-variant-numeric: tabular-nums;
}
.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage-controller-hint { padding: 4px 8px; border-radius: 5px; background: #17211ce6; color: #e9f3e1; font-size: 0.77rem; }
.controller-selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage-dialog { width: min(570px, 94vw); max-height: 86vh; background: var(--surface); border: 1px solid #657563; border-radius: 10px; color: var(--text); padding: 18px 20px; }
.stage-dialog::backdrop { background: #10161180; }
.stage-dialog h2, .stage-dialog p { margin-bottom: 9px; }
.stage-dialog a { color: var(--accent); align-self: center; }
#track-list { display: grid; gap: 5px; max-height: 57vh; overflow: auto; margin: 12px 0; }
.track-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.track-row[aria-current="true"] { border-color: #9dbb79; }
.track-medal { font-weight: 700; white-space: nowrap; }
.track-medal[data-medal="Gold"] { color: #ffdb70; }
.track-medal[data-medal="Silver"] { color: #d3e4ee; }
.track-medal[data-medal="Bronze"] { color: #eba981; }
.track-medal[data-medal="Passed"] { color: var(--accent); }
.benchmark-course { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 9px; }
.medal-fields { display: grid; gap: 6px; max-width: 395px; margin: 14px 0 8px; }
.medal-time-row { display: grid; grid-template-columns: minmax(3.4rem, 1fr) minmax(0, 5rem) auto minmax(0, 5rem) auto minmax(0, 6.2rem); align-items: center; gap: 5px; }
.medal-time-headings { color: var(--muted); font-size: .72rem; text-align: center; }
.medal-time-headings span:nth-child(1) { grid-column: 2; }
.medal-time-headings span:nth-child(2) { grid-column: 4; }
.medal-time-headings span:nth-child(3) { grid-column: 6; }
.medal-fields input { min-width: 0; width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; text-align: center; }
#benchmark-capture-note { color: var(--accent); }
#benchmark-status { min-height: 1.5em; margin-top: 8px; }
.viewport-message:has(#stage-finish-details:not([hidden])) { top: 50%; width: min(440px, 96%); max-height: 94%; overflow: auto; gap: 8px; padding: 10px; border: 1px solid #627158; border-radius: 10px; background: #17201af5; }
#stage-finish-details { width: 100%; }
.result-times, .result-targets { display: grid; gap: 5px; margin: 0; }
.result-times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-targets { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; border-top: 1px solid #49574c; padding-top: 5px; }
.result-times dt, .result-targets dt { font-size: .78rem; color: var(--muted); }
.result-times dd, .result-targets dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; }
.result-targets dd { font-size: .88rem; }
#result-lap-splits, #result-note { font-size: .78rem; margin-top: 5px; }
#flight-timer { font-variant-numeric: tabular-nums; }
.primary { font-weight: 700; color: var(--ink); background: var(--accent); border-color: var(--accent); padding: 11px 22px; min-height: 44px; box-shadow: 0 4px 22px #10240655; }
.primary:hover { background: #e4ff9f; }
.view-data { position: absolute; left: 16px; bottom: 15px; display: grid; grid-template-columns: repeat(2, max-content); align-items: end; gap: 4px 16px; pointer-events: none; }
.view-data div { display: grid; gap: 2px; }
.view-data span { font-size: 0.77rem; }
.view-data strong { font-size: 1.21rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.view-data small { font-size: 0.71rem; font-weight: 500; }
.aircraft-tools { position: absolute; right: 16px; bottom: 15px; display: grid; justify-items: end; gap: 5px; }
#repair-props.repair-urgent { border-color: #ffe492; color: #fff5c6; animation: repair-pulse 1.5s ease-in-out infinite; }
@keyframes repair-pulse {
  0%, 100% { box-shadow: 0 0 0 0 #ffba5500; }
  50% { box-shadow: 0 0 14px 3px #ffc46a9e; }
}
@media (prefers-reduced-motion: reduce) {
  .viewport-status.disarmed { animation: none; }
  #repair-props.repair-urgent { animation: none; box-shadow: 0 0 10px #ffc46a80; }
}
.flight-buttons, .camera-buttons { display: flex; align-items: center; gap: 4px; }
.mode kbd { padding: 0 3px; min-width: auto; font-size: 0.65rem; }
.camera-buttons button { min-width: 29px; font-size: 1rem; padding: 1px 7px; }
.stick-overlay { position: absolute; left: 50%; bottom: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.stick-display { display: grid; justify-items: center; gap: 3px; }
.stick-display span { font-size: 0.61rem; color: #edf3e9; white-space: nowrap; text-shadow: 0 1px 3px #10200f; }
.stick-square { --stick-size: 60px; --stick-travel: calc((var(--stick-size) - 2px) * .42); width: var(--stick-size); height: var(--stick-size); position: relative; background: #142018a8; border: 1px solid #e1eadb90; border-radius: 5px; }
.stick-square::before, .stick-square::after { position: absolute; content: ''; background: #cadbc265; }
.stick-square::before { width: 1px; height: 100%; left: 50%; }
.stick-square::after { height: 1px; width: 100%; top: 50%; }
.stick-square i { position: absolute; left: 50%; top: 50%; background: var(--accent); width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 1px #213018; transform: translate(-50%, -50%); z-index: 1; }
.flight[data-lesson] .fpv-only, .flight[data-lesson] .view-data, .flight[data-lesson] .aircraft-tools,
.flight[data-lesson] .prop-controls { display: none; }
.flight[data-lesson] .flight-image { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; transform: none; }
.flight[data-lesson] .flight-shade { background: linear-gradient(180deg, #111b1738, transparent 20%, transparent 88%, #111b172e); }
.flight[data-lesson] .viewport-message { top: auto; bottom: 19px; right: 16px; left: auto; transform: none; gap: 6px; }
.flight[data-lesson] .viewport-message strong { font-size: 1.08rem; }
.flight[data-lesson] .lesson-stick-row { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center;
  gap: 14px; max-width: calc(100% - 32px); pointer-events: none; }
.flight[data-lesson] .stick-overlay { position: static; transform: none; flex: 0 0 auto; }
#axis-stick-cue { max-width: 180px; padding: 6px 9px; background: #17211cee; border: 1px solid #dce6d256;
  border-radius: 6px; font-size: 0.82rem; line-height: 1.3; }
.stick-arrow { display: none; position: absolute; z-index: 2; width: 17px; height: 24px; background: #f6ff89;
  clip-path: polygon(50% 0, 100% 48%, 68% 48%, 68% 100%, 32% 100%, 32% 48%, 0 48%); }
.stick-overlay[data-guide][data-guide-stick="left"] [data-stick="left"] .stick-arrow,
.stick-overlay[data-guide][data-guide-stick="right"] [data-stick="right"] .stick-arrow {
  display: block; animation: stick-cue 1.2s ease-in-out infinite;
}
.stick-overlay[data-guide="forward"] .stick-arrow { top: -12px; left: calc(50% - 8px); }
.stick-overlay[data-guide="back"] .stick-arrow { bottom: -8px; left: calc(50% - 8px); transform: rotate(180deg); }
.stick-overlay[data-guide="left"] .stick-arrow { left: -11px; top: calc(50% - 12px); transform: rotate(-90deg); }
.stick-overlay[data-guide="right"] .stick-arrow { right: -11px; top: calc(50% - 12px); transform: rotate(90deg); }
@keyframes stick-cue { 0%, 100% { opacity: 1; } 50% { opacity: 0.14; } }
@media (prefers-reduced-motion: reduce) { .stick-overlay[data-guide][data-guide-stick] [data-stick] .stick-arrow { animation: none; } }
.axis-lesson, .hover-lesson { position: absolute; left: 16px; top: 57px; display: grid; gap: 7px; width: max-content; max-width: calc(100% - 32px);
  padding: 10px 12px; color: #f0f6ec; background: #17211cee; border: 1px solid #dce6d256; border-radius: 8px; }
.axis-lesson { max-width: min(258px, calc(100% - 32px)); }
.axis-lesson strong { color: #e0ff87; text-transform: uppercase; font-size: 1.1rem; letter-spacing: 0.07em; }
.axis-lesson p { color: #d1dece; font-size: 0.82rem; line-height: 1.35; }
.station-checkpoint { font-variant-numeric: tabular-nums; }
.station-hold { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.station-hold progress { flex: 1; width: 78px; min-width: 40px; height: 7px; accent-color: #92f59b; }
.station-hold span { white-space: nowrap; }
#pitch-warning { color: #ffd887; font-weight: 650; }
.maze-help { position: absolute; top: 48%; left: 50%; width: min(348px, 82%); transform: translate(-50%, -50%); z-index: 3;
  text-align: center; padding: 11px 14px; border: 1px solid #e8eab27a; border-radius: 10px;
  background: #15231af5; color: #f5f7ea; box-shadow: 0 8px 36px #111c14ad; pointer-events: none; }
.maze-help strong { color: #e6fa9f; font-size: 1rem; }
.maze-help button { pointer-events: auto; min-height: 32px; padding: 5px 14px; font-size: 0.84rem; }
.maze-help-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }
.maze-diagram { --side: 1; display: flex; align-items: center; justify-content: center; gap: 9px; height: 99px; }
.maze-diagram[data-direction="left"] { --side: -1; }
.diagram-radio { flex: 0 0 auto; display: flex; gap: 8px; padding: 11px 9px; border: 1px solid #849898;
  border-radius: 16px 16px 22px 22px; background: #263d39; }
.diagram-pad { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #738987;
  border-radius: 50%; background: linear-gradient(90deg, transparent 49%, #96a99078 50%, transparent 53%),
    linear-gradient(0deg, transparent 49%, #96a99078 50%, transparent 53%); }
.diagram-pad i { width: 9px; height: 9px; border-radius: 50%; background: #9fb3a9; }
.diagram-pad b { display: none; position: absolute; left: 50%; top: 50%; width: 12px; height: 16px; background: #e3fa81;
  clip-path: polygon(50% 0, 100% 50%, 65% 50%, 65% 100%, 35% 100%, 35% 50%, 0 50%);
  transform: translate(-50%, -50%) translate(var(--arrow-x), var(--arrow-y)) rotate(var(--arrow-turn)); }
.maze-diagram[data-stick="left"] [data-diagram-stick="left"], .maze-diagram[data-stick="right"] [data-diagram-stick="right"] {
  border-color: #ecff9b; box-shadow: 0 0 0 2px #e3fa8138; }
.maze-diagram[data-stick="left"] [data-diagram-stick="left"] i, .maze-diagram[data-stick="right"] [data-diagram-stick="right"] i {
  background: #ebff9b; animation: diagram-stick 1.2s ease-in-out infinite; }
.maze-diagram[data-stick="left"] [data-diagram-stick="left"] b, .maze-diagram[data-stick="right"] [data-diagram-stick="right"] b { display: block; }
.diagram-arrow { flex: 0 0 20px; height: 12px; background: #b5c8af;
  clip-path: polygon(0 36%, 61% 36%, 61% 0, 100% 50%, 61% 100%, 61% 64%, 0 64%); }
.diagram-motion { width: min(114px, 35vw); height: 86px; position: relative; display: grid; place-items: center; perspective: 165px; }
.diagram-quad { width: 32px; height: 32px; position: relative; animation: diagram-quad 1.2s ease-in-out infinite;
  background: linear-gradient(45deg, transparent 44%, #a3babb 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #a3babb 45% 55%, transparent 56%); }
.diagram-quad i { position: absolute; width: 9px; height: 9px; background: #f1a56d; border-radius: 50%; }
.diagram-quad i:nth-child(odd) { left: 0; }
.diagram-quad i:nth-child(even) { right: 0; }
.diagram-quad i:nth-child(-n+2) { top: 0; }
.diagram-quad i:nth-child(n+3) { bottom: 0; background: #68cfbe; }
.diagram-quad b { position: absolute; top: -7px; left: calc(50% - 6px); width: 12px; height: 12px;
  background: #ffe66c; clip-path: polygon(50% 0, 100% 100%, 50% 77%, 0 100%); }
.maze-diagram[data-move="pitch"] { --stick-x: 0px; --stick-y: -9px; --arrow-x: 0px; --arrow-y: -21px; --arrow-turn: 0deg;
  --quad-x: 0px; --quad-y: -24px; --bank: 0deg; --pitch: 24deg; --turn: 0deg; }
.maze-diagram:is([data-move="roll"], [data-move="yaw"]) { --stick-x: calc(9px * var(--side)); --stick-y: 0px;
  --arrow-x: calc(20px * var(--side)); --arrow-y: 0px; --arrow-turn: calc(90deg * var(--side)); --quad-y: 0px; --pitch: 0deg; }
.maze-diagram[data-move="roll"] { --quad-x: calc(27px * var(--side)); --bank: calc(-28deg * var(--side)); --turn: 0deg; }
.maze-diagram[data-move="yaw"] { --quad-x: 0px; --bank: 0deg; --turn: calc(88deg * var(--side)); }
.diagram-flight-path { position: absolute; pointer-events: none; color: #94e5e7; opacity: 0.65; }
.maze-diagram:is([data-move="pitch"], [data-move="roll"]) .diagram-flight-path { width: 36px; height: 13px;
  background: currentColor; clip-path: polygon(0 42%, 68% 42%, 68% 0, 100% 50%, 68% 100%, 68% 58%, 0 58%); }
.maze-diagram[data-move="pitch"] .diagram-flight-path { top: 11px; right: calc(50% - 18px); transform: rotate(-90deg); }
.maze-diagram[data-move="roll"] .diagram-flight-path { bottom: 8px; left: calc(50% - 18px);
  transform: translateX(calc(13px * var(--side))) scaleX(var(--side)); }
.maze-diagram[data-move="yaw"] .diagram-flight-path { width: 57px; height: 57px; border: 2px solid transparent;
  border-top-color: currentColor; border-right-color: currentColor; border-radius: 50%; transform: scaleX(var(--side)); }
.maze-diagram[data-move="yaw"] .diagram-flight-path::after { content: ''; position: absolute; right: -3px; bottom: 5px;
  width: 12px; height: 11px; background: currentColor; clip-path: polygon(0 0, 100% 40%, 0 100%); transform: rotate(117deg); }
@keyframes diagram-stick { 20%, 78% { transform: translate(var(--stick-x), var(--stick-y)); } }
@keyframes diagram-quad {
  42%, 84% { transform: translate(var(--quad-x), var(--quad-y)) rotateZ(var(--turn)) rotateY(var(--bank)) rotateX(var(--pitch)); }
}
@media (prefers-reduced-motion: reduce) {
  .maze-diagram[data-stick="left"] [data-diagram-stick="left"] i, .maze-diagram[data-stick="right"] [data-diagram-stick="right"] i {
    animation: none; transform: translate(var(--stick-x), var(--stick-y)); }
  .maze-diagram .diagram-quad { animation: none;
    transform: translate(var(--quad-x), var(--quad-y)) rotateZ(var(--turn)) rotateY(var(--bank)) rotateX(var(--pitch)); }
}
.hover-part { color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.hover-altitudes { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.hover-altitudes div { display: grid; gap: 2px; }
.hover-altitudes span, .hover-status { font-size: 0.75rem; color: #d1dece; }
.hover-altitudes strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.hover-lesson progress { width: 100%; height: 7px; accent-color: #92f59b; }
.hover-status { display: flex; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.hover-lesson[data-in-band] #hover-cue { color: #a2f8ab; }
@container (max-width: 440px) {
  .axis-lesson, .hover-lesson { left: 10px; top: 53px; padding: 7px 8px; max-width: 155px; gap: 4px; }
  .axis-lesson strong { font-size: 0.78rem; }
  #axis-stick-cue { font-size: 0.75rem; max-width: 110px; }
  .flight[data-lesson] .primary { font-size: 0.82rem; padding: 7px 10px; }
  .hover-altitudes { gap: 4px 8px; }
  .hover-altitudes strong { font-size: 0.86rem; }
  .hover-status { flex-wrap: wrap; gap: 2px 8px; }
  .flight[data-lesson] .viewport-message { right: 10px; bottom: 14px; }
}
.mission-strip { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.gate-progress, .mission-data, .shortcuts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.gate-progress span { width: 28px; height: 27px; display: grid; place-items: center; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); font-size: 0.77rem; }
.gate-progress span.current { color: var(--accent); border-color: #8ba34b; }
.gate-progress span.cleared { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.mission-data { justify-content: flex-end; gap: 14px; font-size: 0.78rem; color: var(--muted); }
.mission-data strong { color: var(--text); font-variant-numeric: tabular-nums; margin-left: 2px; }
.shortcuts { padding: 14px 0 0; gap: 11px 17px; color: var(--muted); font-size: 0.82rem; }
summary { cursor: pointer; }
.settings { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); min-width: 0; overflow: hidden; }
.settings-heading { min-height: 61px; padding: 14px 17px; }
.settings-heading h2 { font-weight: 650; font-size: 1.12rem; }
#settings-state { font-size: 0.75rem; color: var(--muted); text-align: right; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding: 0 17px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: transparent; padding: 0 1px 9px; font-size: 0.87rem; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.settings-panel { padding: 10px 17px 4px; }
.setting-note { font-size: 0.78rem; line-height: 1.4; color: var(--muted); }
.physics-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.physics-toolbar button { flex: 0 0 auto; padding: 5px 8px; font-size: 0.78rem; }
.slider-row { display: grid; grid-template-columns: 1fr 84px; align-items: center; gap: 5px 10px; margin: 9px 0 14px; }
.slider-row label { font-size: 0.86rem; font-weight: 560; }
.slider-row input[type=range] { grid-column: 1 / -1; width: 100%; margin: 0; height: 15px; accent-color: var(--accent); }
.slider-track { grid-column: 1 / -1; position: relative; }
.slider-track input[type=range] { display: block; position: relative; z-index: 1; }
.slider-default { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: #3ef0d8; box-shadow: 0 0 6px #3ef0d8; pointer-events: none; z-index: 0; }
.slider-reset { grid-column: 1 / -1; justify-self: start; padding: 3px 10px; font-size: 0.74rem; color: #3ef0d8; background: rgba(62,240,216,.08); border: 1px solid rgba(62,240,216,.4); border-radius: 5px; cursor: pointer; }
.slider-reset[hidden] { display: none; }
.slider-row.changed .numeric input { color: #ffb347; }
.numeric { display: flex; align-items: center; justify-content: flex-end; background: #151b17; border: 1px solid var(--line); border-radius: 5px; min-width: 0; padding-right: 5px; }
.numeric span { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
input[type=number] { width: 100%; min-width: 0; background: #151b17; color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 5px 3px 5px 6px; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.numeric input[type=number] { text-align: right; padding-right: 4px; border: 0; }
input[type=number]::-webkit-inner-spin-button { appearance: none; }
.advanced { border-top: 1px solid var(--line); padding: 11px 0; }
.advanced summary { font-size: 0.84rem; }
.profile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 12px 17px; background: #171d19; border-top: 1px solid var(--line); }
.profile-actions button { font-size: 0.79rem; padding: 7px 9px; }
.profile-actions button:first-child { color: var(--accent); }
.profile-actions a { padding: 7px 3px; }
.select-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.85rem; margin: 6px 0 11px; }
select { color: var(--text); background: #151b17; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 0.85rem; }
.rates-table { width: 100%; table-layout: fixed; border-spacing: 4px 5px; margin: 0 -4px 5px; }
.rates-table th { font-size: 0.73rem; color: var(--muted); font-weight: 500; text-align: left; line-height: 1.05; }
.rates-table tbody th { font-size: 0.81rem; color: var(--text); }
.rates-table .peak { color: var(--muted); text-align: right; font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.rate-graph { display: block; background: #151b17; border: 1px solid var(--line); border-radius: 7px; width: 100%; height: auto; margin: 7px 0 5px; }
.graph-legend { display: flex; gap: 13px; color: var(--muted); font-size: 0.74rem; margin: 0 0 12px; }
.graph-legend span::before { content: ''; display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 4px; background: var(--curve); }
.check-row { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; margin-bottom: 10px; }
#radio-hint { color: var(--muted); font-size: 0.83rem; margin: 6px 0 11px; }
.radio-group { padding: 9px 0 12px; border-top: 1px solid var(--line); }
.radio-group h3 { margin: 0 0 6px; font-size: 0.89rem; }
.radio-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.radio-fields label { display: grid; gap: 2px; font-size: 0.7rem; color: var(--muted); }
.radio-live { width: 100%; height: 7px; accent-color: var(--accent); }
#remap-radio { margin-bottom: 11px; font-size: 0.82rem; }
.radio-setup, .keyboard-guide { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 22px; width: min(480px, calc(100% - 30px)); max-height: 90vh; }
.radio-setup::backdrop, .keyboard-guide::backdrop { background: #0d130fd9; }
.keyboard-guide { max-width: 360px; margin: auto; }
.keyboard-guide h2 { font-size: 1.25rem; }
.keyboard-guide dl { display: grid; gap: 5px; margin: 13px 0 15px; }
.keyboard-guide dl div { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 8px; font-size: 0.85rem; }
.keyboard-guide dd { margin: 0; }
.keyboard-guide form { display: flex; justify-content: flex-end; }
.radio-setup header { margin-bottom: 12px; }
.radio-setup h2 { font-size: 1.45rem; }
.radio-setup p:not(.eyebrow) { color: var(--muted); font-size: 0.94rem; line-height: 1.43; }
.setup-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.setup-actions .primary { padding: 8px 14px; min-height: 38px; }
.setup-sticks { position: static; transform: none; margin: 17px 0 14px; }
.setup-sticks .stick-square { --stick-size: 74px; }
.review-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.82rem; }
.review-row button { padding: 5px 7px; min-width: 73px; }
.review-row button[aria-pressed=true] { color: var(--accent); }
.arm-mapping { padding: 7px 0 8px; border-top: 1px solid var(--line); }
.arm-mapping h3 { font-size: 0.89rem; margin: 5px 0; }
.arm-mapping output { font-size: 0.81rem; color: var(--muted); }
.arm-mapping output.on { color: var(--accent); }
.arm-mapping [data-arm-detect] { margin: 3px 0 6px; }
.arm-detection { display: grid; justify-items: start; gap: 9px; margin: 8px 0; font-size: 0.84rem; }
.arm-detection p { color: var(--muted); line-height: 1.4; }
.arm-detection [data-arm-choices], .arm-detection [data-switch-actions] { display: flex; flex-wrap: wrap; gap: 6px; }
.arm-detection button { padding: 6px 8px; }
.arm-detection button.current { color: var(--accent); border-color: var(--accent); }
@media (max-width: 950px) { .layout { padding: 19px 20px; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(310px, 335px); } .topbar { padding: 0 20px; } }
@media (max-width: 740px) { .layout { display: block; } .flight { position: static; } .settings { margin-top: 22px; } .viewport { height: clamp(300px, 51vh, 530px); } }
@media (max-width: 430px) { .topbar, .layout { padding-left: 13px; padding-right: 13px; } .device span { max-width: 74px; } .viewport { height: 345px; } .viewport-status-stack, .viewport-tools { top: 10px; } .viewport-status-stack, .view-data { left: 10px; } .view-data { bottom: 79px; } .viewport-tools, .aircraft-tools { right: 10px; } .mission-data { gap: 7px; } .stick-square { --stick-size: 50px; } }
@container (max-width: 440px) {
  .course-map { width: clamp(58px, 22cqw, 100px); }
  .viewport-message { top: 50%; }
}

/* Coach tips during training */
.coach-tip { position: absolute; z-index: 6; bottom: 110px; left: 50%; width: min(560px, calc(100% - 40px)); padding: 14px 18px 14px 20px;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s;
  background: rgba(6, 14, 18, .86); border: 1px solid rgba(62, 240, 216, .45); border-left: 3px solid #c8f560; backdrop-filter: blur(8px);
  box-shadow: 0 14px 40px rgba(0,0,0,.45); color: #eef6f2; font-family: Bahnschrift, "Segoe UI", system-ui, sans-serif; }
.coach-tip.show { opacity: 1; transform: translate(-50%, 0); }
.coach-tip-label { display: block; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #3ef0d8; margin-bottom: 5px; }
.coach-tip p { margin: 0; font-size: 16px; line-height: 1.45; }

/* Race battery HUD (Betaflight-style pack voltage, centred at ~60 % height) and the "Battery empty" tip. */
.battery-hud { position: absolute; z-index: 4; top: 59%; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  pointer-events: none; color: #eef6f2; font: 700 15px Bahnschrift, "Segoe UI", system-ui, sans-serif; text-shadow: 1px 1px 2px rgba(0,0,0,.7);
  font-variant-numeric: tabular-nums; white-space: pre; }
.battery-hud[hidden] { display: none; }
.battery-icon { position: relative; width: 22px; height: 11px; border: 2px solid currentColor; border-radius: 2px; box-shadow: 1px 1px 2px rgba(0,0,0,.6); }
.battery-icon::after { content: ""; position: absolute; right: -5px; top: 2px; width: 3px; height: 3px; background: currentColor; }
.battery-icon i { position: absolute; inset: 1px; background: currentColor; transform-origin: left; }
.battery-hud[data-level="low"] { color: #ffb833; }
.battery-hud[data-level="land"], .battery-hud[data-level="empty"] { color: #ff4033; }
.battery-hud.dim[data-level="low"] { color: #805c1a; }
.battery-hud.dim[data-level="land"] { color: #80261f; }
.battery-tip { position: absolute; z-index: 7; top: 50%; left: 50%; transform: translate(-50%, calc(-50% - 30px)); width: min(620px, calc(100% - 40px));
  padding: 16px 20px; background: rgba(6, 14, 18, .9); border: 1px solid rgba(62, 240, 216, .45); border-left: 3px solid #ffb833;
  box-shadow: 0 14px 40px rgba(0,0,0,.45); color: #eef6f2; font-family: Bahnschrift, "Segoe UI", system-ui, sans-serif; }
.battery-tip[hidden] { display: none; }
.battery-tip strong { display: block; color: #ffb833; font-size: 18px; margin-bottom: 8px; }
.battery-tip p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; }
.battery-tip div { display: flex; justify-content: flex-end; gap: 12px; }
#race-options .check-row { display: block; margin: 0 0 14px; }
#race-options .setting-note { display: block; margin-top: 4px; }
/* Signal-loss zone: analogue static over the FPV view outside the stage bounds, then SIGNAL LOST. */
.signal-static { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; z-index: 2; }
.signal-static[hidden], .signal-label[hidden] { display: none; }
.signal-label { position: absolute; z-index: 3; top: 38%; left: 50%; transform: translateX(-50%); pointer-events: none; color: #ff4033;
  font: 700 22px Bahnschrift, "Segoe UI", system-ui, sans-serif; letter-spacing: .12em; text-shadow: 1px 1px 3px rgba(0,0,0,.8); }