/* =========================================================
   Princess Luna — Fan Site
   Core stylesheet: tokens, layout, components, animations.
   ========================================================= */

/* -------- Design tokens -------- */
:root {
  /* Nocturnal base palette */
  --bg-0: #05071a;          /* deepest sky */
  --bg-1: #0a0e2a;          /* section bg */
  --bg-2: #0f1436;          /* card bg */
  --bg-3: #161d4a;          /* card hover */
  --panel: rgba(15, 20, 54, 0.6);
  --panel-strong: rgba(12, 16, 44, 0.92);

  /* Character colors (canon-matched) */
  --luna-coat: #363e7a;
  --luna-coat-deep: #1c2154;
  --luna-mane-1: #2a1e5c;
  --luna-mane-2: #4a6ad1;
  --luna-mane-3: #8ed1ff;
  --luna-eye: #5ce0e6;
  --nm-coat: #0a0a14;
  --nm-teal: #2fbcc0;
  --nm-armor: #7fb9d6;
  --celestia: #fdfaf6;
  --celestia-pink: #ffa5d0;
  --celestia-cyan: #a5d7ff;
  --celestia-gold: #ffd87a;
  --thestral: #4a4a4a;

  /* Accents */
  --star: #e8f1ff;
  --gold: #d4af37;
  --cyan: #5ce0e6;
  --violet: #7c5cff;
  --rose: #ff6bb5;
  --blood: #c62b2b;        /* Control-red for gallery accent */

  /* Typography */
  --font-display: "Cinzel", "Cormorant Garamond", serif;
  --font-serif: "Cormorant Garamond", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Motion */
  --ease-out-soft: cubic-bezier(.16,.84,.25,1);
  --ease-out-quad: cubic-bezier(.2,.7,.25,1);

  /* Radii + shadow */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  --shadow-up: 0 18px 60px -20px rgba(10, 16, 52, 0.9);
  --shadow-glow: 0 0 40px -10px rgba(92, 224, 230, 0.5);

  /* Grid */
  --pad: clamp(20px, 4vw, 72px);
  --section-pad-y: clamp(70px, 12vw, 140px);
}

/* -------- Reset -------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  background: var(--bg-0);
  color: var(--star);
}
body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  background: transparent;        /* cosmos backdrop shows through */
  min-height: 100vh;
  overflow-x: clip;
  cursor: auto;                    /* default system cursor, no custom dot */
  transition: filter 0.8s ease, background-color 0.8s ease;
}
html { background: #02030e; }       /* ensures solid fallback under everything */
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }

