/* Jet Roadster. Interface colours come from /assets/theme.css; physics colours keep one
   meaning in both schemes: blue = jet thrust, amber = friction. */
* { box-sizing: border-box; }
:root {
  --thrust: var(--site-info);
  --friction: var(--site-amber);
  --radius: 12px;
}
body { margin: 0; min-height: 100vh; color: var(--site-text); background: var(--site-bg); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 5px; border: 1px solid currentColor; border-radius: 4px; opacity: .7; margin-left: 6px; }
.muted { color: var(--site-muted); font-size: 12px; }
.nowrap { white-space: nowrap; }
math { font-size: 1.05em; }

/* header — same pattern as the other labs */
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 18px; width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 18px; }
.top-bar h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.top-bar-right { display: flex; align-items: center; gap: 14px; }
.readout { display: grid; gap: 4px; min-width: 130px; padding: 10px 14px; border: 1px solid var(--site-border); border-radius: 8px; background: var(--site-surface-soft); text-align: right; }
.readout span { color: var(--site-muted); font-size: 12px; }
.readout strong { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--site-green); }
.home-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--site-border); border-radius: 50%; background: var(--site-surface); color: var(--site-green); box-shadow: var(--site-shadow); transition: transform .2s ease, border-color .2s ease; }
.home-button:hover, .home-button:focus-visible { border-color: var(--site-accent); color: var(--site-green-hover); transform: translateY(-2px); }
.embed .top-bar { display: none; }

.layout { width: min(1280px, calc(100% - 48px)); margin: 0 auto 40px; display: grid; gap: 20px; }
.panel { background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--radius); box-shadow: var(--site-shadow); }
.task-panel { padding: 18px 20px; }
.task-panel h2 { font-size: 17px; margin-bottom: 8px; }
/* mode switching */
body[data-mode="challenge"] .only-free, body[data-mode="free"] .only-challenge { display: none !important; }
body[data-mode="free"] .top-bar .readout { visibility: hidden; }
.mode-tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px; border-radius: 10px; border: 1px solid var(--site-border); background: var(--site-surface-soft); }
.mode-tabs button { border: 0; background: none; color: var(--site-muted); padding: 7px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.mode-tabs button:hover { color: var(--site-green); }
.mode-tabs button.selected { background: var(--site-green); color: var(--site-on-accent); }
.task-panel p { color: var(--site-muted); line-height: 1.6; max-width: 980px; }
.task-panel b { color: var(--site-text); font-weight: 600; }
.controls-note { margin-top: 8px; font-size: 13px; }
.controls-note kbd { margin: 0 1px; }
.toggle { position: relative; flex: none; width: 44px; height: 26px; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: var(--site-surface-soft); border: 1px solid var(--site-border); pointer-events: none; transition: background .15s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--site-muted); transition: transform .15s; }
.toggle input:checked + span { background: var(--site-green); border-color: var(--site-green); }
.toggle input:checked + span::after { transform: translateX(18px); background: var(--site-on-accent); }
.toggle input:focus-visible + span { outline: 2px solid var(--site-focus); outline-offset: 2px; }

.game { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.rig { display: grid; gap: 14px; }
.rig:fullscreen { background: var(--site-bg); padding: 14px; grid-template-rows: 1fr auto; }
.rig:fullscreen .viewport { height: auto; min-height: 0; }

/* stage */
.viewport { position: relative; height: clamp(380px, 58vh, 620px); border: 1px solid var(--site-border); border-radius: var(--radius); overflow: hidden; background: var(--site-bg); box-shadow: var(--site-shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
#scene, #scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.world-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 12px; color: var(--site-muted); }
.world-label.point { font-weight: 700; font-size: 15px; color: var(--site-text); }
.world-label.road { font-size: 11.5px; letter-spacing: .02em; }
.world-label.force { padding: 3px 7px; border-radius: 6px; background: color-mix(in srgb, var(--site-surface) 88%, transparent); border: 1px solid var(--thrust); color: var(--thrust); font-weight: 600; font-size: 11.5px; }
.world-label.force.friction { border-color: var(--friction); color: var(--friction); }
.world-label.force.radial { border-color: var(--site-border); color: var(--site-muted); }

.hud-top { position: absolute; inset: 12px 12px auto 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.chip { justify-self: start; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: color-mix(in srgb, var(--site-surface) 90%, transparent); border: 1px solid var(--site-border); font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--site-muted); }
.chip[data-state="live"] .dot { background: var(--site-success); animation: pulse 1.2s ease-in-out infinite; }
.chip[data-state="done"] .dot { background: var(--site-success); }
.chip[data-state="danger"] { color: var(--site-danger); border-color: var(--site-danger); }
.chip[data-state="danger"] .dot { background: var(--site-danger); }
@keyframes pulse { 50% { opacity: .35; } }
.timer { white-space: nowrap; padding: 4px 14px; border-radius: 10px; background: color-mix(in srgb, var(--site-surface) 90%, transparent); border: 1px solid var(--site-border); font: 700 24px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }
.timer small { font-size: 13px; color: var(--site-muted); font-weight: 500; }
.views { justify-self: end; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: color-mix(in srgb, var(--site-surface) 90%, transparent); border: 1px solid var(--site-border); backdrop-filter: blur(6px); }
.views button { border: 0; background: none; color: var(--site-muted); padding: 6px 10px; border-radius: 7px; font-size: 13px; }
.views button:hover { color: var(--site-green); }
.views button.selected { background: var(--site-green); color: var(--site-on-accent); }
.views .icon { padding: 6px 9px; }
.hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--site-surface) 92%, transparent); border: 1px solid var(--site-border); color: var(--site-muted); font-size: 13px; white-space: nowrap; pointer-events: none; }
.hint b { color: var(--site-text); }
.hint[hidden] { display: none; }

