:root {
  color-scheme: dark;
  --bg: #0b0b0a;
  --ink: #f2f0ea;
  --dim: #8d8a82;
  --faint: #55534e;
  --line: rgba(242, 240, 234, .14);
  --panel: rgba(11, 11, 10, .72);
  --hot: #ff2a1a;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 2.4vw, 28px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.5 var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- over the room: as little as possible ---- */
.chrome {
  position: fixed; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: var(--gutter);
  pointer-events: none;
  transition: opacity .8s ease;
}
.chrome > * { pointer-events: auto; }
.top { top: 0; padding-top: max(var(--gutter), env(safe-area-inset-top)); }
.bottom { bottom: 0; justify-content: space-between; align-items: flex-end; padding-bottom: max(var(--gutter), env(safe-area-inset-bottom)); }
body.idle .chrome { opacity: 0; }
body.idle .chrome:focus-within { opacity: 1; }
.mark {
  font: 900 20px/1 var(--display); font-stretch: 70%; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap; text-shadow: 0 1px 12px rgba(0, 0, 0, .8);
}
.mark span { color: var(--dim); }
.live { display: inline-flex; width: 8px; height: 8px; margin-right: auto; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 10px var(--hot); animation: blink 1.6s steps(2, jump-none) infinite; }
.live.off i { background: var(--faint); box-shadow: none; animation: none; }
@keyframes blink { 50% { opacity: .25; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.quiet {
  height: 30px; padding: 0 12px; border-radius: 2px; cursor: pointer;
  background: rgba(11, 11, 10, .45); border: 1px solid var(--line); backdrop-filter: blur(6px);
  font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
}
.quiet:hover { border-color: var(--ink); }
.now { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.player { width: 260px; height: 40px; border: 0; background: transparent; color-scheme: dark; }
.on-air {
  max-width: min(60vw, 520px); padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: 800 14px/1.2 var(--display); font-stretch: 80%; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .9);
}
.on-air .bpm { color: var(--dim); font: 400 11px/1 var(--mono); letter-spacing: .08em; }
.on-air:hover #now-title { text-decoration: underline; text-underline-offset: 3px; }
.knobs { display: flex; gap: 6px; }
.you { max-width: min(60vw, 520px); font: 400 11px/1.4 var(--mono); letter-spacing: .04em; color: var(--dim); text-shadow: 0 1px 10px #000; }
.you b { color: var(--hot); font-weight: 500; }
.client { margin: 12px 0 6px; }
pre.wrap { white-space: pre-wrap; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }

/* ---- at the door: only the name, and the way in ---- */
.door-hints {
  position: fixed; left: 50%; bottom: max(8vh, calc(env(safe-area-inset-bottom) + 24px)); z-index: 4; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; transition: opacity .8s ease;
}
.listen-hint { margin: 0; font: 400 11px/1 var(--mono); letter-spacing: .12em; color: var(--dim); text-shadow: 0 1px 8px #000; transition: opacity .6s ease; }
body.heard .listen-hint { opacity: 0; }
.go-in {
  padding: 12px 22px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
  background: rgba(11, 11, 10, .5); backdrop-filter: blur(6px);
  font: 500 11px/1 var(--mono); letter-spacing: .3em; text-transform: uppercase;
  transition: opacity .8s ease;
}
.go-in::before { content: "\2193  "; color: var(--hot); }
.go-in:hover { border-color: var(--ink); }
body:not(.outside) .door-hints { opacity: 0; pointer-events: none; }
body.outside .bottom, body.outside .live, body.outside #bring, body.outside #book { opacity: 0; visibility: hidden; }
.bottom, .live, #bring, #book { transition: opacity .8s ease, visibility .8s; }
body.outside #scene { cursor: pointer; }

/* ---- dialogs ---- */
dialog { padding: 0; border: 1px solid var(--line); background: var(--bg); color: var(--ink); max-width: min(720px, calc(100vw - 32px)); width: 100%; max-height: calc(100dvh - 48px); }
dialog::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); }
.sheet { padding: 22px 24px 26px; }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.sheet h2 { margin: 0; font: 900 34px/1 var(--display); font-stretch: 62%; text-transform: uppercase; }
.sheet h3 { margin: 20px 0 8px; font: 800 13px/1 var(--display); font-stretch: 80%; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.sheet p { max-width: 62ch; }
.dim { color: var(--dim); }
.close { background: none; border: 1px solid var(--line); width: 36px; height: 36px; font-size: 20px; line-height: 1; cursor: pointer; }
pre { margin: 0; padding: 14px 16px; background: #141412; border: 1px solid var(--line); overflow: auto; font: 400 12px/1.6 var(--mono); max-height: 60dvh; }
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy pre { flex: 1; min-width: 0; }
.copy button {
  padding: 0 14px; border-radius: 2px; cursor: pointer; background: var(--ink); color: var(--bg); border: 0; height: auto;
  font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.book-form { display: flex; gap: 8px; margin: 14px 0 6px; }
.book-form input { min-width: 0; height: 36px; padding: 0 10px; background: #141412; border: 1px solid var(--line); color: var(--ink); font: 400 13px/1 var(--mono); border-radius: 2px; }
.book-form input[name=name] { flex: 0 0 9.5em; }
.book-form input[name=text] { flex: 1; }
.book-form input:focus { outline: 2px solid var(--hot); outline-offset: 1px; }
.book-form button { padding: 0 16px; border-radius: 2px; cursor: pointer; background: var(--ink); color: var(--bg); border: 0; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.book-status { min-height: 1.5em; margin: 0 0 8px; }
.book-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 50dvh; overflow: auto; }
.book-lines q { font: 700 17px/1.25 var(--display); font-stretch: 85%; quotes: none; }
.book-lines .who { color: var(--dim); font-size: 11px; }
.tools { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.tools b { font-weight: 500; }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 5; }

/* ---- phones ---- */
@media (max-width: 560px) {
  .bottom { flex-direction: column; align-items: stretch; gap: 10px; }
  .player { width: 100%; }
  .on-air { max-width: 100%; }
  .you { max-width: 100%; }
  .knobs { justify-content: flex-end; }
  .sheet { padding: 18px 16px 22px; }
  .copy { flex-direction: column; }
  .copy button { height: 36px; }
  .book-form { flex-direction: column; }
  .book-form input[name=name] { flex: none; }
  .book-form button { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .live i { animation: none; }
  .chrome { transition: none; }
}

/* ---- the boot screen ---- */
.boot {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: #030303; transition: opacity .9s ease;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-inner { width: min(560px, calc(100vw - 32px)); }
.boot-mark { margin: 0 0 18px; font: 900 44px/1 var(--display); font-stretch: 62%; letter-spacing: .01em; }
.boot-mark span { color: var(--hot); }
.boot-log { list-style: none; margin: 0 0 18px; padding: 0; min-height: 9.5em; font-size: 12px; color: var(--dim); }
.boot-log li::before { content: "> "; color: var(--hot); }
.boot-log li:last-child { color: var(--ink); }
.boot-track { height: 2px; background: var(--line); overflow: hidden; }
.boot-bar { height: 100%; background: var(--hot); transform: scaleX(.03); transform-origin: left; transition: transform .3s ease; }

@media (prefers-reduced-motion: reduce) { .boot { transition: none; } }
