@font-face { font-family: "Doto"; src: url(fonts/DotoRound-900.woff) format("woff"); font-weight: 900; font-display: block; }
@font-face { font-family: "Doto"; src: url(fonts/DotoRound-700.woff) format("woff"); font-weight: 700; font-display: block; }
@font-face { font-family: "Space Mono"; src: url(fonts/SpaceMono-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url(fonts/SpaceMono-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }

:root {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-2: #141414;
  --line: #222222;
  --line-2: #333333;
  --text: #ececec;
  --muted: #7c7c7c;
  --invert: #ffffff;
  --on-invert: #000000;
  --accent: #d71921;
  --dot: #1b1b1b;
  --radius: 18px;
  --mono: "Space Mono", ui-monospace, monospace;
  --dots: "Doto", "Space Mono", monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ececec;
  --surface: #f7f7f7;
  --surface-2: #ffffff;
  --line: #dadada;
  --line-2: #c4c4c4;
  --text: #0b0b0b;
  --muted: #6c6c6c;
  --invert: #000000;
  --on-invert: #ffffff;
  --dot: #d4d4d4;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select { transition: color .18s ease, background-color .18s ease, border-color .18s ease, opacity .18s ease, transform .12s var(--ease); }
button:active:not(:disabled) { transform: scale(.97); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 12px/1.45 var(--mono); letter-spacing: 0.02em;
  display: grid; grid-template-rows: 56px 1fr; overflow: hidden;
  -webkit-font-smoothing: antialiased; transition: background-color .18s ease, color .18s ease;
}
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---------- header ---------- */
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 20px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 14px; }
.logo { font: 900 26px/1 var(--dots); letter-spacing: 0.06em; }
.status { color: var(--muted); font-size: 10px; letter-spacing: 0.16em; }
.status { justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-btn { background: none; border: 1px solid var(--line-2); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; color: var(--text); font-size: 13px; line-height: 1; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:not(:disabled):hover, .pill-btn:hover { border-color: var(--text); }
.pill-btn { background: none; border: 1px solid var(--line-2); border-radius: 999px; height: 28px; padding: 0 12px; cursor: pointer; color: var(--text); font-size: 10px; letter-spacing: 0.16em; }

/* ---------- segmented ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); }
.seg button {
  border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 10.5px; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--invert); color: var(--on-invert); }
.seg.small button { padding: 5px 11px; font-size: 10px; }
.theme-mode { flex: 0 0 auto; }
.theme-mode button { padding-inline: 8px; }
.seg.fill { display: flex; width: 100%; }
.seg.fill button { flex: 1; padding: 7px 4px; }

/* ---------- layout ---------- */
main { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; min-height: 0; }
.panel { transition: background-color .18s ease, border-color .18s ease; }
[data-pane]:not([hidden]) > section { animation: pane-arrive .32s var(--ease) both; }
[data-pane]:not([hidden]) > section:nth-child(2) { animation-delay: 40ms; }
[data-pane]:not([hidden]) > section:nth-child(3) { animation-delay: 80ms; }
[data-pane]:not([hidden]) > section:nth-child(4) { animation-delay: 120ms; }
[data-pane]:not([hidden]) > section:nth-child(5) { animation-delay: 160ms; }
@keyframes pane-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.panel { overflow-y: auto; padding: 8px 16px 24px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }
section { padding: 14px 0 16px; border-bottom: 1px dashed var(--line); }
section:last-child { border-bottom: 0; }
h2 { margin: 0 0 12px; font: 700 10.5px/1 var(--mono); letter-spacing: 0.2em; display: flex; align-items: center; gap: 10px; }
h2 i { font: 900 15px/1 var(--dots); font-style: normal; color: var(--accent); letter-spacing: 0.04em; }

/* ---------- controls ---------- */
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; margin: 0 0 12px; }
.row > label { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.row > .val { font-size: 11px; color: var(--text); min-width: 52px; text-align: right; }
.row > .full { grid-column: 1 / -1; }
.row input.val { background: none; border: 0; border-bottom: 1px solid var(--line-2); padding: 1px 0; width: 76px; outline: none; }
.row input.val:focus { border-color: var(--accent); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: none; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--invert) var(--p, 50%), var(--line-2) var(--p, 50%)); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--line-2); }
input[type=range]::-moz-range-progress { height: 2px; background: var(--invert); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--invert); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--invert); }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--invert); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--invert); }
input[type=range]:focus-visible { outline: 1px dashed var(--accent); outline-offset: 4px; }

