/* The Starheart Palace: the page layer over the WebGL world. design.md owns these decisions. */

:root {
  --night: #141038;
  --night-deep: #0c0818;
  --sky: #24306e;
  --velvet: #c8320f;
  --velvet-lit: #ff4500;
  --velvet-fold: #5e1206;
  --gold: #e2b35c;
  --gold-deep: #8a6420;
  --gold-line: rgba(226, 179, 92, 0.5);
  --gold-hair: rgba(226, 179, 92, 0.2);
  --bulb: #ffd68a;
  --milk: #f6f1e6;
  --milk-soft: rgba(246, 241, 230, 0.78);
  --letter: #141118;
  --screen: #0b0a10;
  --brass-ink: #2a1709;

  --display: 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --serif: 'Roboto Serif', Georgia, serif;
  --byline: 'Cormorant Garamond', Georgia, serif;
  --hand: 'Caveat', cursive;
  --prompter: 'Inter', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 16px;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--night-deep);
  color: var(--milk);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:not(.no-world) {
  height: 100dvh;
  overflow: hidden;
}

p,
h1,
h2,
ol,
ul {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

::selection {
  background: var(--velvet-lit);
  color: var(--milk);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--gold-deep) transparent;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icons {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg .fill {
  fill: currentColor;
  stroke: none;
}

.skip {
  position: fixed;
  left: -9999px;
  top: 8px;
  z-index: 90;
}

.skip:focus {
  left: 8px;
}

/* ---- The world ---- */

.palace {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.no-world .palace,
.no-world .curtain {
  display: none;
}

.window-entry {
  position: fixed;
  z-index: 2;
  display: block;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50% 50% 3px 3px;
  cursor: pointer;
}

.window-entry:focus-visible {
  outline: 2px solid var(--milk);
  outline-offset: 5px;
  background: rgba(130, 125, 240, 0.12);
}

.window-entry:focus-visible::after {
  content: 'Karaoke';
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  padding: 6px 8px;
  background: var(--night-deep);
  color: var(--milk);
  font: 700 12px var(--display);
}

body:not([data-place='street']) .window-entry,
.no-world .window-entry {
  display: none;
}

/* The house curtain parts when the palace is ready: the one entrance of the night. */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.curtain-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.5%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.45)),
    repeating-linear-gradient(
      90deg,
      var(--velvet-fold) 0,
      var(--velvet) 26px,
      #e0400f 40px,
      var(--velvet) 54px,
      var(--velvet-fold) 80px
    );
  transition: transform 1.7s cubic-bezier(0.7, 0, 0.2, 1);
}

.curtain-half.left {
  left: 0;
  box-shadow: inset -30px 0 60px rgba(0, 0, 0, 0.45);
}

.curtain-half.right {
  right: 0;
  box-shadow: inset 30px 0 60px rgba(0, 0, 0, 0.45);
}

.curtain-mark {
  position: relative;
  font: 800 clamp(20px, 4vw, 34px) / 1 var(--display);
  letter-spacing: 0.3em;
  color: var(--bulb);
  transition: opacity 0.5s ease;
}

.curtain-up .curtain-half.left {
  transform: translateX(-102%);
}

.curtain-up .curtain-half.right {
  transform: translateX(102%);
}

.curtain-up .curtain-mark {
  opacity: 0;
}

.curtain-up .curtain {
  visibility: hidden;
  transition: visibility 0s 1.8s;
}

/* ---- Letter tiles and the ticket: the palace's controls ---- */

.tile,
.ticket {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 3px;
  font: 800 14px / 1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.tile {
  color: var(--letter);
  background: var(--milk);
  box-shadow:
    inset 0 -3px 0 rgba(20, 17, 24, 0.14),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

.ticket {
  color: var(--letter);
  background: var(--velvet-lit);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  -webkit-mask:
    radial-gradient(circle 6px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 6px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 6px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 6px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
  padding: 0 22px;
}

.tile:hover {
  transform: translateY(-1px);
  background: #fffaf0;
}

.ticket:hover {
  transform: translateY(-1px);
  background: #ff5a1f;
}

.tile:active,
.ticket:active {
  transform: translateY(1px);
}

.tile:disabled,
.ticket:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
}

.small {
  min-height: 40px;
  padding: 0 13px;
  font-size: 13px;
}

.ticket.small {
  padding: 0 18px;
}

/* ---- HUD ---- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--safe-top) 20px 0;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.crest {
  font: 800 15px / 1 var(--display);
  letter-spacing: 0.3em;
  color: var(--milk);
  text-decoration: none;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
  padding: 10px 0;
}

.crest-sigil {
  color: var(--gold);
}

/* The ON AIR light: lit only when someone is reading right now. */
.on-air {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 69, 0, 0.65);
  border-radius: 3px;
  background: rgba(20, 17, 24, 0.78);
  font: 700 12px / 1 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.on-air i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--velvet-lit);
}

/* ---- The bill: the palace's navigation ---- */

.bill {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 20;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}

body:not([data-place='street']) .bill .enter,
body[data-place='poem'] .bill,
body[data-place='karaoke'] .bill,
body[data-place='karaoke'] .hud {
  display: none;
}

/* ---- The brass plaque under a lightbox ---- */

.plaque {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 64px);
  z-index: 19;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 12px 6px;
  border-radius: 3px;
  color: var(--brass-ink);
  background: linear-gradient(180deg, var(--gold) 0 82%, #c99a46 82%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 14px 34px rgba(0, 0, 0, 0.5);
  animation: rise 0.42s var(--ease-out);
}

.plaque-body {
  text-align: center;
  min-width: 0;
}

.plaque-title {
  font: 800 18px / 1.1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-wrap: balance;
}

.plaque-meta {
  margin-top: 4px;
  font: italic 400 14px / 1.3 var(--serif);
}

.plaque-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.plaque-step {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--brass-ink);
  cursor: pointer;
}

.plaque-step svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

body[data-place='street'] .plaque-step,
body[data-place='poem'] .plaque-step {
  visibility: hidden;
}

/* ---- The reading: an intertitle card in front of the big screen ---- */

.reader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 72px var(--gutter) 24px;
  background: radial-gradient(ellipse at 50% 40%, rgba(12, 8, 24, 0.45), rgba(12, 8, 24, 0.86));
}

.reader-sheet {
  position: relative;
  width: min(740px, 100%);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(22px, 6vw, 64px) 40px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 214, 138, 0.1), rgba(255, 214, 138, 0) 55%),
    rgba(20, 16, 56, 0.97);
  border: 1px solid var(--gold-line);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
  animation: rise 0.5s var(--ease-out);
}

/* On a wide window the reading is set on the big screen itself: the sheet takes the screen's
   projected rectangle and its night, warmed from above like light thrown by the projector. */
.reader.on-screen {
  display: block;
  padding: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(12, 8, 24, 0) 40%, rgba(12, 8, 24, 0.5));
}

.reader.on-screen .reader-sheet {
  position: absolute;
  left: var(--screen-x);
  top: var(--screen-y);
  width: var(--screen-w);
  height: var(--screen-h);
  max-height: none;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 214, 138, 0.1), rgba(255, 214, 138, 0) 60%), #141038;
}

.reader.on-screen .reader-close {
  float: right;
  margin: 12px -10px 0 0;
}