/* cockpit dashboard */
.dashboard { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(620px, calc(100% - 24px)); display: none; grid-template-columns: 150px auto 1fr; align-items: center; gap: 18px; padding: 14px 20px 16px; border-radius: 18px 18px 0 0; border: 1px solid var(--site-border); border-bottom: 0; background: var(--site-surface); box-shadow: var(--site-shadow); }
.viewport[data-view="cockpit"] .dashboard { display: grid; }
body[data-mode="free"] .dashboard { grid-template-columns: 150px 64px auto 1fr; width: min(700px, calc(100% - 24px)); }
.wheel { width: 64px; height: 64px; color: var(--site-text); }
.wheel svg { width: 100%; height: 100%; transition: transform .05s linear; }
.lamp.brake.on { background: var(--site-danger); border-color: var(--site-danger); }
.viewport[data-view="cockpit"] .hint { bottom: auto; top: 64px; }
.gauge { position: relative; height: 94px; }
.gauge svg { width: 150px; height: 92px; }
.g-track, .g-fill { fill: none; stroke-width: 9; stroke-linecap: round; }
.g-track { stroke: var(--site-surface-soft); }
.g-fill { stroke: var(--site-green); transition: stroke-dasharray .08s linear; }
.g-value { position: absolute; left: 0; right: 0; top: 38px; text-align: center; font: 700 26px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.g-value small { display: block; font: 500 11px/1.4 Inter, sans-serif; color: var(--site-muted); }
.g-label { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--site-muted); }
.lamps { display: grid; gap: 6px; }
.lamp { padding: 4px 9px; border-radius: 6px; border: 1px solid var(--site-border); color: var(--site-muted); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-align: center; }
.lamp.on { background: var(--thrust); border-color: var(--thrust); color: var(--site-surface); }
.lamp.warn.on { background: var(--site-danger); border-color: var(--site-danger); animation: pulse .6s steps(2) infinite; }
.tank { display: grid; gap: 7px; }
.tank-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--site-muted); }
.tank-head b { color: var(--site-text); font-variant-numeric: tabular-nums; font-size: 15px; }
.tank-head.small b { font-size: 12px; }
.tank-bar, .bar, .grip-bar { height: 10px; border-radius: 99px; background: var(--site-surface-soft); overflow: hidden; border: 1px solid var(--site-border-soft); }
.tank-bar { height: 14px; }
.tank-bar > div, .bar > div, .grip-bar > div { height: 100%; width: 100%; background: var(--site-green); border-radius: inherit; transition: width .08s linear; }
.tank-bar > div.low, .bar > div.low { background: var(--site-amber); }
.tank-bar > div.endless, .bar > div.endless { background: repeating-linear-gradient(-45deg, var(--site-green) 0 8px, color-mix(in srgb, var(--site-green) 70%, var(--site-surface)) 8px 16px); }
.grip-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; font-size: 12px; color: var(--site-muted); }
.grip-bar > div, .bar.grip > div { width: 0; background: var(--friction); }
.grip-bar > div.over, .bar.grip > div.over { background: var(--site-danger); }

