/* ═══════════════════════════════════════════════════════
   A Little Universe Made for Elysium — core styles
   Palette: #09070D #241020 #EC79BB #FFB6D9 #F9EAF3
   ═══════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Libertine';
  src: url('../assets/fonts/Libertine-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Libertine';
  src: url('../assets/fonts/Libertine-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Libertine';
  src: url('../assets/fonts/Libertine-Italic.otf') format('opentype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Libertine Display';
  src: url('../assets/fonts/LibertineDisplay-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --deep-black: #09070D;
  --dark-plum:  #241020;
  --soft-pink:  #EC79BB;
  --baby-pink:  #FFB6D9;
  --soft-white: #F9EAF3;
  --plum-70: rgba(36, 16, 32, 0.72);
  --pink-glow: 0 0 18px rgba(236, 121, 187, .55), 0 0 46px rgba(236, 121, 187, .22);
  --font-display: 'Libertine Display', 'Libertine', Georgia, 'Times New Roman', serif;
  --font-body: 'Libertine', Georgia, 'Times New Roman', serif;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(236,121,187,.10), transparent 60%),
    radial-gradient(900px 700px at 15% 110%, rgba(36,16,32,.9), transparent 65%),
    var(--deep-black);
  color: var(--soft-white);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

button { font-family: var(--font-ui); cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--baby-pink); outline-offset: 3px; border-radius: 6px;
}

/* ── ambient background layers ─────────────────────── */
#bg-stars {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.nebula {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(closest-side at 25% 30%, rgba(236,121,187,.10), transparent 70%),
    radial-gradient(closest-side at 80% 75%, rgba(255,182,217,.07), transparent 70%),
    radial-gradient(closest-side at 55% 55%, rgba(36,16,32,.55), transparent 75%);
  filter: blur(2px);
}
.moon {
  position: fixed; top: 7%; right: 9%; width: 92px; height: 92px;
  border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(circle at 38% 34%, var(--baby-pink), var(--soft-pink) 55%, #b04f86 100%);
  box-shadow: 0 0 40px rgba(236,121,187,.75), 0 0 120px rgba(236,121,187,.35);
  opacity: .92;
}

/* ── stages & scenes ─────────────────────────────────── */
.stage, .scene {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 5vh 20px 120px;
}
.scene { display: none; }
.scene.active { display: flex; }

.scene-title {
  font-family: var(--font-display);
  font-weight: 400; font-style: italic;
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  color: var(--baby-pink);
  text-shadow: 0 0 22px rgba(255,182,217,.35);
  margin: 0 0 4vh;
}

/* ── buttons ───────────────────────────────────────── */
.btn-primary {
  appearance: none; border: 1px solid rgba(255,182,217,.65);
  background: linear-gradient(180deg, rgba(236,121,187,.24), rgba(236,121,187,.10));
  color: var(--soft-white);
  font-size: 1.02rem; letter-spacing: .04em;
  padding: 14px 34px; border-radius: 999px;
  box-shadow: var(--pink-glow), inset 0 0 14px rgba(236,121,187,.18);
  transition: transform .18s ease, box-shadow .25s ease, background .25s ease;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  background: linear-gradient(180deg, rgba(236,121,187,.38), rgba(236,121,187,.16));
  box-shadow: 0 0 26px rgba(236,121,187,.7), 0 0 70px rgba(236,121,187,.3);
}
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-big { font-size: 1.2rem; padding: 17px 46px; }

/* ═══ STAGE 0 · GATE ═══ */
.gate-card {
  background: var(--plum-70);
  border: 1px solid rgba(236,121,187,.30);
  border-radius: 22px;
  padding: 44px 40px 36px;
  max-width: 520px; width: min(92vw, 520px);
  box-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 0 40px rgba(236,121,187,.05);
  backdrop-filter: blur(8px);
}
.gate-heart { display: block; margin: 0 auto 14px; filter: drop-shadow(0 0 14px rgba(236,121,187,.8)); }
.gate-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0 0 8px;
  color: var(--soft-white); text-shadow: 0 0 26px rgba(236,121,187,.4);
}
.gate-sub { margin: 0 0 28px; color: rgba(249,234,243,.75); font-size: .98rem; }

