/* ==========================================================================
   BOO-BASKET · Stil
   ========================================================================== */

:root {
  --ink: #07060a;
  --night: #0e0b14;
  --plum: #1b1324;
  --plum-2: #2a1d38;
  --wine: #8e1b2a;
  --wine-deep: #4a0912;
  --gold: #c9a45c;
  --gold-hi: #ecd08f;
  --gold-lo: #8a6a2e;
  --bone: #ebe3d2;
  --bone-dim: #b9b0a0;
  --muted: #8f8698;
  --pumpkin: #d8752a;
  --ink-blue: #1d2a5a;
  --paper: #dccaa4;
  --paper-ink: #2b1d10;

  --f-black: "UnifrakturMaguntia", "Old English Text MT", serif;
  --f-caps: "Cinzel", "Trajan Pro", serif;
  --f-body: "Cormorant Garamond", "Garamond", Georgia, serif;
  --f-script: "Pinyon Script", "Snell Roundhand", cursive;
  --f-hand: "Caveat", "Bradley Hand", cursive;
  --f-type: "Special Elite", "Courier New", monospace;
  --f-pixel: "VT323", "Courier New", monospace;

  --ease-out: cubic-bezier(.2, .75, .25, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);

  --paper-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .22  0 0 0 0 .1  0 0 0 .42 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='8'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.is-gate, body.ch-open { overflow: hidden; }
body.ch-covered .scene, body.ch-covered .sky, body.ch-covered #fx-back, body.ch-covered .cursor-glow { visibility: hidden; }
body.ch-covered .scene *, body.ch-covered .sky * { animation-play-state: paused !important; }

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--wine); color: var(--bone); }

.sr-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 100; background: var(--ink); font-family: var(--f-caps); color: var(--gold); text-align: center; padding: 24px; }

/* ---------- Typo-Bausteine ----------------------------------------------- */
.eyebrow {
  margin: 0;
  font-family: var(--f-caps);
  font-size: .74rem;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .9;
}

.gold-text, .gate__name, .altar__title, .chapter__title {
  background: linear-gradient(180deg, #fff1c8 0%, var(--gold-hi) 30%, var(--gold) 62%, var(--gold-lo) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(201, 164, 92, .28)) drop-shadow(0 2px 0 rgba(0, 0, 0, .6));
}

.ornament { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px auto 26px; }
.ornament span { width: 70px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament span:last-child { transform: scaleX(-1); }
.ornament svg { width: 34px; height: 17px; }

/* ---------- Buttons ------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  padding: .95em 1.7em;
  border-radius: 999px;
  border: 1px solid rgba(255, 240, 200, .55);
  font-family: var(--f-caps); font-weight: 600; font-size: .8rem;
  letter-spacing: .2em; text-transform: uppercase;
  color: #1c1307;
  background: linear-gradient(180deg, #f6e0a2 0%, var(--gold) 55%, #a8843f 100%);
  box-shadow: 0 0 0 4px rgba(201, 164, 92, .1), 0 12px 34px rgba(201, 164, 92, .22), inset 0 1px 0 rgba(255, 255, 255, .55);
  overflow: hidden;
  transition: transform .3s var(--ease-out), box-shadow .3s, filter .3s;
}
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .9s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(201, 164, 92, .14), 0 18px 44px rgba(201, 164, 92, .32), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: default; transform: none; }
.btn svg { width: 1.1em; height: 1.1em; fill: currentColor; }

.btn--ghost {
  color: var(--gold-hi);
  background: rgba(20, 14, 26, .55);
  border-color: rgba(201, 164, 92, .5);
  box-shadow: none;
}
.btn--ghost:hover { box-shadow: 0 0 0 4px rgba(201, 164, 92, .1), 0 0 30px rgba(201, 164, 92, .15); }
.btn--small { padding: .7em 1.3em; font-size: .7rem; }

/* ==========================================================================
   HIMMEL, MOND, NEBEL
   ========================================================================== */
#fx-back, #fx-front { position: fixed; inset: 0; pointer-events: none; }
#fx-back { z-index: 1; }
#fx-front { z-index: 55; }

.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 72% -5%, rgba(70, 46, 110, .55), transparent 65%),
    radial-gradient(ellipse 70% 50% at 10% 110%, rgba(90, 20, 40, .28), transparent 70%),
    linear-gradient(180deg, #120d1f 0%, #0b0912 45%, #060509 100%);
}
.sky::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; }

.moon {
  position: absolute;
  top: clamp(40px, 9vh, 110px);
  right: clamp(24px, 11vw, 200px);
  width: clamp(70px, 9vw, 130px); aspect-ratio: 1;
  will-change: transform;
}
.moon__glow {
  position: absolute; inset: -160%;
  background: radial-gradient(circle, rgba(246, 236, 210, .22) 0%, rgba(160, 130, 200, .08) 30%, transparent 60%);
  animation: moonPulse 9s ease-in-out infinite;
}
.moon__disc {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 34%, rgba(120, 110, 90, .35) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 58%, rgba(120, 110, 90, .3) 0 13%, transparent 14%),
    radial-gradient(circle at 46% 74%, rgba(120, 110, 90, .25) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 28%, rgba(120, 110, 90, .2) 0 5%, transparent 6%),
    radial-gradient(circle at 38% 36%, #fbf5e2 0%, #e7dcbd 55%, #b8aa86 100%);
  box-shadow: 0 0 40px rgba(246, 236, 210, .35), inset -10px -8px 22px rgba(60, 50, 40, .45);
}
@keyframes moonPulse { 50% { opacity: .7; transform: scale(1.06); } }

.fog {
  position: absolute; left: -50%; width: 200%;
  background-repeat: repeat-x;
  will-change: transform;
}
.fog--1 {
  bottom: -4vh; height: 32vh; opacity: .9;
  background-image: radial-gradient(ellipse 50% 50% at 50% 60%, rgba(150, 130, 180, .16), transparent 70%);
  background-size: 40% 100%;
  animation: fogDrift 80s linear infinite;
}
.fog--2 {
  bottom: 6vh; height: 24vh; opacity: .7;
  background-image: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(190, 170, 210, .1), transparent 70%);
  background-size: 28% 100%;
  animation: fogDrift 55s linear infinite reverse;
}
.fog--3 {
  top: 30vh; height: 40vh; opacity: .45;
  background-image: radial-gradient(ellipse 50% 40% at 50% 50%, rgba(120, 100, 160, .1), transparent 70%);
  background-size: 50% 100%;
  animation: fogDrift 120s linear infinite;
}
@keyframes fogDrift { to { transform: translateX(50%); } }

/* ==========================================================================
   DAS TOR
   ========================================================================== */
.gate {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  overflow: hidden;
  perspective: 1500px;
  transition: opacity 1.4s ease 2.1s, transform 3.2s var(--ease-io) .5s;
}
.gate.is-opening { opacity: 0; transform: scale(1.35); pointer-events: none; }

.gate__glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 34% 48% at 50% 46%, rgba(255, 214, 150, .14), transparent 70%),
    radial-gradient(ellipse 52% 62% at 50% 46%, rgba(130, 80, 190, .28), transparent 72%);
  animation: glowBreathe 7s ease-in-out infinite;
  transition: opacity 1.6s, transform 2.4s var(--ease-io);
}
.gate.is-opening .gate__glow {
  background:
    radial-gradient(ellipse 30% 46% at 50% 46%, rgba(255, 236, 190, .95), rgba(255, 190, 110, .4) 40%, transparent 72%),
    radial-gradient(ellipse 60% 70% at 50% 46%, rgba(150, 90, 210, .5), transparent 75%);
  transform: scale(1.6);
  animation: none;
}
@keyframes glowBreathe { 50% { opacity: .75; } }

.gate__doors {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: min(100vw, 86vh);
  display: flex;
  transform: translateX(-50%);
  transform-style: preserve-3d;
}
.gate__door {
  flex: 1; height: 100%;
  transition: transform 2.6s cubic-bezier(.6, .02, .25, 1) .35s;
  will-change: transform;
}
.gate__door svg { display: block; width: 100%; height: 100%; }
.gate__door--l { transform-origin: left center; }
.gate__door--r { transform-origin: right center; }
.gate__door--r svg { transform: scaleX(-1); }
.gate.is-opening .gate__door--l { transform: rotateY(98deg); }
.gate.is-opening .gate__door--r { transform: rotateY(-98deg); }

