/* Kakusei – Demo-Webseite */

@property --sweep { syntax: '<percentage>'; inherits: true; initial-value: 130%; }
@property --r { syntax: '<percentage>'; inherits: true; initial-value: 0%; }

:root {
  --ink: #0c0a09;
  --ink-2: #15110e;
  --ink-3: #1f1915;
  --line: #3a312a;
  --paper: #efe6d5;
  --paper-2: #e2d5bd;
  --graphite: #2a2522;
  --text: #ece4d6;
  --muted: #a69c8e;
  --red: #d2402f;
  --red-deep: #7c1c14;
  --gold: #cfa95e;
  --sky: #9cc3e4;
  --spore: #8ff0d0;

  --f-head: "Shippori Mincho B1", "Yu Mincho", Georgia, serif;
  --f-body: "Zen Kaku Gothic New", "Segoe UI", system-ui, sans-serif;
  --f-hand: "Caveat", "Segoe Print", cursive;

  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1180px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Körnung über allem */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) calc(var(--gutter) + env(safe-area-inset-right, 0px)) 14px calc(var(--gutter) + env(safe-area-inset-left, 0px));
  background: linear-gradient(to bottom, rgba(12,10,9,.92), rgba(12,10,9,0));
  transition: background .3s;
}
.nav.solid { background: rgba(12,10,9,.94); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand .kanji { font-family: var(--f-head); font-size: 26px; color: var(--red); line-height: 1; }
.brand .latin { font-family: var(--f-head); letter-spacing: .32em; font-size: 14px; }
.nav ul { list-style: none; display: flex; gap: clamp(14px, 3vw, 32px); margin: 0; padding: 0; }
.nav a.link { text-decoration: none; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 6px 0; position: relative; }
.nav a.link:hover, .nav a.link[aria-current="page"] { color: var(--text); }
.nav a.link[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red); }