.date-input {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 26px;
}
.digit {
  width: 42px; height: 54px;
  background: rgba(9,7,13,.75);
  border: 2px solid rgba(236,121,187,.35);
  border-radius: 10px;
  color: var(--soft-white);
  font-family: var(--font-body); font-size: 1.6rem; text-align: center;
  caret-color: var(--soft-pink);
  transition: border-color .2s ease, box-shadow .2s ease;
  padding: 0;
}
.digit:focus { border-color: var(--soft-pink); box-shadow: 0 0 14px rgba(236,121,187,.55); outline: none; }
.date-input.error .digit { border-color: #ff7d9c; box-shadow: 0 0 12px rgba(255,125,156,.5); }
.date-input.success .digit { border-color: var(--baby-pink); box-shadow: 0 0 16px rgba(255,182,217,.8); }
.slash { color: rgba(249,234,243,.55); font-size: 1.5rem; font-family: var(--font-body); }

.gate-error { color: var(--baby-pink); margin: 16px 0 0; font-size: .95rem; min-height: 1.2em; }

/* ═══ STAGE 1 · WELCOME ═══ */
.welcome-heart { filter: drop-shadow(0 0 22px rgba(236,121,187,.9)); margin-bottom: 22px; }
.welcome-eyebrow {
  font-family: var(--font-body); font-style: italic;
  color: var(--soft-pink); letter-spacing: .18em; text-transform: lowercase;
  margin: 0 0 14px; font-size: .95rem;
}
.welcome-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 5.6vw, 3rem);
  max-width: 720px; margin: 0 0 42px; line-height: 1.35;
  text-shadow: 0 0 34px rgba(236,121,187,.45);
}

/* ═══ SCENE 1 · CAT INTRO ═══ */
.cat-intro-wrap { margin: 2vh 0 5vh; }
.cat-big { width: 320px; height: 320px; filter: drop-shadow(0 14px 30px rgba(0,0,0,.6)) drop-shadow(0 0 34px rgba(236,121,187,.55)); }

/* ═══ SCENE 2 · DOORS ═══ */
.doors {
  display: flex; gap: clamp(14px, 4vw, 44px);
  align-items: flex-end; justify-content: center;
  flex-wrap: wrap; margin-bottom: 4vh;
}
.door {
  appearance: none; background: none; border: none; padding: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: transform .25s ease, filter .25s ease;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.55));
}
.door-art { width: clamp(96px, 16vw, 150px); height: auto; display: block; }
.door:hover { transform: translateY(-8px); }
.door:hover .door-art { filter: drop-shadow(0 0 22px rgba(236,121,187,.75)); }
.door-label {
  font-family: var(--font-body); font-style: italic; font-size: 1.02rem;
  color: var(--soft-white); opacity: .9;
}
.door.selected .door-art { filter: drop-shadow(0 0 30px rgba(255,182,217,.95)); }
.door.selected .door-label { color: var(--baby-pink); }
.doors.locked .door:not(.selected) { opacity: .38; filter: grayscale(.4); }
.doors.locked .door:not(.selected):hover { transform: none; }

