:root {
  --bg: #100e0c;
  --bg-2: #1a1612;
  --panel: #241c16;
  --line: #4a3d2c;
  --text: #efe6d6;
  --muted: #b3a690;
  --amber: #e2a14a;
  --phosphor: #b7d39a;
  --paper: #f3ead7;
  --ink: #1c140c;
  --stamp: #6e2e28;
  --danger: #c45c4a;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(226, 161, 74, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 12px;
  top: 8px;
  transform: translateY(-160%);
  background: var(--amber);
  color: var(--ink);
  padding: 8px 12px;
  z-index: 50;
}
.skip:focus { transform: none; }
.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 18px 20px 8px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.eyebrow, .meta, .status {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: 0; margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 0.92; }
h1.room-title { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.1; }
.lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5a2a24;
  box-shadow: 0 0 0 4px #2a1614;
  display: inline-block;
  margin-right: 8px;
  vertical-align: -2px;
  animation: breathe 3.6s ease-in-out infinite;
}
.stage {
  flex: 1;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 16px;
}
.bank, .room-list, .bezel, .paper, .ending {
  background: var(--panel);
  border: 1px solid var(--line);
}
.bank, .room-list { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.bank button, .room-list button, .tools button, .choice, .paper button.solid {
  min-height: 44px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 10px;
}
.bank button[aria-current="true"] {
  border-color: var(--amber);
  color: var(--amber);
}
.bezel { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.art { background: #090807; border: 1px solid #000; min-height: 180px; }
.art svg { width: 100%; height: auto; display: block; }
.blurb { margin: 0; color: var(--text); max-width: 62ch; }
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 20px;
}
.tools button, .paper button.solid, .title-actions button {
  background: var(--amber);
  color: var(--ink);
  border: 0;
  min-height: 44px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tools button.quiet, .paper button.quiet {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--phosphor);
}
.person { border-top: 1px solid var(--line); padding-top: 8px; }
.person p { margin: 4px 0 8px; color: var(--muted); }

.title, .ending, .recovery {
  width: min(760px, calc(100% - 32px));
  margin: 28px auto;
  padding: 28px 22px 32px;
}
.deck, .title p, .ending p, .paper p { max-width: 62ch; }
.note {
  border-left: 3px solid var(--stamp);
  padding-left: 12px;
  color: var(--muted);
}
.title-actions, .row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.banner {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  color: var(--text);
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 30;
}
.paper {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  padding: 18px 16px 28px;
  border: 0;
}
.paper h2, .paper h3 { color: var(--ink); }
.paper .meta, .paper .tag { color: #6d5840; }
.paper header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.facts { padding-left: 18px; }
.facts li { margin: 6px 0; }
.speech { font-family: var(--serif); font-size: 1.15rem; }
.choice[aria-pressed="true"], .check[aria-pressed="true"] {
  border-color: var(--ink);
  background: #efe2c8;
}
.check, .choice { display: block; width: 100%; margin: 6px 0; }
.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--amber);
}
.toast button { min-height: 44px; }
.error { color: var(--stamp); }
label.slider { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
input[type="range"] { min-height: 44px; width: 100%; }

@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }
  .bank { flex-direction: row; overflow-x: auto; }
  .bank button { min-width: 44%; }
  .top { align-items: start; flex-direction: column; }
}
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .paper { border: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
