/* ============================================
   POLINA — Marvel-inspired romantic site
   ============================================ */

:root {
  --bg-deep: #0a0e1a;
  --bg-card: #12182b;
  --bg-card-hover: #1a2238;
  --gold: #c9a227;
  --gold-light: #e8c547;
  --gold-glow: rgba(201, 162, 39, 0.35);
  --red: #c0392b;
  --red-light: #e74c3c;
  --blue: #2980b9;
  --blue-light: #3498db;
  --purple: #8e44ad;
  --green: #27ae60;
  --orange: #e67e22;
  --text: #e8eaf0;
  --text-muted: #8892a8;
  --border: rgba(201, 162, 39, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: 'Cinzel', serif;
  --font-romantic: 'Cormorant Garamond', serif;
  --font-body: 'Jost', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---- Intro ---- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.intro.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.intro__cosmos {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(41, 128, 185, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 162, 39, 0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(192, 57, 43, 0.08) 0%, transparent 40%),
    var(--bg-deep);
}

.intro__cosmos::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 65%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 45%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 90%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 30%, rgba(255,255,255,0.4) 0%, transparent 100%);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.intro__content {
  position: relative;
  text-align: center;
  padding: 2rem;
  animation: fadeUp 1.2s ease forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro__arc {
  width: 120px;
  margin: 0 auto 1.5rem;
  opacity: 0.7;
}

.intro__pre {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.intro__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.intro__sub {
  font-family: var(--font-romantic);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* ---- Buttons ---- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.btn:active { transform: scale(0.96); }

.btn--gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light), var(--gold));
  color: var(--bg-deep);
  box-shadow: 0 4px 24px var(--gold-glow);
}

.btn--gold:hover {
  box-shadow: 0 6px 32px var(--gold-glow);
}

.btn__shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shine 3s ease infinite;
}

@keyframes shine {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold-light);
}

.btn--outline:hover {
  background: rgba(201, 162, 39, 0.1);
}

.btn--sm {
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
}

.btn__icon {
  width: 18px;
  height: 18px;
}

/* ---- App layout ---- */
.app {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 1rem);
  min-height: 100dvh;
}

.section {
  display: none;
  padding: 1.5rem 1.25rem 2rem;
  max-width: 480px;
  margin: 0 auto;
  animation: sectionIn 0.5s ease;
}

.section.active { display: block; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.section__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  text-align: center;
  color: var(--gold-light);
  margin-bottom: 0.4rem;
}

.section__sub {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ---- Nav ---- */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0.5rem;
}

.nav__btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.nav__btn.active {
  color: var(--gold-light);
}

.nav__btn.active svg {
  transform: scale(1.1);
}

/* ---- Hero / Counter ---- */
.hero {
  position: relative;
  text-align: center;
  padding: 2rem 0;
}

.hero__glow {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  margin-bottom: 1.5rem;
}

.hero__badge-icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
}

.hero__heading {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.hero__since {
  font-family: var(--font-romantic);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.counter__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.5rem;
  min-width: 58px;
}

.counter__num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.counter__label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.2rem;
}

.counter__sep {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  opacity: 0.5;
  padding-bottom: 1rem;
}

.hero__quote {
  font-family: var(--font-romantic);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.surprise-btn { width: 100%; max-width: 280px; }

/* ---- Timeline ---- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline__line {
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--orange), var(--gold), var(--red), var(--blue), var(--purple));
  opacity: 0.4;
}

.timeline__item {
  position: relative;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline__item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline__dot {
  position: absolute;
  left: -2rem;
  top: 1.2rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  z-index: 1;
}

.timeline__dot--gold { background: var(--gold); box-shadow: 0 0 12px var(--gold-glow); }
.timeline__dot--orange { background: var(--orange); box-shadow: 0 0 12px rgba(230, 126, 34, 0.4); }
.timeline__dot--red { background: var(--red); box-shadow: 0 0 12px rgba(192,57,43,0.4); }
.timeline__dot--blue { background: var(--blue-light); box-shadow: 0 0 12px rgba(52,152,219,0.4); }
.timeline__dot--purple { background: var(--purple); box-shadow: 0 0 12px rgba(142,68,173,0.4); }

.timeline__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: border-color 0.3s ease;
}

.timeline__card:active {
  border-color: var(--gold);
}

.timeline__date {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 0.4rem;
}

.timeline__card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.timeline__card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- Letter ---- */
.letter {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.letter.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter__seal {
  position: absolute;
  top: -20px;
  right: 1.5rem;
  width: 50px;
  height: 50px;
}

.letter__greeting {
  font-family: var(--font-romantic);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--gold-light);
  margin-bottom: 1rem;
}

.letter__body p {
  font-family: var(--font-romantic);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--text);
}