/* result */
.result { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--site-bg) 45%, transparent); }
.result[hidden] { display: none; }
.result-card { width: min(440px, 100%); padding: 22px 24px; border-radius: 14px; background: var(--site-surface); border: 1px solid var(--site-border); border-top: 4px solid var(--site-danger); box-shadow: var(--site-shadow-hover); }
.result[data-kind="good"] .result-card { border-top-color: var(--site-success); }
.result-card h2 { font-size: 21px; margin-bottom: 8px; }
.result-card p { color: var(--site-muted); line-height: 1.55; font-size: 14px; }
.result-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
.result-stats div { flex: 1 1 90px; padding: 8px 10px; border-radius: 8px; background: var(--site-surface-soft); }
.result-stats span { display: block; font-size: 11px; color: var(--site-muted); }
.result-stats b { font-variant-numeric: tabular-nums; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.primary, .ghost { padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.primary { border: 1px solid var(--site-green); background: var(--site-green); color: var(--site-on-accent); }
.primary:hover { background: var(--site-green-hover); }
.ghost { border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-green); }
.ghost:hover { border-color: var(--site-green); }
.ghost[hidden] { display: none; }
.render-error { position: absolute; inset: auto 16px 16px; padding: 12px 14px; border-radius: 8px; background: var(--site-surface); border: 1px solid var(--site-danger); color: var(--site-danger); }

/* controls */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; }
.pad { display: flex; flex-wrap: wrap; gap: 12px; }
.pad.drive { gap: 14px; }
.cluster { display: flex; gap: 6px; }
.key { display: grid; place-items: center; width: 58px; height: 52px; padding: 4px 0; border-radius: 10px; border: 1px solid var(--site-border); background: var(--site-surface-soft); color: var(--site-green); font-size: 20px; line-height: 1; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.key small { font-size: 10.5px; color: var(--site-muted); margin-top: 3px; letter-spacing: .02em; }
.key:hover { border-color: var(--site-green); }
.key.side { color: var(--thrust); }
.key.go { width: 64px; }
.key.firing { background: var(--thrust); border-color: var(--thrust); color: var(--site-surface); transform: translateY(1px); }
.key.firing small { color: inherit; opacity: .85; }
.key[data-action="brake"].firing { background: var(--site-danger); border-color: var(--site-danger); }
.jet { display: inline-flex; align-items: center; gap: 12px; min-width: 170px; padding: 10px 16px 10px 10px; border-radius: 11px; border: 1px solid var(--site-border); background: var(--site-surface-soft); color: var(--site-text); text-align: left; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .06s ease; }
.jet b { display: block; font-size: 15px; }
.jet small { display: block; font-size: 12px; color: var(--site-muted); font-variant-numeric: tabular-nums; }
.jet-key { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--site-surface); border: 1px solid var(--site-border); font-size: 18px; color: var(--site-green); }
.jet:hover { border-color: var(--site-green); }
.jet.firing { background: var(--thrust); border-color: var(--thrust); color: var(--site-surface); transform: translateY(1px); }
.jet.firing small { color: inherit; opacity: .85; }
.jet.firing .jet-key { background: transparent; color: inherit; border-color: currentColor; }
.jet.armed { border-color: var(--thrust); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--thrust) 35%, transparent); }
.jet.armed small::after { content: ' · armed'; color: var(--thrust); font-weight: 600; }
.jet:disabled { opacity: .5; cursor: default; }
.power { display: grid; gap: 4px; flex: 1 1 160px; font-size: 12px; color: var(--site-muted); }
.power b { color: var(--site-text); font-variant-numeric: tabular-nums; margin-left: 4px; }
.power input { width: 100%; accent-color: var(--thrust); }
.control-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--site-muted); }
select { padding: 7px 9px; border-radius: 8px; border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-text); }
.icon-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-green); font-size: 16px; }
.icon-button:hover { border-color: var(--site-green); }

