/* Märchenbuch: gealtertes Papier, Goldknöpfe, Waldgrün und Rindenbraun.
   Fotoseiten randlos, Szenenseiten als Buchseite mit Goldrahmen und Ranken. */
:root {
  --forest: #1a2314;      /* Nachtwald hinter dem Buch */
  --moss: #3d5a2c;        /* Moos */
  --leaf: #5f7f3a;        /* helles Blattgrün */
  --bark: #4a2e16;        /* Rindenbraun (Tinte) */
  --bark-deep: #2a190b;
  --paper: #efe0bd;       /* Pergament */
  --paper-dark: #d9c193;
  --gold: #c9a043;
  --gold-hi: #f6e3a1;
  --gold-lo: #8a6420;
  --text: #3a2513;
  --muted: #7a5c3a;
  --display: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --title: "Cinzel", Georgia, serif;
  --body: "Alegreya", Georgia, "Times New Roman", serif;
  --metal: linear-gradient(145deg, #fff1bf 0%, #e7c463 18%, #b8862e 42%, #f3d77f 62%, #9a6c22 82%, #d9b358 100%);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42 0 0 0 0 .28 0 0 0 0 .12 0 0 0 .28 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --fibers: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='.012 .04' numOctaves='4' seed='7'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .33 0 0 0 0 .15 0 0 0 .16 0'/></filter><rect width='100%' height='100%' filter='url(%23f)'/></svg>");
  --vine: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'><g fill='none' stroke='%233d5a2c' stroke-width='2.4' stroke-linecap='round'><path d='M2 2c30 6 46 22 52 52 4 22 18 34 40 38'/><path d='M22 6c-2 10 2 18 10 22'/><path d='M50 40c8-6 18-6 26 0'/><path d='M60 78c-8 2-14 8-14 16'/></g><g fill='%235f7f3a'><path d='M32 28c8-2 14 2 16 10-8 2-14-2-16-10z'/><path d='M76 40c6 4 8 10 4 16-6-4-8-10-4-16z'/><path d='M46 94c-2-8 2-14 10-16 2 8-2 14-10 16z'/><path d='M12 18c6-6 14-6 18 0-6 6-14 6-18 0z'/></g><g fill='%23c9a043'><circle cx='94' cy='92' r='3'/><circle cx='54' cy='54' r='2.2'/><circle cx='84' cy='70' r='1.6'/></g></svg>");
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; width: 100%;
  overflow: hidden; position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, #2b3a20, var(--forest) 70%);
  color: var(--text);
  font-family: var(--body); font-size: 18px;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}

/* ---------- Buch & Seiten ---------- */
.book { position: absolute; inset: 0; perspective: 2000px; max-width: 500px; margin: 0 auto; }
.page {
  position: absolute; inset: 0;
  transform-origin: left center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  display: none; overflow: hidden;
  background: var(--paper);
  will-change: transform;
}
.page.show { display: block; }
.page.active { z-index: 2; }
.page.under { z-index: 1; }
.page.ontop { z-index: 3; }
.page.anim { transition: transform .6s cubic-bezier(.3,.7,.25,1); }
.page .shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 20;
  background: linear-gradient(90deg, rgba(42,25,11,.05), rgba(42,25,11,.55));
}
.page.anim .shade { transition: opacity .6s; }
.page::before { /* Buchrücken */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 22px; z-index: 15; pointer-events: none;
  background: linear-gradient(90deg, rgba(42,25,11,.45), rgba(42,25,11,.12) 45%, rgba(42,25,11,0));
}

/* Pergament-Fläche (Szenen- und Textseiten) */
.paper {
  background-color: var(--paper);
  background-image:
    var(--noise), var(--fibers),
    radial-gradient(ellipse at 15% 10%, rgba(255,250,230,.6), transparent 45%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(122,82,34,.35) 100%);
  box-shadow: inset 0 0 60px rgba(110,70,25,.35), inset 0 0 14px rgba(80,50,15,.4);
}
.paper::after { /* Ranken in den Ecken */
  content: ""; position: absolute; width: 120px; height: 120px; left: 8px; bottom: calc(70px + var(--sab));
  background: var(--vine) no-repeat; transform: rotate(-90deg); opacity: .8; pointer-events: none; z-index: 0;
}