.reader.on-screen .reader-head {
  padding-top: 26px;
}

.reader.on-screen .reader-title {
  font-size: clamp(28px, 3.1vw, 44px);
}

.reader.on-screen .reader-year {
  margin-top: 8px;
}

.reader.on-screen .reader-subtitle {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.4;
}

.reader.on-screen .reader-byline {
  margin-top: 8px;
  font-size: 21px;
}

.reader.on-screen .reader-count {
  margin-top: 6px;
}

.reader.on-screen .reader-acts {
  margin-top: 12px;
}

.reader.on-screen .poem-text {
  margin-top: 22px;
  font-size: 18px;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 14px;
  }
}

.reader-close {
  position: sticky;
  top: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 12px -14px 0 auto;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background: rgba(11, 10, 16, 0.9);
  color: var(--milk);
  cursor: pointer;
}

.reader-close:hover {
  border-color: var(--velvet-lit);
  color: var(--velvet-lit);
}

.reader-head {
  text-align: center;
  padding-top: 8px;
}

.reader-title {
  font: 800 clamp(32px, 6.4vw, 56px) / 1.02 var(--display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--milk);
}

.reader-title:focus {
  outline: none;
}

.reader-year {
  margin-top: 12px;
  font: 600 13px / 1 var(--display);
  letter-spacing: 0.34em;
  color: var(--gold);
}

.reader-subtitle {
  margin: 18px auto 0;
  max-width: 30em;
  font: italic 400 19px / 1.45 var(--serif);
  color: var(--milk-soft);
}

.reader-byline {
  margin-top: 14px;
  font: italic 400 25px / 1.2 var(--byline);
  color: var(--milk);
}

.reader-count {
  margin-top: 14px;
  font: 700 12px / 1.3 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bulb);
}

.reader-acts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.poem-text {
  max-width: 34em;
  margin: 40px auto 0;
  font: 400 19px / 1.72 var(--serif);
  font-optical-sizing: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--milk);
}

.poem-text strong {
  font-weight: 600;
}

.reader-sign {
  margin: 36px 0 0;
  text-align: center;
  letter-spacing: 0.6em;
  color: var(--gold);
}

.pass {
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--gold-hair);
  text-align: center;
}

.pass-heading {
  font: 700 12px / 1 var(--display);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}

.pass-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pass-receipt {
  min-height: 1.5em;
  margin-top: 12px;
  font: italic 400 15px / 1.5 var(--serif);
  color: var(--bulb);
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
}

.reader-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 48%;
  font: 700 13px / 1.2 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--milk-soft);
}

.reader-nav a:hover {
  color: var(--gold);
}

#readerNext {
  margin-left: auto;
  text-align: right;
}

/* ---- Karaoke: the house lights go down, the words come up ---- */

.karaoke {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #000;
  color: #f3efe6;
  font-family: var(--prompter);
  --k-scale: 1;
}

.karaoke-top {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--safe-top) 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.karaoke-name {
  font: 800 13px / 1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 8px 0 12px;
}

.karaoke-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.karaoke-tools select {
  max-width: 100%;
  flex: 1 1 220px;
  justify-content: flex-start;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background:
    linear-gradient(135deg, transparent 50%, var(--gold) 50%) right 18px top 50% / 6px 6px no-repeat,
    linear-gradient(225deg, transparent 50%, var(--gold) 50%) right 12px top 50% / 6px 6px no-repeat,
    linear-gradient(180deg, #1d1736 0%, #0d0a1b 58%, #08060f 100%);
}

.k-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 13px / 1 var(--prompter);
  color: #bdbdbd;
}

.k-group span {
  min-width: 3.2em;
  text-align: center;
}

#karaokeExit {
  margin-left: auto;
}

.karaoke-hint {
  margin-top: 10px;
  font-size: 13px;
  color: #9a9a9a;
}

.karaoke-sheet {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 240px;
}

.k-poem {
  padding: 40px 0 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  scroll-margin-top: 8px;
}

.k-cover {
  display: block;
  width: auto;
  max-width: min(520px, 100%);
  max-height: calc(100svh - 250px);
  height: auto;
  margin: 0 auto 26px;
  border-radius: 4px;
}

.k-title {
  font: 800 calc(1.7rem * var(--k-scale)) / 1.1 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
}

.k-number {
  color: var(--velvet-lit);
}

.k-year {
  color: #cfc9bd;
}

.k-subtitle {
  margin-top: 12px;
  font-size: calc(1.2rem * var(--k-scale));
  font-style: italic;
  line-height: 1.5;
  color: #d6d2ca;
}

.k-byline {
  margin-top: 8px;
  font: italic 400 calc(1.35rem * var(--k-scale)) / 1.3 var(--byline);
  color: #c9c4ba;
}

.k-text {
  margin-top: 26px;
  font-size: calc(1.3rem * var(--k-scale));
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@media (max-width: 768px) and (pointer: coarse) {
  .k-text {
    font-size: calc(2.5rem * var(--k-scale));
    line-height: 1.6;
  }

  .k-subtitle {
    font-size: calc(1.6rem * var(--k-scale));
  }

  .k-title {
    font-size: calc(2.1rem * var(--k-scale));
  }
}

.k-after {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 36px;
  font: 700 15px / 1.3 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.k-after a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #ff7a45;
  text-decoration: none;
  padding: 10px 0;
}

.k-after span {
  color: var(--gold);
  padding: 10px 0;
}

.karaoke-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  padding: 18px 12px max(8px, env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.96) 22%);
  transition: transform 0.4s var(--ease-out);
}

.karaoke-player.tucked {
  transform: translateY(110%);
}

.karaoke-player iframe {
  width: 100%;
  max-width: 420px;
  border-radius: 2px;
}

/* ---- The karaoke room: friends around a screen, the words in time with the music ---- */

.karaoke[data-mode='room'] {
  overflow: hidden;
  background: var(--night-deep);
}

.karaoke[data-mode='room'] > :not(.k-room),
.karaoke[data-mode='sheet'] > .k-room {
  display: none;
}

.karaoke.k-arrive .k-room {
  animation: k-arrive 0.7s var(--ease-out) both;
}

@keyframes k-arrive {
  from {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(6px);
  }
}