.door-reaction { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.door-reaction span { position: absolute; will-change: transform, opacity; }

/* ═══ SCENE 3 · GALLERY ═══ */
.polaroids { display: flex; flex-wrap: wrap; gap: 34px; justify-content: center; margin: 1vh 0 3vh; }
.polaroid {
  appearance: none; border: none; background: var(--soft-white);
  padding: 14px 14px 52px; position: relative;
  transform: rotate(var(--rot, -3deg));
  box-shadow: 0 18px 44px rgba(0,0,0,.6), 0 0 34px rgba(236,121,187,.28);
  transition: transform .25s ease, box-shadow .3s ease;
}
.polaroid img { display: block; width: clamp(200px, 30vw, 300px); height: auto; }
.polaroid:hover { transform: rotate(0deg) scale(1.045); box-shadow: 0 22px 54px rgba(0,0,0,.65), 0 0 52px rgba(236,121,187,.5); }
.polaroid-tape {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 92px; height: 26px; background: rgba(236,121,187,.42);
  border: 1px solid rgba(255,182,217,.5); backdrop-filter: blur(1px);
}
.gallery-hint { color: rgba(249,234,243,.7); font-size: .95rem; margin: 0 0 22px; }

/* ═══ SCENE 4 · FINALE ═══ */
#scene-finale { overflow: hidden; }
#finale-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.finale-text {
  position: relative; z-index: 4; padding: 0 20px;
  display: flex; flex-direction: column; align-items: center; gap: 3vh;
}
.finale-text[hidden] { display: none; }
.finale-line {
  font-family: var(--font-display); font-weight: 400;
  margin: 0; opacity: 0;
}
.finale-line.line-1 {
  font-size: clamp(1.6rem, 5.4vw, 3.2rem); line-height: 1.4; max-width: 900px;
  color: var(--soft-white);
  text-shadow: 0 0 18px rgba(236,121,187,.85), 0 0 60px rgba(236,121,187,.4);
}
.finale-line.line-2 {
  font-size: clamp(1.15rem, 3vw, 1.8rem); font-style: italic;
  color: var(--baby-pink);
  text-shadow: 0 0 16px rgba(255,182,217,.7);
}

/* ═══ COMPANION CAT (persistent) ═══ */
#cat {
  position: fixed; right: 18px; bottom: 92px; z-index: 40;
  display: flex; flex-direction: column; align-items: flex-end;
  transition: bottom .3s ease, right .3s ease, left .3s ease;
}
#cat::before {
  content: ""; position: absolute; inset: -24px -28px; z-index: -1;
  background: radial-gradient(closest-side, rgba(236,121,187,.30), rgba(236,121,187,0) 76%);
  border-radius: 50%;
  pointer-events: none;
}
#cat img {
  width: 160px; height: 160px;
  transition: transform .35s ease;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.6)) drop-shadow(0 0 16px rgba(236,121,187,.6));
}
#cat.tilting img { transform: rotate(-7deg); }
#cat.pos-story  { right: 18px; bottom: 92px; }
#cat.pos-hub    { right: 18px; bottom: 92px; }
#cat.pos-pink   { right: 18px; bottom: 92px; }
#cat.pos-secret { right: 18px; bottom: 92px; }
#cat.pos-gallery{ left: 18px; right: auto; bottom: 118px; align-items: flex-start; }
#cat.pos-finale { right: 16px; bottom: 66px; }
#cat.pos-finale img { width: 124px; height: 124px; }
.cat-bubble {
  position: absolute; bottom: calc(100% + 14px); right: 4px;
  width: max-content; max-width: 250px;
  background: var(--soft-white); color: var(--dark-plum);
  font-family: var(--font-ui); font-size: .92rem; line-height: 1.45;
  padding: 11px 15px; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5);
}
#cat.pos-gallery .cat-bubble { right: auto; left: 4px; border-radius: 14px 14px 14px 4px; }
.cat-bubble::after {
  content: ""; position: absolute; right: 26px; bottom: -7px;
  border: 8px solid transparent; border-top-color: var(--soft-white); border-bottom: 0;
}
#cat.pos-gallery .cat-bubble::after { right: auto; left: 26px; }

/* ═══ MUSIC MINI-PLAYER ═══ */
.mini-player {
  position: fixed; left: 16px; bottom: 16px; z-index: 45;
  display: flex; align-items: center; gap: 8px;
  background: var(--plum-70); border: 1px solid rgba(236,121,187,.35);
  border-radius: 16px; padding: 9px 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  max-width: min(430px, calc(100vw - 32px));
}
.mp-btn {
  appearance: none; border: none; background: none; color: var(--baby-pink);
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; transition: background .2s ease, transform .15s ease;
  flex: none;
}
.mp-btn:hover { background: rgba(236,121,187,.18); }
.mp-btn:active { transform: scale(.9); }
.mp-play { background: rgba(236,121,187,.22); }
.mp-info { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; }
.mp-title-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mp-title {
  font-size: .8rem; color: var(--soft-white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px;
}
.mp-status { font-size: .66rem; color: var(--soft-pink); letter-spacing: .06em; text-transform: uppercase; flex: none; }
.mp-status.error { color: #ff9db4; }
.mp-progress {
  height: 6px; border-radius: 999px;
  background: rgba(249,234,243,.14); position: relative; cursor: pointer;
}
.mp-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--soft-pink), var(--baby-pink));
  box-shadow: 0 0 8px rgba(236,121,187,.8);
}
.mp-time-row { display: flex; justify-content: space-between; font-size: .66rem; color: rgba(249,234,243,.6); }