/* ---------- Fotoseite ---------- */
.photo-page { background: var(--bark-deep); }
.photo-page > img.full {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: kenburns 18s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-2%, -1%); } }
.photo-page .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26,35,20,.55) 0%, rgba(26,35,20,0) 20%, rgba(26,35,20,0) 42%, rgba(30,22,10,.88) 78%, rgba(26,18,8,.97) 100%);
}
.photo-info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 22px calc(92px + var(--sab));
  color: #fbf1d6; display: grid; gap: 10px;
}
.badge {
  justify-self: start; position: relative;
  font: 700 13px/1 var(--title); letter-spacing: .12em; text-transform: uppercase;
  background: var(--metal); color: var(--bark-deep);
  padding: 8px 16px; border-radius: 4px;
  box-shadow: 0 2px 0 var(--gold-lo), 0 6px 14px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.7);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}
.photo-info h1 {
  font: 900 clamp(30px, 9vw, 40px)/1.08 var(--display); margin: 0;
  text-wrap: balance; color: #fff3cf;
  text-shadow: 0 0 18px rgba(201,160,67,.55), 0 2px 4px rgba(0,0,0,.7);
}
.erkennen { margin: 0; font-size: 18px; line-height: 1.45; }
.erkennen strong {
  color: var(--gold-hi); display: block; font: 700 12.5px var(--title);
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 3px;
}
.hinweis {
  margin: 0; font-size: 15px; line-height: 1.4; font-style: italic;
  background: rgba(61,90,44,.55); border: 1px solid rgba(246,227,161,.35);
  padding: 9px 12px; border-radius: 10px;
}
.credit {
  position: absolute; right: 10px; top: calc(10px + var(--sat));
  font: 500 11px var(--body); color: rgba(255,245,220,.9);
  background: rgba(26,18,8,.45); padding: 4px 8px; border-radius: 6px;
  text-decoration: none; max-width: 70%; z-index: 5;
}
.scene-credit { top: auto; bottom: 10px; right: 10px; }
.swipe-hint {
  justify-self: end; display: flex; align-items: center; gap: 8px;
  font: 700 15px var(--title); letter-spacing: .06em; color: var(--gold-hi);
}
.swipe-hint span { display: inline-block; animation: nudge 1.6s ease-in-out infinite; font-size: 22px; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

.nophoto {
  position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 40%;
  background:
    radial-gradient(circle at 50% 35%, rgba(201,160,67,.32), transparent 50%),
    radial-gradient(circle at 15% 85%, rgba(95,127,58,.4), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(95,127,58,.3), transparent 40%),
    var(--forest);
}
.nophoto svg { width: 42%; max-width: 200px; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 0 18px rgba(246,227,161,.5)); }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }

/* ---------- Szenenseite ---------- */
.scene-page { display: flex; flex-direction: column; padding-top: calc(var(--sat) + 16px); }
.scene-page > * { position: relative; z-index: 1; }
.scene-frame {
  position: relative; margin: 0 18px; flex: none;
  aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden;
  background: var(--forest);
  border: 7px solid transparent;
  background-image: linear-gradient(var(--forest), var(--forest)), var(--metal);
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: 0 0 0 1.5px var(--gold-lo), 0 0 0 4px rgba(246,227,161,.6), 0 0 0 5.5px var(--gold-lo),
              0 14px 28px rgba(60,35,10,.45), inset 0 0 18px rgba(0,0,0,.6);
}
.scene-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame-gem { /* Edelstein-Ecken */
  position: absolute; width: 16px; height: 16px; z-index: 3; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #c8f0a0, #4d7a2a 55%, #1f3a12);
  border: 2px solid var(--gold); border-radius: 50%;
  box-shadow: 0 0 8px rgba(160,220,110,.7);
}
.scene-wrap { position: relative; }
.scene-wrap .frame-gem.tl { left: 10px; top: -6px; } .scene-wrap .frame-gem.tr { right: 10px; top: -6px; }
.scene-wrap .frame-gem.bl { left: 10px; bottom: -6px; } .scene-wrap .frame-gem.br { right: 10px; bottom: -6px; }
.scene-missing {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--gold-hi); font: 700 19px/1.3 var(--display); padding: 20px;
  background:
    radial-gradient(circle at 30% 30%, rgba(95,127,58,.55), transparent 60%),
    radial-gradient(circle at 75% 70%, rgba(201,160,67,.35), transparent 55%),
    var(--forest);
}
.scene-missing small { display: block; font: italic 500 14px var(--body); opacity: .85; margin-top: 6px; }
.ornament {
  display: flex; align-items: center; gap: 10px; margin: 14px 22px 0;
  font: 700 11.5px var(--title); letter-spacing: .14em; text-transform: uppercase; color: var(--moss);
}
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.ornament span { text-align: center; max-width: 78%; }
.scene-text {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-y; overscroll-behavior: contain;
  padding: 8px 22px calc(100px + var(--sab));
  -webkit-user-select: text; user-select: text;
  mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 80px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 80px), transparent 100%);
}
.scene-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.scene-head h2 { font: 700 23px/1.15 var(--display); margin: 0; color: var(--bark); text-wrap: balance; }
.scene-text p { margin: 0 0 14px; line-height: 1.6; font-size: 19px; }
.scene-text p.lead::first-letter {
  float: left; font: 900 54px/0.85 var(--display); color: var(--moss);
  margin: 6px 8px 0 0; text-shadow: 1px 1px 0 var(--gold);
}
.auftrag {
  position: relative; margin-top: 8px; padding: 16px 18px 16px 18px;
  background: rgba(255,248,226,.55);
  border: 1.5px solid rgba(138,100,32,.55); border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(255,248,226,.35), 0 0 0 5px rgba(138,100,32,.35), 0 6px 14px rgba(90,55,15,.15);
}
.auftrag::before { /* Wachssiegel */
  content: "✦"; position: absolute; right: -8px; top: -14px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: #f3d9a0; font-size: 17px;
  background: radial-gradient(circle at 35% 30%, #7fa45a, var(--moss) 55%, #22361a);
  box-shadow: 0 3px 6px rgba(0,0,0,.35), inset 0 0 0 3px rgba(0,0,0,.15);
}
.auftrag b { display: block; font: 700 15px var(--title); letter-spacing: .06em; color: var(--moss); margin-bottom: 4px; }
.auftrag p { margin: 0; font-size: 18px; font-style: italic; }

/* ---------- Goldknöpfe ---------- */
.speak, .knob, .open-btn {
  border: 0; cursor: pointer; color: var(--bark-deep);
  background: var(--metal);
  box-shadow:
    inset 0 2px 1px rgba(255,255,255,.75), inset 0 -3px 4px rgba(90,60,15,.55),
    0 0 0 2px var(--gold-lo), 0 0 0 4px rgba(246,227,161,.5), 0 0 0 5px var(--gold-lo),
    0 8px 18px rgba(30,15,5,.5);
}
.speak {
  flex: none; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
}
.speak::before { /* eingravierter Ring */
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border: 1.5px dashed rgba(90,60,15,.55); pointer-events: none;
}
.speak svg { width: 25px; height: 25px; filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)); }
.speak .ico-stop { display: none; }
.speak.playing .ico-play { display: none; }
.speak.playing .ico-stop { display: block; }
.speak.playing::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 3px solid var(--gold); animation: ring 1.3s ease-out infinite;
}
.speak.loading { filter: saturate(.6) brightness(.9); }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.speak:active, .knob:active, .open-btn:active { transform: translateY(1px) scale(.97); }
.speak:focus-visible, .knob:focus-visible, .open-btn:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 5px; }