.letter__sign {
  margin-top: 1.5rem;
  text-align: right;
  color: var(--gold);
}

.letter__sign em {
  font-size: 1.2rem;
}

.letter__vault-hint {
  display: block;
  margin: 1.5rem auto 0;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0.15;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.letter__vault-hint:active {
  opacity: 0.6;
}

/* ---- Stones / Quest ---- */
.stones {
  margin-bottom: 2.5rem;
}

.stones__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stone {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.stone svg {
  width: 50%;
  height: 50%;
  opacity: 0.3;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.stone.found svg {
  opacity: 1;
  animation: stonePulse 2s ease infinite;
}

.stone.found {
  border-color: currentColor;
  box-shadow: 0 0 20px currentColor;
}

@keyframes stonePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.stone--space { color: #3498db; }
.stone--mind { color: #f1c40f; }
.stone--reality { color: #e74c3c; }
.stone--power { color: #9b59b6; }
.stone--time { color: #2ecc71; }
.stone--soul { color: #e67e22; }

.stones__progress {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stones__progress span {
  color: var(--gold-light);
  font-weight: 600;
}

/* ---- Vaults ---- */
.vaults {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.vault {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.3s ease;
}

.vault.unlocked {
  border-color: var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
}

.vault__icon {
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
}

.vault h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.vault__hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.vault__input-wrap {
  display: flex;
  gap: 0.5rem;
}

.vault__input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.vault__input:focus {
  border-color: var(--gold);
}

.vault__msg {
  font-size: 0.8rem;
  margin-top: 0.6rem;
  min-height: 1.2em;
}

.vault__msg.success { color: var(--green); }
.vault__msg.error { color: var(--red-light); }

/* ---- Mini game ---- */
.game {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow: hidden;
}

.game__title {
  font-family: var(--font-display);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 0.3rem;
}

.game__sub {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.game__arena {
  position: relative;
  height: 280px;
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game__arena.playing {
  justify-content: flex-start;
}

.game__hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  background: rgba(10, 14, 26, 0.8);
  z-index: 2;
}

.game__hud strong {
  color: var(--gold-light);
}

.game-heart {
  position: absolute;
  cursor: pointer;
  animation: heartFall linear forwards;
  z-index: 1;
  filter: drop-shadow(0 0 6px rgba(231, 76, 60, 0.5));
}

.game-heart svg {
  width: 100%;
  height: 100%;
}

@keyframes heartFall {
  from { transform: translateY(-40px) rotate(0deg); }
  to { transform: translateY(320px) rotate(360deg); }
}

.game-heart.popped {
  animation: heartPop 0.3s ease forwards;
}

@keyframes heartPop {
  to { transform: scale(1.5); opacity: 0; }
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal__card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: modalIn 0.4s ease;
  max-height: 85dvh;
  overflow-y: auto;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.modal__glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

.modal__glow--purple {
  background: radial-gradient(circle, rgba(142,68,173,0.3) 0%, transparent 70%);
}

.modal__glow--rainbow {
  background: radial-gradient(circle, rgba(201,162,39,0.3) 0%, rgba(231,76,60,0.2) 40%, rgba(52,152,219,0.2) 70%, transparent 100%);
}

.modal__heart {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  animation: heartBeat 1.5s ease infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

.modal__card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold-light);
  margin-bottom: 1rem;
}

.modal__card p {
  font-family: var(--font-romantic);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.modal__extra {
  font-size: 0.85rem !important;
  color: var(--text-muted) !important;
}

.modal__card--secret {
  border-color: var(--purple);
}

.modal__card--assembly {
  border-color: var(--gold);
}

.assembly__text {
  font-size: 1.1rem !important;
}

.assembly__final {
  color: var(--gold-light) !important;
  font-style: italic;
}

/* ---- Floating hearts ---- */
#hearts-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.float-heart {
  position: absolute;
  bottom: -30px;
  animation: floatUp linear forwards;
  opacity: 0.5;
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}

/* ---- Confetti canvas ---- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 600;
}

/* ---- Hidden stone triggers (scattered in UI) ---- */
.stone-trigger {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

/* ---- Responsive tweaks ---- */
@media (min-width: 480px) {
  .section { padding: 2rem 2rem 3rem; }
  .counter__block { min-width: 68px; padding: 0.9rem 0.7rem; }
  .counter__num { font-size: 1.8rem; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