.toggle { width: 34px; height: 18px; border-radius: 999px; border: 1px solid var(--line-2); background: none; position: relative; cursor: pointer; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: transform .22s var(--ease), background .15s; }
.toggle.on { background: var(--invert); border-color: var(--invert); }
.toggle.on::after { transform: translateX(16px); background: var(--on-invert); }

input[type=text], input[type=search] {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 14px; outline: none; font-size: 11px; letter-spacing: 0.08em;
}
input[type=text]:focus, input[type=search]:focus { border-color: var(--invert); }
input::placeholder { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.chip { border: 1px solid var(--line-2); background: none; border-radius: 999px; padding: 5px 10px; font-size: 10px; letter-spacing: 0.12em; cursor: pointer; color: var(--muted); }
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.on { background: var(--invert); color: var(--on-invert); border-color: var(--invert); }

.palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.palettes button { border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; background: none; cursor: pointer; text-align: left; font-size: 9.5px; letter-spacing: 0.12em; color: var(--muted); }
.palettes button i { display: block; height: 10px; border-radius: 6px; margin-bottom: 6px; }
.palettes button.on { border-color: var(--invert); color: var(--text); }
.palettes button:hover { border-color: var(--text); color: var(--text); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modes button { border: 1px solid var(--line-2); border-radius: 14px; background: none; padding: 10px; text-align: left; cursor: pointer; color: var(--muted); }
.modes button b { display: block; font: 900 15px/1.1 var(--dots); letter-spacing: 0.05em; color: var(--text); margin-bottom: 4px; }
.modes button span { font-size: 9.5px; letter-spacing: 0.04em; }
.modes button.on { border-color: var(--invert); background: var(--surface-2); }
.modes button.on b::after { content: " ●"; color: var(--accent); font: 10px var(--mono); vertical-align: middle; }
.note { color: var(--muted); font-size: 10.5px; margin: 10px 0 0; }

.slots { display: grid; gap: 6px; }
.slot { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 1px solid var(--line); border-radius: 999px; }
.slot input[type=color] { width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; }
.slot input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.slot input[type=color]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 50%; }
.slot span { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.slot code { font-size: 10px; color: var(--text); }
.slot .swatch { width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 50%; }

.btn { border: 1px solid var(--line-2); background: none; border-radius: 999px; padding: 11px 14px; cursor: pointer; font-size: 10.5px; letter-spacing: 0.18em; width: 100%; }
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--invert); color: var(--on-invert); border-color: var(--invert); }
.btn.primary:hover::before { content: "● "; color: var(--accent); }
.btn:disabled { opacity: .4; cursor: progress; }
.actions { display: grid; gap: 8px; }
.actions.grid4 { grid-template-columns: repeat(4, 1fr); }
.actions.grid4 .btn { padding: 11px 0; }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 10.5px; }
.stats dt { color: var(--muted); letter-spacing: 0.14em; }
.stats dd { margin: 0; text-align: right; }

/* lat / lon pair, colour swatches, reset links */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.num { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 12px; }
.num:focus-within { border-color: var(--invert); }
.num span { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.num input { width: 100%; background: none; border: 0; outline: none; padding: 8px 0; font-size: 11px; text-align: right; -moz-appearance: textfield; }
.num input::-webkit-inner-spin-button { display: none; }
.swatches { display: flex; gap: 6px; }
.swatches input[type=color] { width: 24px; height: 24px; border: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; }
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input[type=color]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 50%; }
.reset { display: block; margin: 4px 0 0 auto; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); font-size: 10px; letter-spacing: 0.16em; }
.reset:hover { color: var(--accent); }
.row > label[title] { cursor: default; user-select: none; }
.palettes { grid-template-columns: repeat(4, 1fr); }

