/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:            #090810;
  --rose:          #e8456e;
  --rose-dim:      rgba(232, 69, 110, 0.35);
  --rose-glow:     rgba(232, 69, 110, 0.18);
  --gold:          #f4c53a;
  --gold-dim:      rgba(244, 197, 58, 0.3);
  --gold-glow:     rgba(244, 197, 58, 0.15);
  --text:          #f9e8ef;
  --text-muted:    rgba(249, 232, 239, 0.45);
  --font-main:     'Cormorant Garamond', Georgia, serif;
  --font-sc:       'Cormorant SC', Georgia, serif;
  --transition:    cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Aurora background ──────────────────────────────────────────────────────── */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}

.aurora-blob--rose {
  width: 60vmax;
  height: 60vmax;
  background: radial-gradient(circle, rgba(160,25,55,0.7) 0%, transparent 70%);
  bottom: -20vmax;
  left: -15vmax;
  animation: float-rose 22s ease-in-out infinite;
}

.aurora-blob--violet {
  width: 50vmax;
  height: 50vmax;
  background: radial-gradient(circle, rgba(80,15,110,0.6) 0%, transparent 70%);
  top: -15vmax;
  right: -10vmax;
  animation: float-violet 28s ease-in-out infinite;
}

.aurora-blob--blue {
  width: 40vmax;
  height: 40vmax;
  background: radial-gradient(circle, rgba(20,45,130,0.4) 0%, transparent 70%);
  top: 30%;
  left: 30%;
  animation: float-blue 35s ease-in-out infinite;
}

@keyframes float-rose {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(8vw, -6vh) scale(1.08); }
  66%       { transform: translate(-5vw, 8vh) scale(0.95); }
}
@keyframes float-violet {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(-10vw, 8vh) scale(1.1); }
  70%       { transform: translate(6vw, -5vh) scale(0.92); }
}
@keyframes float-blue {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-8vw, -10vh) scale(1.12); }
}

/* ─── Particle canvas ────────────────────────────────────────────────────────── */
#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ─── Counter ───────────────────────────────────────────────────────────────── */
#counter {
  position: fixed;
  top: 1.6rem;
  right: 1.8rem;
  z-index: 10;
  text-align: center;
  font-family: var(--font-sc);
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1;
  letter-spacing: 0.04em;
  transition: color 0.4s;
}

#counter #count {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--rose);
  transition: color 0.4s, transform 0.2s;
  display: inline-block;
}

#counter.tick #count {
  animation: counter-tick 0.3s var(--transition);
}

.counter-sep { color: var(--text-muted); }

.counter-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

@keyframes counter-tick {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ─── Sound button ───────────────────────────────────────────────────────────── */
#sound-btn {
  position: fixed;
  top: 1.6rem;
  left: 1.8rem;
  z-index: 10;
  background: none;
  border: 1px solid rgba(249,232,239,0.15);
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sound-btn:hover {
  border-color: var(--rose-dim);
  color: var(--rose);
  transform: scale(1.1);
}

#sound-btn.muted { opacity: 0.4; }

/* ─── Main layout ────────────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.8rem;
  padding: 1rem 2rem;
  max-width: 680px;
  width: 100%;
}

/* ─── Reason wrapper ─────────────────────────────────────────────────────────── */
#reason-wrapper {
  text-align: center;
  min-height: 12rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

#prefix {
  font-family: var(--font-sc);
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

/* ─── Reason card ────────────────────────────────────────────────────────────── */
#reason-card {
  position: relative;
  padding: 2rem 2.5rem;
  border-radius: 1rem;
  max-width: 560px;
  transition: background 0.5s, box-shadow 0.5s;
}

#reason-card.state-idle {
  background: transparent;
  box-shadow: none;
}

#reason-card.state-normal {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 60px rgba(232, 69, 110, 0.06),
              inset 0 0 0 1px rgba(232, 69, 110, 0.08);
}

#reason-card.state-rare {
  background: linear-gradient(135deg,
    rgba(50,25,0,0.7) 0%,
    rgba(35,18,0,0.6) 100%
  );
  box-shadow:
    0 0 80px rgba(244, 197, 58, 0.2),
    0 0 30px rgba(244, 197, 58, 0.12),
    inset 0 0 0 1px rgba(244, 197, 58, 0.2);
}

#reason-text {
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  color: var(--text);
  transition: color 0.4s;
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
}

#reason-card.state-rare #reason-text {
  color: var(--gold);
}

/* Reason text enter/exit animations */
#reason-card.exiting #reason-text {
  animation: reason-out 0.35s var(--transition) forwards;
}

#reason-card.entering #reason-text {
  animation: reason-in 0.55s var(--transition) forwards;
}

@keyframes reason-out {
  from { opacity: 1; transform: translateY(0); filter: blur(0); }
  to   { opacity: 0; transform: translateY(-14px); filter: blur(4px); }
}

@keyframes reason-in {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ─── Rare badge ─────────────────────────────────────────────────────────────── */
#rare-badge {
  font-family: var(--font-sc);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 1rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s 0.3s, transform 0.4s 0.3s;
  text-align: center;
}