/* ---------- Gemeinsame Bausteine ---------- */
.eyebrow { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin: 0 0 14px; }
.hand { font-family: var(--f-hand); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; line-height: 1.15; margin: 0; }
.lead { font-size: clamp(18px, 2.2vw, 21px); color: #d9cfbf; max-width: 46ch; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 13px 22px; border: 1px solid var(--red); background: var(--red); color: #fff;
  text-decoration: none; font-size: 15px; letter-spacing: .06em; border-radius: 2px;
  transition: transform .2s, background .2s;
}
.btn:hover { background: #e24c3a; transform: translateY(-2px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.reveal { transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.js .reveal:not(.in) { opacity: 0; transform: translateY(28px); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: grid; place-items: center; text-align: center;
  overflow: hidden; padding: 120px var(--gutter) 90px;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 120%, rgba(210,64,47,.28), transparent 60%),
              radial-gradient(ellipse at 50% 40%, transparent 30%, var(--ink) 85%);
  pointer-events: none; z-index: 1;
}
.hero-inner { position: relative; z-index: 2; }
.hero-kanji { width: min(560px, 82vw); height: auto; overflow: visible; }
.hero-kanji text {
  font-family: var(--f-head); font-weight: 800; font-size: 200px;
  fill: transparent; stroke: var(--text); stroke-width: 1.4;
  stroke-dasharray: 1600; stroke-dashoffset: 1600;
  animation: draw 2.2s cubic-bezier(.6,.1,.3,1) .1s forwards, fillin 1.2s ease 1.7s forwards;
}
.hero-kanji text + text { animation-delay: .5s, 2s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fillin { to { fill: var(--text); stroke: transparent; } }
.hero-title { font-family: var(--f-head); letter-spacing: .55em; margin: 10px 0 4px; font-size: clamp(22px, 4vw, 34px); padding-left: .55em; opacity: 0; animation: fadeUp 1s ease 1.8s forwards; }
.hero-sub { color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-size: 13px; opacity: 0; animation: fadeUp 1s ease 2s forwards; margin: 0; }
.hero-tag { margin: 34px auto 0; max-width: 34ch; font-size: clamp(17px, 2.2vw, 20px); color: #d6ccbc; opacity: 0; animation: fadeUp 1s ease 2.3s forwards; }
.scroll-cue { position: absolute; z-index: 2; bottom: 28px; left: 50%; transform: translateX(-50%); font-size: 12px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; text-decoration: none; opacity: 0; animation: fadeUp 1s ease 2.8s forwards; }
.scroll-cue::after { content: ""; display: block; width: 1px; height: 46px; margin: 10px auto 0; background: linear-gradient(var(--muted), transparent); animation: cue 2s ease-in-out infinite; transform-origin: top; }
@media (max-height: 760px) { .scroll-cue { display: none; } }
@keyframes cue {0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Prolog ---------- */
.prolog-intro { padding-top: 120px; padding-bottom: 40px; }
.prolog-intro h2 { font-size: clamp(34px, 6vw, 62px); max-width: 16ch; }
.prolog-intro .lead { margin-top: 22px; }

.timeline { position: relative; padding-top: 40px; padding-bottom: 60px; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
  background: linear-gradient(transparent, var(--line) 6%, var(--line) 94%, transparent);
}
.station {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 90px);
  align-items: center; padding: 70px 0;
}
.station::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--ink); border: 1px solid var(--gold);
  transition: background .6s, box-shadow .6s;
}
.station.in::before { background: var(--gold); box-shadow: 0 0 18px var(--gold); }
.station:nth-child(even) .station-text { order: 2; }
.station-text .log { font-family: var(--f-hand); color: var(--gold); font-size: 22px; margin: 0 0 6px; }
.station-text h3 { font-size: clamp(26px, 3.6vw, 38px); margin-bottom: 16px; }
.station-text p { margin: 0 0 12px; color: #d8cebf; }
.station-text .whisper { color: var(--muted); font-size: 15px; border-left: 2px solid var(--line); padding-left: 14px; margin-top: 18px; }

.scene {
  position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: #07090c;
  overflow: hidden; border-radius: 2px;
}
.scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .cap { position: absolute; left: 14px; bottom: 10px; font-family: var(--f-hand); font-size: 19px; color: rgba(236,228,214,.75); z-index: 2; }
.js .station:not(.in) .scene * { animation-play-state: paused !important; }

/* Szene 1: Erde */
.earth-glow { animation: pulse 5s ease-in-out infinite; transform-origin: 50% 50%; transform-box: fill-box; }
.earth-storm { animation: spin 40s linear infinite; transform-origin: 50% 50%; transform-box: fill-box; }
.ark-rise { animation: rise 7s cubic-bezier(.5,0,.3,1) infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(190px, -170px); opacity: 0; } }
.protest { animation: bob 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
.protest:nth-child(2n) { animation-delay: -.5s; }
.protest:nth-child(3n) { animation-delay: -.9s; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-3deg); } }

/* Szene 2: 200 Plätze */
.seats { position: absolute; inset: 14% 10% 22%; display: grid; grid-template-columns: repeat(20, 1fr); gap: 6px; align-content: center; }
.seats i { aspect-ratio: 1; border-radius: 50%; background: var(--text); opacity: .1; transform: scale(.4); transition: opacity .5s, transform .5s, background .5s; }
.seats i.on { opacity: .9; transform: scale(1); }
.seats i.on.f { background: var(--gold); }

/* Szene 3: Vorräte und Radar */
.supply-bar { animation: drain 9s linear infinite; transform-origin: left; transform-box: fill-box; }
@keyframes drain { 0% { transform: scaleX(1); } 85% { transform: scaleX(.06); } 100% { transform: scaleX(.06); } }
.radar-sweep { animation: spin 4s linear infinite; transform-origin: 0 0; }
.radar-blip { animation: blip 4s linear infinite; }
@keyframes blip { 0%, 22% { opacity: 0; } 24% { opacity: 1; } 40% { opacity: .2; } 100% { opacity: 0; } }

