/* Living Worlds — interface in the style of Project Megapop: pixel fonts, dark panels, gold edges. */
:root {
  --bg: #07081a;
  --panel: rgba(16, 16, 34, 0.9);
  --panel-2: rgba(28, 26, 54, 0.96);
  --edge: #c9a24a;
  --edge-dim: #6d5628;
  --text: #efe6cf;
  --muted: #a99e86;
  --good: #7fd35a;
  --bad: #ff6a4d;
  --warn: #ffc94a;
  --blue: #5c8cf0;
  --water: #58b6e0;
  --font: 'VT323', ui-monospace, monospace;
  --font-title: 'Press Start 2P', ui-monospace, monospace;
  --scale: 1;
}
body.contrast { --panel: rgba(0, 0, 0, 0.97); --panel-2: rgba(0, 0, 0, 0.99); --edge: #ffe070; --edge-dim: #d0b040; --text: #ffffff; --muted: #e0e0e0; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: calc(19px * var(--scale)); }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; touch-action: none; }
button { font-family: var(--font); font-size: calc(18px * var(--scale)); color: var(--text); background: #2b2244; border: 2px solid var(--edge-dim); padding: 2px 8px; cursor: pointer; }
button:hover { border-color: var(--edge); background: #3a2e5c; }
button.on, button.active { border-color: var(--edge); background: #5a4520; color: #fff4c8; }
button:disabled { opacity: 0.45; cursor: default; }
button.big { font-family: var(--font-title); font-size: calc(11px * var(--scale)); padding: 9px; background: #5a4520; border-color: var(--edge); }
input, select { font-family: var(--font); font-size: calc(18px * var(--scale)); background: #151126; color: var(--text); border: 2px solid var(--edge-dim); padding: 1px 6px; }
input[type=range] { accent-color: var(--edge); padding: 0; border: 0; background: none; }
.hidden { display: none !important; }
.panel { position: absolute; background: var(--panel); border: 2px solid var(--edge-dim); box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #000; }
.panel h3 { margin: 0 0 6px; font-family: var(--font-title); font-size: calc(10px * var(--scale)); color: var(--edge); letter-spacing: 1px; }
.panel h3 small { font-family: var(--font); font-size: calc(15px * var(--scale)); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.ico { display: inline-block; width: 16px; height: 16px; background-size: 100% 100%; image-rendering: pixelated; vertical-align: -2px; flex: none; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .muted { color: var(--muted); }
.bar { position: relative; height: 12px; background: #120d22; border: 1px solid #000; }
.bar > i, .bar > div { position: absolute; left: 0; top: 0; bottom: 0; background: var(--edge); width: 0; display: block; }

/* ---------- top bar ---------- */
#topbar { top: 6px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 4px 10px; white-space: nowrap; z-index: 6; }
.tb-world { display: flex; flex-direction: column; line-height: 0.95; min-width: 150px; }
.tb-world span { font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: var(--edge); }
.tb-world small, .tb-cycle small { color: var(--muted); font-size: calc(15px * var(--scale)); margin-top: 3px; }
.tb-cycle { display: flex; align-items: center; gap: 5px; }
.tb-cycle span { font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: #fff2c0; min-width: 76px; }
.tb-mana { display: flex; align-items: center; gap: 6px; }
.tb-mana .bar { width: 150px; height: 16px; }
.tb-mana .bar > div { background: linear-gradient(#ffe08a, #c98a2a); }
.tb-mana .bar span { position: absolute; inset: 0; text-align: center; font-size: calc(16px * var(--scale)); line-height: 15px; text-shadow: 1px 1px #000; }
.tb-speed { display: flex; gap: 2px; }
.tb-speed button { padding: 0 6px; font-size: calc(16px * var(--scale)); }
.tb-next { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: calc(16px * var(--scale)); }
.tb-menu { display: flex; gap: 4px; }
.tb-menu button { position: relative; padding: 1px 6px; }
.badge { position: absolute; right: -6px; top: -6px; background: var(--bad); color: #fff; border-radius: 8px; font-size: calc(13px * var(--scale)); line-height: 14px; padding: 0 4px; }

/* ---------- objectives ---------- */
#objectives { right: 6px; top: 60px; width: 320px; padding: 6px 8px; z-index: 5; font-size: calc(17px * var(--scale)); }
.req { display: grid; grid-template-columns: 16px 1fr 58px; gap: 4px; align-items: center; line-height: 1.02; margin: 2px 0; }
.req .mark { color: var(--muted); } .req.met .mark { color: var(--good); }
.req .val { text-align: right; color: var(--muted); font-size: calc(16px * var(--scale)); }
.req .bar { grid-column: 2 / 4; height: 5px; margin-bottom: 2px; }
.req.met .bar > i { background: var(--good); }
.dwell { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; margin: 4px 0; color: var(--muted); font-size: calc(16px * var(--scale)); }
.dwell .bar > i { background: var(--good); }
#btn-trial { width: 100%; margin-top: 5px; }
#obj-more summary { cursor: pointer; color: var(--muted); font-size: calc(15px * var(--scale)); }
#obj-extra { font-size: calc(16px * var(--scale)); color: var(--muted); }

/* ---------- tutorial ---------- */
#tutorial { left: 6px; top: 64px; width: 360px; padding: 6px 8px; z-index: 5; }
#tu-text { line-height: 1.15; }
#tu-text kbd, #tu-why kbd { border: 1px solid var(--edge-dim); padding: 0 3px; font-family: inherit; }
#tu-steps { margin-top: 5px; }
.tu-step { color: var(--muted); }
.tu-step.ok { color: var(--good, #8fe06a); }
#tu-live { margin-top: 4px; color: #ffe9a8; }
#tu-why { margin-top: 5px; padding-top: 4px; border-top: 1px solid var(--edge-dim); color: var(--muted); font-size: calc(17px * var(--scale)); line-height: 1.1; }
.tu-btns { display: flex; gap: 6px; justify-content: flex-end; margin-top: 5px; }
.tu-btns button:empty, .tu-btns .hidden { display: none; }
#tu-next { background: #5a4520; border-color: var(--edge); }
.tu-glow { outline: 2px solid #ffd24a !important; outline-offset: 2px; animation: tuglow 1.1s ease-in-out infinite; }
@keyframes tuglow { 50% { outline-color: rgba(255, 210, 74, 0.25); } }
@media (prefers-reduced-motion: reduce) { .tu-glow { animation: none; } }
#later { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
#later > * { pointer-events: auto; }
#later-toggle { font-size: calc(15px * var(--scale)); padding: 1px 6px; white-space: nowrap; background: rgba(21, 17, 38, 0.92); }
#later-list { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; background: rgba(21, 17, 38, 0.92); border: 2px solid var(--edge-dim); padding: 3px 6px; flex: 1; }
#later.closed #later-toggle { margin-left: 0; }
#later.closed #later-list { display: none; }
#later .grp { display: flex; align-items: center; gap: 2px; }
#later .grp b { font-weight: normal; color: var(--muted); font-size: calc(14px * var(--scale)); margin-right: 2px; }
.pw.unavail { width: 30px; height: 30px; filter: grayscale(1) brightness(0.55); cursor: help; }
.pw.unavail .ico { width: 20px; height: 20px; }
.pw.unavail:hover { filter: grayscale(0.6) brightness(0.8); }
.tu-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: var(--edge); margin-bottom: 4px; }
.tu-head button { font-size: calc(14px * var(--scale)); padding: 0 5px; }
#tu-text { font-size: calc(17px * var(--scale)); line-height: 1.05; }
#tu-text .step { color: var(--muted); font-size: calc(15px * var(--scale)); }

/* ---------- trial ---------- */
#trialbar { left: 50%; transform: translateX(-50%); top: 58px; width: 420px; padding: 6px 10px; z-index: 6; }
.tr-head { font-family: var(--font-title); font-size: calc(10px * var(--scale)); color: var(--warn); margin-bottom: 4px; }
#tr-stage { font-size: calc(17px * var(--scale)); margin-bottom: 3px; }
#trialbar .bar > i { background: var(--warn); }
#tr-stats { font-size: calc(16px * var(--scale)); color: var(--muted); margin: 3px 0; }
#btn-intervene { width: 100%; }

/* ---------- toolbar ---------- */
#toolbar { left: 50%; transform: translateX(-50%); bottom: 6px; display: flex; align-items: center; gap: 8px; padding: 4px 6px; z-index: 5; max-width: calc(100vw - 12px); }
#powers { display: flex; gap: 3px; }
.pw { position: relative; width: 42px; height: 42px; padding: 0; display: grid; place-items: center; }
.pw .ico { width: 28px; height: 28px; }
.pw .key { position: absolute; left: 2px; top: -1px; font-size: calc(14px * var(--scale)); color: var(--muted); }
.pw .cost { position: absolute; right: 2px; bottom: -2px; font-size: calc(14px * var(--scale)); color: #ffd98a; text-shadow: 1px 1px #000; }
.pw .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.65); pointer-events: none; }
.pw.poor .cost { color: var(--bad); }
.pw.locked { filter: grayscale(1) brightness(0.45); }
.tb-sep { width: 2px; align-self: stretch; background: var(--edge-dim); opacity: 0.6; }
#brushctl { display: flex; flex-direction: column; gap: 1px; font-size: calc(15px * var(--scale)); color: var(--muted); }
#brushctl label { display: grid; grid-template-columns: 72px 90px 34px; align-items: center; gap: 4px; }
#brushctl input[type=range] { width: 90px; }
#brushctl select { font-size: calc(14px * var(--scale)); padding: 0 2px; }
#overlays { display: flex; gap: 2px; }
#overlays button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; }
#overlays button .ico { width: 20px; height: 20px; }
#viewctl { display: flex; gap: 2px; }
#viewctl button { height: 30px; min-width: 30px; padding: 0 4px; display: grid; place-items: center; }
#viewctl .ico { width: 20px; height: 20px; }

/* ---------- preview ---------- */
#preview { left: 50%; transform: translateX(-50%); bottom: 64px; width: 470px; padding: 6px 10px; z-index: 7; }
.pv-head { display: flex; justify-content: space-between; font-family: var(--font-title); font-size: calc(10px * var(--scale)); color: var(--edge); margin-bottom: 4px; }
#pv-cost { color: #ffd98a; }
#pv-text { font-size: calc(17px * var(--scale)); line-height: 1.05; }
#pv-reasons div { color: var(--bad); font-size: calc(17px * var(--scale)); line-height: 1.05; margin-top: 3px; }
#pv-reasons div.fix { color: #ffe9a8; margin: 1px 0 4px 6px; }
#pv-detail summary { color: var(--muted); cursor: pointer; font-size: calc(15px * var(--scale)); }
#pv-detail-body { font-size: calc(16px * var(--scale)); color: var(--muted); }
.pv-buttons { display: flex; gap: 6px; margin-top: 5px; }
.pv-buttons button { flex: 1; }

/* ---------- side panel ---------- */
#sidepanel { right: 6px; top: 250px; width: 360px; max-height: calc(100vh - 450px); min-height: 160px; overflow-y: auto; padding: 8px 10px; z-index: 4; }
#sidepanel .close { position: absolute; right: 4px; top: 2px; padding: 0 6px; }
.sp-tabs { display: flex; gap: 2px; margin: 12px 0 5px; }
.sp-tabs button { flex: 1; padding: 0 2px; font-size: calc(14px * var(--scale)); white-space: nowrap; }
.sp-title { font-family: var(--font-title); font-size: calc(10px * var(--scale)); color: var(--edge); margin: 2px 0 4px; }
.sp-sub { color: var(--muted); font-size: calc(16px * var(--scale)); margin-bottom: 5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; font-size: calc(17px * var(--scale)); line-height: 1.02; gap: 0 8px; }
.kv .k { color: var(--muted); white-space: nowrap; }
.kv > span:nth-child(2n) { text-align: right; }
.sp-sec { margin-top: 7px; border-top: 1px solid var(--edge-dim); padding-top: 4px; }
.sp-sec h4 { margin: 0 0 3px; font-family: var(--font-title); font-size: calc(8px * var(--scale)); color: var(--edge); }
.factor { display: grid; grid-template-columns: 110px 1fr 38px; align-items: center; gap: 6px; font-size: calc(16px * var(--scale)); height: 17px; }
.factor .bar { height: 8px; }
.factor .bar > i { background: var(--good); }
.factor.low .bar > i { background: var(--bad); }
.factor.mid .bar > i { background: var(--warn); }
.lin { display: grid; grid-template-columns: 12px 1fr auto; gap: 6px; align-items: center; padding: 1px 3px; cursor: pointer; font-size: calc(16px * var(--scale)); border-left: 3px solid transparent; line-height: 1.05; }
.lin:hover { background: rgba(255,255,255,0.05); }
.lin.sel { border-left-color: var(--edge); background: rgba(201,162,74,0.12); }
.lin.extinct { opacity: 0.5; text-decoration: line-through; }
.lin .sw { width: 10px; height: 10px; border: 1px solid #000; }
.lin small { color: var(--muted); }
.spark { width: 100%; height: 28px; display: block; }
.cause { font-size: calc(16px * var(--scale)); line-height: 1.05; margin: 2px 0; }
.cause.bad { color: #ffb09c; } .cause.good { color: #d7f5b8; }
.pin { color: var(--edge); }

/* ---------- chronicle ---------- */
#log { left: 6px; bottom: 64px; width: clamp(220px, 26vw, 420px); z-index: 3; }
.log-head { display: flex; justify-content: space-between; padding: 2px 6px; font-family: var(--font-title); font-size: calc(8px * var(--scale)); color: var(--edge); }
.log-head button { padding: 0 6px; font-size: calc(14px * var(--scale)); }
#log-body { max-height: 170px; overflow-y: auto; padding: 0 6px 4px; font-size: calc(17px * var(--scale)); line-height: 1.05; }
#log.collapsed #log-body { max-height: 40px; }
.ev { cursor: pointer; padding: 1px 0; }
.ev:hover { color: #fff; }
.ev .t { color: var(--muted); margin-right: 6px; white-space: nowrap; }
.ev.bad { color: #ffb09c; } .ev.good { color: #d7f5b8; } .ev.cause { color: #bfe6ff; }
.ev .n { color: var(--muted); margin-left: 4px; }

/* ---------- minimap ---------- */
#minimap-wrap { right: 6px; bottom: 6px; padding: 4px; z-index: 3; width: 252px; }
#minimap { display: block; width: 240px; height: 120px; image-rendering: pixelated; cursor: pointer; background: #000; }
#legend { font-size: calc(15px * var(--scale)); margin-top: 3px; line-height: 1.05; }
#legend .row { display: flex; align-items: center; gap: 4px; }
#legend .sw { display: inline-block; width: 10px; height: 10px; border: 1px solid #000; }
#legend .title { color: var(--edge); }

/* ---------- markers ---------- */
#markers { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.marker { position: absolute; transform: translate(-50%, -100%); font-size: calc(15px * var(--scale)); color: var(--text); text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; white-space: nowrap; pointer-events: auto; cursor: pointer; }
.marker.refuge { color: #ffe27a; }
.marker.alert { color: #ffb09c; }
.marker.edge { transform: translate(-50%, -50%); background: rgba(40, 10, 10, 0.85); border: 1px solid #a44; padding: 0 4px; }
.marker .dot { display: inline-block; width: 7px; height: 7px; border: 1px solid #000; margin-right: 3px; background: currentColor; }

#tooltip { position: fixed; pointer-events: none; background: rgba(10, 8, 20, 0.94); border: 1px solid var(--edge-dim); padding: 3px 6px; font-size: calc(16px * var(--scale)); line-height: 1.02; z-index: 20; max-width: 300px; }
#toast { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); background: rgba(60, 20, 20, 0.94); border: 2px solid #a44; padding: 3px 12px; z-index: 30; font-size: calc(19px * var(--scale)); }
#toast.ok { background: rgba(20, 40, 20, 0.94); border-color: #4a4; }
#perf { position: fixed; left: 6px; top: 6px; z-index: 9; font-size: 15px; color: #9fc; background: rgba(0,0,0,0.6); padding: 2px 5px; white-space: pre; pointer-events: none; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, rgba(30, 30, 80, 0.55), rgba(4, 4, 12, 0.92)); z-index: 50; overflow-y: auto; }
#title { background: radial-gradient(ellipse at 50% 45%, rgba(16, 20, 44, 0.2) 0%, rgba(6, 6, 16, 0.7) 75%); }
.title-card { position: relative; background: var(--panel-2); border: 3px solid var(--edge); box-shadow: 0 0 0 3px #000, 0 12px 60px rgba(0, 0, 0, 0.7); padding: 22px 30px; text-align: center; max-width: 560px; margin: 20px; }
.title-card.small { max-width: 380px; }
.title-card.wide { max-width: 980px; width: calc(100vw - 40px); text-align: left; }
.logo-sm { font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: #d8cfb6; letter-spacing: 2px; }
.logo { font-family: var(--font-title); font-size: calc(40px * var(--scale)); color: #e8dcc0; text-shadow: 4px 4px 0 #1c3a2a, 0 0 22px rgba(120, 220, 160, 0.3); letter-spacing: 2px; margin: 10px 0; line-height: 1.15; }
.logo.small { font-size: calc(18px * var(--scale)); text-align: center; }
.subtitle { color: var(--edge); font-size: calc(20px * var(--scale)); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 1px; }
.form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px; text-align: left; margin: 10px 0 12px; }
.form.single { grid-template-columns: 1fr; }
.form label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.form label.chk { flex-direction: row; align-items: center; gap: 6px; }
.form select, .form input[type=text] { width: 100%; min-width: 0; }
.buttons { display: flex; flex-direction: column; gap: 6px; align-items: stretch; margin-top: 8px; }
.buttons.row { flex-direction: row; justify-content: center; }
.help-mini { margin-top: 14px; color: var(--muted); font-size: calc(17px * var(--scale)); line-height: 1.1; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: calc(18px * var(--scale)); line-height: 1.1; }
.help-grid h4 { font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: var(--edge); margin: 10px 0 4px; }
.help-grid p { margin: 0 0 6px; }
#gpu-error { margin-top: 12px; color: var(--bad); font-size: calc(18px * var(--scale)); }
.loading-text { font-family: var(--font-title); font-size: calc(13px * var(--scale)); color: var(--edge); text-align: center; }
.bar.load { margin: 12px 0 6px; height: 14px; }
.camp-grid { display: grid; grid-template-columns: 290px 1fr; gap: 16px; margin: 10px 0; }
#camp-list, #sb-list { display: flex; flex-direction: column; gap: 4px; }
#camp-list button, #sb-list button { text-align: left; display: flex; justify-content: space-between; gap: 6px; }
#camp-list button.sel, #sb-list button.sel { outline: 2px solid var(--edge); }
#camp-list button .st { color: var(--good); }
#camp-list button.preview { opacity: 0.6; }
#camp-brief h4, #sb-brief h4 { margin: 0 0 4px; font-family: var(--font-title); font-size: calc(12px * var(--scale)); color: var(--edge); }
#camp-brief p, #sb-brief p { margin: 4px 0; line-height: 1.08; }
#camp-brief .q { color: #fff2c0; }
#cb-obj div { color: var(--muted); } #cb-obj div::before { content: '▸ '; color: var(--edge); }
.vol-grid { display: grid; grid-template-columns: 110px 1fr 38px; gap: 2px 8px; align-items: center; padding: 4px 6px; border: 2px solid var(--edge-dim); background: rgba(0, 0, 0, 0.25); font-size: calc(17px * var(--scale)); text-align: left; }
.vol-grid label { color: var(--muted); }
.vol-grid span { text-align: right; color: var(--muted); }
#res-checks { text-align: left; margin: 8px 0; }
#res-checks .chk { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; font-size: calc(18px * var(--scale)); }
#res-extra { text-align: left; color: var(--muted); font-size: calc(17px * var(--scale)); }
.save-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--edge-dim); }
.arch-world { border: 1px solid var(--edge-dim); padding: 6px 8px; margin: 6px 0; background: rgba(0,0,0,0.25); }
.arch-world h5 { margin: 0 0 3px; font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: var(--edge); }

@media (max-width: 1250px) { #brushctl label { grid-template-columns: 52px 70px 30px; } #brushctl input[type=range] { width: 70px; } .tb-next { display: none; } }
@media (max-width: 1000px) { #log { width: 220px; } #objectives { width: 270px; } #sidepanel { width: 280px; } #preview { width: 380px; } }
/* codex */
.codex-row { display: flex; gap: 6px; align-items: center; cursor: pointer; padding: 2px 3px; border: 1px solid transparent; font-size: calc(16px * var(--scale)); line-height: 1.05; }
.codex-row:hover, .codex-row.open { border-color: var(--edge-dim); background: rgba(255, 210, 74, 0.06); }
.codex-row .ico { width: 24px; height: 24px; flex: none; background-size: contain; image-rendering: pixelated; }
.codex-row small { color: var(--muted, #b9a9d8); }
.codex-row.locked { cursor: default; opacity: 0.55; }
.codex-row.locked .ico { filter: grayscale(1) brightness(0.6); }
.codex-row .new { color: var(--edge); font-weight: normal; font-size: 0.8em; }
.codex-body { margin: 2px 0 6px 30px; font-size: calc(16px * var(--scale)); line-height: 1.1; }
.codex-body p { margin: 0 0 4px; }
.codex-body h4 { margin: 4px 0 2px; font-family: var(--font-title); font-size: calc(8px * var(--scale)); color: var(--edge); }
.obj-next { font-size: calc(15px * var(--scale)); line-height: 1.05; margin: 3px 0 2px; color: #d9cff0; }
.obj-next b { color: var(--edge); font-weight: normal; }
#hintcard { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(520px, 90vw); z-index: 30; font-size: calc(16px * var(--scale)); line-height: 1.1; }
#hintcard .tu-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--font-title); font-size: calc(9px * var(--scale)); color: var(--edge); margin-bottom: 4px; }
#hintcard .tu-head button { font-size: calc(14px * var(--scale)); }
#hintcard kbd { border: 1px solid var(--edge-dim); padding: 0 3px; font-family: inherit; }
.sp-tabs { flex-wrap: wrap; }
#hintcard { left: 12px; bottom: 150px; transform: none; width: min(460px, 60vw); }
.hist { background: rgba(10, 6, 24, 0.5); border: 1px solid var(--edge-dim); margin: 4px 0; }
.hist .hev { cursor: pointer; }
.sp-title button { font-size: calc(12px * var(--scale)); padding: 0 4px; margin-left: 6px; }
#replaybar { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; z-index: 25; padding: 4px 10px; width: min(640px, 80vw); }
#replaybar input { flex: 1; }
#replaybar span { font-size: calc(15px * var(--scale)); white-space: nowrap; min-width: 150px; }
/* trial result summary */
/* planet card (mission brief) */
.brief-card { max-width: 860px; max-height: 92vh; overflow: auto; }
.brief-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brief-series { font-size: 0.75em; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent, #ffd24a); }
.brief-series.desperate { color: #ff7a5a; }
.brief-tag { color: #a8a0c8; margin-top: 4px; }
.brief-card .logo { text-align: left; }
.brief-planet { width: 92px; height: 92px; border-radius: 50%; flex: none; box-shadow: inset -18px -12px 30px rgba(0,0,0,0.75), 0 0 24px rgba(120,160,255,0.25); }
.brief-q { font-style: italic; color: #d8d0f0; }
.brief-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; margin: 10px 0; padding: 8px 10px; background: rgba(0,0,0,0.25); border: 2px solid var(--edge); }
.brief-stats div { display: flex; flex-direction: column; font-size: 0.9em; }
.brief-stats span { color: #8a7aa8; font-size: 0.85em; }
.brief-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.brief-cols h4, .brief-card h4 { margin: 10px 0 4px; color: #ffd24a; }
.brief-cols ul, .brief-tips ul { margin: 0; padding-left: 18px; }
.brief-cols li, .brief-tips li { margin: 3px 0; }
.brief-tips { margin-top: 10px; }
.brief-tips summary { cursor: pointer; color: #a8a0c8; }
@media (max-width: 700px) { .brief-cols { grid-template-columns: 1fr; } }
.reveal { border: 2px solid #ff7a5a; background: rgba(80, 20, 10, 0.35); padding: 6px 12px; margin: 8px 0; }
.reveal h4 { color: #ff9a7a; margin: 4px 0; }
.camp-head { font-size: 0.75em; letter-spacing: 0.18em; text-transform: uppercase; color: #a8a0c8; padding: 8px 4px 4px; }
.camp-head.desperate { color: #ff7a5a; }
.camp-locked { color: #6a6088; font-size: 0.85em; padding: 4px 6px; }
#result .title-card { max-width: 640px; width: calc(100vw - 40px); max-height: 92vh; overflow: auto; }
.res-h { margin: 10px 0 2px; text-align: left; font-family: var(--font-title); font-size: calc(10px * var(--scale)); color: var(--edge); font-weight: normal; }
.res-chart { width: 100%; height: auto; display: block; background: rgba(0, 0, 0, 0.25); border: 1px solid #3a3050; }
.res-chart text { font-family: inherit; }
.res-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 10px; margin: 10px 0; text-align: left; font-size: calc(15px * var(--scale)); color: var(--muted); }
.res-stats b { display: block; color: #fff; font-weight: normal; font-size: calc(19px * var(--scale)); }
#obj-go { width: 100%; margin-top: 6px; }
@media (max-width: 700px) { .res-stats { grid-template-columns: repeat(2, 1fr); } }
.marker.plate { font-weight: bold; color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000; }
.parrow { display: inline-block; margin-left: 4px; color: #ffd24a; }
#sb-brief .form { display: flex; flex-direction: column; gap: 6px; }
#sb-brief .form label:not(.chk) { display: grid; grid-template-columns: 9em 1fr; align-items: center; gap: 8px; }
#sb-brief .form select, #sb-brief .form input[type=text] { width: 100%; }
/* narrow windows: the tool bar splits into two rows (powers, then brush, views and camera tools) */
#toolbar.stack { flex-wrap: wrap; justify-content: center; row-gap: 4px; width: max-content; max-width: calc(100vw - 12px); }
#toolbar.stack #powers { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; }
#toolbar.stack > .tb-sep:first-of-type { display: none; }
#toolbar.stack #overlays, #toolbar.stack #viewctl { flex-wrap: wrap; justify-content: center; }
/* trailer recording: only the planet, in 16:9 */
body.trailer #hud, body.trailer #markers, body.trailer .screen:not(#loading), body.trailer #toast, body.trailer #hintcard, body.trailer #tutorial, body.trailer #preview, body.trailer #perf { display: none !important; }
body.trailer canvas#view { width: 100vw; height: 56.25vw; top: calc(50vh - 28.125vw); bottom: auto; }
#trailer-status { position: fixed; left: 8px; bottom: 8px; z-index: 50; font-family: var(--font); font-size: 18px; color: #ffd24a; background: rgba(10, 8, 22, 0.8); padding: 3px 8px; border: 1px solid #5a4520; pointer-events: none; }