.k-room {
  --k-stage: 1;
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: var(--safe-top) 14px max(10px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 70% 60% at 50% 42%, rgba(103, 104, 172, 0.42), transparent 70%),
    linear-gradient(90deg, var(--velvet-fold) 0, rgba(94, 18, 6, 0) 7%, rgba(94, 18, 6, 0) 93%, var(--velvet-fold) 100%),
    linear-gradient(180deg, #1b1546 0%, var(--night) 55%, var(--night-deep) 100%);
  color: var(--milk);
  font-family: var(--prompter);
}

.k-wall {
  position: absolute;
  inset: 0 0 auto;
  height: 70px;
  pointer-events: none;
}

.k-lights {
  width: 100%;
  height: 100%;
}

.k-lights path {
  fill: none;
  stroke: rgba(226, 179, 92, 0.35);
  stroke-width: 1.5;
}

.k-lights circle {
  fill: var(--bulb);
  filter: drop-shadow(0 0 6px rgba(255, 214, 138, 0.9));
  animation: k-twinkle 3.2s ease-in-out infinite;
}

.k-lights circle:nth-child(3n + 1) {
  animation-delay: -1.1s;
}

.k-lights circle:nth-child(3n + 2) {
  animation-delay: -2.2s;
}

@keyframes k-twinkle {
  50% {
    opacity: 0.55;
  }
}

.k-screen {
  position: relative;
  z-index: 1;
  min-height: 0;
  width: min(1180px, 100%);
  margin: 26px auto 0;
  display: flex;
}

.k-glass {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: #000;
  box-shadow:
    0 0 0 6px rgba(20, 16, 56, 0.9),
    0 0 0 7px var(--gold-hair),
    0 0 70px rgba(114, 112, 255, 0.28);
}

.k-now {
  padding: 14px 20px 0;
  font: 800 13px / 1.2 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.k-setlist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 20px 120px;
}

.k-set-note {
  margin: 6px 0 14px;
  font-size: 14px;
  color: #9d98b8;
}

.k-set-items {
  list-style: none;
  display: grid;
  gap: 4px;
}

.k-set-items button {
  width: 100%;
  display: grid;
  grid-template-columns: 2.2em 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: baseline;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 1px;
  background: transparent;
  color: #f3efe6;
  text-align: left;
  cursor: pointer;
}

.k-set-items button:hover,
.k-set-items button:focus-visible {
  border-color: var(--gold-line);
  background: rgba(226, 179, 92, 0.07);
}

.k-set-n {
  grid-row: span 2;
  font: 800 calc(1.35rem * var(--k-stage)) / 1 var(--display);
  color: var(--velvet-lit);
}

.k-set-title {
  font: 600 calc(1.2rem * var(--k-stage)) / 1.25 var(--prompter);
}

.k-set-track {
  margin-top: 3px;
  font-size: 13px;
  color: #8f8aa8;
}

.k-text-btn {
  margin-top: 18px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: #ff7a45;
  font: 700 14px / 1.2 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.k-prompter {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.k-track {
  padding: 2px 20px 0;
  font-size: 12px;
  color: #7f7a98;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.k-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 74%, transparent 100%);
}

.k-lines {
  padding: 0 clamp(18px, 4vw, 56px);
  transition: transform 0.5s var(--ease-out);
  will-change: transform;
}

.k-l {
  margin: 0;
  padding: 0.16em 0;
  font: 600 calc(clamp(24px, 3.9vw, 52px) * var(--k-stage)) / 1.22 var(--prompter);
  color: #f3efe6;
  opacity: 0.16;
  transition:
    opacity 0.35s ease,
    color 0.35s ease;
  overflow-wrap: break-word;
}

.k-l-stanza {
  margin-top: 0.7em;
}

.k-l.is-past {
  opacity: 0.22;
}

.k-l.is-soon {
  opacity: 0.42;
}

.k-l.is-next {
  opacity: 0.66;
}

.k-l.is-now {
  opacity: 1;
  color: rgba(243, 239, 230, 0.5);
}

/* Word by word, at Star's own speed (world/stage.js wordAt): a said word is lit bulb-gold, the word
   in his mouth fills left to right, a word he leans into keeps a held glow, and his fastest bars
   (five syllables a second and up) burn ember. */
.k-l .k-w {
  transition:
    color 0.12s linear,
    text-shadow 0.4s ease;
}

.k-l.is-now .k-w.said {
  color: var(--bulb);
}

.k-l.is-now .k-w.now {
  color: transparent;
  background: linear-gradient(90deg, var(--bulb) var(--p, 0%), rgba(243, 239, 230, 0.5) var(--p, 0%));
  -webkit-background-clip: text;
  background-clip: text;
}

.k-l.is-now .k-w.k-lean.said,
.k-l.is-now .k-w.k-lean.now {
  text-shadow: 0 0 0.42em rgba(255, 214, 138, 0.55);
}

.k-l.is-now.k-hot .k-w.said {
  color: #ff7a3d;
  text-shadow: 0 0 0.5em rgba(255, 92, 30, 0.55);
}

.k-l.is-now.k-hot .k-w.now {
  background-image: linear-gradient(90deg, #ff7a3d var(--p, 0%), rgba(243, 239, 230, 0.5) var(--p, 0%));
}

.k-count {
  position: absolute;
  left: 50%;
  bottom: 18%;
  display: flex;
  gap: 14px;
  transform: translateX(-50%);
}

.k-count[hidden] {
  display: none;
}

.k-count span {
  position: relative;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: transparent;
}

.k-count svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* Unlit, each count-in mark is a gold hair diamond; lit, it turns into the house's hidden marks,
   drawn by hand: star, heart, note, and the four-point spark on the beat before the words. */
.k-count span::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  transition: opacity 0.12s ease;
}

.k-count span.on {
  color: var(--bulb);
  filter: drop-shadow(0 0 7px var(--bulb));
  animation: k-count-pop 0.28s var(--ease-out);
}

.k-count span.on::after {
  opacity: 0;
}

@keyframes k-count-pop {
  from {
    transform: scale(1.6);
  }
}

/* The rest clock: in every silence, the exact time to the next words, the bars and beats left, and
   the rest draining away; it warms to the bulb in the last four beats. */
.k-rest {
  position: absolute;
  top: 9%;
  left: 50%;
  z-index: 3;
  width: min(560px, 86%);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.k-rest-num {
  font-size: clamp(54px, 11vw, 112px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(226, 179, 92, 0.35);
}

.k-rest-unit {
  margin-left: 0.12em;
  font-size: 0.36em;
  font-weight: 500;
  color: #9d98b8;
}

.k-rest-sub {
  margin-top: 10px;
  font-size: clamp(14px, 2.2vw, 19px);
  font-variant-numeric: tabular-nums;
  color: #c9c4dc;
}

.k-rest-bar {
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(226, 179, 92, 0.18);
}

.k-rest-bar span {
  display: block;
  height: 100%;
  background: var(--gold);
  transform-origin: left center;
}

/* Star's introduction: plain white, as large as fits, while the intro plays. */
.k-intro {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 5vw, 64px);
  pointer-events: none;
}

.k-intro p {
  max-width: 100%;
  font-weight: 400;
  line-height: 1.32;
  text-align: center;
  text-wrap: pretty;
  color: #fff;
}

.k-prompter.k-introducing .k-view {
  visibility: hidden;
}

.k-rest[data-intro='yes'] {
  top: 3%;
}

.k-rest[data-intro='yes'] .k-rest-num {
  font-size: clamp(30px, 5vw, 46px);
}

.k-rest[data-intro='yes'] .k-rest-sub {
  margin-top: 4px;
  font-size: 13px;
}

.k-rest[data-intro='yes'] .k-rest-bar {
  margin-top: 6px;
}

.k-l.is-behind {
  opacity: 0.12;
}

@media (max-height: 520px) {
  .k-rest {
    top: 4%;
  }

  .k-rest-num {
    font-size: 44px;
  }

  .k-rest-sub {
    margin-top: 4px;
    font-size: 13px;
  }

  .k-rest-bar {
    margin-top: 8px;
  }
}

.k-rest[data-close='yes'] .k-rest-num {
  color: var(--bulb);
  text-shadow: 0 0 32px var(--bulb);
}

.k-rest[data-close='yes'] .k-rest-bar span {
  background: var(--bulb);
}

.k-count[data-wait='yes']::before {
  content: '♪';
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: #8f8aa8;
}

.k-end {
  position: absolute;
  inset: auto 0 16%;
  text-align: center;
  color: var(--gold);
}

.k-end button {
  position: relative;
  margin-top: 8px;
  padding: 15px 28px;
  border: 0;
  border-radius: 1px;
  background: linear-gradient(180deg, rgba(40, 30, 14, 0.92), rgba(12, 8, 4, 0.96));
  box-shadow:
    inset 0 0 0 1px var(--gold-line),
    0 0 40px -12px rgba(226, 179, 92, 0.5);
  color: var(--milk);
  font: 700 14px / 1.2 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.2s ease,
    box-shadow 0.25s ease;
}

.k-end button::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(226, 179, 92, 0.18);
  pointer-events: none;
}

.k-end button:hover,
.k-end button:focus-visible {
  color: var(--bulb);
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    0 0 48px -8px rgba(226, 179, 92, 0.65);
}

.k-pulse {
  position: absolute;
  top: -22px;
  right: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.25;
}

.k-pulse.beat {
  animation: k-beat 0.32s ease-out;
}

.k-pulse.one {
  animation: k-one 0.45s ease-out;
}

@keyframes k-beat {
  from {
    opacity: 0.9;
    transform: scale(1.4);
  }
}

@keyframes k-one {
  from {
    opacity: 1;
    transform: scale(2.2);
    box-shadow: 0 0 16px var(--bulb);
  }
}

.k-toast {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 1px;
  background: rgba(12, 8, 24, 0.94);
  border: 1px solid var(--gold-line);
  font-size: 13px;
  color: var(--milk);
  white-space: nowrap;
}

.k-friends {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--k-deck-h, 150px) - 14px);
  z-index: 2;
  width: 100%;
  height: clamp(110px, 22vh, 230px);
  pointer-events: none;
}

.k-friend {
  fill: #0a0817;
  stroke: rgba(255, 214, 138, 0.28);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: k-sway 3.6s ease-in-out infinite;
}

.k-friend.f2,
.k-friend.f5 {
  animation-duration: 2.8s;
}

.k-friend.f3,
.k-friend.f6 {
  animation-delay: -1.4s;
}

.k-friend .arm {
  fill: none;
  stroke: #0a0817;
  stroke-width: 18;
  stroke-linecap: round;
}

.k-friend .phone {
  fill: var(--bulb);
  stroke: none;
  filter: drop-shadow(0 0 10px rgba(255, 214, 138, 0.9));
}

.k-friend .cup {
  fill: var(--velvet);
  stroke: none;
}

@keyframes k-sway {
  50% {
    transform: rotate(2.2deg) translateX(4px);
  }
}

.k-deck {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

.k-deck-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The deck: engraved brass-on-velvet plates, square-cut (1px), set in Star's cover face. Each plate
   carries a gold hair frame 3px inside, like the book sheet's; a lamp sweep crosses it on hover.
   Play is the house ticket, the one solid action in the room. Labels say exactly what each does. */
.k-deck button,
.karaoke-tools button,
.karaoke-tools select {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 1px;
  background: linear-gradient(180deg, #1d1736 0%, #0d0a1b 58%, #08060f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(226, 179, 92, 0.34),
    inset 0 1px 0 rgba(255, 214, 138, 0.2),
    0 12px 26px -16px #000;
  color: var(--milk);
  font: 700 12.5px / 1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.2s var(--ease-out);
}

.k-deck button::before,
.karaoke-tools button::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(226, 179, 92, 0.13);
  pointer-events: none;
}

.k-deck button::after,
.karaoke-tools button::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 45%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 214, 138, 0.16), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s var(--ease-out);
  pointer-events: none;
}