/* Szene 4: Wurmloch */
.wh-ring { transform-origin: 300px 225px; animation: spin 12s linear infinite; }
.wh-ring:nth-of-type(2) { animation-duration: 8s; animation-direction: reverse; }
.wh-ring:nth-of-type(3) { animation-duration: 5s; }
.wh-ring:nth-of-type(4) { animation-duration: 3s; animation-direction: reverse; }
.wh-ship { animation: fall 6s cubic-bezier(.6,0,.4,1) infinite; transform-origin: 300px 225px; }
@keyframes fall { 0% { transform: translate(-230px, 150px) scale(1.4) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(0, 0) scale(0) rotate(540deg); opacity: 0; } }

/* Szene 5: Nanos */
.planet-a { animation: drift 18s ease-in-out infinite alternate; }
.planet-b { animation: drift 24s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(-18px, 8px); } }
.nanos-dot { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .5; } }
.nanos-label { opacity: 0; animation: fadeUp 1.2s ease 1.6s forwards; }

/* Szene 6: Landung */
.spore { animation: spore 6s linear infinite; }
@keyframes spore { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translate(var(--dx, 10px), -230px); opacity: 0; } }
.crystal-glow { animation: pulse 4s ease-in-out infinite; }

/* Szene 7: Die Nacht */
.pods { position: absolute; inset: 12% 8% 20%; display: grid; grid-template-columns: repeat(16, 1fr); gap: 7px; align-content: center; }
.pods i { aspect-ratio: 1 / 1.5; border-radius: 40%; background: #7fd3ff; box-shadow: 0 0 8px #7fd3ff; opacity: .85; transition: opacity 1.4s ease, box-shadow 1.4s, background 1.4s; }
.pods i.off { opacity: .08; box-shadow: none; background: #3b4a55; }
.pods i.born { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* Szene 8: Bauwerk */
.tower path, .tower line, .tower rect, .tower polyline { stroke-dasharray: 600; stroke-dashoffset: 600; }
.station.in .tower path, .station.in .tower line, .station.in .tower rect, .station.in .tower polyline { animation: draw 3.5s ease forwards; }
.station.in .tower > *:nth-child(2n) { animation-delay: .5s; }
.station.in .tower > *:nth-child(3n) { animation-delay: 1s; }

/* Zeitsprung */
.leap { position: relative; min-height: 90svh; display: grid; place-items: center; text-align: center; overflow: hidden; padding: 80px var(--gutter); }
.leap::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, rgba(210,64,47,.35), transparent 55%); opacity: 0; transition: opacity 2.4s ease; }
.leap.in::before { opacity: 1; }
.leap h2 { font-size: clamp(42px, 9vw, 120px); letter-spacing: .04em; }
.leap h2 span { display: inline-block; transition: opacity 1.4s ease, filter 1.4s ease, transform 1.4s ease; }
.js .leap:not(.in) h2 span { opacity: 0; filter: blur(14px); transform: scale(1.08); }
.leap h2 span:nth-child(2) { transition-delay: .5s; }
.leap h2 span:nth-child(3) { transition-delay: 1s; }
.leap p { position: relative; color: var(--muted); max-width: 40ch; margin: 24px auto 0; }

/* Teaser zur Welt */
.world { padding-top: 40px; padding-bottom: 110px; }
.world-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 40px 0 70px; }
.world-grid > div { background: var(--ink-2); padding: 28px 26px; }
.world-grid .num { font-family: var(--f-head); font-size: 40px; color: var(--red); line-height: 1; }
.world-grid h3 { font-size: 20px; margin: 12px 0 8px; }
.world-grid p { margin: 0; color: var(--muted); font-size: 15px; }