/* -------- Global cosmic backdrop (fixed behind every section) -------- */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(74, 58, 175, 0.32) 0%, transparent 55%),
    radial-gradient(ellipse at 82% 72%, rgba(42, 98, 200, 0.26) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(92, 224, 230, 0.14) 0%, transparent 55%),
    linear-gradient(180deg, #04061a 0%, #060826 35%, #030517 80%, #020312 100%);
}
.cosmos__nebula {
  position: absolute;
  width: 120vmax;
  height: 120vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: nebulaDrift 60s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
.cosmos__nebula--a {
  top: -40vmax; left: -30vmax;
  background: radial-gradient(closest-side, rgba(124, 92, 255, 0.55), transparent 70%);
}
.cosmos__nebula--b {
  top: 20vmax; right: -40vmax;
  background: radial-gradient(closest-side, rgba(47, 188, 192, 0.4), transparent 70%);
  animation-duration: 80s;
  animation-direction: alternate-reverse;
}
.cosmos__nebula--c {
  bottom: -50vmax; left: 10vmax;
  background: radial-gradient(closest-side, rgba(255, 107, 181, 0.25), transparent 70%);
  animation-duration: 90s;
}
@keyframes nebulaDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(6vw, -4vh, 0) scale(1.08); }
}
/* Three procedural star layers — CSS box-shadow technique */
.cosmos__stars {
  position: absolute;
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  background-repeat: repeat;
  background-image: radial-gradient(1px 1px at 50% 50%, #ffffff 40%, transparent 60%);
  background-size: 2px 2px;
  opacity: 0;
  pointer-events: none;
}
.cosmos__stars::before,
.cosmos__stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}
.cosmos__stars--far {
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 10% 20%, #ffffff 0.6px, transparent 1.2px),
    radial-gradient(circle at 70% 40%, #e8f1ff 0.5px, transparent 1px),
    radial-gradient(circle at 35% 80%, #ffffff 0.5px, transparent 1px),
    radial-gradient(circle at 85% 10%, #cfe7ff 0.5px, transparent 1px),
    radial-gradient(circle at 50% 55%, #ffffff 0.4px, transparent 1px),
    radial-gradient(circle at 20% 65%, #ffffff 0.5px, transparent 1px),
    radial-gradient(circle at 95% 85%, #ffffff 0.4px, transparent 1px);
  background-size: 400px 400px;
  animation: starsDrift 120s linear infinite;
}
.cosmos__stars--mid {
  opacity: 0.75;
  background-image:
    radial-gradient(circle at 15% 25%, #ffffff 1.1px, transparent 1.8px),
    radial-gradient(circle at 65% 65%, #5ce0e6 1.0px, transparent 1.6px),
    radial-gradient(circle at 30% 75%, #ffffff 1.0px, transparent 1.6px),
    radial-gradient(circle at 88% 35%, #b8d4ff 0.9px, transparent 1.6px),
    radial-gradient(circle at 45% 15%, #ffffff 1.0px, transparent 1.8px),
    radial-gradient(circle at 55% 90%, #ffffff 1.0px, transparent 1.6px);
  background-size: 300px 300px;
  animation: starsDrift 80s linear infinite reverse;
}
.cosmos__stars--near {
  opacity: 0.95;
  background-image:
    radial-gradient(circle at 20% 40%, #ffffff 1.5px, transparent 2.4px),
    radial-gradient(circle at 72% 18%, #ffe7a3 1.4px, transparent 2.4px),
    radial-gradient(circle at 45% 82%, #d6eaff 1.3px, transparent 2.2px),
    radial-gradient(circle at 85% 70%, #ffffff 1.4px, transparent 2.2px);
  background-size: 500px 500px;
  animation: starsTwinkle 6s ease-in-out infinite, starsDrift 55s linear infinite;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
}
@keyframes starsDrift {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-400px, -200px, 0); }
}
@keyframes starsTwinkle {
  0%, 100% { opacity: 0.9; }
  50%      { opacity: 0.55; }
}
.cosmos__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(2, 3, 14, 0.55) 100%);
}

/* -------- Navigation -------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 28px;
  align-items: center;
  padding: 14px var(--pad);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(180deg, rgba(5, 7, 26, 0.85) 0%, rgba(5, 7, 26, 0.5) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav__brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 14px;
}
.nav__logo { width: 32px; height: 32px; filter: drop-shadow(0 0 8px rgba(92,224,230,.5)); }
.nav__title { white-space: nowrap; }
.nav__links {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}
.nav__links a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(232, 241, 255, 0.75);
  border-radius: 999px;
  transition: color .25s, background .25s;
  position: relative;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 4px;
  width: 0; height: 1px;
  background: var(--luna-eye);
  transform: translateX(-50%);
  transition: width .3s var(--ease-out-soft);
}
.nav__links a:hover { color: var(--star); background: rgba(124, 92, 255, 0.1); }
.nav__links a:hover::after { width: 32px; }

.nav__tools { display: flex; align-items: center; gap: 12px; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  transition: border-color .25s;
}
.lang-toggle:hover { border-color: rgba(92, 224, 230, 0.55); }
.lang-toggle span { padding: 2px 4px; opacity: 0.6; transition: opacity .2s, color .2s; }
.lang-toggle span.active { opacity: 1; color: var(--luna-eye); }
.lang-toggle__sep { opacity: 0.4 !important; }

.auth-btn {
  padding: 8px 18px;
  border: 1px solid rgba(92, 224, 230, 0.5);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--luna-eye);
  background: rgba(92, 224, 230, 0.08);
  transition: background .25s, transform .2s;
}
.auth-btn:hover { background: rgba(92, 224, 230, 0.2); transform: translateY(-1px); }

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 6px;
}
.nav__burger span {
  display: block;
  height: 1.5px;
  background: var(--star);
  border-radius: 2px;
}

@media (max-width: 1100px) {
  .nav { grid-template-columns: auto 1fr auto; }
  .nav__links { display: none; }
  .nav__burger { display: flex; }
  .nav.open .nav__links {
    display: flex;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--panel-strong);
    padding: 18px var(--pad);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .nav.open .nav__links a { padding: 10px 0; text-align: center; font-size: 16px; }
}

/* -------- HERO -------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.hero__sky {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.hero__vignette {
  position: absolute; inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at 70% 50%, transparent 0%, transparent 40%, rgba(5, 7, 26, 0.55) 100%),
    linear-gradient(180deg, transparent 65%, rgba(5, 7, 26, 0.55) 100%);
  pointer-events: none;
}
.hero__luna {
  position: absolute;
  right: -6%;
  top: 50%;
  transform: translateY(-50%);
  width: min(58vw, 780px);
  aspect-ratio: 1;
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  animation: lunaFloat 9s var(--ease-out-soft) infinite alternate;
}
.hero__luna-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  /* Feather edges so the image's show-background blends into the cosmic hero */
  -webkit-mask-image: radial-gradient(ellipse 62% 72% at 52% 50%, black 55%, transparent 96%);
          mask-image: radial-gradient(ellipse 62% 72% at 52% 50%, black 55%, transparent 96%);
  filter: drop-shadow(0 40px 80px rgba(0, 0, 0, 0.55));
  transition: opacity 1.2s var(--ease-out-soft), filter 1.2s var(--ease-out-soft);
}
.hero__luna-img--luna { opacity: 1; }
.hero__luna-img--nm   { opacity: 0; }

@keyframes lunaFloat {
  from { transform: translateY(calc(-50% - 6px)); }
  to   { transform: translateY(calc(-50% + 8px)); }
}

/* Nightmare Moon cross-fade */
.hero.nightmare .hero__luna-img--luna { opacity: 0; }
.hero.nightmare .hero__luna-img--nm   {
  opacity: 1;
  filter: drop-shadow(0 40px 90px rgba(47, 188, 192, 0.55)) saturate(1.1);
}
.hero.nightmare .hero__vignette {
  background:
    radial-gradient(ellipse at 70% 50%, rgba(47, 188, 192, 0.15) 0%, transparent 40%, rgba(5, 7, 26, 0.9) 100%),
    linear-gradient(180deg, transparent 60%, rgba(5, 7, 26, 1) 100%);
}

/* Full-page Nightmare Moon mode — everything gets darker + teal */
body.is-nightmare {
  background: #02020a;
}
body.is-nightmare .cosmos {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(47, 188, 192, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 70%, rgba(25, 10, 55, 0.5) 0%, transparent 60%),
    linear-gradient(180deg, #030616 0%, #02040f 100%);
  filter: brightness(0.55) saturate(1.15) contrast(1.05);
}
body.is-nightmare .cosmos__nebula--a {
  background: radial-gradient(closest-side, rgba(47, 188, 192, 0.45), transparent 70%);
}
body.is-nightmare .cosmos__nebula--b {
  background: radial-gradient(closest-side, rgba(80, 40, 160, 0.35), transparent 70%);
}
body.is-nightmare .cosmos__nebula--c {
  background: radial-gradient(closest-side, rgba(255, 60, 140, 0.15), transparent 70%);
}
body.is-nightmare .cosmos__stars {
  animation-duration: 200s;     /* stars slow almost to a stop */
}
body.is-nightmare .cosmos__stars--near {
  filter: drop-shadow(0 0 4px rgba(47, 188, 192, 0.8));
}
body.is-nightmare .section,
body.is-nightmare .hero__content,
body.is-nightmare .foot {
  filter: brightness(0.9) hue-rotate(-6deg);
}
body.is-nightmare .nav {
  background: rgba(2, 4, 12, 0.9);
  border-bottom-color: rgba(47, 188, 192, 0.22);
}
body.is-nightmare .section__title span,
body.is-nightmare .hero__title-lg {
  background: linear-gradient(180deg, #d8fffd 0%, #5fdfe2 45%, #2fbcc0 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
body.is-nightmare .btn--primary {
  background: linear-gradient(135deg, #0c2528 0%, #2fbcc0 100%);
  color: #02020a;
}
body.is-nightmare .btn--ghost {
  border-color: rgba(47, 188, 192, 0.55);
  color: #b9f2f4;
}
body.is-nightmare .hero {
  background: radial-gradient(ellipse at 70% 40%, rgba(47, 188, 192, 0.1), transparent 60%);
}

.hero__content {
  position: relative;
  z-index: 4;
  padding: 160px var(--pad) 100px;
  max-width: 720px;
}
.hero__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--luna-eye);
  margin: 0 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.hero__kicker::before {
  content: "";
  width: 30px; height: 1px;
  background: var(--luna-eye);
}
.hero__title {
  margin: 0 0 24px;
  line-height: 0.9;
  font-family: var(--font-display);
}
.hero__title-sm {
  display: block;
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: rgba(232, 241, 255, 0.7);
  margin-bottom: 8px;
}
.hero__title-lg {
  display: block;
  font-size: clamp(84px, 16vw, 200px);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff 0%, #bcd4ff 45%, #5ce0e6 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(92, 224, 230, 0.12);
}
.hero__sub {
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.5;
  color: rgba(232, 241, 255, 0.82);
  margin: 0 0 40px;
  max-width: 560px;
}

.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 36px; }

/* Buttons */
.btn {
  --btn-pad-y: 14px;
  --btn-pad-x: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform .2s var(--ease-out-soft), box-shadow .25s, background .25s;
  overflow: hidden;
  isolation: isolate;
}
.btn--primary {
  background: linear-gradient(135deg, #4a6ad1 0%, #8ed1ff 100%);
  color: #0a0e2a;
  box-shadow: 0 10px 30px -10px rgba(92, 224, 230, 0.55);
}
.btn--primary:hover { box-shadow: 0 16px 50px -15px rgba(92, 224, 230, 0.8); transform: translateY(-2px); }
.btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--star);
}
.btn--ghost:hover { border-color: var(--luna-eye); background: rgba(92, 224, 230, 0.08); }
.btn--sm { padding: 8px 16px; font-size: 13px; }

.hero__hint {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: rgba(232, 241, 255, 0.45);
  text-transform: uppercase;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--luna-eye);
  box-shadow: 0 0 12px var(--luna-eye);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.moon-clock {
  position: absolute;
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  z-index: 5;
}
.moon-clock__phase {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(232, 241, 255, 0.2);
  position: relative;
  transition: transform .3s;
}
.moon-clock__phase.active { background: var(--star); box-shadow: 0 0 22px var(--star); }

/* -------- Section scaffolding -------- */
.section {
  position: relative;
  padding: var(--section-pad-y) var(--pad);
  max-width: 1440px;
  margin: 0 auto;
}
.section__chrome {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(232, 241, 255, 0.5);
}
.section__chrome::before {
  content: "";
  width: 48px;
  height: 1px;
  background: rgba(92, 224, 230, 0.7);
}
.section__chrome.dark { color: rgba(232, 241, 255, 0.6); }
.section__num {
  color: var(--luna-eye);
  font-weight: 700;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 72px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: 0.005em;
  margin: 0 0 28px;
  max-width: 18ch;
  background: linear-gradient(180deg, #fff 0%, #b7c7ef 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
.section__lede {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.6vw, 22px);
  line-height: 1.55;
  color: rgba(232, 241, 255, 0.78);
  max-width: 62ch;
  margin: 0 0 56px;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s var(--ease-out-soft), transform 1s var(--ease-out-soft);
}
.reveal.is-in { opacity: 1; transform: none; }

/* -------- STORY timeline — 3D scroll-reveal cards -------- */
.story { position: relative; }
.story__timeline {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 0 20px;
}

.story__chapter {
  position: relative;
  margin: 54px 0;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease-out-soft), transform 0.9s var(--ease-out-soft);
}
.story__chapter.is-in,
.story__chapter.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Subtle connecting line down the centre, only between chapters */
.story__chapter:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -50px;
  width: 1px;
  height: 46px;
  background: linear-gradient(180deg, rgba(92, 224, 230, 0.5), transparent);
}

/* Marker — roman numeral glyph, inline above card */
.story__marker {
  position: relative;
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #a5c4ff 45%, #2a3a7a 100%);
  color: #0a0e2a;
  font-family: var(--font-display);
  font-weight: 700;
  display: grid; place-items: center;
  font-size: 20px;
  box-shadow: 0 0 28px rgba(141, 175, 255, 0.55), 0 8px 20px rgba(0,0,0,0.4);
  border: 1.5px solid rgba(255,255,255,0.35);
  z-index: 2;
}
.story__marker.dark {
  background: radial-gradient(circle at 35% 35%, #4a4a60 0%, #0a0a14 80%);
  color: var(--nm-teal);
  box-shadow: 0 0 36px rgba(47, 188, 192, 0.55), 0 8px 20px rgba(0,0,0,0.5);
  border-color: rgba(92, 224, 230, 0.5);
}
.story__marker.glow {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #5ce0e6 40%, #4a6ad1 100%);
  box-shadow: 0 0 40px rgba(92, 224, 230, 0.7), 0 10px 22px rgba(0,0,0,0.45);
  border-color: rgba(255,255,255,0.6);
}

/* Body — single centered column, narrative reading rhythm */
.story__body {
  position: relative;
  padding: 44px 48px 40px;
  border-radius: var(--r-xl);
  background: linear-gradient(160deg, rgba(28, 38, 88, 0.52), rgba(10, 14, 42, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 30px 70px -30px rgba(2, 6, 22, 0.75),
    0 0 0 1px rgba(92, 224, 230, 0.08) inset;
  overflow: hidden;
  transition: box-shadow .5s, transform .5s var(--ease-out-soft);
}
.story__chapter:hover .story__body {
  transform: translateY(-3px);
  box-shadow:
    0 36px 80px -30px rgba(2, 6, 22, 0.85),
    0 0 0 1px rgba(92, 224, 230, 0.2) inset,
    0 0 40px rgba(92, 224, 230, 0.12);
}

.story__body::before {
  content: "";
  position: absolute;
  top: -30%; left: 50%;
  width: 120%; height: 120%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(92, 224, 230, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.story__figure {
  position: relative;
  margin: -44px -48px 28px;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: radial-gradient(ellipse at 50% 45%, #1a2058 0%, #0a0e2a 70%, #05071a 100%);
  isolation: isolate;
}
.story__figure img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 40%;
  -webkit-mask-image: radial-gradient(ellipse 100% 85% at 50% 40%, black 55%, transparent 95%);
          mask-image: radial-gradient(ellipse 100% 85% at 50% 40%, black 55%, transparent 95%);
  filter: saturate(1.05) contrast(1.02);
}
.story__figure::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(16, 20, 52, 0.55) 80%, rgba(16, 20, 52, 0.95) 100%);
  pointer-events: none;
}
.story__figure--dark {
  background: radial-gradient(ellipse at 50% 45%, #15163e 0%, #060716 80%);
}
.story__figure--dark img { filter: saturate(0.9) brightness(0.92) contrast(1.05); }
.story__figure--glow {
  background: radial-gradient(ellipse at 50% 45%, #1c2872 0%, #0a0e30 80%);
}
.story__figure--glow img { filter: saturate(1.15) brightness(1.05); }

.story__body h3 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--star);
  position: relative;
}
.story__body p {
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.65;
  color: rgba(232, 241, 255, 0.82);
  margin: 0 0 14px;
  position: relative;
}

/* Mobile — collapse to single column, drop 3D */
@media (max-width: 700px) {
  .story__timeline { padding: 10px 0; }
  .story__chapter { margin: 36px 0; transform: translateY(20px); }
  .story__chapter:not(:last-child)::after { bottom: -32px; height: 28px; }
  .story__marker { width: 48px; height: 48px; font-size: 18px; margin-bottom: 14px; }
  .story__body { padding: 28px 22px 24px; }
  .story__figure { margin: -28px -22px 22px; aspect-ratio: 16 / 10; }
}

/* -------- SISTERS -------- */
.sisters__duo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
}
.sister {
  padding: 40px;
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, rgba(22, 29, 74, 0.35), rgba(10, 14, 42, 0.15));
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  transition: transform .35s, box-shadow .35s;
}
.sister:hover { transform: translateY(-6px); }
.sister--celestia { box-shadow: 0 20px 80px -30px rgba(255, 216, 122, 0.3); }
.sister--celestia:hover { box-shadow: 0 30px 90px -20px rgba(255, 216, 122, 0.55); }
.sister--luna { box-shadow: 0 20px 80px -30px rgba(92, 224, 230, 0.3); }
.sister--luna:hover { box-shadow: 0 30px 90px -20px rgba(92, 224, 230, 0.6); }

.sister__portrait {
  position: relative;
  margin: -20px -20px 24px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 22px 22px 0 0;
  isolation: isolate;
}
.sister__halo {
  position: absolute;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  filter: blur(38px) saturate(1.1);
  opacity: 0.8;
}
.sister__halo--sun {
  background:
    radial-gradient(ellipse 58% 62% at 55% 45%, rgba(255, 214, 140, 0.55) 0%, rgba(255, 150, 100, 0.22) 45%, transparent 75%),
    radial-gradient(ellipse 90% 120% at 50% 110%, rgba(120, 70, 180, 0.35) 0%, transparent 70%);
}
.sister__halo--moon {
  background:
    radial-gradient(ellipse 58% 62% at 45% 45%, rgba(92, 180, 230, 0.55) 0%, rgba(90, 110, 220, 0.3) 45%, transparent 75%),
    radial-gradient(ellipse 90% 120% at 50% 110%, rgba(50, 30, 100, 0.45) 0%, transparent 70%);
}
.sister__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center 55%;
  -webkit-mask-image: radial-gradient(ellipse 70% 78% at 50% 55%, black 60%, transparent 96%);
          mask-image: radial-gradient(ellipse 70% 78% at 50% 55%, black 60%, transparent 96%);
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
  transform: translateZ(0);
  transition: transform 0.6s var(--ease-out-soft);
}
.sister__img--flip { transform: scaleX(-1); }
.sister:hover .sister__img { transform: scale(1.04); }
.sister:hover .sister__img--flip { transform: scale(1.04) scaleX(-1); }
.sister__name {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 600;
  margin: 0 0 6px;
}
.sister__sub {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(232, 241, 255, 0.6);
  margin: 0 0 22px;
}
.sister__body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.6;
  color: rgba(232, 241, 255, 0.78);
  margin: 0 0 12px;
}

.sisters__vs {
  position: relative;
  width: 96px; height: 280px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
}
.sisters__cm {
  width: 72px; height: 72px;
  display: block;
  filter: drop-shadow(0 0 18px rgba(255,220,140,0.35));
  animation: cmSpin 28s linear infinite;
}
.sisters__cm--sun {
  filter: drop-shadow(0 0 22px rgba(255,190,90,0.55));
}
.sisters__cm--moon {
  animation-direction: reverse;
  animation-duration: 34s;
  filter: drop-shadow(0 0 22px rgba(92,224,230,0.55));
}
.sisters__vs-line {
  flex: 1;
  width: 1px;
  background: linear-gradient(180deg, transparent 0%, #ffc86a 18%, #fff 50%, #5ce0e6 82%, transparent 100%);
  opacity: 0.7;
  margin: 10px 0;
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
}
@keyframes cmSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Sister portrait SVG sizing */
.sister__svg { display: block; width: 100%; height: auto; }

@media (max-width: 900px) {
  .sisters__duo { grid-template-columns: 1fr; }
  .sisters__vs { width: 100%; height: 96px; flex-direction: row; margin: 0 auto; }
  .sisters__vs-line { width: auto; height: 1px; flex: 1; margin: 0 14px; background: linear-gradient(90deg, transparent 0%, #ffc86a 18%, #fff 50%, #5ce0e6 82%, transparent 100%); }
}

/* -------- ROYAL CANTERLOT VOICE -------- */
.voice__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}
.voice-card {
  position: relative;
  margin: 0;
  padding: 36px 32px 30px;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(22, 29, 74, 0.55), rgba(10, 14, 42, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform .3s, border-color .3s;
}
.voice-card::before {
  content: "";
  position: absolute;
  top: 14px; left: 20px;
  font-family: var(--font-display);
  font-size: 80px;
  color: rgba(92, 224, 230, 0.16);
  content: "\201C";
  line-height: 1;
}
.voice-card:hover { transform: translateY(-4px) rotate(-0.3deg); border-color: rgba(92, 224, 230, 0.5); }
.voice-card:hover::before { color: rgba(92, 224, 230, 0.35); }
.voice-card p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  margin: 0 0 20px;
  color: var(--star);
  position: relative;
  z-index: 1;
}
.voice-card footer {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--luna-eye);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* Crescent sigil floating in the corner */
.voice-card__sigil {
  position: absolute;
  top: 14px; right: 18px;
  width: 42px; height: 42px;
  display: block;
  opacity: 0.55;
  filter: drop-shadow(0 0 10px rgba(92, 224, 230, 0.5));
  animation: voiceSigilFloat 6s ease-in-out infinite;
  z-index: 1;
}
.voice-card__sigil svg { width: 100%; height: 100%; }
@keyframes voiceSigilFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-4px) rotate(4deg); }
}

/* Audio waveform along the bottom */
.voice-card__wave {
  position: absolute;
  left: 28px; right: 28px; bottom: 14px;
  height: 24px;
  opacity: 0.5;
  color: var(--luna-eye);
  display: block;
  pointer-events: none;
  z-index: 0;
}
.voice-card__wave svg { width: 100%; height: 100%; }
.voice-card__wave svg path {
  stroke-dasharray: 4 6;
  animation: voiceWave 3s linear infinite;
}
@keyframes voiceWave {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -40; }
}

/* Decorative corner brackets (royal frame) */
.voice-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(92, 224, 230, 0.0);
  border-radius: calc(var(--r-lg) - 6px);
  pointer-events: none;
  transition: border-color .35s, inset .35s;
  z-index: 0;
}
.voice-card:hover::after { border-color: rgba(92, 224, 230, 0.35); inset: 6px; }

/* Loud (Royal Voice) variant — larger, glowing text */
.voice-card--loud { padding-top: 48px; }
.voice-card--loud p {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #e6fcff;
  text-shadow: 0 0 18px rgba(92, 224, 230, 0.35);
  font-size: clamp(18px, 1.8vw, 24px);
}
.voice-card--loud { background: linear-gradient(160deg, rgba(28, 40, 95, 0.75), rgba(8, 12, 34, 0.45)); }
.voice-card--loud .voice-card__wave { opacity: 0.72; }
.voice-card--loud .voice-card__sigil { opacity: 0.85; }

/* Soft (intimate) variant */
.voice-card--soft { background: linear-gradient(160deg, rgba(16, 22, 55, 0.55), rgba(24, 36, 80, 0.25)); }
.voice-card--soft p { font-style: italic; }
.voice-card--soft .voice-card__wave { opacity: 0.3; }
.voice-card--soft .voice-card__sigil { opacity: 0.35; }

/* -------- GALLERY (Control-inspired) -------- */
.gallery { padding-top: calc(var(--section-pad-y) + 20px); }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.gallery-card {
  position: relative;
  aspect-ratio: 4/5;
  background: var(--bg-1);
  overflow: hidden;
  cursor: pointer;
  transition: background .3s;
}
.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  transition: border-color .3s;
  pointer-events: none;
  z-index: 3;
}
.gallery-card:hover { background: #14194a; }
.gallery-card:hover::after { border-color: var(--blood); }
.gallery-card__visual {
  position: absolute; inset: 0;
  transition: transform .6s var(--ease-out-soft);
}
.gallery-card:hover .gallery-card__visual { transform: scale(1.04); }
.gallery-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  background: linear-gradient(180deg, transparent 50%, rgba(5, 7, 26, 0.92) 100%);
}
.gallery-card__code {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--blood);
  margin: 0 0 6px;
  text-transform: uppercase;
}
.gallery-card__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--star);
}
.gallery-card__desc {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  color: rgba(232, 241, 255, 0.65);
}
.gallery-card__classified {
  position: absolute;
  top: 14px; right: -32px;
  background: var(--blood);
  color: #fff;
  padding: 3px 40px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  transform: rotate(45deg);
  text-transform: uppercase;
  z-index: 4;
}

/* Gallery modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; animation: fadeIn .35s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 26, 0.9);
  backdrop-filter: blur(10px);
}
.modal__content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
  animation: modalIn .4s var(--ease-out-soft);
}
@keyframes modalIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal__close {
  position: absolute;
  top: 14px; right: 18px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--star);
  font-size: 22px;
  line-height: 1;
  z-index: 3;
  transition: background .2s;
}
.modal__close:hover { background: var(--blood); }
.modal__visual {
  background: #0a0e2a;
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 30px;
}
.modal__visual svg { max-height: 400px; }
.modal__body { padding: 36px 32px; overflow-y: auto; }
.modal__file {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--blood);
  margin: 0 0 8px;
}
.modal__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 18px;
}
.modal__text {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.6;
  color: rgba(232, 241, 255, 0.8);
  margin: 0;
  white-space: pre-line;
}
@media (max-width: 700px) {
  .modal__content { grid-template-columns: 1fr; max-height: 95vh; }
  .modal__visual { min-height: 240px; }
}

/* -------- NIGHT GUARD -------- */
.guard__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.guard-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform .3s, border-color .3s, box-shadow .35s;
}
.guard-card:hover {
  transform: translateY(-6px);
  border-color: rgba(124, 92, 255, 0.5);
  box-shadow: 0 30px 80px -30px rgba(124, 92, 255, 0.5);
}
.guard-card__portrait {
  position: relative;
  aspect-ratio: 1;
  background: radial-gradient(ellipse 70% 70% at 50% 55%, #1a1f44 0%, #0a0d22 70%);
  overflow: hidden;
  isolation: isolate;
}
.guard-card__portrait::before {
  content: "";
  position: absolute; inset: -15%;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 55% at 50% 50%, rgba(92, 180, 230, 0.35) 0%, rgba(90, 110, 220, 0.18) 40%, transparent 75%);
  filter: blur(30px);
  pointer-events: none;
}
.guard-card__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  -webkit-mask-image: radial-gradient(ellipse 72% 78% at 50% 52%, black 58%, transparent 94%);
          mask-image: radial-gradient(ellipse 72% 78% at 50% 52%, black 58%, transparent 94%);
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.5)) saturate(0.9) brightness(0.95);
  transition: transform 0.7s var(--ease-out-soft);
}
.guard-card:hover .guard-card__img { transform: scale(1.05); }
.guard-card__meta { padding: 24px; }
.guard-card__codename {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--luna-eye);
  margin: 0 0 8px;
}
.guard-card__meta h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}
.guard-card__meta p {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.55;
  color: rgba(232, 241, 255, 0.72);
  margin: 0;
}