/* side column */
.side-col { display: grid; gap: 16px; }
.instruments, .settings { padding: 16px 18px; display: grid; gap: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h2 { font-size: 15px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--site-border); color: var(--site-green); }
.big { display: flex; align-items: baseline; gap: 6px; font: 700 40px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.big small { font: 500 14px Inter, sans-serif; color: var(--site-muted); }
.meter { display: grid; gap: 7px; }
.meter-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--site-muted); }
.meter-head b { color: var(--site-text); font-variant-numeric: tabular-nums; }
.split { display: flex; justify-content: space-between; font-size: 12px; color: var(--site-muted); }
.split b { color: var(--site-text); font-variant-numeric: tabular-nums; }
.key-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--thrust); }
.key-dot.side { background: var(--site-accent); }
.hint-text { font-size: 12px; line-height: 1.45; color: var(--site-muted); min-height: 2.9em; }
.forces { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--site-border-soft); }
.forces div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--site-border-soft); font-size: 13px; }
.forces dt { color: var(--site-muted); }
.forces dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.forces dd.thrust { color: var(--thrust); }
.forces dd.friction { color: var(--friction); }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.setting strong { display: block; font-size: 14px; }
.setting small { display: block; font-size: 12px; color: var(--site-muted); line-height: 1.4; }
.segmented { display: flex; padding: 3px; border-radius: 9px; border: 1px solid var(--site-border); background: var(--site-surface-soft); flex: none; }
.segmented button { border: 0; background: none; color: var(--site-muted); padding: 6px 11px; border-radius: 7px; font-size: 13px; }
.segmented .selected { background: var(--site-green); color: var(--site-on-accent); }
.autopilots { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--site-border-soft); }
.autopilots > span { width: 100%; font-size: 14px; font-weight: 600; }
.autopilots .ghost { padding: 7px 11px; font-size: 13px; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 12px; border-top: 1px solid var(--site-border-soft); font-size: 13px; }
.switches label { display: flex; align-items: center; gap: 7px; cursor: pointer; }

/* notes */
.notes { padding: 0; }
.notes summary { list-style: none; display: flex; justify-content: space-between; padding: 16px 20px; font-weight: 600; cursor: pointer; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary span { color: var(--site-green); }
.notes[open] summary { border-bottom: 1px solid var(--site-border-soft); }
.notes[open] summary span { transform: rotate(45deg); }
.notes-body { padding: 20px; display: grid; gap: 22px; }
.note-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 32px; }
.note-grid h3, .assumptions h3 { font-size: 15px; margin-bottom: 8px; }
.note-grid p, .assumptions li { color: var(--site-muted); line-height: 1.6; font-size: 14px; margin-bottom: 8px; }
.formula { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--site-green); background: var(--site-surface-soft); border-radius: 0 8px 8px 0; color: var(--site-text) !important; overflow-x: auto; }
.assumptions ul { margin: 0; padding-left: 20px; }
.sources a { color: var(--site-green); margin-right: 14px; }
.reference { width: 100%; border-collapse: collapse; font-size: 13px; }
.reference caption { text-align: left; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.reference th, .reference td { padding: 8px 10px; border-bottom: 1px solid var(--site-border-soft); text-align: left; }
.reference th { background: var(--site-surface-tint); color: var(--site-green); font-weight: 600; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--site-muted); }
footer a { color: var(--site-green); }

@media (max-width: 1060px) {
  .game { grid-template-columns: 1fr; }
  .side-col { grid-template-columns: 1fr 1fr; align-items: start; }
  .note-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .top-bar, .layout { width: calc(100% - 28px); }
  .top-bar { padding: 16px 0 12px; }
  .top-bar h1 { font-size: 24px; }
  .readout { min-width: 0; padding: 7px 10px; }
  .side-col { grid-template-columns: 1fr; }
  .viewport { height: 62vh; min-height: 360px; }
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-top .timer { grid-row: 2; justify-self: start; font-size: 19px; }
  .views button { padding: 6px 7px; font-size: 12px; }
  .hint { display: none; }
  .chip { font-size: 12px; padding: 6px 10px; }
  .jet small { display: none; }
  .pad:not(.drive) { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .pad:not(.drive) .jet { flex: 1 1 0; }
  .pad.drive { width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: 6px; }
  .cluster { gap: 4px; }
  .key, .key.go { width: 48px; height: 50px; font-size: 18px; }
  .key small { font-size: 9.5px; }
  body[data-mode="free"] .dashboard { grid-template-columns: 112px 1fr; }
  .dashboard .wheel { display: none; }
  .jet { padding: 8px 12px 8px 8px; }
  .jet { flex: 1 1 140px; min-width: 0; }
  .control-end { margin-left: 0; width: 100%; justify-content: flex-end; }
  .dashboard { grid-template-columns: 112px 1fr; gap: 12px; padding: 10px 12px 12px; }
  .dashboard .lamps { display: none; }
  .gauge { height: 74px; } .gauge svg { width: 112px; height: 70px; } .g-value { top: 26px; font-size: 20px; }
  .reference { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