.teaser { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(28px, 6vw, 80px); align-items: center; }
.teaser h2 { font-size: clamp(30px, 4.6vw, 48px); margin-bottom: 18px; }
.teaser p { color: #d6ccbc; }
.teaser .btn { margin-top: 18px; }
.teaser-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.teaser-cards .sk { aspect-ratio: 3 / 4; border-radius: 2px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.teaser-cards a:nth-child(odd) { transform: translateY(18px) rotate(-1.2deg); }
.teaser-cards a:nth-child(even) { transform: rotate(1deg); }
.teaser-cards a { display: block; transition: transform .4s; }
.teaser-cards a:hover { transform: translateY(-6px) rotate(0); }

.footer { border-top: 1px solid var(--line); padding: 34px 0 44px; color: var(--muted); font-size: 13px; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 30px; }

/* ---------- Skizzen-Komponente ---------- */
.sk {
  position: relative; overflow: hidden; isolation: isolate;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .3 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(120,95,60,.22));
}
.sk-layer { position: absolute; inset: 0; }
.sk img {
  position: absolute; left: 50%; top: 50%; max-width: none; height: auto;
  width: calc(var(--z, 1) * 100%);
  transform: translate(calc(var(--fx, .5) * -100%), calc(var(--fy, .5) * -100%));
  user-select: none; pointer-events: none;
}
.sk-pencil {
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(168deg, #000 calc(var(--sweep) - 14%), transparent var(--sweep));
          mask-image: linear-gradient(168deg, #000 calc(var(--sweep) - 14%), transparent var(--sweep));
}
.sk-pencil .b { filter: grayscale(1) contrast(1.25) brightness(1.06); }
.sk-pencil .d { filter: grayscale(1) invert(1) blur(1.4px); mix-blend-mode: color-dodge; }
.sk-color, .sk-true {
  opacity: 0;
  -webkit-mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 55%), #000 var(--r), transparent calc(var(--r) + 28%));
          mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 55%), #000 var(--r), transparent calc(var(--r) + 28%));
  transition: --r 1.1s cubic-bezier(.3,.6,.2,1), opacity .25s;
}
.sk.colored .sk-color { opacity: 1; --r: 150%; }
.sk-true { background: var(--paper); }
.sk-hatch { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
.sk-hatch path { fill: none; stroke: var(--graphite); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.js .sk:not(.drawn) .sk-pencil { --sweep: 0%; }
.sk.drawn .sk-pencil { animation: sweep 1.5s cubic-bezier(.45,.1,.3,1) both; }
.sk.drawn .sk-hatch { animation: hatchFade 2.1s ease both; }
.sk.drawn .sk-hatch path { animation: hatch 1.3s ease forwards; }
@keyframes sweep { from { --sweep: 0%; } to { --sweep: 130%; } }
@keyframes hatch { to { stroke-dashoffset: 0; } }
@keyframes hatchFade { 0% { opacity: .55; } 60% { opacity: .45; } 100% { opacity: 0; } }

/* Illusion: wahre Gestalt flackert durch */
.sk.unveiled .sk-true { opacity: 1; --r: 150%; animation: flicker .9s steps(1, end); }
@keyframes flicker {
  0% { opacity: 0; } 8% { opacity: 1; } 14% { opacity: 0; } 24% { opacity: .9; } 30% { opacity: 0; }
  42% { opacity: 1; } 48% { opacity: .2; } 60% { opacity: 1; } 100% { opacity: 1; }
}
.sk.unveiled .sk-pencil, .sk.unveiled .sk-color { animation: jitter .9s steps(2, end); }
@keyframes jitter { 0%, 100% { transform: none; } 20% { transform: translate(-3px, 1px); } 40% { transform: translate(2px, -1px); } 60% { transform: translate(-1px, 0); } }

/* ---------- Figuren-Seite ---------- */
.page-head { padding-top: 130px; padding-bottom: 30px; position: relative; }
.page-head h1 { font-size: clamp(40px, 7vw, 76px); }
.page-head .lead { margin-top: 18px; }

.levels { display: flex; flex-wrap: wrap; gap: 8px; margin: 34px 0 0; padding: 0; list-style: none; }
.levels li { border: 1px solid var(--line); padding: 7px 12px; font-size: 13px; color: var(--muted); border-radius: 2px; }
.levels b { color: var(--text); font-weight: 700; margin-right: 6px; }


.subnav { position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 40; background: rgba(12,10,9,.94); border-bottom: 1px solid var(--line); margin-top: 30px; }
.subnav ul { list-style: none; margin: 0 auto; padding: 0 var(--gutter); display: flex; gap: 6px; overflow-x: auto; max-width: var(--maxw); scrollbar-width: none; }
.subnav a { display: block; white-space: nowrap; padding: 13px 12px; text-decoration: none; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a.active { color: var(--text); border-color: var(--red); }

.group { padding: 70px 0 20px; scroll-margin-top: 110px; }
.group-head { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; align-items: end; margin-bottom: 38px; }
.group-head .gnum { font-family: var(--f-head); font-size: 64px; line-height: .8; color: var(--red); grid-row: span 2; }
.group-head h2 { font-size: clamp(28px, 4vw, 40px); }
.group-head p { margin: 0; color: var(--muted); max-width: 60ch; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 34px 26px; }
.card {
  position: relative; text-align: left; cursor: pointer; background: none; border: 0; padding: 0;
  transform: rotate(var(--tilt, 0deg)); transition: transform .45s cubic-bezier(.2,.7,.2,1);
}
.card:hover, .card:focus-visible { transform: rotate(0) translateY(-6px); }
.card .sk { aspect-ratio: 3 / 4; border-radius: 2px; box-shadow: 0 14px 34px rgba(0,0,0,.55); }
.card::before {
  content: ""; position: absolute; z-index: 3; top: -9px; left: 50%; width: 74px; height: 20px; margin-left: -37px;
  background: rgba(226,213,189,.55); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.card .note { position: absolute; z-index: 2; right: 10px; top: 10px; font-family: var(--f-hand); font-size: 20px; color: var(--graphite); transform: rotate(4deg); line-height: 1; }
.card .num-badge { position: absolute; z-index: 2; left: 10px; top: 10px; font-family: var(--f-head); font-size: 13px; color: var(--paper); background: var(--graphite); padding: 3px 8px; }
.card-meta { padding: 14px 4px 0; }
.card-meta h3 { font-size: 22px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card-meta h3 .k { font-size: 16px; color: var(--red); font-weight: 600; }
.card-meta .mean { font-family: var(--f-hand); font-size: 20px; color: var(--gold); line-height: 1.2; }
.card-meta .role { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card .hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 26px 10px 9px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; text-align: center; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.55)); opacity: 0; transition: opacity .3s; }
.card:hover .hint, .card:focus-visible .hint { opacity: 1; }


/* ---------- Detail-Dialog ---------- */
dialog.detail {
  width: min(1240px, 100vw - 24px); max-height: calc(100svh - 24px); padding: 0; border: 1px solid var(--line);
  background: var(--ink-2); color: var(--text); border-radius: 3px; overflow: hidden;
}
dialog.detail::backdrop { background: rgba(5,4,3,.82); backdrop-filter: blur(3px); }
dialog.detail[open] { animation: dlg .45s cubic-bezier(.2,.7,.2,1); }
@keyframes dlg { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.detail-grid { display: grid; grid-template-columns: 1.35fr 1fr; max-height: calc(100svh - 26px); }
.detail-visual { position: relative; background: var(--ink); padding: 22px; display: flex; flex-direction: column; gap: 14px; justify-content: center; min-height: 0; }
.detail-visual .sk { width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.6); max-height: calc(100svh - 150px); }
.detail-visual .sk img { width: calc(var(--z, 1) * 100%); }
.view-switch { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.view-switch button { background: none; border: 1px solid var(--line); padding: 7px 14px; font-size: 13px; cursor: pointer; border-radius: 30px; color: var(--muted); }
.view-switch button[aria-pressed="true"] { border-color: var(--gold); color: var(--text); }
.detail-text { overflow-y: auto; padding: 38px 36px 40px; }
.detail-text h2 { font-size: clamp(32px, 4vw, 46px); display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.detail-text h2 .k { color: var(--red); font-size: .55em; }
.detail-text .mean { font-family: var(--f-hand); color: var(--gold); font-size: 24px; margin: 4px 0 2px; }
.detail-text .role { color: var(--muted); margin: 0 0 20px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 0 0 24px; }
.facts div { background: var(--ink-3); padding: 9px 12px; }
.facts dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 15px; }
.detail-text p { margin: 0 0 14px; color: #ddd3c3; }
.detail-text h4 { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 26px 0 10px; font-weight: 700; }
.traits { list-style: none; padding: 0; margin: 0; }
.traits li { position: relative; padding-left: 22px; margin-bottom: 6px; color: #d4cab9; font-size: 15px; }
.traits li::before { content: "✎"; position: absolute; left: 0; color: var(--muted); font-size: 13px; }
.quote { font-family: var(--f-head); font-size: 19px; border-left: 2px solid var(--red); padding-left: 16px; margin: 20px 0; color: var(--text); }
.dlg-close, .dlg-nav { position: absolute; z-index: 5; background: rgba(12,10,9,.75); border: 1px solid var(--line); width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 18px; display: grid; place-items: center; }
.dlg-close { top: 14px; right: 14px; }
.dlg-nav.prev { left: 14px; top: 14px; }
.dlg-nav.next { left: 64px; top: 14px; }
.dlg-close:hover, .dlg-nav:hover { border-color: var(--text); }
.ref-note { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

/* ---------- Responsiv ---------- */
@media (max-width: 860px) {
  .timeline::before { left: 12px; }
  .station { grid-template-columns: 1fr; padding: 46px 0 46px 34px; gap: 22px; }
  .station::before { left: 12px; top: 58px; }
  .station:nth-child(even) .station-text { order: 0; }
  .world-grid { grid-template-columns: 1fr; }
  .teaser { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; max-height: calc(100svh - 26px); overflow-y: auto; }
  .detail-text { overflow: visible; padding: 26px 20px 34px; }
  .detail-visual { padding: 64px 12px 16px; }
  dialog.detail { overflow-y: auto; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .nav { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; }
  .brand .latin { display: none; }
  .nav ul { gap: 18px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; }
  .card-meta h3 { font-size: 18px; }
  .card-meta .mean { font-size: 17px; }
  .card-meta .role { font-size: 13px; }
  .card .note { font-size: 16px; }
  .teaser-cards { grid-template-columns: repeat(2, 1fr); }
  .subnav { top: calc(50px + env(safe-area-inset-top, 0px)); }
  .group-head .gnum { font-size: 46px; }
  .seats { gap: 3px; }
  .pods { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Spoilerschutz: Kapitelauswahl mit dem Mana-Kristall ---------- */
html.gate-open { overflow: hidden; }
.gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(ellipse at 50% 42%, rgba(18,38,44,.97), rgba(8,7,6,.99) 72%);
  opacity: 0; transition: opacity .5s; --charge: .04;
}
.gate.show { opacity: 1; }
.gate.leaving { opacity: 0; transition: opacity .55s .1s; }
.gate[hidden] { display: none; }
.gate-inner { position: relative; z-index: 1; width: min(520px, 100%); text-align: center; }
.gate h2 { font-size: clamp(26px, 6vw, 40px); margin: 6px 0 4px; }
.crystal-wrap { position: relative; width: min(170px, 42vw); aspect-ratio: 2 / 3; margin: 18px auto 22px; }
.crystal {
  width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 0 calc(6px + var(--charge) * 46px) rgba(143, 240, 208, calc(.15 + var(--charge) * .7)));
  transition: filter .7s; animation: crystalFloat 5s ease-in-out infinite;
}
@keyframes crystalFloat { 50% { transform: translateY(-8px); } }
.c-back { fill: #0e1c22; }
.c-energy { transform: translateY(calc((1 - var(--charge)) * 300px)); transition: transform .9s cubic-bezier(.3,.7,.2,1); opacity: .92; }
.c-facet {
  fill: rgba(255,255,255,.05); stroke: rgba(200,255,240,.5); stroke-width: 1;
  transform-box: fill-box; transform-origin: center;
  transition: transform 1s cubic-bezier(.2,.7,.2,1), opacity .9s ease .15s;
}
.c-facet.f0, .c-facet.f3 { fill: rgba(255,255,255,.14); }
.c-facet.f4 { fill: rgba(0,0,0,.18); }
.c-edge { fill: none; stroke: #d9fff1; stroke-width: 1.5; opacity: .8; }
.c-cracks path { fill: none; stroke: #f4fffb; stroke-width: 1.4; stroke-linecap: round; opacity: calc((var(--charge) - var(--at)) * 6); transition: opacity .6s; }
.gate-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.chip {
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted);
  font-family: var(--f-head); font-size: 17px; transition: color .25s, background .25s, box-shadow .25s, border-color .25s;
}
.chip:hover { color: var(--text); border-color: var(--spore); }
.chip.lit { color: var(--ink); background: linear-gradient(#c6f8e7, #6fd8bd); border-color: transparent; box-shadow: 0 0 14px rgba(143,240,208,.4); }
.chip[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--spore), 0 0 22px rgba(143,240,208,.7); }
.chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.gate-info { color: var(--text); min-height: 3em; max-width: 40ch; margin: 16px auto 14px; }
.gate-go[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.gate-small { color: var(--muted); font-size: 13px; max-width: 46ch; margin: 18px auto 0; }
.gate-sparks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.gate-sparks i { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%; background: var(--spore); box-shadow: 0 0 8px var(--spore); opacity: 0; animation: gateRise linear infinite; }
@keyframes gateRise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .8; } 100% { transform: translateY(-105vh); opacity: 0; } }

/* Zerspringen */
.gate-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.gate-burst i {
  position: absolute; width: calc(7px * var(--s)); height: calc(7px * var(--s)); margin: -3px; border-radius: 50%;
  background: #ffcf7a; box-shadow: 0 0 10px #ff8a3d, 0 0 22px var(--red); opacity: 0;
}
.gate.shatter .gate-burst i { animation: gateBurst 1.1s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes gateBurst { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--ex), var(--ey)) scale(.3); } }
.gate.shatter .c-facet { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.7); opacity: 0; }
.gate.shatter .c-energy, .gate.shatter .c-edge, .gate.shatter .c-back, .gate.shatter .c-cracks { opacity: 0; transition: opacity .25s; }
.gate.shatter .crystal { animation: none; filter: drop-shadow(0 0 60px rgba(244,255,251,.9)); }
.gate.shatter .gate-inner > :not(.crystal-wrap) { opacity: 0; transition: opacity .3s; }
.gate.shatter::after { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 42%, rgba(244,255,251,.85), transparent 55%); animation: gateFlash .7s ease-out forwards; }
@keyframes gateFlash { from { opacity: 1; } to { opacity: 0; } }

/* Lesestand in der Navigation */
.nav ul { align-items: center; }
.read-pill {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 13px; letter-spacing: .06em; color: var(--text);
  background: rgba(143,240,208,.08); border: 1px solid rgba(143,240,208,.35); border-radius: 999px; padding: 6px 12px;
}
.read-pill:hover { border-color: var(--spore); }
.read-pill .rp-k { color: var(--spore); font-size: 10px; }
.read-state { color: var(--spore); font-size: 14px; margin-top: 14px; }

/* Figuren im Schatten */
.card.shadowed { cursor: default; }
.card.shadowed:hover { transform: rotate(var(--tilt, 0deg)); }
.card.shadowed .sk-pencil, .card.shadowed .sk-hatch { display: none; }
.card.shadowed .sk-color { opacity: 1; -webkit-mask-image: none; mask-image: none; mix-blend-mode: multiply; }
.card.shadowed .sk-color img { filter: grayscale(1) brightness(.55) contrast(9); }
.card.shadowed .sk::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-head); font-size: 64px; color: rgba(239,230,213,.8); text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.card.shadowed .card-meta h3 { color: var(--muted); }
.card.shadowed .card-meta .role { color: var(--spore); }
.teaser-cards .shadowed .sk-pencil, .teaser-cards .shadowed .sk-hatch { display: none; }
.teaser-cards .shadowed .sk-color { opacity: 1; -webkit-mask-image: none; mask-image: none; mix-blend-mode: multiply; }
.teaser-cards .shadowed .sk-color img { filter: grayscale(1) brightness(.55) contrast(9); }
.teaser-cards button.shadowed { display: block; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.teaser-cards button.shadowed:nth-child(odd) { transform: translateY(18px) rotate(-1.2deg); }
.teaser-cards button.shadowed:nth-child(even) { transform: rotate(1deg); }

/* Gesperrt: Klick auf eine Figur, die erst später kommt */
.card.shadowed, .teaser-cards button.shadowed { cursor: not-allowed; }
.shadowed.denied { animation: denyShake .42s ease; }
.shadowed.denied .sk::after { color: #d9614c; transition: color .1s; }
.card.shadowed.denied .card-meta .role { color: #d9614c; }
@keyframes denyShake { 15% { translate: -7px 0; } 35% { translate: 6px 0; } 55% { translate: -4px 0; } 75% { translate: 2px 0; } 100% { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { .shadowed.denied { animation-duration: .01s; } }

@media (max-width: 560px) {
  .read-pill .rp-l { display: none; }
  .read-pill { padding: 5px 10px; }
}
/* Kapitelauswahl: auf kleinen Bildschirmen oben beginnen statt abschneiden */
.gate { place-items: initial; }
.gate-inner { margin: auto; }
@media (max-height: 720px) {
  .crystal-wrap { width: min(118px, 30vw); margin: 10px auto 14px; }
  .gate h2 { font-size: 26px; }
  .gate-info { margin: 10px auto 10px; min-height: 2.6em; }
  .gate-small { margin-top: 12px; }
}

/* KI-Hinweis und Impressum */
.ai-note {
  display: inline-flex; align-items: flex-start; gap: 8px; max-width: 62ch;
  font-size: 13px; line-height: 1.5; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 14px 0 0; background: rgba(255,255,255,.02);
}
.ai-note::before { content: "KI"; flex: none; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--ink); background: var(--gold); border-radius: 4px; padding: 2px 5px; margin-top: 1px; }
.footer .ai-note { margin: 0; }
.footer a { color: var(--text); }
.legal { max-width: 760px; padding-top: 130px; padding-bottom: 60px; }
.legal h1 { font-size: clamp(36px, 6vw, 60px); margin-bottom: 10px; }
.legal h2 { font-size: 24px; margin: 38px 0 10px; }
.legal h3 { font-size: 18px; margin: 24px 0 6px; }
.legal p, .legal li { color: var(--text); line-height: 1.7; }
.legal ul { padding-left: 20px; }
.legal address { font-style: normal; line-height: 1.7; }
.legal .todo { background: rgba(210,64,47,.18); color: #ffb4a8; padding: 0 4px; border-radius: 3px; }

/* Ton an/aus in der Kapitelauswahl */
.gate-sound {
  position: fixed; z-index: 3; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px));
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted);
}
.gate-sound:hover { color: var(--text); border-color: var(--spore); }
.gate-sound[aria-pressed="true"] { color: var(--spore); }
.gate-sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gate-sound svg path:first-child { fill: currentColor; stroke: none; }
.gate.shatter .gate-sound { opacity: 0; transition: opacity .3s; }

/* Musik an/aus in der Leiste */
.music-btn {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); padding: 0;
}
.music-btn:hover { color: var(--text); border-color: var(--gold); }
.music-btn[aria-pressed="true"] { color: var(--gold); border-color: rgba(207,169,94,.5); }
.music-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) { .music-btn { width: 30px; height: 30px; } .nav ul { gap: 12px; } }

/* Leiste auf schmalen Handys: nichts umbrechen */
.brand, .read-pill { white-space: nowrap; flex: none; }
@media (max-width: 560px) {
  .nav { gap: 10px; }
  .nav ul { gap: 10px; }
  .nav a.link { letter-spacing: .06em; font-size: 12.5px; }
  .read-pill { padding: 5px 9px; font-size: 12px; }
  .read-pill .rp-k { display: none; }
}
@media (max-width: 360px) {
  .nav a.link { font-size: 11.5px; letter-spacing: .03em; }
}