.gate__pillar {
  position: absolute; bottom: 0;
  width: 96px; height: 80vh;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .6), transparent 30%, transparent 70%, rgba(0, 0, 0, .7)),
    repeating-linear-gradient(180deg, transparent 0 58px, rgba(0, 0, 0, .55) 58px 60px),
    linear-gradient(180deg, #1d1922, #0c0a0f);
  box-shadow: 0 0 60px rgba(0, 0, 0, .9);
}
.gate__pillar::before {
  content: ""; position: absolute; left: -10px; right: -10px; top: -18px; height: 22px;
  background: linear-gradient(180deg, #2a2530, #121016); border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(236, 208, 143, .2);
}
.gate__pillar--l { left: calc(50% - min(50vw, 43vh) - 96px); }
.gate__pillar--r { right: calc(50% - min(50vw, 43vh) - 96px); }

.candle {
  position: absolute; left: 50%; top: -70px;
  width: 16px; height: 50px; margin-left: -8px;
  background: linear-gradient(90deg, #d8cfbd, #f3ecdd 40%, #a89f8e);
  border-radius: 3px 3px 2px 2px;
}
.candle::before { content: ""; position: absolute; left: 7px; top: -6px; width: 2px; height: 7px; background: #222; }
.candle i {
  position: absolute; left: 50%; top: -30px;
  width: 14px; height: 26px; margin-left: -7px;
  background: radial-gradient(ellipse at 50% 70%, #fff6dc 0 20%, #ffc861 45%, rgba(255, 120, 30, .0) 72%);
  border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
  filter: blur(.4px);
  animation: flame 1.6s ease-in-out infinite alternate;
  transform-origin: 50% 90%;
}
.candle i::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 160px; height: 160px; margin: -80px 0 0 -80px;
  background: radial-gradient(circle, rgba(255, 190, 110, .22), transparent 60%);
  border-radius: 50%;
}
@keyframes flame {
  0% { transform: scale(1, 1) rotate(-2deg); opacity: .95; }
  35% { transform: scale(.92, 1.08) rotate(2deg); }
  70% { transform: scale(1.04, .94) rotate(-1deg); opacity: 1; }
  100% { transform: scale(.96, 1.05) rotate(3deg); opacity: .9; }
}

.lantern {
  position: absolute; left: 0; top: 0; pointer-events: none;
  width: 400vmax; height: 400vmax; margin: -200vmax 0 0 -200vmax;
  background: radial-gradient(circle 340px at 50% 50%, transparent 0, rgba(3, 2, 6, .45) 65%, rgba(3, 2, 6, .72) 100%);
  transform: translate(50vw, 46vh);
  will-change: transform;
  transition: opacity 1s;
}
.gate.is-opening .lantern { opacity: 0; }

.gate__content {
  position: relative; z-index: 2;
  width: min(100% - 32px, 600px);
  padding: 48px 28px 40px;
  text-align: center;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(7, 6, 10, .92) 0%, rgba(7, 6, 10, .75) 55%, transparent 80%);
  transition: opacity .7s, transform .9s var(--ease-out), filter .7s;
}
.gate.is-opening .gate__content { opacity: 0; transform: translateY(-14px) scale(.97); filter: blur(8px); }

.gate__content > * { animation: rise 1.4s var(--ease-out) both; }
.gate__content > :nth-child(1) { animation-delay: .3s; }
.gate__content > :nth-child(2) { animation-delay: .5s; }
.gate__content > :nth-child(3) { animation-delay: .8s; }
.gate__content > :nth-child(4) { animation-delay: 1.05s; }
.gate__content > :nth-child(5) { animation-delay: 1.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.gate__name {
  margin: 10px 0 0;
  font-family: var(--f-black);
  font-weight: 400;
  font-size: clamp(2.9rem, 10.5vw, 5.8rem);
  line-height: 1.05;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

.gate__question {
  display: block;
  font-style: italic;
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  color: var(--bone);
  margin-bottom: 18px;
}
.gate.is-returning .gate__field input { display: none; }
.gate.is-returning .gate__field { justify-content: center; border: 0; }

.gate__field {
  display: flex; align-items: center; gap: 12px;
  max-width: 440px; margin: 0 auto;
  padding: 6px 6px 6px 18px;
  border: 1px solid rgba(201, 164, 92, .45);
  border-radius: 999px;
  background: rgba(14, 10, 18, .7);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, .6), 0 0 0 4px rgba(201, 164, 92, .05);
  transition: border-color .3s, box-shadow .3s;
}
.gate__field:focus-within { border-color: var(--gold-hi); box-shadow: inset 0 0 20px rgba(0, 0, 0, .6), 0 0 0 4px rgba(201, 164, 92, .12), 0 0 40px rgba(201, 164, 92, .15); }
.gate__field input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: var(--bone);
  font-family: var(--f-body); font-size: 1.25rem;
  padding: 8px 0;
}
.gate__field input::placeholder { color: rgba(235, 227, 210, .35); font-style: italic; }
.gate__field .btn { flex: none; padding: .9em 1.4em; }

.gate__msg { min-height: 1.6em; margin: 14px 0 0; font-style: italic; color: #e07a8b; }
.gate__form.is-wrong .gate__field { animation: shake .5s cubic-bezier(.36, .07, .19, .97); border-color: #b3263a; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* Willkommens-Popup nach der richtigen Antwort */
.gate.is-welcome .gate__content { opacity: 0; transform: scale(.96); filter: blur(6px); pointer-events: none; }
.welcome {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 50%, rgba(7, 6, 10, .75), rgba(7, 6, 10, .92));
  opacity: 0;
  transition: opacity .6s;
}
.welcome.is-on { opacity: 1; }
.welcome__card {
  position: relative;
  width: min(100%, 540px);
  padding: 44px clamp(22px, 6vw, 44px) 34px;
  text-align: center;
  border-radius: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(110, 70, 160, .35), transparent 70%),
    linear-gradient(180deg, #1c1426, #0d0a12);
  box-shadow:
    0 0 0 1px rgba(201, 164, 92, .55),
    0 0 0 6px #0b080e,
    0 0 0 7px rgba(201, 164, 92, .22),
    0 40px 90px rgba(0, 0, 0, .8),
    0 0 80px rgba(201, 164, 92, .12);
  transform: translateY(24px) scale(.94);
  transition: transform .8s cubic-bezier(.3, 1.35, .5, 1);
}
.welcome.is-on .welcome__card { transform: none; }
.welcome__bat { position: absolute; left: 50%; top: -15px; width: 60px; height: 30px; margin-left: -30px; color: var(--gold); filter: drop-shadow(0 0 10px rgba(201, 164, 92, .5)); }
.welcome__kicker { margin: 0 0 16px; font-family: var(--f-caps); font-size: .68rem; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); }
.welcome__text { margin: 0; font-style: italic; font-size: clamp(1.12rem, 3.6vw, 1.32rem); line-height: 1.6; color: var(--bone); }
.welcome .ornament { margin: 22px auto 24px; }
.welcome__card > * { opacity: 0; }
.welcome.is-on .welcome__card > * { animation: rise 1s var(--ease-out) both; }
.welcome.is-on .welcome__card > :nth-child(2) { animation-delay: .15s; }
.welcome.is-on .welcome__card > :nth-child(3) { animation-delay: .3s; }
.welcome.is-on .welcome__card > :nth-child(4) { animation-delay: .55s; }
.welcome.is-on .welcome__card > :nth-child(5) { animation-delay: .7s; }

.gate__foot {
  margin: 26px 0 0;
  font-family: var(--f-caps); font-size: .66rem; letter-spacing: .5em; text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   DER KORB · SZENE
   ========================================================================== */
.scene { position: relative; z-index: 2; min-height: 100vh; overflow-x: hidden; overflow-x: clip; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 64px;
  padding: env(safe-area-inset-top) clamp(16px, 3vw, 36px) 0;
  background: linear-gradient(180deg, rgba(7, 6, 10, .88), rgba(7, 6, 10, 0));
  opacity: 0; transform: translateY(-10px);
  transition: opacity 1s .6s, transform 1s var(--ease-out) .6s;
}
.scene.is-in .topbar { opacity: 1; transform: none; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-caps); font-size: .78rem; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-hi); }
.brand svg { width: 30px; height: 15px; color: var(--gold); }

.progress {
  display: flex; align-items: center; gap: 12px;
  padding: 5px 14px 5px 6px;
  border: 1px solid rgba(201, 164, 92, .3); border-radius: 999px;
  background: rgba(14, 10, 18, .6);
  font-family: var(--f-caps); font-size: .66rem; letter-spacing: .2em; color: var(--muted);
}
.progress__dots { display: flex; gap: 4px; }
.progress__dots i {
  position: relative;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(201, 164, 92, .22);
  background: rgba(10, 7, 13, .7);
  transition: border-color .5s, background .5s, box-shadow .5s;
}
.progress__dots svg {
  width: 17px; height: 17px;
  fill: none; stroke: rgba(201, 164, 92, .38); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .5s, filter .5s;
}
.progress__dots i.is-on { border-color: rgba(236, 208, 143, .75); background: radial-gradient(circle at 50% 35%, #3a2a48, #160f1d); box-shadow: 0 0 12px rgba(236, 208, 143, .35); }
.progress__dots i.is-on svg { stroke: var(--gold-hi); filter: drop-shadow(0 0 4px rgba(236, 208, 143, .7)); }
.progress__count { color: var(--gold-hi); min-width: 2.2em; text-align: right; }

.sound-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 1px solid rgba(201, 164, 92, .3); border-radius: 999px;
  background: rgba(14, 10, 18, .6);
  font-family: var(--f-caps); font-size: .62rem; letter-spacing: .24em; text-transform: uppercase; color: var(--bone-dim);
  transition: border-color .3s, color .3s;
}
.sound-toggle:hover { border-color: var(--gold); color: var(--gold-hi); }
.sound-toggle__bars { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.sound-toggle__bars i { width: 2px; height: 100%; background: var(--gold); transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.sound-toggle__bars i:nth-child(2) { animation-delay: -.3s; }
.sound-toggle__bars i:nth-child(3) { animation-delay: -.6s; }
.sound-toggle__bars i:nth-child(4) { animation-delay: -.15s; }
.sound-toggle.is-off .sound-toggle__bars i { animation: none; transform: scaleY(.2); background: var(--muted); }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.altar {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding: 96px 16px 150px;
}
@media (min-width: 920px) and (min-height: 700px) {
  .altar { padding: 78px 16px 40px; }
  .altar__title { font-size: clamp(2.8rem, 6.5vh, 4.4rem); margin: 4px 0 6px; }
  .altar__lead { font-size: 1.08rem; }
}

.altar__intro { max-width: 640px; text-align: center; }
.altar__intro > * { opacity: 0; }
.scene.is-in .altar__intro > * { animation: rise 1.3s var(--ease-out) both; }
.scene.is-in .altar__intro > :nth-child(2) { animation-delay: .15s; }
.scene.is-in .altar__intro > :nth-child(3) { animation-delay: .35s; }

.altar__title {
  margin: 8px 0 10px;
  font-family: var(--f-black); font-weight: 400;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  line-height: 1.05;
}
.altar__lead { margin: 0 auto; max-width: 520px; font-style: italic; font-size: clamp(1.05rem, 2.6vw, 1.2rem); color: var(--bone-dim); }

/* Bühne – Raster (Handy / kleine Fenster) */
.altar__stage {
  --bw: min(76vw, 300px);
  position: relative;
  width: 100%; max-width: 760px;
  margin-top: 40px;
  display: flex; flex-direction: column; align-items: center;
}

.runes {
  position: absolute; left: 50%;
  top: calc(var(--bw) * -0.32);
  width: calc(var(--bw) * 1.6);
  aspect-ratio: 1;
  transform: translateX(-50%);
  pointer-events: none;
}
.runes svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.runes__c { fill: none; stroke: rgba(201, 164, 92, .28); stroke-width: 1; stroke-dasharray: 1900; stroke-dashoffset: 1900; }
.runes__c--2 { stroke-dasharray: 2 7; stroke-dashoffset: 0; opacity: 0; }
.runes__c--3 { stroke: rgba(201, 164, 92, .14); }
.scene.is-in .runes__c { animation: drawCircle 3.4s var(--ease-io) .3s forwards; }
.scene.is-in .runes__c--2 { animation: fadeIn 2s ease 1.2s forwards; }
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
.runes__spin { animation: spin 160s linear infinite; will-change: transform; }
.runes__text { font-family: var(--f-caps); font-size: 15px; letter-spacing: 7px; fill: rgba(201, 164, 92, .3); opacity: 0; }
.scene.is-in .runes__text { animation: fadeIn 2.4s ease 1.6s forwards; }
.runes__stars path { fill: rgba(236, 208, 143, .55); }
@keyframes spin { to { transform: rotate(360deg); } }

.basket {
  position: relative; z-index: 2;
  width: var(--bw);
  padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0;
}
.scene.is-in .basket { animation: basketIn 1.4s var(--ease-out) .4s both; }
@keyframes basketIn {
  from { opacity: 0; transform: translateY(-40px) scale(.85); filter: blur(8px); }
  60% { opacity: 1; transform: translateY(6px) scale(1.02); filter: none; }
  to { opacity: 1; transform: none; }
}
.basket__svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 26px 30px rgba(0, 0, 0, .7)); transition: transform .5s var(--ease-out); }
.basket__halo {
  position: absolute; left: 50%; top: 48%; width: 130%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(130, 80, 190, .3), rgba(201, 164, 92, .08) 40%, transparent 65%);
  border-radius: 50%;
  animation: glowBreathe 6s ease-in-out infinite;
  pointer-events: none;
}
.basket__label {
  margin-top: 4px;
  font-family: var(--f-caps); font-size: .72rem; letter-spacing: .32em; text-transform: uppercase;
  color: var(--muted);
  transition: color .5s;
}
.basket:hover .basket__svg { transform: translateY(-4px); }
.basket__env { transition: filter .8s, transform .8s; }
.basket__flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame 1.4s ease-in-out infinite alternate; }
.padlock__count { font-family: var(--f-caps); font-weight: 700; font-size: 14px; fill: #3a2a0c; letter-spacing: 1px; }

.basket.is-rattle .chains { animation: rattle .5s ease; transform-box: view-box; transform-origin: 160px 198px; }
@keyframes rattle { 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1deg); } }
.basket.is-breaking .chains { animation: rattle .35s ease 2; transform-box: view-box; transform-origin: 160px 198px; }