/* ---------- Startbild ---------- */
.cover { background: var(--bark-deep); color: #fff; display: grid; grid-template-columns: minmax(0, 1fr); align-content: end; padding: 0 22px calc(28px + var(--sab)); }
.cover .stage { position: absolute; inset: 0; animation: breathe 22s ease-in-out infinite alternate; transform-origin: 30% 40%; }
.cover img.full { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.cover canvas.magic, .cover canvas.burst { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cover canvas.burst { z-index: 4; }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.07); } }
.cover .veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,35,20,.35) 0%, rgba(26,35,20,0) 14%, rgba(26,35,20,0) 64%, rgba(30,22,10,.88) 84%, rgba(26,18,8,.97) 100%); }
.cover-inner { position: relative; display: grid; gap: 12px; min-width: 0; z-index: 3; }
.cover-inner > * { min-width: 0; }
.cover .eyebrow { font: 700 12px var(--title); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-hi); text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.cover h1 { margin: 0; font: 900 clamp(27px, 8.2vw, 38px)/1.08 var(--display); text-wrap: balance; }
.shimmer span {
  display: inline-block;
  background: linear-gradient(100deg, #fff5d6 0%, #fff5d6 36%, #ffe7a3 44%, #e3b341 50%, #ffe7a3 56%, #fff5d6 64%, #fff5d6 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.7)) drop-shadow(0 0 14px rgba(201,160,67,.4));
  animation: wordIn .8s cubic-bezier(.2,.8,.2,1.2) both, sheen 4.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * 120ms + 300ms), calc(var(--i) * 90ms + 1.6s);
}
@keyframes wordIn { from { opacity: 0; transform: translateY(14px) scale(.9); filter: blur(6px); } to { opacity: 1; transform: none; } }
@keyframes sheen { 0% { background-position: 100% 0; } 45%, 100% { background-position: -50% 0; } }
.cover-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.open-btn {
  flex: 1; border-radius: 999px; padding: 15px 20px;
  font: 700 16px var(--title); letter-spacing: .08em; text-transform: uppercase; text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
.speak.greet { width: 64px; height: 64px; animation: callme 2.2s ease-out infinite; }
.speak.greet.playing { animation: none; }
@keyframes callme { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18) drop-shadow(0 0 14px rgba(246,227,161,.85)); } }
body.on-cover .pager { opacity: 0; pointer-events: none; }

/* ---------- Textseite (Für die Großen) ---------- */
.text-page { padding: calc(var(--sat) + 30px) 24px calc(110px + var(--sab)); overflow-y: auto; touch-action: pan-y; }
.text-page > * { position: relative; z-index: 1; }
.text-page h2 { font: 700 26px/1.15 var(--display); color: var(--bark); margin: 0 0 14px; }
.text-page h3 { font: 700 15px var(--title); letter-spacing: .1em; text-transform: uppercase; color: var(--moss); margin: 24px 0 8px; }
.text-page p, .text-page li { line-height: 1.55; font-size: 16.5px; }
.text-page ul { padding-left: 18px; margin: 0; }
.text-page a { color: var(--moss); font-weight: 700; word-break: break-word; }

h1, h2 { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }

