:root {
  --ink: #e9e7e1; --muted: #a3a29b; --line: rgba(233,231,225,.2); --accent: #d8a24a; --bg: rgba(10,11,12,.84); --field: rgba(255,255,255,.07);
  font-family: "Segoe UI", system-ui, sans-serif; color: var(--ink);
}
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
canvas { display: block; width: 100vw; height: 100vh; }
body:not(.playing) canvas { filter: brightness(.5); }
body.playing { cursor: none; }

#ui { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; align-items: center; padding: 16px clamp(16px, 7vw, 96px); box-sizing: border-box; overflow-y: auto; pointer-events: auto;
  background: linear-gradient(90deg, rgba(0,0,0,.82), rgba(0,0,0,.2)); }
.screen[hidden], #boot[hidden], #hud[hidden], #stamp[hidden] { display: none; }
.panel { width: min(560px, 100%); margin: auto 0; }
h1, h2 { margin: 0 0 12px; font-weight: 600; letter-spacing: 0; line-height: 1.1; }
h1 { font-size: clamp(36px, 6vw, 60px); text-transform: uppercase; }
h2 { font-size: 30px; }
.kicker { margin: 0 0 8px; color: var(--accent); font: 600 13px/1.4 Consolas, monospace; text-transform: uppercase; }
.lead { color: var(--muted); line-height: 1.5; margin: 0 0 24px; }
.small { color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 18px; }
nav { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 16px 0; max-width: 300px; }
nav.row { flex-direction: row; max-width: none; }

button, select { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 3px; padding: 11px 14px; text-align: left; cursor: pointer; transition: background .12s, border-color .12s; }
button:hover, button:focus-visible, select:hover { background: rgba(255,255,255,.14); border-color: var(--accent); outline: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #17130b; font-weight: 600; }
button.primary:hover, button.primary:focus-visible { background: #e9b865; }
select { padding: 7px 10px; min-width: 0; }
select option { background: #16171a; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.page { max-height: 56vh; overflow-y: auto; padding: 4px 10px 4px 0; }
.field { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 56px; gap: 12px; align-items: center; min-height: 40px; border-bottom: 1px solid rgba(255,255,255,.06); }
.field select, .field .key { grid-column: 2 / 4; }
.field.check input { grid-column: 2; justify-self: start; }
.field output { color: var(--muted); font: 12px Consolas, monospace; text-align: right; }
.field .key { padding: 6px 10px; font: 13px Consolas, monospace; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

.stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; margin: 12px 0; max-height: 60vh; overflow-y: auto; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-family: Consolas, monospace; text-align: right; }

#boot { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 48px clamp(16px, 7vw, 96px); box-sizing: border-box; background: #070809; }
#boot strong { font-size: clamp(26px, 5vw, 42px); font-weight: 600; text-transform: uppercase; }
#boot p { margin: 0; color: var(--muted); font: 13px Consolas, monospace; }
#boot-track { height: 3px; background: var(--line); }
#boot-bar { height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s; }

#hud { position: fixed; top: 10px; right: 12px; padding: 6px 8px; background: rgba(0,0,0,.6); font: 12px/1.4 Consolas, monospace; white-space: pre; text-align: right; }
#stamp { position: fixed; top: 12px; left: 16px; font: 13px/1.35 Consolas, monospace; color: rgba(255,255,255,.82); text-shadow: 0 0 2px #000, 0 1px 2px #000; white-space: pre; display: none; }
body.playing #stamp { display: block; }
body.playing #stamp[hidden] { display: none; }
#subs { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); max-width: min(760px, 90vw); padding: 5px 10px; background: rgba(0,0,0,.72); line-height: 1.4; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
#subs.on { opacity: 1; }
#subs b { color: var(--accent); font-weight: 600; }
#feel { position: fixed; left: 50%; bottom: 8%; transform: translateX(-50%); font-size: 16px; opacity: 0; transition: opacity .3s; text-shadow: 0 1px 3px #000; pointer-events: none; text-align: center; }
#black { position: fixed; inset: 0; background: #000; opacity: 0; transition: opacity 1.2s; pointer-events: none; }

@media (max-width: 560px) {
  .field { grid-template-columns: 1fr 1fr; }
  .field output { display: none; }
  .field select, .field .key { grid-column: 2; }
}
