:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f1eee7;
  background: #121513;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
header { position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: max(15px, env(safe-area-inset-left)); pointer-events: none; text-shadow: 0 2px 8px #000; }
h1 { margin: 0 0 3px; font-size: clamp(1rem, 2vw, 1.38rem); letter-spacing: -.025em; }
header span, #status, .credits { color: #bdc8bf; font-size: .82rem; }
.stage { position: relative; overflow: hidden; background: #211a16; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.room { position: absolute; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.dim { opacity: 0; transition: opacity 70ms linear; }
.dim[data-dim] { opacity: .95; }
.loading { position: absolute; z-index: 3; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; background: #121513; }
.loading[hidden] { display: none; }
.loading p, #status { margin: 0; }
footer { position: relative; display: grid; justify-items: center; gap: 5px; padding: 7px 12px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid #353e37; }
.controls { display: flex; width: min(100%, 180px); }
button { border: 1px solid #4b5853; border-radius: 8px; min-height: 44px; padding: 0 14px; background: #242d27; color: #f1eee7; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.controls button { flex: 1; }
.controls .primary { flex: 1.2; background: #a9e1d2; color: #142720; border-color: #caf9ed; }
button:disabled { opacity: .54; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #a9e1d2; outline-offset: 3px; }
.credits { position: absolute; bottom: max(13px, env(safe-area-inset-bottom)); right: max(12px, env(safe-area-inset-right)); font-size: .72rem; }
.credits-page { max-width: 42rem; margin: 40px auto; padding: 0 20px; line-height: 1.5; }
.credits-page a { color: #a9e1d2; }
@media (max-width: 490px) {
  .credits { position: static; }
}
@media (max-height: 390px) and (orientation: landscape) {
  footer { grid-template-columns: 1fr minmax(165px, 300px) 1fr; align-items: center; padding-block: 4px; }
  .credits { position: static; }
}
