/* Faqat sen uchun — Night Sky + 3D Letter + Fingerprint Seal */

:root {
  --void: #050510;
  --violet: #6b4ce6;
  --rose: #e89ab5;
  --rose-deep: #c45d85;
  --gold: #f0d78c;
  --soft: #f4f0ff;
  --muted: rgba(244, 240, 255, 0.55);
  --font-d: "Cormorant Garamond", Georgia, serif;
  --font-s: "Great Vibes", cursive;
  --font-u: "Outfit", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --soft-e: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden; background: var(--void); color: var(--soft);
  font-family: var(--font-u); -webkit-font-smoothing: antialiased; touch-action: manipulation;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.app {
  position: relative; width: 100%; height: 100%; min-height: 100dvh; overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #12102a 0%, var(--void) 55%);
}
.sky-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

.nebula {
  position: fixed; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 2; opacity: 0.35;
}
.nebula-1 {
  width: 60vw; height: 60vw; top: -10%; left: -15%;
  background: radial-gradient(circle, rgba(107,76,230,0.45), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate;
}
.nebula-2 {
  width: 50vw; height: 50vw; bottom: -5%; right: -10%;
  background: radial-gradient(circle, rgba(232,154,181,0.25), transparent 70%);
  animation: drift 34s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(30px,-20px) scale(1.08); }
}
.vignette {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(5,5,16,0.78) 100%);
}

.sound-controls {
  position: fixed; top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right)); z-index: 100;
}
.sound-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(240,215,140,0.35);
  background: rgba(10,10,26,0.65); backdrop-filter: blur(8px);
  color: var(--gold); font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.sound-btn:hover, .sound-btn:focus-visible { border-color: var(--gold); outline: none; }
.sound-btn.playing { border-color: var(--rose); box-shadow: 0 0 18px rgba(232,154,181,0.35); }

.scene {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 1s var(--soft-e), visibility 1s; z-index: 10;
}
.scene.active { opacity: 1; visibility: visible; pointer-events: auto; }

/* INTRO */
.intro-wrap { text-align: center; padding: 1.5rem; max-width: 92vw; z-index: 5; position: relative; }
.intro-eyebrow {
  font-size: 0.75rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 1rem; opacity: 0; animation: rise 1.2s var(--ease) 0.4s forwards;
}
.intro-title {
  font-family: var(--font-s); font-size: clamp(2.8rem, 12vw, 4.5rem); font-weight: 400;
  text-shadow: 0 0 40px rgba(107,76,230,0.5); margin-bottom: 0.8rem;
  opacity: 0; animation: rise 1.2s var(--ease) 0.7s forwards;
}
.intro-sub {
  font-family: var(--font-d); font-size: clamp(1.05rem, 3.5vw, 1.3rem); color: var(--muted);
  margin-bottom: 2.4rem; opacity: 0; animation: rise 1.2s var(--ease) 1s forwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  font-family: var(--font-u); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.03em;
  border: none; cursor: pointer; border-radius: 999px; padding: 0.9rem 1.8rem;
  transition: transform 0.35s var(--ease), box-shadow 0.35s, background 0.3s, opacity 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn-lantern {
  background: linear-gradient(145deg, #5a3fd4, #3d2a9e); color: #fff;
  box-shadow: 0 8px 32px rgba(107,76,230,0.45), inset 0 0 0 1px rgba(255,255,255,0.08);
  display: inline-flex; align-items: center; gap: 0.55rem;
  opacity: 0; animation: rise 1s var(--ease) 1.35s forwards;
}
.btn-lantern:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 40px rgba(107,76,230,0.6);
}
.lantern-icon { font-size: 1.15rem; }

.btn-ghost {
  margin-top: 1.4rem; background: transparent; color: var(--gold);
  border: 1px solid rgba(240,215,140,0.35); font-size: 0.9rem;
}
.btn-ghost:hover { background: rgba(240,215,140,0.08); }
.btn-ghost.hidden { display: none; }

.skip-link {
  position: absolute; bottom: max(18px, env(safe-area-inset-bottom));
  right: max(14px, env(safe-area-inset-right)); z-index: 30;
  background: transparent; border: none; color: rgba(244,240,255,0.4);
  font-size: 0.8rem; font-family: var(--font-u); cursor: pointer; padding: 0.4rem 0.7rem;
}
.skip-link:hover { color: var(--soft); }
.skip-link.hidden { opacity: 0; pointer-events: none; }

/* SKY */
.scene-sky { flex-direction: column; }
.lantern {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  z-index: 15; opacity: 0; transition: opacity 0.4s;
}
.lantern.visible { opacity: 1; }
.lantern.rising { animation: lanternRise 4.5s var(--ease) forwards; }
@keyframes lanternRise {
  0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-85vh) scale(0.55); opacity: 0.12; }
}
.lantern-body {
  font-size: 2.8rem; filter: drop-shadow(0 0 18px rgba(240,180,80,0.7));
  position: relative; z-index: 2;
}
.lantern-glow {
  position: absolute; top: 50%; left: 50%; width: 90px; height: 90px;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(240,180,80,0.55), transparent 70%);
  border-radius: 50%; animation: glowPulse 2s ease-in-out infinite; z-index: 1;
}
@keyframes glowPulse {
  0%,100% { transform: translate(-50%,-50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%,-50%) scale(1.25); opacity: 1; }
}
.constellation {
  position: absolute; width: min(90vw, 400px); height: auto;
  top: 50%; left: 50%; transform: translate(-50%,-55%); z-index: 12;
  opacity: 0; transition: opacity 0.8s;
}
.constellation.visible { opacity: 1; }
.const-lines line {
  stroke: rgba(240,215,140,0.55); stroke-width: 1.2; stroke-linecap: round;
  fill: none; stroke-dasharray: 220; stroke-dashoffset: 220;
  transition: stroke-dashoffset 1.2s var(--ease);
}
.const-lines line.drawn { stroke-dashoffset: 0; }
.const-stars circle { fill: var(--gold); opacity: 0; transition: opacity 0.5s; }
.const-stars circle.lit { opacity: 1; }
.sky-hint {
  position: absolute; bottom: max(28px, env(safe-area-inset-bottom));
  left: 0; right: 0; text-align: center; font-family: var(--font-d);
  font-size: 1.05rem; color: var(--muted); opacity: 0; transition: opacity 0.6s; z-index: 14;
}
.sky-hint.visible { opacity: 1; }