/* ---------- Blätterleiste ---------- */
.pager {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px max(16px, env(safe-area-inset-left, 0px)) calc(12px + var(--sab)) max(16px, env(safe-area-inset-right, 0px));
  max-width: 500px; margin: 0 auto; pointer-events: none; transition: opacity .3s;
}
.knob {
  pointer-events: auto; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
}
.knob::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1.5px solid rgba(90,60,15,.45); }
.knob svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)); }
.knob:disabled { filter: grayscale(.7) brightness(.8); opacity: .45; }
.counter {
  position: relative; font: 700 14px var(--title); letter-spacing: .08em; color: var(--gold-hi);
  padding: 8px 20px; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #4e6e36, var(--moss) 55%, #2b411e);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Glühwürmchen über allem */
#fireflies { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

@media (prefers-reduced-motion: reduce) {
  .photo-page > img.full, .swipe-hint span, .nophoto svg, .cover .stage, .speak.greet { animation: none; }
  .shimmer span { animation: none; color: #fff5d6; background: none; }
  .page.anim { transition-duration: .2s; }
  #fireflies { display: none; }
}

/* ---------- Schlosskarte ---------- */
.map-page {
  display: flex; flex-direction: column;
  padding: calc(var(--sat) + 20px) 0 calc(84px + var(--sab));
  background: radial-gradient(ellipse at 50% 40%, #1b2a44, #0d1424 70%);
}
.map-head { text-align: center; padding: 0 20px; }
.map-head h2 {
  font: 900 23px/1.12 var(--display); margin: 0; text-wrap: balance; color: var(--gold-hi);
  text-shadow: 0 0 16px rgba(201,160,67,.6), 0 2px 3px rgba(0,0,0,.8);
}
.map-head p { margin: 6px 0 0; font-style: italic; font-size: 16px; color: rgba(246,227,161,.8); }
.map-box { flex: 1; min-height: 0; margin-top: 8px; position: relative; }
.map-box svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-note { margin: 6px 20px 0; text-align: center; font-size: 13.5px; font-style: italic; color: rgba(246,227,161,.7); }
.trail { animation: march 3s linear infinite; }
@keyframes march { to { stroke-dashoffset: -100; } }
.trail-spark { filter: drop-shadow(0 0 10px #ffd86b); }
.medal { cursor: pointer; outline: none; }
.medal-halo { fill: rgba(255,214,120,.22); animation: halo 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.medal:active .medal-halo, .medal:focus-visible .medal-halo { fill: rgba(255,236,170,.6); }
@keyframes halo { 0%,100% { opacity: .5; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.05); } }
.medal-nr { font: 900 30px var(--display); fill: #3a2513; }
.medal-label {
  font: 700 31px var(--title); letter-spacing: .02em; fill: #fff0c2;
  paint-order: stroke; stroke: rgba(13,20,36,.92); stroke-width: 9px; stroke-linejoin: round;
}
.visited-ring { opacity: 0; }
.medal.visited .visited-ring { opacity: 1; }
@keyframes popIn { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
.counter { cursor: pointer; pointer-events: auto; }
.page.pagein { animation: pagein .6s ease-out; }
@keyframes pagein { from { opacity: 0; filter: brightness(1.6) blur(4px); transform: scale(1.04); } to { opacity: 1; filter: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { .trail, .medal, .medal-halo, .page.pagein { animation: none; } .trail-spark { display: none; } }

.open-btn { white-space: nowrap; font-size: 15px; letter-spacing: .05em; padding-inline: 14px; }

/* Eingangsbild */
.intro { cursor: pointer; }
.intro .veil { background: linear-gradient(180deg, rgba(26,18,8,.25) 0%, rgba(26,18,8,0) 12%, rgba(26,18,8,0) 78%, rgba(26,18,8,.85) 100%); }
.intro-hint {
  position: absolute; left: 0; right: 0; bottom: calc(34px + var(--sab)); z-index: 3; text-align: center;
  font: 700 15px var(--title); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-hi);
  text-shadow: 0 0 12px rgba(201,160,67,.8), 0 2px 4px rgba(0,0,0,.8);
  animation: hintPulse 2.4s ease-in-out infinite;
}
.intro-hint span { display: inline-block; animation: spin 6s linear infinite; }
@keyframes hintPulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .intro-hint, .intro-hint span { animation: none; } }

/* Szenenbilder im Hochformat: hoher Rahmen, langsamer Schwenk, Vollbild beim Tippen */
.scene-frame { aspect-ratio: auto; height: min(52dvh, 460px); }
.scene-frame.has-img { cursor: zoom-in; }
.scene-frame .scene-img { animation: pan 20s ease-in-out infinite alternate; }
@keyframes pan { from { object-position: 50% 0%; } to { object-position: 50% 100%; } }
.zoom-hint {
  position: absolute; left: 10px; bottom: 10px; z-index: 5;
  font: 700 11px var(--title); letter-spacing: .06em; color: var(--bark-deep);
  background: var(--metal); padding: 5px 10px; border-radius: 99px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(10,8,4,.94);
  display: grid; place-items: center; padding: calc(var(--sat) + 10px) 10px calc(var(--sab) + 40px);
  animation: lbIn .25s ease-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 0 0 2px var(--gold-lo), 0 0 40px rgba(201,160,67,.35); }
.lightbox-close { position: absolute; bottom: calc(var(--sab) + 14px); left: 0; right: 0; text-align: center; font: 700 13px var(--title); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-hi); }
.lightbox.out { opacity: 0; transition: opacity .25s; }
@keyframes lbIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scene-frame .scene-img { animation: none; object-position: 50% 30%; } }

/* Durchs Tor fliegen */
.intro .stage { transform-origin: 50% 58%; }
.intro.entering .stage { animation: none; transform: scale(3.2); filter: brightness(1.5) blur(1.5px); transition: transform 1.3s cubic-bezier(.55,0,.75,.3), filter 1.3s ease-in; }
.intro::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 56%, #fffbe8 0%, #ffe7a3 35%, rgba(255,214,120,.0) 75%);
}
.intro.entering::after { opacity: 1; transition: opacity .9s ease-in .5s; }
.intro.entering .intro-hint { opacity: 0; transition: opacity .3s; animation: none; }

/* ===== Neuer Zierrahmen, verdeckte Bilder, magischer Scrollbalken ===== */
.paper::after { display: none; }                 /* keine Ranken mehr */
.scene-page { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; padding-top: calc(var(--sat) + 10px); }
.scroller { scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
/* Goldrahmen wie vorher */
.scene-wrap { position: relative; margin: 0 18px; }
.scene-frame {
  position: relative; height: min(52dvh, 460px); margin: 0;
  border-radius: 6px; overflow: hidden; border: 7px solid transparent;
  background-image: linear-gradient(var(--forest), var(--forest)), var(--metal);
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: 0 0 0 1.5px var(--gold-lo), 0 0 0 4px rgba(246,227,161,.6), 0 0 0 5.5px var(--gold-lo),
              0 14px 28px rgba(60,35,10,.45), inset 0 0 18px rgba(0,0,0,.6);
}
.scene-window {
  position: absolute; inset: 0; overflow: hidden; z-index: 1;
  background:
    radial-gradient(circle at 50% 50%, rgba(246,227,161,.12), transparent 60%),
    linear-gradient(135deg, #1f3317 0%, #3d5a2c 45%, #4a2e16 75%, #1a2314 100%);
}
.scene-window::before {
  content: "✦ Simsalabim ✦"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 17px var(--display); color: rgba(246,227,161,.95);
}
.scene-window .scene-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%;
  animation: pan 20s ease-in-out infinite alternate; visibility: hidden; z-index: 1;
}
.scene-window.revealed .scene-img { visibility: visible; }
.scene-window .scene-missing { z-index: 1; }
.scene-window:not(.revealed) .scene-missing, .scene-window:not(.revealed) .zoom-hint, .scene-window:not(.revealed) .credit { visibility: hidden; }
.scene-window canvas.glitter { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; }
.scene-window .zoom-hint { z-index: 4; }
.scene-text { flex: none; overflow: visible; mask-image: none; -webkit-mask-image: none; padding: 4px 24px calc(110px + var(--sab)); }
.ornament { margin-top: 6px; }

.rail {
  position: absolute; right: 6px; top: calc(var(--sat) + 18px); bottom: calc(100px + var(--sab));
  width: 18px; z-index: 16; pointer-events: none; opacity: .75; transition: opacity .3s;
}
.rail::before {
  content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--gold) 12%, var(--gold) 88%, transparent);
  opacity: .5;
}
.rail-thumb {
  position: absolute; left: 0; top: 0; width: 18px; height: 26px; display: grid; place-items: center;
  font-size: 17px; line-height: 1; color: #fff3c0;
  text-shadow: 0 0 6px #ffd86b, 0 0 12px #e3b341;
}
.rail.active { opacity: 1; }
.rail.active .rail-thumb { text-shadow: 0 0 8px #fff, 0 0 16px #ffd86b, 0 0 28px #e3b341; }

/* Zierrahmen als 9-teiliges Rahmenbild: Ecken, Wappen, Fuchs und Schildkröte bleiben unverzerrt,
   nur die glatten Seiten werden gestreckt. Maße aus dem Rahmenbild (1374 × 1145 px). */
.scene-wrap { margin: 0 12px; --fw: calc(min(100vw, 500px) - 24px); }
.scene-frame {
  height: min(54dvh, 480px); border-radius: 0; overflow: visible; background: none; box-shadow: none;
  border-style: solid;
  border-width: calc(var(--fw) * 165 / 1374) calc(var(--fw) * 96 / 1374) calc(var(--fw) * 153 / 1374) calc(var(--fw) * 92 / 1374);
  border-image: url("img/rahmen.webp") 165 96 153 92 stretch;
  filter: drop-shadow(0 10px 16px rgba(60,35,10,.35));
}
.scene-window { border-radius: 2px; }
.scene-wrap .frame-gem { display: none; }
.scene-page .ornament { margin-top: 18px; }