.k-deck button:hover,
.k-deck button:focus-visible,
.karaoke-tools button:hover,
.karaoke-tools button:focus-visible,
.karaoke-tools select:hover {
  color: var(--bulb);
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    inset 0 1px 0 rgba(255, 214, 138, 0.34),
    0 0 22px -6px rgba(226, 179, 92, 0.45),
    0 12px 26px -16px #000;
}

.k-deck button:hover::after,
.k-deck button:focus-visible::after,
.karaoke-tools button:hover::after,
.karaoke-tools button:focus-visible::after {
  left: 120%;
}

.k-deck button:active,
.karaoke-tools button:active {
  transform: translateY(1px);
}

.k-deck button svg,
.karaoke-tools button svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
}

.k-deck button[aria-pressed='true'],
.karaoke-tools [aria-pressed='true'] {
  color: #ff7a45;
  box-shadow:
    inset 0 0 0 1px var(--velvet-lit),
    inset 0 0 18px rgba(255, 69, 0, 0.18),
    0 12px 26px -16px #000;
}

.k-deck .k-play {
  min-width: 118px;
  padding: 0 24px;
  color: var(--letter);
  font-weight: 800;
  background: linear-gradient(180deg, #ff6a2b, var(--velvet-lit) 55%, #d93a00);
  box-shadow: 0 10px 26px -10px rgba(255, 69, 0, 0.65);
  -webkit-mask:
    radial-gradient(circle 6px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 6px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 6px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 6px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
}

.k-deck .k-play::before {
  inset: 3px 11px;
  border-color: rgba(20, 17, 24, 0.28);
  border-style: dashed none;
}

.k-deck .k-play:hover,
.k-deck .k-play:focus-visible {
  color: var(--letter);
  background: linear-gradient(180deg, #ff7a3d, #ff5a1f 55%, #e24400);
  box-shadow: 0 12px 30px -8px rgba(255, 90, 31, 0.8);
}

.k-deck .k-play[aria-pressed='true'] {
  color: var(--bulb);
  background: linear-gradient(180deg, #5e1206, #3a0b04);
  box-shadow: 0 10px 26px -12px rgba(255, 69, 0, 0.5);
}

.k-deck .k-play[aria-pressed='true']::before {
  border-color: rgba(255, 214, 138, 0.3);
}

.k-room[data-view='setlist'] .k-deck-group:nth-child(2),
.k-room[data-view='setlist'] #kRestart,
.k-room[data-view='setlist'] .k-play,
.k-room[data-view='setlist'] .k-time,
.k-room[data-view='setlist'] #kToSet {
  display: none;
}

/* While the setlist is up the friends sit down below its rows, so no title is read through a head;
   they stand again for the performance. */
.k-friends {
  transition:
    transform 0.5s ease,
    opacity 0.5s ease;
}

.k-room[data-view='setlist'] .k-friends {
  transform: translateY(62%);
  opacity: 0.32;
}

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

.k-time {
  min-width: 6.5em;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #9d98b8;
}

.k-music {
  position: relative;
  z-index: 3;
  width: min(520px, 100%);
  margin: 0 auto;
}

.k-music iframe {
  display: block;
  border-radius: 2px;
}

@media (max-width: 700px) {
  .k-room {
    gap: 8px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .k-screen {
    margin-top: 18px;
  }

  .k-l {
    font-size: calc(clamp(26px, 7.4vw, 40px) * var(--k-stage));
  }

  /* On a phone every plate stays on the glass: groups wrap, plates tighten, nothing runs off. */
  .k-deck {
    gap: 6px;
    max-width: 100%;
  }

  .k-deck-group {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
  }

  .k-deck button {
    min-height: 42px;
    padding: 0 10px;
    font-size: 11px;
    letter-spacing: 0.09em;
  }

  .k-deck .k-play {
    min-width: 96px;
  }

  .k-friends {
    height: clamp(80px, 15vh, 140px);
  }
}

/* ---- Sheets: the book counter and the cinema controls ---- */

.sheet {
  position: fixed;
  right: max(24px, 4vw);
  top: 50%;
  z-index: 30;
  transform: translateY(-50%);
  width: min(400px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  padding: 30px 28px 26px;
  background: rgba(11, 10, 16, 0.94);
  border: 1px solid var(--gold-line);
  outline: 1px solid var(--gold-hair);
  outline-offset: -8px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  animation: rise 0.45s var(--ease-out);
}

.sheet-close {
  float: right;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -12px -12px 0 8px;
  border: 1px solid var(--gold-hair);
  border-radius: 50%;
  background: transparent;
  color: var(--milk);
  cursor: pointer;
}

.sheet-close:hover {
  border-color: var(--velvet-lit);
  color: var(--velvet-lit);
}

.book-title {
  margin-top: 4px;
  font: 800 34px / 1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.book-title:focus,
.program-title:focus {
  outline: none;
}

.book-line {
  margin-top: 14px;
  font: 400 17px / 1.55 var(--serif);
  color: var(--milk-soft);
}

.book-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

/* The door: the bouncer's card at the rope, on the left so the line stays in view. */
.door {
  right: auto;
  left: max(24px, 4vw);
}

/* At the rope, the bill steps out of the way so nothing stands between you and him. */
body.at-door .bill {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.door-who {
  margin: 0 0 6px;
  font: 800 11px / 1 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.door-line {
  min-height: 2.6em;
  margin: 0 0 18px;
  font: 400 22px / 1.3 var(--serif);
  color: var(--milk, #f3ede2);
}

.door-form {
  display: grid;
  gap: 10px;
}

.door-form input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--milk, #f3ede2);
  font: 400 18px / 1 var(--serif);
}

.door-form input::placeholder {
  color: #7d7568;
}

.door-form input:focus {
  border-color: var(--gold);
}

.door[data-state='refused'] .door-form input {
  border-color: var(--velvet-lit);
}

.door[data-state='welcome'] .door-form,
.door[data-state='greeting'] .door-form,
.door[data-state='looking'] .door-form,
.door[data-state='checking'] .door-form {
  opacity: 0.55;
}

.door-eye {
  display: block;
  width: 132px;
  height: 132px;
  margin: 16px auto 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  object-fit: cover;
  transform: scaleX(-1);
  box-shadow: 0 0 28px rgba(226, 179, 92, 0.35);
}

.door-eye[hidden],
.door-face[hidden],
.door-scan[hidden],
.door-vouch[hidden],
.door-vouch input[hidden],
.door-music[hidden] {
  display: none;
}

/* While he looks: the round eye in a slow bulb-gold ring that breathes, brighter once he can see
   a face, dimmer when the frame is dark, and a small "Looking" under it. */
.door-scan {
  position: relative;
  width: 132px;
  margin: 16px auto 0;
}

.door-scan .door-eye {
  margin: 0;
}

.door-scan-ring {
  position: absolute;
  inset: -8px;
  height: 148px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--bulb);
  border-right-color: var(--gold-line);
  animation: door-scan 1.6s linear infinite;
  opacity: 0.55;
  transition: opacity 0.4s;
}

.door-scan[data-face='yes'] .door-scan-ring {
  opacity: 1;
  box-shadow: 0 0 22px rgba(255, 214, 138, 0.35);
}

.door-scan[data-face='dark'] .door-scan-ring {
  opacity: 0.25;
}

.door-scan-label {
  display: block;
  margin-top: 10px;
  text-align: center;
  font: 700 10px / 1 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  animation: door-breathe 1.8s ease-in-out infinite;
}

@keyframes door-scan {
  to {
    transform: rotate(360deg);
  }
}

@keyframes door-breathe {
  50% {
    opacity: 0.45;
  }
}

/* The conversation after a face that rang a bell: who you are, how you know Star, then his question. */
.door-vouch {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.door-vouch input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--milk, #f3ede2);
  font: 400 18px / 1 var(--serif);
}

.door-vouch input::placeholder {
  color: #7d7568;
}

.door-vouch input:focus {
  border-color: var(--gold);
}

.door-vouch[data-step='test'] input {
  font-family: var(--hand);
  font-size: 22px;
}

.door[data-state='vouch'] .door-form,
.door[data-state='vouch'] .door-face,
.door[data-state='vouching'] .door-form,
.door[data-state='vouching'] .door-face,
.door[data-state='test'] .door-form,
.door[data-state='test'] .door-face,
.door[data-state='judging'] .door-form,
.door[data-state='judging'] .door-face {
  display: none;
}

.door[data-state='vouching'] .door-vouch,
.door[data-state='judging'] .door-vouch,
.door[data-state='scanning'] .door-form {
  opacity: 0.55;
}

/* The door's own music: a small toggle in the card's corner with the track's name. */
.door-music {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: 700 10px / 1 var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.8;
}

.door-music svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.door-music[aria-pressed='false'] {
  color: #7d7568;
  text-decoration: line-through;
}

.door-face {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: transparent;
  color: var(--gold);
  font: 700 12px / 1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.door-face:disabled {
  opacity: 0.5;
}

.door-note {
  margin: 14px 0 0;
  font: 400 13px / 1.5 var(--serif);
  color: #c4bba9;
}

/* The call: while Royal rings Star, the card shows the line live. The lamp is the light on his
   earpiece (blinking velvet while it rings, steady once Star picks up, dark when it drops); the
   clock runs; each step lights in bulb gold the moment it really lands. */
.door[data-state='asking'] .door-form,
.door[data-state='asking'] .door-face,
.door[data-state='asking'] .door-note,
.door[data-state='reserve'] .door-form,
.door[data-state='reserve'] .door-face,
.door[data-state='reserve'] .door-note,
.door[data-state='reserved'] .door-form,
.door[data-state='reserved'] .door-face,
.door[data-state='reserved'] .door-note {
  display: none;
}

.door-call[hidden],
.door[data-state='reserved'] .door-call,
.door-call-leave[hidden],
.door-book[hidden],
.door-pass[hidden],
.door-portrait video[hidden],
.door-portrait img[hidden],
.door-detail[hidden] {
  display: none;
}

.door-call {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 69, 0, 0.08), transparent 60%), rgba(12, 8, 24, 0.55);
}

.door-call::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold-hair);
  border-radius: 2px;
  pointer-events: none;
}

.door-call-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.door-call-lamp {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px 0 -6px -6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.door-call-lamp span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #ffd3b8 0 14%, var(--velvet-lit) 42%, #8a1a04 100%);
  box-shadow:
    0 0 0 1px rgba(226, 179, 92, 0.65),
    0 0 14px 3px rgba(255, 69, 0, 0.75),
    0 0 36px 8px rgba(255, 69, 0, 0.28);
  animation: door-lamp 0.8s steps(1, end) infinite;
}

.door-call[data-state='picked'] .door-call-lamp span {
  animation: door-lamp-steady 2.4s ease-in-out infinite;
}

.door-call[data-state='missed'] .door-call-lamp span,
.door-call[data-state='turned'] .door-call-lamp span {
  animation: none;
  background: radial-gradient(circle at 38% 34%, #6b4a40 0 14%, #3a1208 60%, #1c0904 100%);
  box-shadow: 0 0 0 1px rgba(226, 179, 92, 0.35);
}

@keyframes door-lamp {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  14% {
    opacity: 0.86;
  }
  50% {
    opacity: 0.12;
    transform: scale(0.82);
    box-shadow: 0 0 0 1px rgba(226, 179, 92, 0.45);
  }
}

@keyframes door-lamp-steady {
  50% {
    filter: brightness(1.2);
  }
}

.door-call-label {
  margin: 0;
  font: 800 13px / 1 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--milk);
}

.door-call-clock {
  font: 700 22px / 1 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--bulb);
  text-shadow: 0 0 14px rgba(255, 214, 138, 0.35);
}

.door-call[data-state='missed'] .door-call-clock,
.door-call[data-state='turned'] .door-call-clock {
  color: #8f8573;
  text-shadow: none;
}

.door-call-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.door-call-steps li {
  position: relative;
  padding-top: 14px;
  font: 700 10.5px / 1.2 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 241, 230, 0.36);
  transition: color 0.4s ease;
}

/* A hairline track under the steps; each lit step paints its segment gold. */
.door-call-steps li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-hair);
  transition:
    background-color 0.4s ease,
    box-shadow 0.4s ease;
}