/* 3D CARD */
.stage-3d { perspective: 1400px; width: min(92vw, 400px); }
.message-card {
  position: relative; transform-style: preserve-3d;
  transform: rotateY(-18deg) rotateX(6deg) translateY(30px) scale(0.92);
  opacity: 0;
  transition: transform 1.1s var(--ease), opacity 0.9s var(--ease);
}
.message-card.visible {
  opacity: 1;
  transform: rotateY(-6deg) rotateX(3deg) translateY(0) scale(1);
}
.message-card.flat { transform: rotateY(0) rotateX(0) translateY(0) scale(1); }
.card-face {
  position: relative; border-radius: 20px;
  background: linear-gradient(160deg, rgba(28,22,55,0.92), rgba(14,10,32,0.88));
  border: 1px solid rgba(107,76,230,0.28);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 40px rgba(107,76,230,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
  padding: 2rem 1.6rem 1.5rem; overflow: hidden;
  max-height: min(78vh, 540px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.card-shine {
  position: absolute; top: -30%; left: -20%; width: 70%; height: 60%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.07), transparent 70%);
  pointer-events: none; transform: rotate(-12deg);
}
.message-to {
  font-family: var(--font-s); font-size: 1.85rem; color: var(--gold);
  margin-bottom: 1.15rem; opacity: 0; transition: opacity 0.7s;
  text-shadow: 0 0 20px rgba(240,215,140,0.25);
}
.message-to.visible { opacity: 1; }
.message-text {
  font-family: var(--font-d);
  font-size: clamp(1.02rem, 3.2vw, 1.18rem);
  line-height: 1.8; color: var(--soft);
}
.message-text .line {
  opacity: 0; transform: translateY(10px); margin-bottom: 0.95em;
  transition: opacity 0.8s var(--soft-e), transform 0.8s var(--soft-e);
}
.message-text .line.visible { opacity: 1; transform: translateY(0); }
.message-text .line.accent { color: var(--rose); font-style: italic; }
.card-seal {
  position: absolute; bottom: 14px; right: 18px;
  font-size: 0.9rem; color: rgba(240,215,140,0.35); pointer-events: none;
}

/* ========== FINGERPRINT SEAL ========== */
.seal-wrap {
  text-align: center; padding: 1.5rem; max-width: 94vw; position: relative; z-index: 5;
}
.seal-prompt {
  font-family: var(--font-d); font-size: clamp(1.3rem, 4.5vw, 1.75rem);
  color: var(--soft); margin-bottom: 0.35rem;
  opacity: 0; animation: rise 0.9s var(--ease) 0.2s forwards;
}
.seal-sub {
  font-family: var(--font-d); font-size: 1rem; color: var(--muted); margin-bottom: 1.8rem;
  opacity: 0; animation: rise 0.9s var(--ease) 0.4s forwards;
}

.fp-stage {
  position: relative; width: min(280px, 78vw); height: 220px;
  margin: 0 auto 1.2rem;
}

/* Hold UI */
.fp-hold {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s, transform 0.5s;
}
.fp-hold.gone {
  opacity: 0; pointer-events: none; transform: scale(0.85);
}

.fp-ring {
  position: absolute; width: 140px; height: 140px;
  transform: rotate(-90deg);
}
.fp-ring-bg {
  fill: none; stroke: rgba(244,240,255,0.12); stroke-width: 3;
}
.fp-ring-progress {
  fill: none; stroke: var(--rose); stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.05s linear;
  filter: drop-shadow(0 0 6px rgba(232,154,181,0.6));
}
.fp-hold.holding .fp-ring-progress {
  transition: stroke-dashoffset 1.8s linear;
  stroke-dashoffset: 0;
}

.fp-pad {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(40,30,70,0.95), rgba(18,12,40,0.95));
  border: 1px solid rgba(232,154,181,0.35);
  box-shadow: 0 0 30px rgba(232,154,181,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.25rem; cursor: pointer; user-select: none;
  position: relative; z-index: 2;
  transition: transform 0.2s, box-shadow 0.3s, border-color 0.3s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.fp-pad:hover, .fp-pad:focus-visible {
  border-color: var(--rose);
  box-shadow: 0 0 40px rgba(232,154,181,0.35);
  outline: none;
}
.fp-hold.holding .fp-pad {
  transform: scale(0.92);
  border-color: var(--rose);
  box-shadow: 0 0 50px rgba(232,154,181,0.5), inset 0 0 20px rgba(232,154,181,0.15);
}
.fp-icon {
  width: 36px; height: 36px;
}
.fp-line {
  fill: none; stroke: rgba(232,154,181,0.75); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.fp-hint {
  font-size: 0.62rem; letter-spacing: 0.04em; color: var(--muted);
  text-transform: lowercase;
}

/* Split heart */
.split-heart {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
}
.split-heart.show { opacity: 1; pointer-events: auto; }

.heart-half {
  width: 90px; height: 100px;
  position: relative;
  transition: transform 1s var(--ease);
}
.heart-half.left { transform: translateX(20px); }
.heart-half.right { transform: translateX(-20px); }
.split-heart.apart .heart-half.left { transform: translateX(-18px) rotate(-8deg); }
.split-heart.apart .heart-half.right { transform: translateX(18px) rotate(8deg); }
.split-heart.joined .heart-half.left { transform: translateX(2px); }
.split-heart.joined .heart-half.right { transform: translateX(-2px); }

.half-inner {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
  /* heart half shapes via clip */
}
.heart-half.left .half-inner {
  clip-path: path("M90,30 C90,10 70,0 50,0 C50,0 50,0 50,0 C30,0 10,12 10,35 C10,60 50,90 50,90 L90,55 Z");
  background: linear-gradient(145deg, #e89ab5, #a03d62);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(192,70,110,0.4);
}
.heart-half.right .half-inner {
  clip-path: path("M0,30 C0,10 20,0 40,0 C40,0 40,0 40,0 C60,0 80,12 80,35 C80,60 40,90 40,90 L0,55 Z");
  background: linear-gradient(215deg, #f0b0c4, #b84870);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(192,70,110,0.4);
}

/* Simpler reliable heart halves using CSS */
.heart-half.left .half-inner,
.heart-half.right .half-inner {
  clip-path: none;
  width: 88px; height: 80px;
  background: transparent;
  box-shadow: none;
  position: relative;
}
.heart-half.left .half-inner::before,
.heart-half.right .half-inner::before {
  content: "";
  position: absolute;
  width: 44px; height: 70px;
  background: linear-gradient(160deg, #f0a8c0, #c45d85 60%, #9a3a5c);
  top: 4px;
}
.heart-half.left .half-inner::before {
  left: 44px;
  border-radius: 44px 44px 8px 44px;
  transform-origin: left center;
  box-shadow: -4px 6px 20px rgba(160,50,90,0.35);
}
.heart-half.right .half-inner::before {
  right: 44px; left: auto;
  border-radius: 44px 44px 44px 8px;
  transform-origin: right center;
  box-shadow: 4px 6px 20px rgba(160,50,90,0.35);
}
/* classic heart lobes */
.heart-half.left .half-inner::after,
.heart-half.right .half-inner::after {
  content: "";
  position: absolute;
  width: 44px; height: 44px;
  background: linear-gradient(145deg, #f2b4c8, #d07098);
  top: 0;
  border-radius: 50%;
}
.heart-half.left .half-inner::after { left: 22px; }
.heart-half.right .half-inner::after { right: 22px; left: auto; }

.half-fp {
  position: relative; z-index: 3;
  width: 34px; height: 42px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 0.8s 0.3s;
}
.half-fp path {
  fill: none;
  stroke: rgba(255,255,255,0.55);
  stroke-width: 1.4;
  stroke-linecap: round;
}
.half-fp.mine path { stroke: rgba(240,215,140,0.7); }
.split-heart.sealed .half-fp { opacity: 1; }

.half-label {
  position: relative; z-index: 3;
  font-family: var(--font-s);
  font-size: 1.15rem;
  color: rgba(255,255,255,0.9);
  margin-top: 2px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.6s 0.5s;
}
.split-heart.sealed .half-label { opacity: 1; }

.heart-glow {
  position: absolute; width: 160px; height: 120px;
  background: radial-gradient(ellipse, rgba(232,154,181,0.35), transparent 70%);
  filter: blur(10px); z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 0.8s;
}
.split-heart.sealed .heart-glow { opacity: 1; }

.seal-done {
  font-family: var(--font-d); font-size: 1.15rem; color: var(--gold);
  margin-top: 0.5rem; min-height: 1.4em;
  opacity: 0; transition: opacity 0.6s;
}
.seal-done.visible { opacity: 1; }
.seal-done.hidden { display: none; }

/* FINALE */
.finale-wrap {
  text-align: center; padding: 2rem 1.5rem; max-width: 90vw; position: relative; z-index: 5;
}
.finale-meteors {
  position: absolute; inset: -40% -20%; pointer-events: none; overflow: visible;
}
.meteor {
  position: absolute; width: 2px; height: 60px;
  background: linear-gradient(to bottom, transparent, var(--gold));
  border-radius: 2px; opacity: 0; animation: meteorFall 1.4s var(--ease) forwards;
}
@keyframes meteorFall {
  0% { transform: translateY(-20px) rotate(25deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(280px) rotate(25deg); opacity: 0; }
}
.finale-mini-heart {
  font-size: 1.8rem; margin-bottom: 0.8rem; opacity: 0;
  filter: drop-shadow(0 0 12px rgba(232,154,181,0.6));
}
.finale-mini-heart.visible { animation: rise 0.8s var(--ease) forwards; }
.finale-line {
  font-family: var(--font-d); font-size: clamp(1.25rem, 4.2vw, 1.8rem);
  line-height: 1.55; color: var(--soft); margin-bottom: 0.85rem;
  opacity: 0; transform: translateY(14px);
}
.finale-line.visible { animation: rise 1s var(--ease) forwards; }
.finale-line-soft { color: var(--muted); font-size: clamp(1.05rem, 3.5vw, 1.3rem); }
.finale-sign {
  font-family: var(--font-s); font-size: clamp(1.7rem, 5.5vw, 2.4rem);
  color: var(--gold); margin-top: 1.5rem; margin-bottom: 2.4rem;
  opacity: 0; transform: translateY(10px);
}
.finale-sign.visible { animation: rise 1s var(--ease) forwards; }
.btn-replay {
  background: transparent; color: rgba(244,240,255,0.65);
  border: 1px solid rgba(240,215,140,0.3); font-size: 0.85rem; padding: 0.65rem 1.4rem;
  opacity: 0;
}
.btn-replay.visible { animation: rise 0.8s var(--ease) forwards; }
.btn-replay:hover { color: var(--soft); border-color: var(--gold); }

.float-heart {
  position: fixed; pointer-events: none; color: var(--rose); font-size: 0.9rem;
  opacity: 0; z-index: 15; animation: floatUp 5s linear forwards;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 0.75; }
  100% { transform: translateY(-85vh) scale(1.1); opacity: 0; }
}

@media (max-width: 480px) {
  .card-face { padding: 1.5rem 1.25rem 1.3rem; }
  .lantern-body { font-size: 2.3rem; }
  .fp-pad { width: 88px; height: 88px; }
  .fp-ring { width: 128px; height: 128px; }
}