.basket.is-unlocked .chains { display: none; }
.basket.is-unlocked .basket__env { filter: drop-shadow(0 0 14px rgba(255, 214, 150, .8)); animation: envFloat 3.6s ease-in-out infinite; }
.basket.is-unlocked .basket__label { color: var(--gold-hi); animation: labelGlow 2.4s ease-in-out infinite; }
.basket.is-unlocked .basket__halo { background: radial-gradient(circle, rgba(255, 214, 150, .32), rgba(201, 164, 92, .1) 40%, transparent 65%); }
@keyframes envFloat { 50% { transform: translateY(-10px); } }
@keyframes labelGlow { 50% { text-shadow: 0 0 14px rgba(236, 208, 143, .8); } }

/* Reliquien – Raster */
.relics {
  position: relative; z-index: 3;
  width: 100%;
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 620px) { .relics { grid-template-columns: repeat(6, minmax(0, 1fr)); } .relic { grid-column: span 2; } .relic:nth-child(4) { grid-column: 2 / span 2; } }

.relic__btn {
  position: relative;
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 8px 18px;
  border: 1px solid rgba(201, 164, 92, .16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30, 21, 40, .88), rgba(12, 9, 16, .9));
  text-align: center;
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .35s var(--ease-out), border-color .4s, background .4s;
}
.relic__btn:hover { border-color: rgba(201, 164, 92, .45); }

.relic__medal {
  position: relative;
  width: clamp(78px, 22vw, 104px); aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, #33233f 0%, #160f1d 58%, #0b080e 100%);
  box-shadow:
    0 0 0 1px rgba(201, 164, 92, .6),
    0 0 0 6px rgba(10, 7, 13, .95),
    0 0 0 7px rgba(201, 164, 92, .28),
    0 18px 40px rgba(0, 0, 0, .6),
    inset 0 0 26px rgba(0, 0, 0, .85);
  transition: box-shadow .5s, transform .5s var(--ease-out);
  margin-bottom: 10px;
}
.relic__ring {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 1px dashed rgba(201, 164, 92, .3);
  animation: spin 40s linear infinite paused;
  transition: border-color .4s, inset .5s var(--ease-out);
}
.relic__icon {
  width: 54%; height: 54%;
  fill: none; stroke: var(--gold-hi); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(236, 208, 143, .35));
  transition: transform .5s var(--ease-out), filter .4s;
}
.relic__seal {
  position: absolute; right: -4px; top: -4px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 38% 32%, #d0425a, var(--wine) 60%, var(--wine-deep));
  box-shadow: 0 3px 8px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(74, 9, 18, .6);
  transform: scale(0) rotate(-40deg);
  transition: transform .6s cubic-bezier(.3, 1.6, .5, 1);
}
.relic__seal svg { width: 16px; height: 16px; fill: none; stroke: #ffd9df; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.relic.is-opened .relic__seal { transform: scale(1) rotate(0); }

.relic__num { font-family: var(--f-caps); font-size: .66rem; letter-spacing: .4em; color: var(--gold); }
.relic__title { font-family: var(--f-caps); font-weight: 600; font-size: clamp(.82rem, 2.6vw, .98rem); letter-spacing: .1em; color: var(--bone); }
.relic__sub { font-style: italic; font-size: .95rem; line-height: 1.25; color: var(--muted); }

.relic__btn:hover .relic__medal, .relic__btn:focus-visible .relic__medal {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px rgba(236, 208, 143, .9),
    0 0 0 6px rgba(10, 7, 13, .95),
    0 0 0 7px rgba(236, 208, 143, .5),
    0 0 46px rgba(201, 164, 92, .38),
    0 24px 50px rgba(0, 0, 0, .7),
    inset 0 0 26px rgba(0, 0, 0, .85);
}
.relic__btn:hover .relic__ring { border-color: rgba(236, 208, 143, .65); inset: -18px; animation-play-state: running; }
.relic__btn:hover .relic__icon { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(236, 208, 143, .7)); }