.door-call-steps li[data-done='true'],
.door-call-steps li[data-now='true'] {
  color: var(--milk);
}

.door-call-steps li[data-done='true']::before {
  background: var(--gold);
}

.door-call-steps li[data-now='true']::before {
  background: var(--bulb);
  box-shadow: 0 0 10px rgba(255, 214, 138, 0.8);
  animation: door-step 1.6s ease-in-out infinite;
}

.door-call[data-state='picked'] .door-call-steps li[data-now='true']::before,
.door-call[data-state='missed'] .door-call-steps li[data-now='true']::before,
.door-call[data-state='turned'] .door-call-steps li[data-now='true']::before {
  animation: none;
}

@keyframes door-step {
  50% {
    opacity: 0.4;
  }
}

.door-call-leave {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: transparent;
  color: var(--gold);
  font: 700 12px / 1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  animation: door-rise 0.5s var(--ease-out);
}

@keyframes door-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* The guest book: the portrait sits first, in a round gold frame lit like a dressing-room mirror;
   the fields are the house's 48px wells; the ticket reserves the handle by name. */
.door-book {
  display: grid;
  gap: 12px;
  animation: door-rise 0.5s var(--ease-out);
}

.door-sitting {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.door-portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255, 214, 138, 0.14), rgba(12, 8, 24, 0.9) 70%);
  box-shadow:
    0 0 0 5px rgba(12, 8, 24, 0.9),
    0 0 0 6px var(--gold-hair),
    0 0 32px rgba(255, 214, 138, 0.28);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.4s ease;
}

