.stage { position: fixed; inset: 0; z-index: -1; display: none; overflow: hidden; }
.js:not(.reading) .stage { display: block; }

.mood { position: absolute; inset: 0; opacity: 0; transition: opacity 1.8s ease; }
.mood.on { opacity: 1; }
.mood-tag { background: linear-gradient(180deg, #5d7aa0, #d9a95a 62%, #7a5a22); }
.mood-abend { background: linear-gradient(180deg, #2b1b44, #b5482f 62%, #e08a3c); }
.mood-haus { background: linear-gradient(180deg, #1c100a, #3a2012); }
.mood-sturm { background: linear-gradient(180deg, #05070f, #141b2b); }
.mood-stille { background: linear-gradient(180deg, #0c0a0c, #1c1410); }
.mood-nacht { background: linear-gradient(180deg, #070b1c, #141c33); }
.mood-mond { background: linear-gradient(180deg, #0a1230, #1a2a55); }
.mood-morgen { background: linear-gradient(180deg, #7d8796, #c8b48a 62%, #5b4a2b); }
.mood-ahorn { background: linear-gradient(180deg, #6d7f95, #b5683a 62%, #5e2a18); }
.mood-winter { background: linear-gradient(180deg, #0d1424, #26324d 62%, #6f7c96); }
.mood-scheune { background: linear-gradient(180deg, #1e140b, #4a3218 62%, #6e4f26); }
.mood-wald { background: linear-gradient(180deg, #0f2219, #1f3a26 62%, #2b4422); }
.mood-neumond { background: linear-gradient(180deg, #020309, #080b16); }
.mood-bestie { background: linear-gradient(180deg, #0a0505, #2a0d08 62%, #3a140a); }
.mood-macht { background: linear-gradient(180deg, #1a0000, #4a0606 62%, #120000); }

#scene { position: absolute; inset: 0; width: 100%; height: 100%; }

.flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, rgba(120, 180, 255, 0.85), rgba(79, 141, 255, 0.15) 70%); opacity: 0; pointer-events: none; }
.flash.red { background: radial-gradient(circle at 50% 55%, rgba(255, 90, 70, 0.85), rgba(255, 59, 48, 0.15) 70%); }
.flash.go { animation: flash 1.4s ease-out; }
@keyframes flash { 12% { opacity: 1; } 100% { opacity: 0; } }

.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 5; display: none; }
.js:not(.reading) .progress { display: block; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold), var(--red)); }

.controls { position: fixed; right: 16px; bottom: 16px; z-index: 5; display: none; gap: 0.5rem; }
.js .controls { display: flex; }
.controls button {
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  background: rgba(7, 11, 28, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.controls button[aria-pressed="true"] { background: var(--gold); color: var(--night); }
.reading #toggle-sound { display: none; }

.reader {
  max-width: 42rem;
  margin: 1rem auto 5rem;
  padding: 2.5rem clamp(16px, 5vw, 48px);
  background: rgba(7, 11, 28, 0.84);
  box-shadow: 0 0 60px 30px rgba(7, 11, 28, 0.5);
}
.reading .reader, html:not(.js) .reader { background: transparent; box-shadow: none; }
.reader-head h1 { font-size: clamp(2.25rem, 6vw, 3.25rem); }
.hint { color: var(--muted); font-style: italic; margin: 0.75rem 0 2.5rem; }
.reading .hint { display: none; }
.resume { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0 0 2.5rem; }
.resume[hidden] { display: none; }
.reader > p { margin: 0 0 1.1em; }
.reader > p:focus { outline: none; }
.reader > p.beat { margin: 2.25rem 0; font-size: 1.25rem; text-align: center; color: var(--gold); }
.reader > p.break { margin-top: 4.5rem; }
.reader > p.break::before { content: "✦"; display: block; margin-bottom: 2.5rem; color: var(--gold-deep); text-align: center; }
/* Each section of the prologue opens with its own heading. */
.reader > h2.part { margin: 4.5rem 0 2rem; text-align: center; color: var(--gold); font-size: clamp(1.5rem, 4vw, 2rem); }
.reader > h2.part::before { content: "✦"; display: block; margin-bottom: 1.5rem; font-size: 1rem; color: var(--gold-deep); }
.reader-head + h2.part { margin-top: 0; }
.reader-head + h2.part::before { content: none; }
.reading .reader > p.beat { font-size: inherit; text-align: inherit; color: inherit; margin: 0 0 1.1em; }

/* Text after a closed gate stays hidden. Without JavaScript or in reading mode nothing is ever locked. */
.gate { display: none; }
.js:not(.reading) .gate { display: block; margin: 3rem 0; text-align: center; }
.js:not(.reading) .gate:not(.open) ~ * { display: none; }
.js:not(.reading) .gate.open .btn { display: none; }
.js:not(.reading) .gate.open:not(.gate-silk) { margin: 0; }
.reader button.btn { min-height: 44px; cursor: pointer; font: inherit; }

.basket { display: block; width: min(100%, 22rem); margin: 0 auto 1.5rem; }
.basket-silk { transition: transform 1.1s ease-in, opacity 1.1s ease-in; transform-box: fill-box; }
.basket-amulet { animation: amulet 3s ease-in-out infinite; }
.lifted .basket-silk { transform: translate(40px, -60px) rotate(8deg); opacity: 0; }
@keyframes amulet { 50% { filter: drop-shadow(0 0 7px #fff); } }

.js .foot-row { padding-bottom: 5rem; }
.reader-end { margin-top: 3.5rem; text-align: center; }
.reader-end .rule { padding: 0; margin-bottom: 2rem; }
.reader-end h2 { margin-top: 0; }
.reader-end .next { color: var(--gold); font-style: italic; }

@media (max-width: 480px) {
  .controls { right: 16px; left: 16px; justify-content: flex-end; }
  .reader { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mood { transition: none; }
  .basket-silk { transition: none; }
  .basket-amulet { animation: none; }
  .flash.go { animation: none; }
}