/* Bühne – Ring (Desktop) */
.altar__stage.is-ring {
  --size: min(94vw, clamp(520px, calc(100vh - 330px), 760px));
  width: var(--size); height: var(--size); max-width: none;
  margin-top: 6px;
  display: block;
}
.is-ring .runes { inset: 0; top: 0; left: 0; width: 100%; height: 100%; transform: none; }
.is-ring .basket {
  position: absolute; left: 50%; top: 50%;
  width: 40%;
  margin: 0;
  transform: translate(-50%, -54%);
}
.scene.is-in .is-ring .basket { animation-name: basketInRing; }
@keyframes basketInRing {
  from { opacity: 0; transform: translate(-50%, calc(-54% - 40px)) scale(.85); filter: blur(8px); }
  60% { opacity: 1; transform: translate(-50%, calc(-54% + 6px)) scale(1.02); filter: none; }
  to { opacity: 1; transform: translate(-50%, -54%); }
}
.is-ring .relics { position: absolute; inset: 0; margin: 0; display: block; pointer-events: none; }
.is-ring .relic {
  position: absolute; left: 50%; top: 50%;
  width: 26%;
  transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 0px)));
  pointer-events: auto;
}
.is-ring .relic__btn { border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 8px 0; }
.is-ring .relic__num, .is-ring .relic__title, .is-ring .relic__sub { text-shadow: 0 0 6px #07060a, 0 0 14px #07060a, 0 0 24px #07060a; }
.is-ring .relic__medal { width: min(72%, 122px); }
.is-ring .relic__title { white-space: nowrap; }

/* ==========================================================================
   FRIEDHOF
   ========================================================================== */
.graveyard {
  position: fixed; left: -2%; right: -2%; bottom: 0; z-index: 1;
  height: clamp(150px, 26vh, 300px);
  pointer-events: none;
  will-change: transform;
  opacity: 0;
}
.scene.is-in .graveyard { animation: fadeIn 2.4s ease .2s forwards; }
.graveyard svg { width: 100%; height: 100%; display: block; }
.graveyard::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60%;
  background: linear-gradient(180deg, transparent, rgba(7, 6, 10, .85));
}
.gy__hill { fill: #0f0b15; }
.gy__far { fill: #0b0810; }
.gy__tree { stroke: #07050a; }
.gy__near { fill: #060409; }
.gy__fence { fill: #040306; }
.gy__ground { fill: #030204; }

/* ==========================================================================
   KAPITEL-OVERLAY
   ========================================================================== */
.chapter {
  position: fixed; inset: 0; z-index: 50;
  clip-path: circle(0px at var(--ox, 50%) var(--oy, 50%));
  transition: clip-path .9s var(--ease-io);
}
.chapter.is-open { clip-path: circle(150vmax at var(--ox, 50%) var(--oy, 50%)); }

.chapter__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(90, 56, 130, .45), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 115%, rgba(110, 20, 40, .3), transparent 70%),
    #09070d;
}
.chapter__bg::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; }

.chapter__scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chapter__head { position: relative; text-align: center; padding: calc(78px + env(safe-area-inset-top)) 16px 10px; }
.chapter__close {
  position: fixed; z-index: 5;
  top: calc(14px + env(safe-area-inset-top)); left: clamp(12px, 3vw, 32px);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(201, 164, 92, .35); border-radius: 999px;
  background: rgba(12, 9, 16, .94);
  font-family: var(--f-caps); font-size: .66rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-hi);
  transition: border-color .3s, transform .3s var(--ease-out);
}
.chapter__close:hover { border-color: var(--gold-hi); transform: translateX(-3px); }
.chapter__close span { font-size: 1rem; line-height: 1; }

.chapter__num, .chapter__title, .chapter__sub { opacity: 0; }
.chapter.is-open .chapter__num { animation: rise 1s var(--ease-out) .3s both; }
.chapter.is-open .chapter__title { animation: rise 1.1s var(--ease-out) .4s both; }
.chapter.is-open .chapter__sub { animation: rise 1s var(--ease-out) .55s both; }
.chapter__num { margin: 0; font-family: var(--f-caps); font-size: .72rem; letter-spacing: .45em; text-transform: uppercase; color: var(--gold); }
.chapter__title { margin: 6px 0 2px; font-family: var(--f-black); font-weight: 400; font-size: clamp(2.6rem, 8vw, 4.4rem); line-height: 1.05; }
.chapter__sub { margin: 0; font-style: italic; color: var(--muted); font-size: 1.1rem; }

.chapter__body { position: relative; max-width: 1080px; margin: 0 auto; padding: 26px 16px calc(120px + env(safe-area-inset-bottom)); }

.rv { opacity: 0; }
.chapter.is-open .rv { animation: rv 1s var(--ease-out) both; animation-delay: .6s; }
.chapter.is-open .rv:nth-child(2) { animation-delay: .75s; }
.chapter.is-open .rv:nth-child(3) { animation-delay: .9s; }
.chapter.is-open .rv:nth-child(4) { animation-delay: 1.05s; }
.chapter.is-open .rv:nth-child(5) { animation-delay: 1.2s; }
.chapter.is-open .rv:nth-child(6) { animation-delay: 1.35s; }
@keyframes rv { from { opacity: 0; transform: translateY(28px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.ch-lead { max-width: 620px; margin: 0 auto 34px; text-align: center; font-style: italic; font-size: clamp(1.1rem, 2.8vw, 1.3rem); color: var(--bone-dim); }

/* ---------- Fotos --------------------------------------------------------- */
.ph { position: relative; aspect-ratio: 1; overflow: hidden; background: #15111b; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s; }
.ph--loaded img { opacity: 1; }
.ph--empty {
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 70% 20%, #2c2140, #120e18 70%);
}
.ph--empty svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph__label {
  position: absolute; left: 0; right: 0; top: 9%;
  text-align: center;
  font-family: var(--f-caps); font-size: .6rem; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(235, 227, 210, .5);
  padding: 0 10px;
}

/* ==========================================================================
   I · AKTE
   ========================================================================== */
.dossier {
  position: relative;
  max-width: 780px; margin: 0 auto;
  padding: clamp(26px, 6vw, 60px) clamp(20px, 6vw, 60px) clamp(30px, 6vw, 56px);
  color: var(--paper-ink);
  font-family: var(--f-type);
  background:
    radial-gradient(ellipse at 18% 12%, rgba(120, 80, 30, .18), transparent 40%),
    radial-gradient(ellipse at 85% 80%, rgba(110, 70, 30, .22), transparent 45%),
    var(--paper-noise),
    linear-gradient(180deg, #e1d1ad, #d1bd92);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .65), inset 0 0 90px rgba(90, 58, 20, .45), inset 0 0 14px rgba(60, 38, 10, .5);
  transform: rotate(-.5deg);
  cursor: default;
}
.dossier.is-shake { animation: stampShake .35s ease; }
@keyframes stampShake { 30% { transform: rotate(-.5deg) translate(2px, 3px); } 60% { transform: rotate(-.5deg) translate(-2px, -1px); } }

.dossier__clip {
  position: absolute; top: -18px; right: 18%;
  width: 24px; height: 74px;
  border: 3px solid #8f8c98; border-radius: 14px;
  transform: rotate(6deg);
  box-shadow: 1px 2px 3px rgba(0, 0, 0, .35);
}
.dossier__clip::after { content: ""; position: absolute; left: 4px; right: 4px; top: 10px; bottom: 4px; border: 3px solid #a9a6b2; border-top: 0; border-radius: 0 0 10px 10px; }

.dossier__head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px;
  padding-bottom: 12px; margin-bottom: 26px;
  border-bottom: 3px double rgba(70, 45, 20, .6);
  font-family: var(--f-caps); font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: #5a3d1f;
}

.dossier__top { display: grid; grid-template-columns: minmax(110px, 170px) 1fr; gap: clamp(16px, 4vw, 34px); align-items: center; margin-bottom: 28px; }
.dossier__photo { margin: 0; padding: 8px 8px 0; background: #f0e9da; box-shadow: 0 8px 18px rgba(60, 40, 10, .35); transform: rotate(-3deg); }
.dossier__photo .ph { aspect-ratio: 4 / 5; }
.dossier__photo .ph img { filter: grayscale(1) sepia(.35) contrast(1.1); }
.dossier__photo figcaption { font-family: var(--f-hand); font-size: 1.05rem; text-align: center; padding: 4px 0 6px; color: #3a2c20; }
.dossier__id small { font-family: var(--f-caps); font-size: .66rem; letter-spacing: .3em; text-transform: uppercase; color: #7a5832; }
.dossier__id h3 { margin: 2px 0 10px; font-family: var(--f-caps); font-weight: 700; font-size: clamp(1.4rem, 5vw, 2.1rem); line-height: 1.1; letter-spacing: .04em; }
.dossier__id p { margin: 4px 0; font-size: .95rem; }
.redact span { display: inline-block; padding: 0 .5em; background: #17121a; color: transparent; transition: background .4s, color .4s; cursor: help; }
.redact:hover span, .redact:focus span { background: rgba(23, 18, 26, .1); color: var(--wine); }

.dossier__fields { margin: 0; }
.dossier__row { display: grid; grid-template-columns: 180px 1fr; gap: 6px 22px; padding: 12px 0; border-bottom: 1px dashed rgba(90, 60, 30, .35); }
.dossier__row dt { font-family: var(--f-caps); font-weight: 600; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: #6b4a26; padding-top: 3px; }
.dossier__row dd { margin: 0; font-size: 1.02rem; line-height: 1.5; min-height: 1.5em; }
.dossier__row dd.is-typing span[aria-hidden]::after { content: "▌"; animation: blink .7s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

.dossier__foot { display: flex; justify-content: flex-end; align-items: baseline; gap: 16px; margin-top: 30px; font-family: var(--f-caps); font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: #6b4a26; }
.dossier__sign { font-family: var(--f-script); font-size: 2.1rem; text-transform: none; letter-spacing: 0; color: var(--ink-blue); border-bottom: 1px solid rgba(29, 42, 90, .4); padding: 0 10px; }

.dossier__stamp {
  position: absolute; right: 7%; bottom: 20%;
  display: flex; flex-direction: column; align-items: center;
  padding: .25em .7em .3em;
  border: 5px double #a3202f; border-radius: 6px;
  font-family: var(--f-caps); font-weight: 700; font-size: clamp(1.4rem, 5vw, 2.3rem); letter-spacing: .12em; text-transform: uppercase; line-height: 1;
  color: #a3202f;
  mix-blend-mode: multiply;
  -webkit-mask-image: var(--paper-noise), linear-gradient(#000, #000);
  -webkit-mask-composite: source-out;
  mask-image: var(--paper-noise), linear-gradient(#000, #000);
  mask-composite: subtract;
  opacity: 0;
  transform: rotate(-14deg) scale(2.6);
  pointer-events: none;
}
.dossier__stamp small { font-size: .42em; letter-spacing: .4em; margin-top: .4em; }
.dossier.is-stamped .dossier__stamp { opacity: .92; transform: rotate(-14deg) scale(1); transition: transform .2s cubic-bezier(.6, 0, .9, .4), opacity .12s; }

.dossier__skip { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-family: var(--f-caps); font-size: .58rem; letter-spacing: .3em; text-transform: uppercase; color: rgba(90, 60, 30, .55); transition: opacity .4s; }
.dossier.is-done .dossier__skip { opacity: 0; }

/* Akte passt ohne Scrollen auf eine Seite */
.dossier__photo .ph img { object-position: 50% 0; }
.chapter:has(.chapter__body--akte) .chapter__head { padding-top: calc(58px + env(safe-area-inset-top)); padding-bottom: 0; }
.chapter:has(.chapter__body--akte) .chapter__title { font-size: clamp(2rem, 6vh, 3.4rem); }
.chapter:has(.chapter__body--akte) .chapter__sub { font-size: .95rem; }
.chapter__body--akte { padding-top: 14px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.chapter__body--akte .dossier { padding: clamp(18px, 3.2vh, 34px) clamp(18px, 5vw, 48px) clamp(20px, 3.2vh, 32px); }
.chapter__body--akte .dossier__head { margin-bottom: clamp(10px, 2vh, 18px); padding-bottom: 8px; }
.chapter__body--akte .dossier__top { grid-template-columns: clamp(96px, 17vh, 160px) 1fr; margin-bottom: clamp(8px, 1.6vh, 16px); }
.chapter__body--akte .dossier__photo figcaption { font-size: .95rem; padding: 2px 0 4px; }
.chapter__body--akte .dossier__row { grid-template-columns: 170px 1fr; padding: clamp(5px, 1vh, 9px) 0; }
.chapter__body--akte .dossier__row dd { font-size: .96rem; line-height: 1.4; min-height: 1.4em; }
.chapter__body--akte .dossier__foot { margin-top: clamp(10px, 2vh, 18px); }
.chapter__body--akte .dossier__sign { font-size: 1.8rem; }
.chapter__body--akte .dossier { max-width: 940px; }
.chapter__body--akte .dossier__photo figcaption { white-space: nowrap; font-size: .8rem; }
@media (max-height: 860px) {
  .chapter:has(.chapter__body--akte) .chapter__num,
  .chapter:has(.chapter__body--akte) .chapter__sub { display: none; }
  .chapter:has(.chapter__body--akte) .chapter__head { padding-top: calc(16px + env(safe-area-inset-top)); }
  .chapter:has(.chapter__body--akte) .chapter__title { font-size: 2.1rem; }
  .chapter__body--akte .dossier__top { grid-template-columns: clamp(84px, 15vh, 130px) 1fr; }
}

/* ==========================================================================
   II · TRÄNKE
   ========================================================================== */
.potions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 22px; max-width: 1180px; margin: 0 auto; }
@media (min-width: 1100px) { .chapter__body--traenke { max-width: 1240px; } }
.potion { display: flex; flex-direction: column; align-items: center; gap: 14px; perspective: 1200px; }
.chapter.is-open .potion.rv { animation-delay: calc(.6s + var(--i) * .12s); }

.potion__card {
  position: relative;
  width: 100%; min-height: 420px; flex: 1 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr);
  padding: 0; border: 0; background: none;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.35, 1.35, .45, 1);
}
.potion.is-flipped .potion__card { transform: rotateY(180deg); }

/* Beide Seiten: identisches Raster -> Kopf und Fuß überall auf gleicher Höhe.
   Beide liegen in derselben Rasterzelle, damit die Karte mit langem Text mitwächst */
.potion__face {
  position: relative; grid-area: 1 / 1;
  display: grid;
  grid-template-rows: 64px auto 104px;
  grid-template-columns: minmax(0, 1fr);
  padding: 18px 18px 16px;
  border: 1px solid transparent;
  border-radius: 20px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  overflow: hidden;
  text-align: center;
}
.potion__head, .potion__body, .potion__foot { position: relative; width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.potion__head { justify-content: center; border-bottom: 1px solid rgba(201, 164, 92, .22); }
.potion__body { justify-content: center; }
.potion__foot { justify-content: flex-start; gap: 6px; padding-top: 14px; border-top: 1px solid rgba(201, 164, 92, .22); }

.potion__front {
  border: 1px solid rgba(201, 164, 92, .22);
  background:
    radial-gradient(ellipse 70% 45% at 50% 50%, color-mix(in srgb, var(--c) 24%, transparent), transparent 70%),
    linear-gradient(180deg, #1a1222, #0d0a11);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .4s, box-shadow .4s;
}
.potion__card:hover .potion__front { border-color: color-mix(in srgb, var(--c) 60%, var(--gold)); box-shadow: 0 24px 50px rgba(0, 0, 0, .55), 0 0 50px color-mix(in srgb, var(--c) 30%, transparent); }
.potion__uses {
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, var(--gold));
  border-radius: 999px;
  font-family: var(--f-caps); font-weight: 600; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 35%, var(--gold-hi));
  background: color-mix(in srgb, var(--c) 10%, transparent);
}
.potion__glow { position: absolute; left: 50%; top: 50%; width: 150px; height: 150px; margin: -75px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), transparent 65%); filter: blur(10px); animation: glowBreathe 4s ease-in-out infinite; }

.bottle { position: relative; width: 112px; height: 168px; overflow: visible; animation: bottleFloat 4.5s ease-in-out infinite; animation-delay: calc(var(--i) * -.8s); }
@keyframes bottleFloat { 50% { transform: translateY(-8px) rotate(1.5deg); } }
.liquid { animation: wave 2.6s linear infinite; }
@keyframes wave { to { transform: translateX(60px); } }
.bubble { opacity: 0; animation: bubble var(--dur, 3s) ease-in infinite; animation-delay: var(--d, 0s); }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }
.cork { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.potion__card:hover .cork { transform: translateY(-6px) rotate(-6deg); transform-box: fill-box; transform-origin: center; }

.potion__name {
  display: flex; align-items: center; justify-content: center;
  min-height: 2.6em;
  font-family: var(--f-caps); font-weight: 600; font-size: .88rem; letter-spacing: .08em; line-height: 1.3;
  color: var(--bone);
}
.potion__hint { font-style: italic; font-size: .9rem; color: var(--muted); }

.potion__back {
  transform: rotateY(180deg);
  color: var(--paper-ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120, 80, 30, .2), transparent 50%),
    var(--paper-noise),
    linear-gradient(180deg, #e6d6b2, #d0bb8f);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .55), inset 0 0 50px rgba(90, 58, 20, .4);
}
.potion__back::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(90, 60, 30, .45); border-radius: 13px; outline: 1px solid rgba(90, 60, 30, .25); outline-offset: -5px; pointer-events: none; }
.voucher__head, .voucher__foot { border-color: rgba(90, 60, 30, .3); }
.voucher__head { gap: 3px; padding-bottom: 4px; }
.voucher__kicker { font-family: var(--f-black); font-size: 1.75rem; line-height: 1; color: #7a1622; }
.voucher__name { font-family: var(--f-caps); font-size: .54rem; letter-spacing: .18em; line-height: 1.3; text-transform: uppercase; color: #6b4a26; text-wrap: balance; }
.voucher__body { justify-content: flex-start; gap: 10px; padding: 26px 2px 0; }
.voucher__title { display: flex; align-items: center; justify-content: center; min-height: 2.5em; text-wrap: balance; font-family: var(--f-caps); font-weight: 700; font-size: 1.02rem; letter-spacing: .05em; line-height: 1.25; color: #2b1a0c; }
.voucher__text { font-style: italic; font-size: 1.02rem; line-height: 1.38; color: #3a2817; text-wrap: pretty; }
.voucher__count { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 2.6em; font-family: var(--f-caps); font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; color: #6b4a26; }
.voucher__inf { font-family: var(--f-body); font-size: 1.5rem; line-height: .8; letter-spacing: 0; color: #7a1622; }
.voucher__pips { display: flex; gap: 8px; height: 14px; align-items: center; }
.voucher__pips i { width: 9px; height: 9px; transform: rotate(45deg); border: 1.5px solid #7a1622; transition: background .4s; }
.voucher__pips i.is-used { background: #7a1622; }
.voucher__fine { display: flex; flex-direction: column; align-items: center; font-size: .9rem; font-style: italic; color: #6b4a26; line-height: 1.35; }
.voucher__stamp {
  position: absolute; left: 50%; top: 50%;
  padding: .2em .6em;
  border: 4px double #a3202f; border-radius: 6px;
  font-family: var(--f-caps); font-weight: 700; font-size: 1.5rem; letter-spacing: .14em; text-transform: uppercase;
  color: #a3202f; mix-blend-mode: multiply;
  transform: translate(-50%, -50%) rotate(-18deg) scale(2.4);
  opacity: 0;
  pointer-events: none;
}
.potion.is-redeemed .voucher__stamp { opacity: .78; transform: translate(-50%, -50%) rotate(-18deg) scale(1); }
.potion.is-stamping .voucher__stamp { transition: transform .22s cubic-bezier(.6, 0, .9, .4) .15s, opacity .1s .15s; }
.potion.is-pulse .voucher__pips i.is-new,
.potion.is-pulse .voucher__inf { animation: pipPop .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pipPop { 40% { transform: rotate(45deg) scale(1.7); } }
.potion.is-pulse .voucher__inf { animation-name: infPop; }
@keyframes infPop { 40% { transform: scale(1.5); } }

.potion__redeem { opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .4s .5s, transform .4s .5s var(--ease-out), filter .3s; }
.potion.is-flipped .potion__redeem { opacity: 1; transform: none; pointer-events: auto; }
.potion__redeem.is-armed { background: linear-gradient(180deg, #e05468, var(--wine) 60%, var(--wine-deep)); color: #fff1f3; border-color: rgba(255, 180, 190, .6); }

/* ==========================================================================
   III · EULENPOST
   ========================================================================== */
.relic__badge {
  position: absolute; left: -4px; top: -4px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--gold-hi); color: #1a1208;
  font-family: var(--f-caps); font-weight: 700; font-size: .8rem; letter-spacing: 0;
  box-shadow: 0 0 0 3px #0b080e, 0 0 18px rgba(236, 208, 143, .8);
  animation: badgePulse 1.8s ease-in-out infinite;
}
.relic__badge[hidden] { display: none; }
@keyframes badgePulse { 50% { transform: scale(1.12); box-shadow: 0 0 0 3px #0b080e, 0 0 28px rgba(236, 208, 143, 1); } }

.owlpost { position: relative; max-width: 640px; margin: 70px auto 0; }
.owlpost__perch {
  position: absolute; z-index: 2; right: 26px; top: -84px;
  width: 104px;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .55));
}
.owlf { display: block; width: 100%; overflow: visible; animation: owlIdle 4s ease-in-out infinite; }
.owlf__eyes { animation: owlBlink 5s steps(1) infinite; transform-origin: 60px 51px; }
.owlf__wing { transform-box: fill-box; }
.owlf__wing--l { transform-origin: 100% 30%; }
.owlf__wing--r { transform-origin: 0 30%; }
@keyframes owlIdle { 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes owlBlink { 0%, 94%, 100% { transform: none; } 96% { transform: scaleY(.1); } }

.owlpost__perch.is-flying { animation: owlAway 1.5s cubic-bezier(.5, 0, .7, .3) forwards; }
.owlpost__perch.is-flying .owlf__wing--l { animation: flapL .16s ease-in-out infinite alternate; }
.owlpost__perch.is-flying .owlf__wing--r { animation: flapR .16s ease-in-out infinite alternate; }
.owlpost__perch.is-back { animation: owlReturn .9s var(--ease-out) both; }
.owlpost__perch.is-back .owlf__letter { animation: letterBack .6s var(--ease-out) both .5s; }
@keyframes owlAway {
  0% { transform: none; opacity: 1; }
  20% { transform: translate(-10px, 8px) rotate(4deg); }
  100% { transform: translate(260px, -380px) rotate(-18deg) scale(.4); opacity: 0; }
}
@keyframes owlReturn { from { transform: translate(-200px, -260px) scale(.5) rotate(14deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes letterBack { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes flapL { to { transform: rotate(-38deg); } }
@keyframes flapR { to { transform: rotate(38deg); } }

.owlpost__form {
  position: relative;
  padding: 30px clamp(20px, 5vw, 38px) 22px;
  color: var(--paper-ink);
  background:
    radial-gradient(ellipse at 12% 6%, rgba(120, 80, 30, .18), transparent 45%),
    var(--paper-noise),
    linear-gradient(180deg, #ecdfc0, #d8c59c);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6), inset 0 0 60px rgba(90, 58, 20, .3);
  transform: rotate(-.6deg);
}
.owlpost__form::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(90, 60, 30, .3); pointer-events: none; }
.owlpost__label { display: block; margin-bottom: 10px; font-family: var(--f-caps); font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: #7a5a30; }
.owlpost__form textarea {
  position: relative;
  display: block; width: 100%; min-height: 130px; resize: vertical;
  padding: 4px 2px;
  border: 0; outline: none;
  background: repeating-linear-gradient(180deg, transparent 0 33px, rgba(90, 60, 30, .28) 33px 34px);
  font-family: var(--f-hand); font-size: 1.55rem; line-height: 34px; color: var(--ink-blue);
}
.owlpost__form textarea::placeholder { color: rgba(29, 42, 90, .4); }
.owlpost__row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.owlpost__count { font-family: var(--f-caps); font-size: .62rem; letter-spacing: .2em; color: #8a6a3a; }
.owlpost__msg { position: relative; min-height: 1.4em; margin: 12px 0 0; font-style: italic; color: #5a3d1f; }

.mailbox { max-width: 640px; margin: 56px auto 0; }
.mailbox__title { margin: 0 0 18px; text-align: center; font-family: var(--f-caps); font-weight: 400; font-size: .8rem; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); }
.mailbox__list { display: flex; flex-direction: column; gap: 14px; }
.mailbox__empty { margin: 0; text-align: center; font-style: italic; color: var(--muted); }
.mail {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; padding: 16px 20px 14px;
  border: 1px solid rgba(201, 164, 92, .2); border-radius: 14px;
  background: linear-gradient(180deg, rgba(30, 21, 40, .88), rgba(12, 9, 16, .9));
  text-align: left; color: var(--bone);
  transition: border-color .3s, transform .3s var(--ease-out), box-shadow .3s;
}
button.mail:hover, button.mail:focus-visible { border-color: rgba(236, 208, 143, .6); transform: translateY(-2px); }
.mail__date { font-family: var(--f-caps); font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.mail__q { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mail__status { display: flex; align-items: center; gap: 8px; font-style: italic; color: var(--bone-dim); }
.mail.is-waiting .mail__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: blink 1.4s steps(1) infinite; }
.mail.is-new { border-color: rgba(236, 208, 143, .7); box-shadow: 0 0 30px rgba(236, 208, 143, .18); }
.mail.is-new .mail__status { color: var(--gold-hi); font-style: normal; font-family: var(--f-caps); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; }
.mail.is-read { opacity: .78; }
.mail.is-read .mail__status::before { content: "✓"; color: var(--gold); font-style: normal; }
.mail__seal { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #d0425a, var(--wine) 60%, var(--wine-deep)); box-shadow: 0 0 10px rgba(208, 66, 90, .7); }

.ow-read__q { margin: 4px 0 20px; padding-bottom: 16px; border-bottom: 1px solid rgba(90, 60, 30, .3); font-family: var(--f-hand); font-size: 1.5rem; line-height: 1.2; color: #5a3d1f; }

@media (max-width: 520px) {
  .owlpost { margin-top: 76px; }
  .owlpost__perch { width: 86px; right: 12px; top: -70px; }
  .owlpost__form textarea { font-size: 1.35rem; }
  .owlpost__send { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .owlpost__perch.is-flying { animation: none; opacity: .3; }
}

/* ==========================================================================
   IV · BRIEFE (Öffnen, wenn …)
   ========================================================================== */
/* Das ganze Kapitel ist die Leinwand */
.chapter[data-ch="briefe"] .chapter__bg {
  background:
    radial-gradient(rgba(236, 208, 143, .12) 1px, transparent 1.4px) 0 0 / 34px 34px,
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(90, 56, 130, .45), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 115%, rgba(110, 20, 40, .3), transparent 70%),
    #110b15;
}
.chapter__body--briefe { max-width: 1240px; }

.wall-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 22px; margin: -14px 0 30px; }
.wall-bar__count { font-family: var(--f-caps); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 54px 34px;
  padding: 20px 6px 10px;
}

.ow {
  position: relative;
  width: 100%; max-width: 260px; justify-self: center;
  aspect-ratio: 1.4;
  padding: 0; border: 0;
  transform: translate(var(--dx), var(--dy)) rotate(var(--r));
  background: var(--paper-noise), linear-gradient(170deg, #eadcbb, #cdb88c);
  border-radius: 4px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, .55), 0 2px 0 rgba(255, 255, 255, .25) inset;
  color: var(--paper-ink);
  transition: transform .45s var(--ease-out), box-shadow .45s, filter .45s;
}
.ow:hover, .ow:focus-visible, .ow.is-picked {
  transform: translate(var(--dx), calc(var(--dy) - 6px)) rotate(0deg) scale(1.06);
  box-shadow: 0 26px 44px rgba(0, 0, 0, .65), 0 0 0 2px rgba(236, 208, 143, .6), 0 0 40px rgba(236, 208, 143, .25);
  z-index: 2;
}
.ow__pin {
  position: absolute; left: 50%; top: -9px; z-index: 3;
  width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d0, #c9a45c 45%, #6b5122);
  box-shadow: 0 4px 6px rgba(0, 0, 0, .55);
}
.ow__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 42%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #d9c69c, #c2ab7c);
  transition: opacity .4s;
}
.ow__label {
  position: absolute; left: 7%; right: 7%; bottom: 8%;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--f-hand); font-size: 1.32rem; line-height: 1.05; text-align: center;
}
.ow__label small { font-family: var(--f-caps); font-size: .56rem; letter-spacing: .2em; text-transform: uppercase; opacity: .65; margin-bottom: 3px; }
.ow__seal {
  position: absolute; left: 50%; top: 42%;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  display: grid; place-items: center;
  border-radius: 46% 54% 50% 50%;
  background: radial-gradient(circle at 36% 30%, color-mix(in srgb, var(--seal) 60%, #fff), var(--seal) 55%, color-mix(in srgb, var(--seal) 55%, #000));
  box-shadow: 0 3px 6px rgba(0, 0, 0, .45), inset 0 0 0 3px color-mix(in srgb, var(--seal) 70%, #000);
  font-family: var(--f-black); font-size: 1.2rem; color: color-mix(in srgb, var(--seal) 40%, #000);
  transition: transform .5s var(--ease-out), opacity .5s;
}
/* gelesen: Klappe weg, Siegel gebrochen */
.ow.is-read { filter: saturate(.75) brightness(.88); }
.ow.is-read .ow__flap { opacity: .25; }
.ow.is-read .ow__seal { transform: scale(.75) rotate(-24deg); opacity: .55; }

.ow-read { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; }
.ow-read__backdrop { position: absolute; inset: 0; background: rgba(5, 3, 8, .8); opacity: 0; transition: opacity .35s; }
.ow-read__paper {
  position: relative;
  width: min(100%, 580px); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(30px, 6vw, 54px) clamp(22px, 6vw, 54px) 30px;
  color: var(--paper-ink);
  background:
    radial-gradient(ellipse at 12% 6%, rgba(120, 80, 30, .18), transparent 45%),
    var(--paper-noise),
    linear-gradient(180deg, #ecdfc0, #d8c59c);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .7), inset 0 0 70px rgba(90, 58, 20, .35);
  font-size: clamp(1.12rem, 3vw, 1.3rem); line-height: 1.6;
  outline: none;
  opacity: 0; transform: translateY(30px) rotate(-1.5deg) scale(.96);
  transition: opacity .35s, transform .45s var(--ease-out);
}
.ow-read.is-on .ow-read__backdrop { opacity: 1; }
.ow-read.is-on .ow-read__paper { opacity: 1; transform: none; }
.ow-read__kicker { margin: 0; font-family: var(--f-caps); font-size: .66rem; letter-spacing: .3em; text-transform: uppercase; color: #7a5a30; }
.ow-read__title { margin: 4px 0 18px; font-family: var(--f-hand); font-weight: 700; font-size: clamp(1.9rem, 6vw, 2.5rem); line-height: 1.05; color: var(--ink-blue); }
.ow-read__body p { margin: 0 0 .8em; }
.ow-read__sig { margin: 14px 0 22px; text-align: right; font-family: var(--f-script); font-size: 2.2rem; color: var(--ink-blue); }
.ow-read .btn--ghost { color: #5a3d1f; background: rgba(255, 255, 255, .15); border-color: rgba(90, 60, 30, .45); }

@media (max-width: 520px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 14px; padding: 16px 0 0; }
  .ow { --dx: 0px !important; }
  .ow__label { font-size: 1rem; left: 5%; right: 5%; }
  .ow__label small { font-size: .46rem; letter-spacing: .12em; }
  .ow__seal { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: .9rem; }
}

/* ==========================================================================
   V · BRIEF
   ========================================================================== */
/* Beim Brief: keine große Überschrift, damit er auf die Seite passt (Titel bleibt für Screenreader) */
.chapter:has(.chapter__body--brief) .chapter__head { padding: calc(60px + env(safe-area-inset-top)) 16px 0; }
.chapter:has(.chapter__body--brief) :is(.chapter__num, .chapter__title, .chapter__sub) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.letter-stage { min-height: 56vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding-top: 70px; transition: opacity .6s, transform .6s var(--ease-out); }
.letter-stage.is-gone { opacity: 0; transform: translateY(40px) scale(.95); }

.env { position: relative; width: min(88vw, 470px); aspect-ratio: 1.56; perspective: 1400px; animation: envBob 5s ease-in-out infinite; }
@keyframes envBob { 50% { transform: translateY(-8px) rotate(-.6deg); } }
.env.is-open { animation: none; }
.env__back { position: absolute; inset: 0; border-radius: 8px; background: linear-gradient(180deg, #2c1b24, #170d13); box-shadow: 0 40px 70px rgba(0, 0, 0, .7), 0 0 0 1px rgba(201, 164, 92, .35); }
.env__paper {
  position: absolute; left: 6%; right: 6%; top: 7%; bottom: 6%; z-index: 2;
  display: flex; justify-content: center; padding-top: 9%;
  background: var(--paper-noise), linear-gradient(180deg, #efe2c4, #d6c39a);
  border-radius: 3px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .3);
  font-family: var(--f-script); font-size: clamp(1.4rem, 5vw, 2rem); color: #3a2614;
  transition: transform 1.1s cubic-bezier(.5, 0, .2, 1);
}
.env.is-pulled .env__paper { transform: translateY(-64%); }
.env__pocket {
  position: absolute; inset: 0; z-index: 3;
  border-radius: 8px;
  background: linear-gradient(165deg, #3a2430, #1f1219 70%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(201, 164, 92, .3);
}
.env__pocket::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), rgba(201, 164, 92, .28) 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
              linear-gradient(to top left, transparent calc(50% - 1px), rgba(201, 164, 92, .28) 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat;
}
.env__flap {
  position: absolute; left: 0; right: 0; top: 0; z-index: 4;
  height: 58%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #45293a, #26161f);
  transform-origin: 50% 0;
  transition: transform .8s cubic-bezier(.5, 0, .3, 1), z-index 0s .4s;
}
.env__flap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(201, 164, 92, .12), transparent 60%); }
.env.is-open .env__flap { transform: rotateX(180deg); z-index: 1; }

.env__seal {
  position: absolute; left: 50%; top: 58%; z-index: 6;
  width: clamp(70px, 20vw, 92px); aspect-ratio: 1;
  padding: 0; border: 0; background: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6));
  animation: sealPulse 2.6s ease-in-out infinite;
}
.env__seal:disabled { cursor: default; animation: none; }
@keyframes sealPulse { 50% { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)) drop-shadow(0 0 16px rgba(208, 66, 90, .7)); transform: translate(-50%, -50%) scale(1.05); } }
.seal { position: absolute; inset: 0; transition: transform .9s cubic-bezier(.4, 0, .6, 1), opacity .9s; }
.seal svg { width: 100%; height: 100%; display: block; }
.seal--l { clip-path: polygon(0 0, 52% 0, 46% 30%, 54% 55%, 47% 100%, 0 100%); }
.seal--r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 47% 100%, 54% 55%, 46% 30%); }
.env.is-cracked .seal--l { transform: translate(-36px, 90px) rotate(-40deg); opacity: 0; }
.env.is-cracked .seal--r { transform: translate(34px, 100px) rotate(34deg); opacity: 0; }
.seal__initial { font-family: var(--f-black); font-size: 44px; fill: #4a0912; stroke: rgba(224, 104, 124, .35); stroke-width: .8; }
.env__hint { margin: 0; font-family: var(--f-caps); font-size: .7rem; letter-spacing: .45em; text-transform: uppercase; color: var(--gold); animation: labelGlow 2.4s ease-in-out infinite; transition: opacity .4s; }
.env.is-cracked + .env__hint { opacity: 0; }

.letter {
  position: relative;
  max-width: 700px; margin: 10px auto 0;
  padding: clamp(34px, 7vw, 70px) clamp(24px, 7vw, 70px) clamp(30px, 6vw, 56px);
  color: var(--paper-ink);
  background:
    radial-gradient(ellipse at 15% 8%, rgba(120, 80, 30, .18), transparent 45%),
    radial-gradient(ellipse at 90% 92%, rgba(110, 70, 30, .2), transparent 50%),
    var(--paper-noise),
    linear-gradient(180deg, #ecdfc0, #d8c59c);
  box-shadow: 0 50px 100px rgba(0, 0, 0, .7), inset 0 0 90px rgba(90, 58, 20, .4);
  font-size: clamp(1.18rem, 3vw, 1.38rem);
  line-height: 1.65;
}
.letter::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(90, 60, 30, .35); pointer-events: none; }
.letter > * { opacity: 0; }
.letter.is-in > * { animation: inkIn 1.3s var(--ease-out) both; }
.letter.is-in > :nth-child(1) { animation-delay: .2s; }
.letter.is-in > :nth-child(2) { animation-delay: .65s; }
.letter.is-in > :nth-child(3) { animation-delay: 1.1s; }
.letter.is-in > :nth-child(4) { animation-delay: 1.55s; }
.letter.is-in > :nth-child(5) { animation-delay: 2s; }
.letter.is-in > :nth-child(6) { animation-delay: 2.45s; }
.letter.is-in > :nth-child(7) { animation-delay: 2.9s; }
.letter.is-in > :nth-child(8) { animation-delay: 3.35s; }
.letter.is-in > :nth-child(9) { animation-delay: 3.8s; }
.letter.is-in > :nth-child(10) { animation-delay: 4.25s; }
.letter.is-in > :nth-child(11) { animation-delay: 4.7s; }
@keyframes inkIn { from { opacity: 0; transform: translateY(10px); filter: blur(5px); } to { opacity: 1; transform: none; filter: none; } }

.letter__date { margin: 0 0 22px; text-align: right; font-family: var(--f-caps); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: #6b4a26; }
.letter__greet { margin: 0 0 10px; font-family: var(--f-script); font-size: clamp(2.2rem, 7vw, 2.8rem); line-height: 1.2; color: #2a1a0c; }
.letter__p { margin: 0 0 1em; }
.letter__signoff { margin: 1.6em 0 0; font-style: italic; }
.letter__sig { margin: 0; font-family: var(--f-script); font-size: clamp(2.6rem, 8vw, 3.4rem); line-height: 1.3; color: var(--ink-blue); }
.letter__sig span { display: inline-block; padding-right: .3em; clip-path: inset(0 100% 0 0); transition: clip-path 1.8s cubic-bezier(.5, 0, .3, 1); }
.letter.is-signed .letter__sig span { clip-path: inset(0 -10% 0 0); }
.letter__ps { margin: 1.6em 0 0; padding-top: 1em; border-top: 1px dashed rgba(90, 60, 30, .35); font-size: .9em; font-style: italic; color: #4a3420; }
.letter__ps b { font-family: var(--f-caps); font-style: normal; font-size: .8em; letter-spacing: .1em; color: #7a1622; margin-right: .3em; }
.letter__end { margin-top: 34px; text-align: center; }
.letter__back { color: #5a3d1f; background: rgba(255, 255, 255, .15); border-color: rgba(90, 60, 30, .45); }

/* ==========================================================================
   LIGHTBOX, TOAST, CURSOR
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: rgba(5, 4, 8, .95);
  opacity: 0; transition: opacity .4s;
  cursor: zoom-out;
}
.lightbox.is-on { opacity: 1; }
.lightbox__card { margin: 0; padding: 14px 14px 0; background: #f3ede1; width: min(92vw, 640px); box-shadow: 0 40px 100px rgba(0, 0, 0, .8); transform: scale(.88) rotate(-3deg); transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.lightbox.is-on .lightbox__card { transform: none; }
.lightbox__img .ph { aspect-ratio: auto; min-height: 240px; max-height: 72vh; }
.lightbox__img .ph--loaded img { position: static; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.lightbox__img .ph--empty { aspect-ratio: 1; }
.lightbox figcaption { padding: 14px 6px 18px; text-align: center; font-family: var(--f-hand); font-size: clamp(1.4rem, 4vw, 1.8rem); line-height: 1.15; color: #2a2230; }

.toast {
  position: fixed; left: 50%; z-index: 70;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: max-content; max-width: min(100% - 32px, 460px);
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 20px 15px;
  border: 1px solid rgba(201, 164, 92, .4); border-radius: 16px;
  background: rgba(18, 13, 24, .97);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6), 0 0 30px rgba(201, 164, 92, .1);
  transform: translate(-50%, calc(100% + 40px));
  opacity: 0;
  transition: transform .6s var(--ease-out), opacity .4s;
  pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast strong { font-family: var(--f-caps); font-weight: 600; font-size: .66rem; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-hi); }
.toast span { font-size: 1.1rem; line-height: 1.35; color: var(--bone); }

.cursor-glow {
  position: fixed; left: 0; top: 0; z-index: 80;
  width: 380px; height: 380px; margin: -190px 0 0 -190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 120, .06), transparent 62%);
  will-change: transform;
  pointer-events: none;
  opacity: 0; transition: opacity .6s;
}
.cursor-glow.is-on { opacity: 1; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 619px) {
  .relic:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 7px); }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .moon { top: 58px; right: -12px; width: 62px; opacity: .85; }
  .brand span { display: none; }
  .progress { gap: 8px; padding-right: 10px; }
  .progress__dots i { width: 26px; height: 26px; }
  .sound-toggle__label { display: none; }
  .sound-toggle { padding: 10px 12px; }
  .dossier__top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .dossier__photo { width: 60%; max-width: 200px; }
  .dossier__row { grid-template-columns: 1fr; gap: 2px; }
  .dossier__stamp { bottom: 12%; }
  .chapter__body--akte .dossier__top { grid-template-columns: 34% 1fr; justify-items: start; text-align: left; gap: 16px; }
  .chapter__body--akte .dossier__photo { width: 100%; }
  .chapter__body--akte .dossier__photo figcaption { font-size: .8rem; }
  .chapter__body--akte .dossier__id h3 { font-size: 1.25rem; margin-bottom: 6px; }
  .chapter__body--akte .dossier__id p { font-size: .82rem; }
  .chapter__body--akte .dossier__row { grid-template-columns: 1fr; gap: 0; padding: 5px 0; }
  .chapter__body--akte .dossier__row dt { font-size: .6rem; padding-top: 0; }
  .chapter__body--akte .dossier__row dd { font-size: .86rem; line-height: 1.35; }
  .chapter__body--akte .dossier__head { font-size: .58rem; }
  .chapter__body--akte { padding-left: 10px; padding-right: 10px; }
  .chapter__body--akte .dossier { padding: 16px 16px 18px; }
  .chapter__body--akte .dossier__photo figcaption { font-size: .62rem; }
  .chapter__body--akte .dossier__row { padding: 3px 0; }
  .chapter__body--akte .dossier__row dd { font-size: .8rem; line-height: 1.3; }
  .chapter__body--akte .dossier__foot { margin-top: 8px; }
  .chapter__body--akte .dossier__sign { font-size: 1.5rem; }
  .chapter__body--akte .dossier__clip { right: 46%; }
}
@media (max-width: 760px) and (max-height: 860px) {
  .chapter:has(.chapter__body--akte) .chapter__head { text-align: right; padding-top: calc(14px + env(safe-area-inset-top)); padding-right: 18px; }
  .chapter:has(.chapter__body--akte) .chapter__title { font-size: 1.9rem; }
  .potion__card { min-height: 400px; }
}

@media (max-width: 400px) {
  .relic__btn { padding: 16px 4px 14px; }
  .relic__sub { font-size: .85rem; }
  .gate__field { flex-direction: column; border-radius: 22px; padding: 10px; }
  .gate__field input { text-align: center; width: 100%; }
  .gate__field .btn { width: 100%; }
}

/* Automatischer Sparmodus für langsame Geräte (siehe fx.js) */
.fx-lite .fog { display: none; }
.fx-lite .runes__spin,
.fx-lite .moon__glow,
.fx-lite .gate__glow,
.fx-lite .basket__halo,
.fx-lite .potion__glow,
.fx-lite .owlf { animation: none !important; }
.fx-lite .cursor-glow { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; transition-delay: 0s !important; }
  .fog, .runes__spin, .relic__ring { animation: none !important; }
}

/* ==========================================================================
   GUTSCHEIN-POPUP (Einlösen mit Eingabe)
   ========================================================================== */
.vask {
  position: fixed; inset: 0; z-index: 65;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: rgba(5, 4, 8, .82);
  opacity: 0;
  transition: opacity .35s;
}
.vask.is-on { opacity: 1; }
.vask__card {
  position: relative;
  width: min(100%, 440px);
  display: flex; flex-direction: column; align-items: center;
  padding: 34px clamp(22px, 6vw, 36px) 28px;
  text-align: center;
  color: var(--paper-ink);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120, 80, 30, .2), transparent 50%),
    var(--paper-noise),
    linear-gradient(180deg, #e6d6b2, #d0bb8f);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .75), inset 0 0 50px rgba(90, 58, 20, .4), 0 0 0 1px color-mix(in srgb, var(--c) 50%, transparent);
  transform: translateY(20px) scale(.95);
  transition: transform .5s cubic-bezier(.3, 1.35, .5, 1);
}
.vask.is-on .vask__card { transform: none; }
.vask__card::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(90, 60, 30, .45); border-radius: 13px; pointer-events: none; }
.vask__card.is-wrong { animation: shake .5s cubic-bezier(.36, .07, .19, .97); }
.vask__kicker { margin: 0; font-family: var(--f-caps); font-size: .6rem; letter-spacing: .3em; text-transform: uppercase; color: #6b4a26; }
.vask__title { margin: 6px 0 18px; font-family: var(--f-black); font-weight: 400; font-size: 2.1rem; line-height: 1.05; color: #7a1622; }
.vask__label { font-family: var(--f-caps); font-weight: 700; font-size: 1rem; letter-spacing: .05em; color: #2b1a0c; margin-bottom: 10px; }
.vask__input {
  width: 100%;
  padding: 10px 4px;
  border: 0; border-bottom: 1.5px solid rgba(90, 60, 30, .55);
  background: transparent;
  font-family: var(--f-body); font-size: 1.3rem; text-align: center;
  color: #2b1a0c;
  outline: none;
  color-scheme: light;
  transition: border-color .3s;
}
.vask__input::placeholder { color: rgba(60, 40, 20, .45); font-style: italic; }
.vask__input:focus { border-bottom-color: #7a1622; }
.vask__err { min-height: 1.4em; margin: 10px 0 4px; font-style: italic; font-size: .98rem; color: #a3202f; }
.vask__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.vask .btn--ghost { color: #5a3d1f; background: rgba(255, 255, 255, .15); border-color: rgba(90, 60, 30, .45); }

/* ==========================================================================
   HANDY-FEINSCHLIFF
   ========================================================================== */
/* Dunkler Streifen hinter "Zurück zum Korb", sobald gescrollt wird –
   sonst läuft der Text sichtbar unter dem Button durch */
.chapter::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; z-index: 4;
  height: calc(76px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(9, 7, 13, .97) 0%, rgba(9, 7, 13, .9) 62%, rgba(9, 7, 13, 0) 100%);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.chapter.is-scrolled::after { opacity: 1; }

/* Tor & Willkommen: scrollbar statt abgeschnitten, wenn der Bildschirm zu niedrig ist (Querformat) */
.gate { overflow-y: auto; place-items: normal; }
.gate__content { margin: auto; }
.welcome { overflow-y: auto; place-items: normal; }
.welcome__card { margin: auto; }

/* Briefe an der Wand: Siegel höher, damit zweizeilige Beschriftungen nicht darunter liegen */
@media (max-width: 520px) {
  .ow { aspect-ratio: 1.22; }
  .ow__flap { height: 34%; }
  .ow__seal { top: 34%; }
  .ow__label { bottom: 9%; }
}

@media (max-width: 400px) {
  /* Akte: "Zurück zum Korb" und "Die Akte" passen nebeneinander */
  .chapter__close { padding: 9px 13px; letter-spacing: .14em; gap: 6px; }
  .chapter:has(.chapter__body--akte) .chapter__title { font-size: 1.6rem; }
  /* Büroklammer nicht über "Archiv der Eulen" */
  .chapter__body--akte .dossier__clip { right: 38%; }
  /* Buttons im Briefpapier einzeilig */
  .ow-read__close { letter-spacing: .12em; padding-left: 1.2em; padding-right: 1.2em; }
}

@media (max-height: 520px) {
  .gate__content { padding: 22px 20px 18px; }
  .gate__content .ornament { margin: 8px auto 12px; }
  .welcome { padding: 18px 16px; }
  .welcome__card { padding: 30px 28px 22px; }
  .welcome .ornament { margin: 12px auto 14px; }
}

/* Kalender im Gutschein-Popup (Latenightdrive) */
.cal { width: 100%; max-width: 320px; margin: 0 auto; }
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal__month { font-family: var(--f-caps); font-weight: 700; font-size: .95rem; letter-spacing: .06em; color: #2b1a0c; }
.cal__nav {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(90, 60, 30, .45); background: rgba(255, 255, 255, .15);
  font-size: 1.5rem; line-height: 1; color: #5a3d1f;
  display: grid; place-items: center; padding: 0 0 3px;
}
.cal__nav:disabled { opacity: .3; }
.cal__week, .cal__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal__week span { font-family: var(--f-caps); font-size: .68rem; letter-spacing: .05em; color: #6b4a26; padding: 4px 0; }
.cal__day {
  aspect-ratio: 1; min-height: 34px; width: 100%;
  border: 0; border-radius: 50%; background: transparent;
  font-family: var(--f-body); font-size: 1.08rem; font-weight: 600; color: #2b1a0c;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s;
}
.cal__day:disabled { color: rgba(60, 40, 20, .28); font-weight: 400; }
.cal__day.is-today { box-shadow: inset 0 0 0 1.5px rgba(122, 22, 34, .55); }
.cal__day.is-picked { background: #7a1622; color: #f6e8c8; box-shadow: 0 3px 8px rgba(122, 22, 34, .4); }
.cal__picked { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid rgba(90, 60, 30, .3); font-style: italic; font-size: 1.05rem; color: rgba(60, 40, 20, .55); }
.cal__picked.is-set { color: #7a1622; font-style: normal; font-weight: 600; }
.vask:has(.cal) { overflow-y: auto; place-items: normal; }
.vask:has(.cal) .vask__card { margin: auto; padding-top: 28px; padding-bottom: 22px; }
.vask:has(.cal) .vask__title { margin-bottom: 12px; }
@media (max-height: 700px) {
  .vask:has(.cal) { padding-top: 12px; padding-bottom: 12px; }
  .vask:has(.cal) .vask__card { padding-top: 22px; padding-bottom: 16px; }
  .vask:has(.cal) .vask__title { font-size: 1.7rem; margin: 4px 0 6px; }
  .vask:has(.cal) .vask__label { margin-bottom: 4px; }
  .cal__head { margin-bottom: 2px; }
  .cal__nav { width: 34px; height: 34px; }
  .cal__week span { padding: 2px 0; }
  .cal__day { aspect-ratio: auto; min-height: 0; height: 32px; border-radius: 10px; }
  .cal__picked { margin-top: 6px; padding-top: 6px; }
  .vask:has(.cal) .vask__err { margin: 4px 0 2px; }
}

/* Tränke: Luft zwischen Text und Fußzeile; einzelner letzter Trank mittig bei 2 Spalten */
.voucher__body { padding-bottom: 16px; }
@media (min-width: 414px) and (max-width: 600px) {
  .potion:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 11px); }
}

/* Hauptseite: dunkler Hintergrund hinter der oberen Leiste, sobald gescrollt wird */
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: -22px; z-index: -1;
  background: linear-gradient(180deg, rgba(7, 6, 10, .97) 0%, rgba(7, 6, 10, .92) 70%, rgba(7, 6, 10, 0) 100%);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
body.is-scrolled .topbar::before { opacity: 1; }
