:root {
  /* Black, white and the game's red, on every page. */
  --bg: #0b0b0b;
  --panel: #141414;
  --line: #2b2b2b;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --accent: #e0303d;
  --accent-dim: #7a1c23;
  --display: "Bahnschrift", "DIN Condensed", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 3px solid var(--accent); background: var(--bg);
}
h1 { margin: 0; font-family: var(--display); font-stretch: condensed; font-weight: 700; text-transform: uppercase; font-size: 24px; line-height: 1; letter-spacing: 0; color: #fff; }
a.home-link { color: inherit; text-decoration: none; }
a.home-link:hover, a.home-link:focus-visible { color: var(--accent); outline: none; }
h1 span { font-family: system-ui, -apple-system, Segoe UI, sans-serif; font-stretch: normal; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 1px; margin-left: 10px; }
.actions { display: flex; gap: 8px; }

button, select, input[type=search] {
  font: inherit; color: var(--text); background: #1b1b1b;
  border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px;
}
a.button { font: inherit; color: var(--text); background: #1b1b1b; text-decoration: none; border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; }
a.button:hover { border-color: var(--accent); }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
button.primary:hover { background: #f04652; border-color: #f04652; }

main { flex: 1; display: grid; grid-template-columns: 340px 1fr 300px; min-height: 0; }
aside { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#details { border-right: 0; border-left: 1px solid var(--line); padding: 12px; overflow: auto; }
.controls { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }

#files { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; font: 12px/1.3 ui-monospace, Consolas, monospace; }
#files li { padding: 4px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#files li:hover { background: #1b1b1b; }
#files li.active { background: #3a1015; color: var(--accent); }
#files li .size { float: right; color: var(--muted); margin-left: 8px; }

#stage { position: relative; min-width: 0; }
#view { width: 100%; height: 100%; display: block; }
.overlay {
  position: absolute; inset: 0; margin: auto; height: fit-content; max-width: 520px;
  background: rgba(16, 16, 16, .96); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 3px; padding: 20px 24px;
}
.overlay a { color: var(--accent); }
.overlay h2 { margin-top: 0; font-family: var(--display); font-stretch: condensed; font-weight: 700; text-transform: uppercase; font-size: 26px; letter-spacing: .5px; color: #fff; }
.overlay.small { inset: auto 12px 12px auto; max-width: 420px; padding: 8px 12px; font-size: 12px; }
code { background: #222731; padding: 1px 5px; border-radius: 4px; }

#details h3 { margin: 0 0 8px; font-size: 14px; word-break: break-all; }
#details h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.thumbs figure { margin: 0; font-size: 10px; color: var(--muted); word-break: break-all; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #222 repeating-conic-gradient(#2a2a2a 0 25%, #1e1e1e 0 50%) 0 0 / 12px 12px; border-radius: 4px; }
pre { font: 11px/1.35 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.warn { color: #e0a050; font-size: 12px; }
.zones { display: flex; flex-wrap: wrap; gap: 4px; }
.zones button { font-size: 12px; padding: 3px 8px; }

/* ---- The landing page: black, white and the game's red, set large enough to read. ---- */
body.landing {
  --bg: #0b0b0b; --text: #f2f2f2; --soft: #c9c9c9; --muted: #a3a3a3; --line: #2b2b2b;
  --accent: #e0303d; --accent-dim: #7a1c23; --ok: #9ddcaa; --bad: #ffb36b;
  --display: "Bahnschrift", "DIN Condensed", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  background: var(--bg); font-size: 16px; line-height: 1.6;
}
main.home { display: block; overflow: auto; padding: 0 20px 48px; }
main.home > * { max-width: 700px; margin: 0 auto; }
body.landing code { font-size: .9em; background: #1e1e1e; color: var(--text); padding: 1px 6px; }

main.home > .hero { position: relative; max-width: none; margin: 0 -20px; padding: 64px 20px 32px; overflow: hidden; border-bottom: 3px solid var(--accent); }
.hero-art { position: absolute; inset: -12px; background: center / cover no-repeat; opacity: 0; transition: opacity 1s ease; filter: blur(10px) brightness(var(--lift, 2)) saturate(1.1); transform: scale(1.08); }
.hero.has-art .hero-art { opacity: 1; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 11, 11, .3), rgba(11, 11, 11, .9)); pointer-events: none; }
.hero-text { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.hero h1 { margin: 0; font-family: var(--display); font-stretch: condensed; font-weight: 700; text-transform: uppercase;
  font-size: clamp(48px, 11vw, 88px); line-height: .9; letter-spacing: -1px; color: #fff; }
.tagline { margin: 12px 0 0; font-size: 19px; color: #e6e6e6; }

.block { padding: 36px 0 32px; border-bottom: 1px solid var(--line); }
.block h2 { margin: 0 0 20px; font-family: var(--display); font-stretch: condensed; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 26px; color: #fff; }
.block p { margin: 0 0 14px; color: var(--soft); }
.hint { font-size: 15px; color: var(--muted) !important; }
.hint:empty { display: none; }

.stage + .stage { margin-top: 28px; }
.stage h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 19px; font-weight: 600; color: #fff; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; font-size: 14px; font-weight: 700; color: #fff; background: var(--accent); }
#step-folder.done .n { background: #2f6b3d; }
.stage.nudge h3 { animation: nudge .7s ease; }
@keyframes nudge { 30% { color: var(--accent); } }

body.landing button { border-radius: 3px; font-size: 15px; }
body.landing button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; padding: 11px 20px; font-size: 16px; }
body.landing button.primary:hover { background: #f04652; }
.folder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.folder-state { color: var(--soft); }
.folder-state.ok { color: var(--ok); font-weight: 600; }
.folder-state.bad { color: var(--bad); }

.doors { display: grid; gap: 8px; margin-top: 4px; }
a.door { display: grid; gap: 2px; padding: 14px 18px; color: var(--text); text-decoration: none; background: #151515; border-left: 3px solid var(--line); transition: border-color .15s, background .15s; }
a.door:hover, a.door:focus-visible { border-left-color: var(--accent); background: #1b1b1b; outline: none; }
.door-title { font-size: 18px; font-weight: 700; color: #fff; }
.arrow { color: var(--accent); margin-left: 4px; }
.door-desc { color: var(--soft); font-size: 15px; }
#step-mode.locked a.door { cursor: not-allowed; }
#step-mode.locked .door-title, #step-mode.locked .door-desc { opacity: .6; }
#step-mode.locked .arrow { color: var(--muted); }

.meters { display: grid; gap: 22px; margin-bottom: 18px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.meter-name { font-size: 18px; font-weight: 700; color: #fff; }
.meter-count { color: var(--soft); font-variant-numeric: tabular-nums; }
.meter-count b { color: #fff; font-size: 18px; }
.meter-share { display: inline-block; margin-left: 8px; min-width: 3.2em; text-align: right; font-weight: 700; color: var(--accent); }
.meter-bar { height: 10px; margin: 8px 0 8px; background: #222; overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--accent); min-width: 3px; }
.meter-note { margin: 0 !important; font-size: 15px; color: var(--muted) !important; }
.progress-details > summary { cursor: pointer; width: fit-content; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.progress-details > summary:hover { color: var(--accent); }
.progress-details[open] > summary { margin-bottom: 12px; }

.progress { border-top: 1px solid var(--line); padding: 18px 0 8px; scroll-margin-top: 12px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress h3 { margin: 0; font-size: 17px; color: #fff; }
.progress-share { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-bar { height: 5px; margin: 8px 0 6px; background: #1e1e1e; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }
.progress-sum { margin: 0 0 10px !important; font-size: 14px; color: var(--muted) !important; }
.progress-group { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.progress-group h4 { margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.progress-group h4 .muted { color: var(--muted); font-weight: 400; }
.progress-group ul { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.mission { font: 12px/1 ui-monospace, Consolas, monospace; padding: 5px 7px; border-radius: 2px; border: 1px solid #3a3a3a; color: var(--soft); cursor: help; }
.mission.end { background: #3a1015; border-color: #a3262f; color: #ffd0d4; }
.mission.partway { border-style: dashed; }
.mission.untried { color: var(--muted); }
.mission:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.progress-foot { margin: 12px 0 0 !important; font-size: 14px; color: var(--muted) !important; }

.faq { margin: 0; }
.faq dt { font-weight: 700; color: #fff; font-size: 17px; }
.faq dd { margin: 4px 0 20px; color: var(--soft); }
.faq dd:last-child { margin-bottom: 0; }

footer.notice { padding-top: 24px; color: var(--muted); font-size: 13px; }
footer.notice p { margin: 0; }

@media (max-width: 560px) {
  main.home > .hero { padding: 44px 20px 26px; }
  .tagline { font-size: 17px; }
  .progress-group { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art, a.door { transition: none; }
  .stage.nudge h3 { animation: none; }
}

/* Keys, for the pages' lists of controls. */
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; font: 600 11px/1.5 ui-monospace, Consolas, monospace; text-align: center; color: var(--text); background: #23272f; border: 1px solid #3a3a3a; border-bottom-width: 2px; border-radius: 4px; }
.tag { margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }

#toolbar {
  position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; pointer-events: none;
}
#toolbar[hidden] { display: none; }
#toolbar > * { pointer-events: auto; }
#toolbar button { padding: 4px 9px; font-size: 12px; background: rgba(20, 20, 20, .92); }
#toolbar button.on { border-color: var(--accent); color: var(--accent); }
#toolbar .group { display: flex; }
#toolbar .group button { border-radius: 0; margin-left: -1px; }
#toolbar .group button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
#toolbar .group button:last-child { border-radius: 0 6px 6px 0; }
#toolbar label {
  display: flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: rgba(20, 20, 20, .92);
}
#toolbar input[type=range] { width: 110px; }
.faces { display: grid; grid-template-columns: auto 1fr 3em; gap: 2px 10px; align-items: center; font-size: 12px; }
.faces output { text-align: right; color: var(--muted); }
.scene { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0; font-size: 12px; }
.scene input[type=range] { flex: 1 1 140px; }
.scene output { min-width: 9em; color: var(--muted); font-variant-numeric: tabular-nums; }
#studio-clock { min-width: 36px; font-variant-numeric: tabular-nums; }

#chips { display: flex; flex-wrap: wrap; gap: 4px; }
#chips button { font-size: 11px; padding: 2px 8px; }
#chips button.on { border-color: var(--accent); color: var(--accent); }

.thumbs figure.opens { cursor: zoom-in; }
.picks { display: flex; flex-wrap: wrap; gap: 4px; max-height: 220px; overflow: auto; }
.picks button { font-size: 11px; padding: 2px 6px; }
.picks button.on { outline: 2px solid #e0303d; }
#texture-view { inset: 0; max-width: none; height: auto; margin: 0; padding: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(0, 0, 0, 0.85); cursor: zoom-out; z-index: 5; }
#texture-view[hidden] { display: none; }
#texture-view img { image-rendering: pixelated; height: auto; background: repeating-conic-gradient(#2a2a2a 0 25%, #1e1e1e 0 50%) 0 0 / 16px 16px; }

.clips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.clips select { max-width: 100%; }
.clips input[type=range] { flex: 1 1 140px; }
.states { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.states select { margin-left: 6px; }

/* The pages' welcome box: what to do first, and the controls as a list of keys. */
#welcome { max-width: 720px; max-height: calc(100% - 24px); overflow: auto; }
#welcome .small { font-size: 12px; }
.controls-list { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.controls-list > summary { cursor: pointer; font-weight: 600; color: var(--accent); width: fit-content; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; margin-top: 8px; }
.keys h3 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 12px; align-items: baseline; }
.keys dt { white-space: nowrap; color: var(--muted); }
.keys dt kbd + kbd { margin-left: 2px; }
.keys dd { margin: 0; }
@media (max-width: 560px) { .keys dt { white-space: normal; } }