.door-portrait:hover,
.door-portrait:focus-visible {
  box-shadow:
    0 0 0 5px rgba(12, 8, 24, 0.9),
    0 0 0 6px var(--gold-line),
    0 0 44px rgba(255, 214, 138, 0.45);
}

.door-portrait video,
.door-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.door-portrait video {
  transform: scaleX(-1);
}

.door-portrait-cue {
  display: grid;
  justify-items: center;
  gap: 8px;
  font: 800 11px / 1 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.door-portrait-cue svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.door-portrait[data-state='live'] .door-portrait-cue,
.door-portrait[data-state='taken'] .door-portrait-cue,
.door-portrait[data-state='flash'] .door-portrait-cue {
  display: none;
}

.door-portrait-count {
  position: relative;
  z-index: 1;
  font: 800 64px / 1 var(--display);
  color: var(--bulb);
  text-shadow:
    0 0 18px rgba(255, 214, 138, 0.9),
    0 2px 0 rgba(42, 23, 9, 0.6);
  pointer-events: none;
}

.door-portrait-count:not(:empty) {
  animation: door-count 0.82s var(--ease-out);
}

@keyframes door-count {
  from {
    opacity: 0;
    transform: scale(1.5);
  }
  30% {
    opacity: 1;
  }
}

/* The flash: a bulb-white bloom over the frame as the shutter falls. */
.door-portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fffaf0, rgba(255, 214, 138, 0.6) 60%, transparent);
  opacity: 0;
  pointer-events: none;
}

.door-portrait[data-state='flash']::after {
  animation: door-flash 0.7s ease-out;
}

@keyframes door-flash {
  from {
    opacity: 1;
  }
}

.door-upload {
  min-height: 32px;
  padding: 8px 6px;
  font: italic 400 14px / 1 var(--serif);
  color: rgba(246, 241, 230, 0.62);
  text-decoration: underline;
  text-decoration-color: var(--gold-hair);
  text-underline-offset: 4px;
  cursor: pointer;
}

.door-upload-lit {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.door-field {
  position: relative;
  display: grid;
}

.door-field > span,
.door-chips legend {
  margin-bottom: 6px;
  padding: 0;
  font: 800 10.5px / 1 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.door-field input,
.door-detail {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--milk);
  font: 400 17px / 1 var(--serif);
}

.door-field input:focus,
.door-detail:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(226, 179, 92, 0.16);
}

.door-field input::placeholder,
.door-detail::placeholder {
  font-style: italic;
  color: #7d7568;
}

.door-handle b {
  position: absolute;
  top: 16.5px;
  left: 14px;
  font: 400 17px / 48px var(--serif);
  color: var(--bulb);
  pointer-events: none;
}

.door-handle input {
  padding-left: 31px;
  color: var(--bulb);
}

.door-handle small {
  min-height: 1.4em;
  margin-top: 6px;
  font: italic 400 13px / 1.4 var(--serif);
  color: rgba(246, 241, 230, 0.6);
}

.door-book[data-handle='free'] .door-handle small {
  color: var(--bulb);
}

.door-book[data-handle='taken'] .door-handle small,
.door-book[data-handle='house'] .door-handle small {
  color: #ff8a5c;
}

.door-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.door-chips legend {
  display: block;
}

.door-chips label {
  position: relative;
}

.door-chips input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.door-chips span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  font: 700 12px / 1.1 var(--display);
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  color: var(--milk-soft);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.door-chips input:checked + span {
  border-color: var(--milk);
  background: var(--milk);
  color: var(--letter);
  box-shadow:
    inset 0 -3px 0 rgba(20, 17, 24, 0.14),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

.door-chips input:focus-visible + span {
  outline: 2px solid var(--milk);
  outline-offset: 2px;
}

.door-detail {
  grid-column: 1 / -1;
  margin-top: 4px;
  animation: door-rise 0.35s var(--ease-out);
}

.door-vibe input {
  font-style: italic;
}

.door-book .ticket {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  font-size: 15px;
}

.door-book-fine {
  margin: 0;
  font: italic 400 13px / 1.5 var(--serif);
  text-align: center;
  color: rgba(246, 241, 230, 0.55);
}

.door-nudge {
  animation: door-nudge 0.5s ease;
}

@keyframes door-nudge {
  20%,
  60% {
    transform: translateX(-5px);
  }
  40%,
  80% {
    transform: translateX(5px);
  }
}

/* The pass: what the guest holds once their name is with Royal. Their portrait in gold, their
   name in caps, the handle in bulb light, and the house's three marks at the foot. */
.door-pass {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 24px 18px 18px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: radial-gradient(ellipse at 50% 0, rgba(255, 214, 138, 0.16), transparent 70%), rgba(12, 8, 24, 0.6);
  text-align: center;
  animation: door-pass 0.9s var(--ease-out);
}

.door-pass::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold-hair);
  border-radius: 2px;
  pointer-events: none;
}