.map-texture { border-top: 1px solid var(--line); padding-top: 11px; margin-top: 14px; }
.texture-title { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.texture-file { display: none; }
.texture-top { min-height: 38px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.texture-top .chip { margin: 0; flex: 0 0 auto; }
.texture-name { min-width: 0; overflow: hidden; color: var(--muted); font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.texture-top .reset { flex: 0 0 auto; margin-left: auto; font-size: 8px; }
.texture-preview { width: 34px; height: 34px; object-fit: contain; border: 1px solid var(--line-2); border-radius: 7px; background: #111; }
.texture-note { margin-top: 2px; line-height: 1.55; }

/* ---------- search ---------- */
.search { position: relative; }
.hits:not([hidden]) { animation: drop-in .16s var(--ease) both; transform-origin: top center; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.hits { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; max-height: 320px; overflow-y: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.hits li { padding: 7px 10px; border-radius: 9px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.hits li:hover, .hits li.on { background: var(--invert); color: var(--on-invert); }
.hits li small { color: var(--muted); font-size: 9.5px; grid-column: 1 / -1; letter-spacing: 0.08em; }
.hits li:hover small, .hits li.on small { color: inherit; opacity: .7; }

.mini-map-wrap { position: relative; width: 100%; aspect-ratio: 2 / 1; margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); isolation: isolate; }
#minimap { width: 100%; height: 100%; aspect-ratio: 2 / 1; display: block; border: 0; cursor: crosshair; background: var(--surface); touch-action: none; }
#minimap.panning { cursor: grabbing; }
#minimap.selecting { cursor: crosshair; }
#minimap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini-globe { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 48%, #1b1c1d, #070809 72%); touch-action: none; }
.mini-globe[hidden] { display: none; }
.mini-globe canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.mini-globe-toggle { position: absolute; z-index: 2; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; color: #fff; background: rgba(0,0,0,.66); backdrop-filter: blur(6px); }
.mini-globe-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.mini-globe-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.mini-tools { display: flex; gap: 5px; margin-top: 6px; }
.mini-tools .chip { padding: 4px 9px; height: 27px; }
.mini-tools .chip:first-child, .mini-tools .chip:nth-child(2) { min-width: 30px; font-size: 15px; padding: 2px 7px; }
.mini-tools .chip:last-child { margin-left: auto; }
.mini-help { margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.reset.terrain-reset { opacity: .55; }
.reset.terrain-reset:hover, .reset.terrain-reset:focus-visible { opacity: .82; }

/* ---------- stage ---------- */
.stage {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(circle, var(--dot) 1px, transparent 1.4px) 0 0 / 14px 14px, var(--bg);
  display: grid; place-items: center;
}
.frame { position: relative; overflow: hidden; isolation: isolate; box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, .55); background: #000; touch-action: none; }
.frame canvas, #view3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#dragContext { z-index: 0; pointer-events: none; }
#view2d { z-index: 1; cursor: grab; transform-origin: 0 0; }
#dragGrid { z-index: 2; pointer-events: none; }
#view2d.drag { cursor: grabbing; }
#view2d.easing { transition: transform .2s var(--ease); }
#view3d { z-index: 1; }
.frame canvas[hidden], #view3d[hidden] { display: none; }
.stage.full .frame { box-shadow: none; background: none; }
.hud { position: absolute; pointer-events: none; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); }
.hud.tl { top: 16px; left: 18px; }
.hud.tr { top: 14px; right: 16px; pointer-events: auto; }
.trace-btn { border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--muted); cursor: pointer; font: 700 8px/1 var(--mono); letter-spacing: .1em; }
.trace-btn:hover { border-color: var(--accent); color: var(--text); }
.trace-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.trace-btn[hidden] { display: none; }
.hud.bl { bottom: 14px; left: 18px; }
.hud.br { bottom: 14px; right: 18px; text-align: right; }
.busy-spinner { position: absolute; z-index: 6; top: 16px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; pointer-events: none; animation: busy-spin .7s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
.hud-title { font: 900 22px/1 var(--dots); color: var(--text); letter-spacing: 0.06em; margin-bottom: 6px; text-transform: uppercase; }
.mono { font-family: var(--mono); }
/* ---------- lunar loading indicator ---------- */
.busy { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.busy-card {
  display: grid; justify-items: center; gap: 8px; width: min(330px, 100%); padding: 15px 18px 14px;
  border: 1px solid var(--line); border-radius: 4px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  box-shadow: 0 10px 32px #0008; backdrop-filter: blur(10px);
  animation: loader-arrive .24s ease-out both;
}
.busy-art { display: grid; place-items: center; width: 100%; }
.busy-visual { display: block; width: min(200px, 100%); height: auto; }
.busy-copy { display: grid; justify-items: center; gap: 6px; text-align: center; }
.busy-copy b { font: 700 11px/1.25 var(--mono); letter-spacing: .02em; }
.busy-copy small { color: var(--muted); font: 8px/1.4 var(--mono); letter-spacing: .02em; }
.busy-quote { min-height: 1.4em; }
.busy-stats { font-size: 7px !important; letter-spacing: .08em !important; }
@keyframes loader-arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }
/* app.js sets data-motion from the device profile and the ANIMATIONS setting; the spinner keeps turning so work never looks frozen */
:root[data-motion="off"] *:not(.busy-spinner), :root[data-motion="off"] *::before, :root[data-motion="off"] *::after, :root[data-motion="off"] ::backdrop { animation: none !important; transition: none !important; }
.toast { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 9px 16px; font-size: 10.5px; letter-spacing: 0.1em; max-width: 80%; animation: toast-arrive .14s ease-out both; }
@keyframes toast-arrive { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.err::before { content: "● "; color: var(--accent); }

/* ---------- hover demos ---------- */
.demo-dot { margin-left: 6px; padding: 0 3px; border: 0; background: none; color: var(--accent); font: 700 11px/1 var(--mono); letter-spacing: 0; vertical-align: 0; cursor: help; opacity: .8; }
.demo-dot:hover, .demo-dot:focus-visible { opacity: 1; }
:root[data-demos="off"] .demo-dot { display: none; }
.modes button { position: relative; }
.modes .demo-dot { position: absolute; top: 9px; right: 9px; margin: 0; }
.demo-dot.arming { animation: dot-arm .85s linear both; }  /* matches DEMO_WAIT in app.js */
.trace-btn .demo-dot { margin-left: 5px; font-size: 9px; }
@keyframes dot-arm { from { opacity: .8; text-shadow: none; } to { opacity: 1; text-shadow: 0 0 2px var(--accent), 0 0 9px var(--accent); } }
.demo-card {
  position: fixed; z-index: 40; left: 0; top: 0; width: min(380px, calc(100vw - 24px)); padding: 7px 7px 12px;
  border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface-2); color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55); pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(6px) scale(.97); transform-origin: center;
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s linear .18s;
}
.demo-card.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.demo-card.pinned { pointer-events: auto; }
.demo-media { overflow: hidden; border-radius: 10px; background: #000; aspect-ratio: 16 / 9; }
.demo-media video, .demo-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.demo-title { display: block; margin: 11px 7px 5px; font: 700 10px/1.3 var(--mono); letter-spacing: .16em; }
.demo-text { margin: 0 7px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }

/* ---------- settings + first-visit notice ---------- */
.prefs-btn { display: grid; place-items: center; padding: 0; }
.prefs-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
dialog.sheet {
  width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px 22px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--text);
  box-shadow: 0 24px 80px #0009;
}
dialog.sheet[open] { animation: sheet-in .28s var(--ease) both; }
dialog.sheet::backdrop { background: #000a; backdrop-filter: blur(3px); animation: fade-in .28s ease both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
dialog.sheet p { margin: 0 0 12px; font-size: 11px; line-height: 1.6; }
dialog.sheet .note { font-size: 10px; letter-spacing: .04em; }
dialog.sheet .btn { margin-top: 4px; }
.actions.two { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1400px) { .hud.br { display: none; } }
@media (max-width: 1180px) {
  main { grid-template-columns: 270px minmax(0, 1fr); }
  #right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; }
  body { overflow: auto; }
}
@media (max-width: 760px) {
  body { grid-template-rows: auto 1fr; overflow: auto; height: auto; }
  .top { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 16px; }
  .status { flex-wrap: wrap; justify-content: flex-end; gap: 8px 6px; }
  .tabs { grid-column: 1 / -1; order: 3; justify-self: stretch; display: flex; }
  .tabs button { flex: 1; padding: 7px 4px; }
  #status { display: none; }
  main { display: flex; flex-direction: column; }
  .stage { order: -1; height: 62vh; }
  .panel { overflow: visible; padding: 4px 16px 16px; }
  #left, #right { border: 0; border-top: 1px solid var(--line); max-height: none; }
  .hud.br { display: none; }
}