#reason-card.state-rare #rare-badge {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Click hint ─────────────────────────────────────────────────────────────── */
#click-hint {
  font-family: var(--font-sc);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  animation: hint-pulse 3s ease-in-out infinite;
  margin-top: 0.5rem;
}

#click-hint.hidden { display: none; }

@keyframes hint-pulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.9; }
}

/* ─── Heart button ───────────────────────────────────────────────────────────── */
#heart-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: clamp(90px, 18vw, 130px);
  height: clamp(90px, 18vw, 130px);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#heart-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 18px var(--rose-dim))
          drop-shadow(0 0 6px var(--rose-glow));
  animation: heart-pulse 2.2s ease-in-out infinite;
  transition: filter 0.3s;
  overflow: visible;
}

#heart-path {
  fill: url(#heartGrad);
  transition: d 0.3s;
}


@keyframes heart-pulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 18px var(--rose-dim)) drop-shadow(0 0 6px var(--rose-glow)); }
  50%       { transform: scale(1.06); filter: drop-shadow(0 0 30px var(--rose-dim)) drop-shadow(0 0 12px var(--rose-glow)); }
}

#heart-btn:hover #heart-svg {
  filter: drop-shadow(0 0 30px rgba(232,69,110,0.55))
          drop-shadow(0 0 12px rgba(232,69,110,0.3));
  animation-play-state: paused;
  transform: scale(1.08);
}

#heart-btn.beating #heart-svg {
  animation: heart-beat 0.35s var(--transition) forwards;
}

@keyframes heart-beat {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.28); }
  65%  { transform: scale(0.93); }
  100% { transform: scale(1); }
}

/* Ripple */
.heart-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--rose);
  opacity: 0;
  pointer-events: none;
}

.heart-ripple.active {
  animation: ripple-out 0.6s ease-out forwards;
}

@keyframes ripple-out {
  from { transform: scale(0.8); opacity: 0.6; }
  to   { transform: scale(2.2); opacity: 0; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: var(--font-sc);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.name-link {
  background: none;
  border: none;
  font: inherit;
  color: var(--rose);
  cursor: pointer;
  text-decoration: none;
  letter-spacing: inherit;
  padding: 0;
  transition: color 0.3s, text-shadow 0.3s;
}

.name-link:hover {
  color: var(--text);
  text-shadow: 0 0 12px var(--rose);
}

/* ─── Finale overlay ─────────────────────────────────────────────────────────── */
#finale {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 8, 16, 0);
  backdrop-filter: blur(0px);
  transition: background 1s, backdrop-filter 1s;
  padding: 2rem;
}

#finale.visible {
  background: rgba(9, 8, 16, 0.92);
  backdrop-filter: blur(16px);
}

#finale.hidden {
  display: none;
}

#finale-content {
  position: relative;
  max-width: 540px;
  width: 100%;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s 0.4s, transform 0.8s 0.4s var(--transition);
}

#finale.visible #finale-content {
  opacity: 1;
  transform: translateY(0);
}

.finale-pre {
  font-family: var(--font-sc);
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  line-height: 2;
}

.finale-main {
  font-family: var(--font-main);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  line-height: 1.1;
  margin: 1.2rem 0 0.8rem;
  text-shadow: 0 0 60px var(--rose-dim);
}

.finale-sub {
  font-family: var(--font-sc);
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.finale-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.finale-cta {
  font-family: var(--font-sc);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.finale-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 2.4rem;
  border-radius: 3rem;
  font-family: var(--font-sc);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s, background 0.3s;
  border: 1px solid var(--rose);
  color: var(--text);
  background: rgba(232, 69, 110, 0.15);
}

.finale-btn:hover {
  transform: translateY(-2px);
  background: rgba(232, 69, 110, 0.28);
  box-shadow: 0 8px 30px rgba(232, 69, 110, 0.25);
}

.finale-btn--ghost {
  background: transparent;
  border-color: rgba(249, 232, 239, 0.2);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.finale-btn--ghost:hover {
  background: rgba(249, 232, 239, 0.06);
  box-shadow: none;
  border-color: rgba(249, 232, 239, 0.35);
  color: var(--text);
}

/* Finale floating stars */
#finale-stars {
  position: absolute;
  inset: -4rem;
  pointer-events: none;
  overflow: hidden;
}

.f-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--rose);
  border-radius: 50%;
  animation: f-star-float linear infinite;
  opacity: 0;
}

@keyframes f-star-float {
  0%   { opacity: 0; transform: translateY(0) scale(0); }
  10%  { opacity: 1; transform: translateY(-10px) scale(1); }
  90%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-120px) scale(0.5); }
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #reason-card { padding: 1.5rem 1.5rem; }
  main { gap: 2rem; }
  #counter { top: 1rem; right: 1.2rem; }
  #sound-btn { top: 1rem; left: 1.2rem; }
  footer { bottom: 1rem; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rose-dim); border-radius: 2px; }