@keyframes door-pass {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-1.5deg);
  }
}

.door-pass img {
  width: 128px;
  height: 128px;
  margin-bottom: 8px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 5px rgba(12, 8, 24, 0.9),
    0 0 0 6px var(--gold-hair),
    0 0 36px rgba(255, 214, 138, 0.35);
}

.door-pass-name {
  margin: 0;
  font: 800 22px / 1.1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--milk);
}

.door-pass-handle {
  margin: 0;
  font: 400 18px / 1.2 var(--serif);
  color: var(--bulb);
  text-shadow: 0 0 14px rgba(255, 214, 138, 0.45);
}

.door-pass-line {
  max-width: 30ch;
  margin: 8px 0 0;
  font: italic 400 15px / 1.5 var(--serif);
  color: var(--milk-soft);
}

.door-pass-line span {
  font-style: normal;
  color: var(--milk);
  overflow-wrap: anywhere;
}

/* The house's three marks; a long look (or a hover) and they glint. */
.door-pass-sigil {
  margin: 10px 0 0;
  font: 400 13px / 1 var(--serif);
  letter-spacing: 0.6em;
  color: var(--gold-deep);
  transition:
    color 0.6s ease,
    text-shadow 0.6s ease;
}

/* The heart is drawn, not typed, so no platform swaps it for a red emoji. */
.door-pass-heart {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.1em;
}

.door-pass:hover .door-pass-sigil,
.door-pass:active .door-pass-sigil {
  color: var(--bulb);
  text-shadow: 0 0 12px rgba(255, 214, 138, 0.8);
}

@media (prefers-reduced-motion: reduce) {
  .door-call-lamp span,
  .door-call-steps li[data-now='true']::before,
  .door-portrait-count:not(:empty),
  .door-portrait[data-state='flash']::after,
  .door-book,
  .door-pass,
  .door-call-leave,
  .door-nudge {
    animation: none;
  }
}

/* His stage: the close-ups in a gold frame over the scene, the polaroid, and the confetti. */
.door-stage {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.door-stage[hidden],
.door-panel[hidden],
.door-polaroid[hidden],
.door-list[hidden] {
  display: none;
}

/* The List, for the once-over: Star's clipboard in a gold close-up. Names scribbled down it, his
   gold pen reading row by row, and the guest's own row, found, in Star's hand with a velvet tick. */
.door-list {
  --row-h: 38px;
  position: relative;
  width: min(62vmin, 340px);
  padding: 22px 26px 26px 54px;
  border: 3px solid var(--gold);
  outline: 1px solid var(--gold-hair);
  outline-offset: -10px;
  background: #f4eedf;
  color: #2a2420;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(226, 179, 92, 0.25);
  transform: rotate(-2deg);
  animation: snap-up 0.5s var(--ease-out);
}

.door-list-head {
  margin: 0 0 10px;
  font: 800 13px / 1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--velvet);
}

.door-list ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.door-list li {
  position: relative;
  height: var(--row-h);
  border-bottom: 1px solid rgba(42, 36, 32, 0.14);
}

.door-list li i {
  position: absolute;
  left: 0;
  bottom: 11px;
  width: var(--w);
  height: 7px;
  border-radius: 4px;
  background: repeating-linear-gradient(100deg, rgba(42, 36, 32, 0.42) 0 9px, transparent 9px 13px);
  transition: opacity 0.3s;
}

.door-list-you span {
  position: absolute;
  left: 0;
  bottom: 4px;
  font: 400 28px / 1 var(--hand);
  color: #1f1a17;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.4s,
    transform 0.4s;
}

.door-list-you.found i {
  opacity: 0;
}

.door-list-you.found span {
  opacity: 1;
  transform: none;
}

.door-list-you::after {
  content: '';
  position: absolute;
  left: -34px;
  bottom: 12px;
  width: 10px;
  height: 20px;
  border-right: 4px solid var(--velvet);
  border-bottom: 4px solid var(--velvet);
  transform: rotate(40deg) scale(0);
  transform-origin: bottom left;
  transition: transform 0.35s 0.25s var(--ease-out);
}

.door-list-you.found {
  background: linear-gradient(90deg, rgba(255, 214, 138, 0.45), transparent 80%);
}

.door-list-you.found::after {
  transform: rotate(40deg) scale(1);
}

.door-list-pen {
  --row: 0;
  position: absolute;
  left: 18px;
  top: calc(22px + 23px + var(--row) * var(--row-h));
  width: 22px;
  height: 6px;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, var(--gold), var(--bulb));
  box-shadow: 0 0 10px rgba(255, 214, 138, 0.6);
  transition: top 0.3s var(--ease-out);
}

