:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07101d;
  color: #e5f0f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 52% 42%, rgba(33, 74, 92, 0.26), transparent 52%),
    linear-gradient(145deg, #07101d 0%, #0a1421 58%, #07101b 100%);
}

button { font: inherit; }

.chamber {
  width: min(100% - 48px, 1320px);
  margin: 0 auto;
  padding: 30px 0 22px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 8px 18px;
}

.eyebrow,
.stage-caption,
.control-label,
.footer-note,
.world-readout span {
  color: #92a9ba;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.18em;
}

.eyebrow { margin: 0 0 8px; }

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.04em;
}

.dek {
  margin: 5px 0 0;
  color: #afc0cd;
  font-size: 14px;
}

.world-readout {
  display: grid;
  justify-items: end;
  gap: 6px;
  padding-bottom: 2px;
}

.world-readout strong {
  color: #f2c879;
  font: 500 14px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.035em;
}

.stage {
  position: relative;
  height: min(68vh, var(--stage-height));
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgba(117, 157, 178, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(47, 106, 121, 0.11), transparent 55%),
    rgba(5, 12, 21, 0.42);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.stage-caption {
  position: absolute;
  z-index: 1;
  top: 18px;
  left: 22px;
  pointer-events: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 12px;
}

.control-label { margin-right: 8px; }

.controls button {
  min-width: 54px;
  padding: 8px 12px;
  border: 1px solid rgba(146, 169, 186, 0.23);
  border-radius: 999px;
  background: rgba(17, 31, 46, 0.72);
  color: #d5e2e9;
  cursor: pointer;
  font-size: 12px;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.controls button:hover,
.controls button:focus-visible {
  border-color: rgba(85, 230, 193, 0.65);
  color: #ffffff;
  outline: none;
}

.controls button[aria-pressed="true"] {
  border-color: rgba(85, 230, 193, 0.62);
  background: rgba(39, 119, 111, 0.28);
  color: #85f2d9;
}

.control-divider {
  height: 22px;
  margin: 0 4px;
  border-left: 1px solid rgba(146, 169, 186, 0.23);
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 8px 0;
  font-size: 9px;
  letter-spacing: 0.15em;
}

.stage-error { display: grid; place-items: center; }
.error-message { max-width: 420px; padding: 24px; color: #f2c879; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .chamber { width: min(100% - 24px, 1320px); padding-top: 18px; }
  .masthead { align-items: start; }
  .world-readout { padding-top: 6px; }
  .world-readout strong { font-size: 11px; }
  .stage { height: 62vh; min-height: 430px; }
  .stage-caption { top: 14px; left: 14px; font-size: 8px; }
  .control-label { width: 100%; margin-bottom: 3px; }
  .controls { gap: 6px; }
  .controls button { padding: 8px 10px; }
  .footer-note { font-size: 8px; }
}

@media (max-width: 440px) {
  .masthead { display: block; }
  .world-readout { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
  .stage { min-height: 380px; }
  .footer-note { display: grid; gap: 6px; }
}

@media (pointer:coarse){.controls button{min-height:44px}input[type=range]{height:44px;min-height:44px;padding:0}.ledger summary{display:flex;align-items:center;min-height:44px}}