/* -------- EQUESTRIA MAP -------- */
.map-section { padding-bottom: calc(var(--section-pad-y) + 30px); }
.map-stage {
  position: relative;
  height: min(85vh, 820px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: radial-gradient(ellipse at center, #0d1230 0%, #05071a 80%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6);
}
.map-stage__canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
}
.map-stage__canvas:active { cursor: grabbing; }
.map-stage canvas { display: block; width: 100% !important; height: 100% !important; }

.map-legend {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 20px 22px;
  background: rgba(10, 14, 42, 0.75);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  max-width: 260px;
  z-index: 2;
  font-size: 13px;
}
.map-legend__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--star);
}
.map-legend ul { list-style: none; margin: 0; padding: 0; }
.map-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  color: rgba(232, 241, 255, 0.8);
  cursor: pointer;
  transition: color .2s;
}
.map-legend li:hover { color: var(--star); }
.map-legend li.active { color: var(--luna-eye); }
.map-legend__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: rgba(232, 241, 255, 0.4);
  margin: 14px 0 0;
  text-transform: uppercase;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
  flex-shrink: 0;
}
.dot.gold { background: var(--gold); color: var(--gold); }
.dot.cyan { background: var(--cyan); color: var(--cyan); }
.dot.white { background: #fff; color: #fff; }
.dot.dark { background: #3a5e3a; color: #3a5e3a; }
.dot.pink { background: #ff99d1; color: #ff99d1; }
.dot.yellow { background: #ffdc6e; color: #ffdc6e; }
.dot.orange { background: #ff8a4c; color: #ff8a4c; }
.dot.red { background: #ff4d4d; color: #ff4d4d; }

.map-tooltip {
  position: absolute;
  padding: 12px 16px;
  background: rgba(5, 7, 26, 0.95);
  border: 1px solid var(--luna-eye);
  border-radius: 10px;
  font-size: 13px;
  color: var(--star);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  max-width: 280px;
  z-index: 3;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
}
.map-tooltip.show { opacity: 1; }
.map-tooltip strong {
  color: var(--luna-eye);
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 15px;
}

/* ---- Map control panel (zoom / rotate / tilt / reset) ---- */
.map-controls {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px;
  background: rgba(10, 14, 42, 0.78);
  border: 1px solid rgba(144, 192, 255, 0.18);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 22px rgba(92, 224, 230, 0.06);
  animation: mapCtrlsFloat 6s ease-in-out infinite alternate;
}
@keyframes mapCtrlsFloat {
  from { transform: translateY(calc(-50% - 4px)); }
  to   { transform: translateY(calc(-50% + 4px)); }
}
.map-ctrl {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(144, 192, 255, 0.18);
  background: linear-gradient(180deg, rgba(22, 30, 70, 0.9), rgba(9, 12, 36, 0.9));
  color: rgba(214, 230, 255, 0.88);
  cursor: pointer;
  transition:
    transform .18s var(--ease-out-soft),
    color .2s,
    border-color .2s,
    box-shadow .25s,
    background .25s;
  padding: 0;
}
.map-ctrl:hover {
  color: var(--luna-eye, #8ae4ff);
  border-color: rgba(138, 228, 255, 0.6);
  box-shadow:
    0 0 0 1px rgba(138, 228, 255, 0.25),
    0 0 24px rgba(138, 228, 255, 0.35),
    inset 0 0 12px rgba(138, 228, 255, 0.15);
  transform: translateY(-1px) scale(1.04);
}
.map-ctrl:active {
  transform: translateY(0) scale(0.97);
  box-shadow: inset 0 0 14px rgba(138, 228, 255, 0.25);
}
.map-ctrl:focus-visible {
  outline: 2px solid var(--luna-eye, #8ae4ff);
  outline-offset: 2px;
}
.map-ctrl--reset {
  color: rgba(255, 214, 120, 0.9);
}
.map-ctrl--reset:hover {
  color: #ffd670;
  border-color: rgba(255, 214, 120, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 214, 120, 0.3),
    0 0 24px rgba(255, 214, 120, 0.38);
}
.map-ctrl__sep {
  display: block;
  height: 1px;
  margin: 2px 6px;
  background: linear-gradient(90deg, transparent, rgba(144, 192, 255, 0.35), transparent);
}
.map-ctrl__zoom {
  margin-top: 4px;
  padding: 4px 0 2px;
  text-align: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(214, 230, 255, 0.7);
  border-top: 1px dashed rgba(144, 192, 255, 0.18);
}

@media (max-width: 720px) {
  .map-controls {
    right: 10px;
    padding: 6px 5px;
    gap: 4px;
  }
  .map-ctrl { width: 34px; height: 34px; border-radius: 10px; }
  .map-ctrl svg { width: 16px; height: 16px; }
  .map-ctrl__zoom { font-size: 10px; }
}

/* -------- FAN THEORIES -------- */
.theories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.theory {
  position: relative;
  padding: 34px 30px;
  border-radius: var(--r-lg);
  background: linear-gradient(170deg, rgba(22, 29, 74, 0.6), rgba(10, 14, 42, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: transform .3s, border-color .3s;
}
.theory::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx,50%) var(--my,50%), rgba(124, 92, 255, 0.13), transparent 50%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.theory:hover::before { opacity: 1; }
.theory:hover { transform: translateY(-4px); border-color: rgba(124, 92, 255, 0.4); }
.theory__sigil {
  width: 48px; height: 48px;
  margin-bottom: 20px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(92, 224, 230, 0.2), rgba(124, 92, 255, 0.2));
  color: var(--luna-eye);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.theory h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--star);
}
.theory p {
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.6;
  margin: 0;
  color: rgba(232, 241, 255, 0.78);
}

/* -------- COMMUNITY -------- */
.community__layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
}
@media (max-width: 800px) { .community__layout { grid-template-columns: 1fr; } }

.auth-panel {
  padding: 28px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  height: fit-content;
  position: sticky;
  top: 90px;
}
.auth-tabs {
  display: flex;
  gap: 2px;
  background: rgba(5, 7, 26, 0.6);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(232, 241, 255, 0.6);
  transition: background .25s, color .25s;
}
.auth-tab.active {
  background: linear-gradient(135deg, #4a6ad1, #7c5cff);
  color: var(--star);
}
.auth-form { display: grid; gap: 14px; }
.auth-form.hidden { display: none; }
.auth-form label { display: grid; gap: 6px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(232, 241, 255, 0.65); font-weight: 500; }
.auth-form input {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 7, 26, 0.6);
  color: var(--star);
  font-size: 15px;
  transition: border-color .2s;
}
.auth-form input:focus { outline: none; border-color: var(--luna-eye); }
.auth-form button { margin-top: 6px; justify-content: center; }
.auth-form__msg {
  margin: 0;
  font-size: 13px;
  min-height: 18px;
}
.auth-form__msg.err { color: #ff7a9a; }
.auth-form__msg.ok { color: var(--luna-eye); }
.auth-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: rgba(232, 241, 255, 0.5);
  line-height: 1.5;
}

.me { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.me__avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a6ad1, #8ed1ff);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #0a0e2a;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(92, 224, 230, 0.35);
}
.me__hi { margin: 0; font-size: 12px; color: rgba(232, 241, 255, 0.6); letter-spacing: 0.08em; }
.me__name { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; }

.comments { display: grid; gap: 20px; align-content: start; }

.comment-form {
  padding: 20px;
  background: rgba(10, 14, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
}
.comment-form textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(5, 7, 26, 0.6);
  color: var(--star);
  font-size: 15px;
  font-family: var(--font-serif);
  line-height: 1.5;
  resize: vertical;
  transition: border-color .2s;
}
.comment-form textarea:focus { outline: none; border-color: var(--luna-eye); }
.comment-form textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.comment-form__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 14px;
  flex-wrap: wrap;
}
.comment-form__hint { margin: 0; font-size: 13px; color: rgba(232, 241, 255, 0.55); }

.comment {
  padding: 22px 24px;
  background: rgba(10, 14, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  transition: border-color .25s;
}
.comment:hover { border-color: rgba(92, 224, 230, 0.2); }
.comment__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: #0a0e2a;
  flex-shrink: 0;
}
.comment__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.comment__name { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.comment__time { font-family: var(--font-mono); font-size: 11px; color: rgba(232, 241, 255, 0.45); letter-spacing: 0.1em; }
.comment__body { font-family: var(--font-serif); font-size: 16px; line-height: 1.55; color: rgba(232, 241, 255, 0.85); margin: 0; white-space: pre-wrap; word-break: break-word; }
.comment__delete { font-size: 11px; color: rgba(232, 241, 255, 0.4); background: none; border: 0; margin-top: 6px; letter-spacing: 0.1em; text-transform: uppercase; text-align: left; padding: 0; }
.comment__delete:hover { color: #ff7a9a; }
.comments__empty {
  padding: 32px;
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  color: rgba(232, 241, 255, 0.55);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
}

/* -------- FOOTER -------- */
.foot {
  padding: 60px var(--pad) 40px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 80px;
  color: rgba(232, 241, 255, 0.65);
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 700px) { .foot { grid-template-columns: 1fr; } }
.foot__brand { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--star); margin: 0 0 10px; }
.foot__text { margin: 0; max-width: 400px; }
.foot__head { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--luna-eye); margin: 0 0 12px; }
.foot__col ul { list-style: none; margin: 0; padding: 0; }
.foot__col li { padding: 4px 0; }

/* -------- utilities -------- */
.hidden { display: none !important; }

/* -------- Magnetic buttons slight transform -------- */
.magnetic { transition: transform .2s var(--ease-out-soft); }

/* -------- Prefer reduced motion -------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .luna-mane, .luna-tail, .sisters__cm, .mane-stars circle, .luna-eye { animation: none; }
}

/* ================================================================
   Supplementary styles — layer on top to support the app.js DOM
   ================================================================ */

/* Reveal fallback alias (app.js adds both .is-in and .is-visible) */
.reveal.is-visible { opacity: 1; transform: none; }

/* Cursor states */
.cursor-ring.is-down { transform: translate3d(var(--x,0), var(--y,0), 0) scale(0.85); }
body.modal-open { overflow: hidden; }
body.nav-open { overflow: hidden; }

/* Nav scrolled state + active link */
.nav.is-scrolled {
  background: rgba(5, 7, 26, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(124, 92, 255, 0.18);
}
.nav__links a.is-active { color: var(--star); }
.nav__links a.is-active::after { width: 32px; }
.nav__burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav panel */
@media (max-width: 960px) {
  body.nav-open .nav__links {
    display: flex;
    position: fixed;
    inset: 64px 0 0 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(5, 7, 26, 0.96);
    backdrop-filter: blur(18px);
    z-index: 90;
    padding: 40px;
  }
  body.nav-open .nav__links a { font-size: 20px; }
}

/* Gallery card (app.js layout variant) */
.gallery-card__meta {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(180deg, rgba(5,7,26,0) 0%, rgba(5,7,26,0.78) 45%, rgba(5,7,26,0.96) 100%);
}
.gallery-card__code {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--blood, #c8353a);
  text-transform: uppercase;
  margin: 0;
}
.gallery-card__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(232, 241, 255, 0.55);
  margin: 0;
  text-transform: uppercase;
}
.gallery-card__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 2px 0 0;
  color: var(--star);
  line-height: 1.15;
}
.gallery-card__short {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
  margin: 4px 0 10px;
  color: rgba(232, 241, 255, 0.72);
}
.gallery-card__open {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 8px 14px;
  background: transparent;
  color: var(--luna-eye, #5ce0e6);
  border: 1px solid rgba(92, 224, 230, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: background .3s, color .3s, border-color .3s;
}
.gallery-card__open:hover {
  background: var(--luna-eye, #5ce0e6);
  color: #06091b;
}
.gallery-card__ribbon {
  position: absolute;
  top: 14px;
  right: -38px;
  background: var(--blood, #c8353a);
  color: #fff;
  padding: 4px 44px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  transform: rotate(45deg);
  text-transform: uppercase;
  z-index: 4;
  box-shadow: 0 6px 20px -8px rgba(0,0,0,0.6);
}
.gallery-card[data-tone="royal"] { --card-accent: #5ce0e6; }
.gallery-card[data-tone="dark"]  { --card-accent: #2fbcc0; }
.gallery-card[data-tone="soft"]  { --card-accent: #a3c7ff; }
.gallery-card[data-tone="dream"] { --card-accent: #8ed1ff; }
.gallery-card[data-tone="haunt"] { --card-accent: #9f78ff; }
.gallery-card[data-tone="fire"]  { --card-accent: #ffd14a; }
.gallery-card:hover::after { border-color: var(--card-accent, var(--blood)); }

/* Theory cards */
.theories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 32px;
}
.theory-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 28px 26px 26px;
  border-radius: 20px;
  background:
    radial-gradient(520px circle at var(--mx) var(--my), rgba(124, 92, 255, 0.16), transparent 55%),
    linear-gradient(160deg, rgba(24, 29, 70, 0.9), rgba(10, 13, 38, 0.9));
  border: 1px solid rgba(124, 92, 255, 0.2);
  overflow: hidden;
  transition: transform .4s var(--ease-out-soft), border-color .3s;
}
.theory-card:hover {
  transform: translateY(-4px);
  border-color: rgba(92, 224, 230, 0.4);
}
.theory-card__sigil {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--luna-eye, #5ce0e6);
  padding: 4px 10px;
  border: 1px solid rgba(92, 224, 230, 0.4);
  border-radius: 999px;
  margin-bottom: 14px;
}
.theory-card__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--star);
  line-height: 1.2;
}
.theory-card__body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.6;
  color: rgba(232, 241, 255, 0.78);
  margin: 0;
}
.theory-card__glow {
  position: absolute;
  inset: -40% -40% auto auto;
  width: 70%;
  padding-top: 70%;
  background: radial-gradient(closest-side, rgba(124, 92, 255, 0.12), transparent 70%);
  pointer-events: none;
}

/* ============ Fan art ============ */
.fanart__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  margin-top: 32px;
}
.fanart-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(160deg, rgba(24, 29, 70, 0.92), rgba(10, 13, 38, 0.92));
  border: 1px solid rgba(124, 92, 255, 0.22);
  transition:
    transform .45s var(--ease-out-soft),
    border-color .3s,
    box-shadow .45s;
  isolation: isolate;
}
.fanart-card:hover {
  transform: translateY(-5px);
  border-color: rgba(92, 224, 230, 0.45);
  box-shadow: 0 22px 48px -18px rgba(92, 224, 230, 0.25);
}
.fanart-card__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(92, 224, 230, 0.08), transparent 60%),
    #080b1e;
}
.fanart-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .6s var(--ease-out-soft), filter .4s;
}
.fanart-card:hover .fanart-card__img {
  transform: scale(1.04);
  filter: saturate(1.08);
}
.fanart-card__hint {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 11px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240, 245, 255, 0.9);
  background: rgba(8, 11, 30, 0.72);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(92, 224, 230, 0.28);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.fanart-card:hover .fanart-card__hint {
  opacity: 1;
  transform: translateY(0);
}
.fanart-card__body {
  padding: 18px 20px 22px;
}
.fanart-card__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--star, #e8f1ff);
  line-height: 1.25;
}
.fanart-card__caption {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.55;
  color: rgba(232, 241, 255, 0.76);
  margin: 0 0 10px;
}
.fanart-card__author {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(180, 200, 235, 0.5);
}

/* Auth messages (state aliases used by app.js) */
.auth-form__msg:empty { display: none; }

/* Comment layout (app.js uses .comment__main wrapper) */
.comment {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}
.comment__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.comment__head { display: flex; align-items: baseline; gap: 12px; }
.comment.is-mine { border-color: rgba(92, 224, 230, 0.35); }
.comment.is-mine .comment__name { color: var(--luna-eye, #5ce0e6); }

/* Auth panel logged-in "me" block */
.me { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.me__name { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--star); }

/* Gallery visual sizing */
.gallery-card__visual > svg { width: 100%; height: 100%; display: block; }
.gallery-card__scene {
  position: absolute; inset: 0;
  overflow: hidden;
  isolation: isolate;
}
.gallery-card__halo {
  position: absolute; inset: -15%;
  filter: blur(38px);
  pointer-events: none;
  z-index: 0;
}
.gallery-card__img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 48%, black 60%, transparent 96%);
          mask-image: radial-gradient(ellipse 78% 82% at 50% 48%, black 60%, transparent 96%);
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.55));
}

/* Modal visual: hold the SVG full-bleed */
.modal__visual { position: relative; background: #0a0d24; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.modal__visual svg { width: 100%; height: 100%; object-fit: cover; }