/* playlist panel */
.playlist-panel {
  position: fixed; left: 16px; bottom: 86px; z-index: 46;
  width: min(360px, calc(100vw - 32px));
  max-height: min(60vh, 480px); overflow-y: auto;
  background: var(--plum-70); border: 1px solid rgba(236,121,187,.4);
  border-radius: 18px; padding: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
}
.pl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pl-head strong { font-family: var(--font-body); font-style: italic; color: var(--baby-pink); font-weight: 400; }
.pl-close, .guide-close {
  appearance: none; border: none; background: none; color: rgba(249,234,243,.7); font-size: .95rem;
}
.pl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: 10px;
  color: var(--soft-white); text-align: left; font-size: .86rem;
  padding: 9px 10px; transition: background .18s ease;
}
.pl-item:hover { background: rgba(236,121,187,.14); }
.pl-item.current { background: rgba(236,121,187,.22); }
.pl-item.current .pl-title { color: var(--baby-pink); }
.pl-num { color: rgba(249,234,243,.45); font-size: .75rem; width: 16px; flex: none; }
.pl-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-eq { display: none; gap: 2px; align-items: flex-end; height: 12px; flex: none; }
.pl-item.current.playing .pl-eq { display: flex; }
.pl-eq i { width: 3px; background: var(--soft-pink); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.pl-eq i:nth-child(2) { animation-delay: .25s; } .pl-eq i:nth-child(3) { animation-delay: .5s; }
.pl-volume { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .85rem; }
.pl-volume input[type="range"] { flex: 1; accent-color: var(--soft-pink); }

/* ═══ GUIDE ═══ */
.guide-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 45;
  display: flex; align-items: center; gap: 7px;
  background: var(--plum-70); color: var(--baby-pink);
  border: 1px solid rgba(236,121,187,.45);
  border-radius: 999px; padding: 10px 18px; font-size: .86rem; letter-spacing: .05em;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  transition: box-shadow .2s ease, transform .15s ease;
}
.guide-btn:hover { box-shadow: 0 0 22px rgba(236,121,187,.55); transform: translateY(-1px); }
.guide-panel {
  position: fixed; right: 16px; bottom: 72px; z-index: 46;
  width: min(320px, calc(100vw - 32px));
  background: var(--plum-70); border: 1px solid rgba(236,121,187,.4);
  border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
}
.guide-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.guide-panel-head strong { color: var(--baby-pink); font-family: var(--font-body); font-style: italic; font-weight: 400; }
#guide-text { margin: 0 0 12px; font-size: .9rem; line-height: 1.55; color: var(--soft-white); }
.guide-status {
  margin: 0 0 12px; padding: 9px 12px;
  border: 1px dashed rgba(236,121,187,.45); border-radius: 10px;
  font-size: .82rem; font-style: italic; line-height: 1.5; color: var(--baby-pink);
}
.cat-toggle { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: rgba(249,234,243,.8); }
.cat-toggle input { accent-color: var(--soft-pink); }

/* ═══ LIGHTBOX ═══ */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(9,7,13,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 4vw;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border: 6px solid var(--soft-white); border-radius: 4px;
  box-shadow: 0 0 80px rgba(236,121,187,.4);
}
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: rgba(36,16,32,.8); color: var(--soft-white);
  border: 1px solid rgba(236,121,187,.5); border-radius: 50%;
  width: 44px; height: 44px; font-size: 1.1rem;
}