.door-panel {
  width: min(56vmin, 480px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid var(--gold);
  outline: 1px solid var(--gold-hair);
  outline-offset: -10px;
  background: #0b0a10;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(226, 179, 92, 0.25);
  animation: panel-in 0.35s var(--ease-out);
}

.door-polaroid {
  margin: 0;
  padding: 14px 14px 44px;
  background: #f7f3ea;
  color: #2a2420;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
  transform: rotate(-4deg);
  animation: snap-up 0.5s var(--ease-out);
}

.door-polaroid img {
  display: block;
  width: min(48vmin, 360px);
  aspect-ratio: 1;
  object-fit: cover;
  background: #ddd;
}

.door-polaroid figcaption {
  margin-top: 14px;
  text-align: center;
  font: italic 400 22px / 1 var(--serif);
}

.door-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.door-confetti i {
  position: absolute;
  top: -4vh;
  left: var(--x);
  width: 10px;
  height: 16px;
  background: hsl(var(--hue) 90% 60%);
  animation: confetti-fall 2.6s var(--delay) cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes snap-up {
  from {
    opacity: 0;
    transform: translateY(60px) rotate(-14deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: rotate(-4deg);
  }
}

@keyframes confetti-fall {
  to {
    transform: translateY(108vh) rotate(var(--spin));
    opacity: 0.9;
  }
}

@media (max-width: 720px) {
  .door-stage {
    place-items: start center;
    padding-top: 10vh;
  }
}

.book-form input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: var(--milk);
  color: var(--letter);
  font: 400 16px / 1 var(--serif);
}

.book-form input::placeholder {
  color: #6b6458;
}

.book-form .ticket {
  min-height: 48px;
}

.book-note {
  margin-top: 12px;
  font: italic 400 14px / 1.5 var(--serif);
  color: var(--milk-soft);
}

.book-thanks {
  min-height: 1.5em;
  margin-top: 10px;
  font: italic 400 16px / 1.5 var(--serif);
  color: var(--bulb);
}

/* A small transport overlays the theater; the palace's actual screen stays visible. */
.sheet.cinema {
  position: fixed;
  inset: 60px 0 0;
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  transform: none;
  overflow: visible;
  animation: none;
  background: transparent;
  border: 0;
  outline: 0;
  box-shadow: none;
}
.cinema-head {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: max(16px, calc((100% - 856px) / 2));
  right: max(16px, calc((100% - 856px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-shadow: 0 1px 8px #000;
}
.cinema-title {
  margin: 0;
  font: 800 16px/1.2 var(--display);
  text-transform: uppercase;
}
.cinema-note {
  margin: 4px 0 0;
  font: 500 10px/1.3 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.cinema .sheet-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  float: none;
  margin: 0;
  background: rgba(0, 0, 0, 0.4);
}
.cinema .player-controls {
  width: min(880px, 100%);
  margin: auto;
}
.cinema-stage {
  position: absolute;
  inset: 0;
}
/* Only hidden while the video supplies the WebGL texture. */
.cinema-video {
  position: absolute;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}
.cinema.player-expanded .cinema-video,
.no-world .cinema-video {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  background: #000;
}
.cinema.player-expanded .cinema-head {
  top: max(12px, env(safe-area-inset-top));
}
body[data-place='cinema'] .bill,
body[data-place='program'] .bill {
  display: none;
}

/* ---- The program: every poem as a playbill line ---- */

.program {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(12, 8, 24, 0.95);
}

.program-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 64px) 20px 140px;
}

.program-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 16px;
  align-items: end;
}

.program-title {
  font: 800 clamp(36px, 7vw, 68px) / 0.98 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.program-head .sheet-close {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  align-self: start;
}

.program-totals {
  grid-column: 1 / -1;
  font: 700 13px / 1.4 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bulb);
}

.program-totals:empty {
  display: none;
}

.program-filter {
  grid-column: 1 / -1;
  height: 48px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 3px;
  background: #141018;
  color: var(--milk);
  font: 400 16px / 1 var(--serif);
}

.program-filter::placeholder {
  color: rgba(246, 241, 230, 0.66);
}

.program-list {
  list-style: none;
  padding: 0;
  margin-top: 28px;
}

.program-list a {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--gold-hair);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.program-list a:hover {
  background: rgba(255, 69, 0, 0.09);
}

/* Each cover is a one-sheet (2:3), shown whole as a little poster so its painted title reads. */
.program-list img,
.program-sigil {
  width: 64px;
  height: 96px;
  border-radius: 2px;
  object-fit: cover;
}

.program-list img {
  outline: 1px solid var(--gold-hair);
  outline-offset: 2px;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.9);
}

.program-sigil {
  display: grid;
  place-items: center;
  background: var(--velvet-fold);
  color: var(--gold);
  font-size: 24px;
}

.program-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: baseline;
}

.program-number {
  font: 700 14px / 1 var(--display);
  color: #ff7a45;
  font-variant-numeric: tabular-nums;
}

.program-title {
  margin: 0;
}

.program-list .program-title {
  font: 700 20px / 1.15 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.program-meta {
  grid-column: 2;
  font: italic 400 14px / 1.4 var(--serif);
  color: var(--milk-soft);
}

.program-empty {
  padding: 24px 0;
  font: italic 400 17px / 1.5 var(--serif);
  color: var(--milk-soft);
}

.stage-door {
  margin-top: 72px;
  text-align: center;
}

.follow {
  font: 700 13px / 1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.follow-sign {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font: 500 32px / 1 var(--hand);
  rotate: -2deg;
}

.follow-sign a {
  text-decoration: none;
}

.bell {
  width: 26px;
  height: 26px;
  color: var(--bulb);
  transform-origin: 50% 10%;
  animation: ring 2.6s ease-in-out 1s 2;
}

@keyframes ring {
  0%,
  40%,
  100% {
    rotate: 0deg;
  }
  10%,
  30% {
    rotate: 16deg;
  }
  20% {
    rotate: -16deg;
  }
}

.door-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  list-style: none;
  padding: 0;
  margin-top: 28px;
}

.door-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font: 600 14px / 1 var(--display);
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--milk-soft);
}

.door-links a:hover {
  color: var(--gold);
}

.door-fine {
  margin-top: 18px;
  font: italic 400 14px / 1.5 var(--serif);
  color: rgba(246, 241, 230, 0.66);
}

.stubs-door {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  vertical-align: middle;
  color: rgba(246, 241, 230, 0.44);
  text-decoration: none;
  border-radius: 999px;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.stubs-door svg {
  width: 14px;
  height: 14px;
}

.stubs-door:hover,
.stubs-door:focus-visible {
  color: var(--gold);
  background: rgba(226, 179, 92, 0.12);
}

/* ---- Where the palace is dark (no WebGL): the program is the page ---- */

.no-world .bill .enter,
.no-world #programClose {
  display: none;
}

.no-world .program:not([hidden]),
.no-world[data-place='street'] .program {
  position: static;
  background: radial-gradient(120% 60% at 50% 0%, #2a1c55, var(--night-deep) 70%);
  min-height: 100dvh;
}

/* ---- Phones ---- */

@media (max-width: 600px) {
  .bill {
    left: var(--gutter);
    right: var(--gutter);
    transform: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .bill .enter {
    grid-column: 1 / -1;
  }

  .bill .tile {
    padding: 0 4px;
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  body[data-place='street'] .plaque {
    bottom: calc(var(--safe-bottom) + 112px);
  }

  .reader {
    padding: 0;
  }

  .reader-sheet {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    padding-bottom: calc(var(--safe-bottom) + 24px);
  }

  .reader-close {
    top: var(--safe-top);
    margin-right: -10px;
  }

  .poem-text {
    font-size: 18px;
    line-height: 1.68;
  }

  .sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 64dvh;
    transform: none;
    padding: 24px 20px calc(var(--safe-bottom) + 12px);
    border-width: 1px 0 0;
    outline: 0;
  }

  body[data-place='book'] .bill,
  body[data-place='cinema'] .bill {
    display: none;
  }

  .karaoke-tools .k-group {
    flex: 1 1 auto;
  }
}

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

  .curtain-up .curtain-half.left,
  .curtain-up .curtain-half.right {
    transform: none;
    opacity: 0;
  }
}

/* A phone on its side: the friends step behind the glass, framing the screen from its edges, so the
   words are never covered. */
@media (max-height: 520px) {
  .k-friends {
    z-index: 0;
    height: 96px;
  }
}

/* A phone on its side, during the introduction: the clock folds into one slim line. */
@media (max-height: 520px) {
  .k-rest[data-intro='yes'] {
    top: 2%;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 12px;
  }

  .k-rest[data-intro='yes'] .k-rest-num {
    font-size: 24px;
  }

  .k-rest[data-intro='yes'] .k-rest-sub {
    margin-top: 0;
    font-size: 12px;
  }

  .k-rest[data-intro='yes'] .k-rest-bar {
    flex-basis: 100%;
    height: 3px;
    margin-top: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door-scan-ring,
  .door-scan-label {
    animation: none;
  }
}
