/* =========================================================
   DIWALI — FESTIVAL OF LIGHTS (ORANGE, MAGENTA & GOLD)
   ========================================================= */
:root {
  --bg-deep: #1b0416;
  --bg-magenta: #4b0933;
  --saffron: #ff7b00;
  --magenta: #e8257a;
  --gold: #ffd452;
  --ivory: #fff8eb;
  --muted: rgba(255, 240, 212, 0.78);

  --card-bg: linear-gradient(155deg, rgba(96, 16, 62, 0.78), rgba(38, 6, 28, 0.9));
  --card-border: rgba(255, 212, 82, 0.55);

  --font-display: "Rozha One", Georgia, serif;
  --font-ui: "Poppins", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 35%, #691042 0%, var(--bg-magenta) 42%, var(--bg-deep) 100%);
  color: var(--ivory);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.diwali-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.rangoli-wheel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(92vmin, 720px);
  height: min(92vmin, 720px);
  transform: translate(-50%, -50%);
  animation: rangoliSpin 85s linear infinite;
}

@keyframes rangoliSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Row of Glowing Clay Diyas */
.diya-row {
  position: absolute;
  bottom: clamp(14px, 3vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: clamp(28px, 8vw, 110px);
}

.diya {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.diya .flame {
  width: 14px;
  height: 24px;
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  background: radial-gradient(circle at 50% 70%, #ffffff 0%, #ffe680 42%, #ff7b00 88%);
  box-shadow: 0 0 26px #ff9d00, 0 0 54px rgba(255, 123, 0, 0.7);
  animation: flameDance 1.6s ease-in-out infinite alternate;
}

.diya:nth-child(even) .flame { animation-delay: 0.55s; }

.diya .bowl {
  margin-top: -4px;
  width: 44px;
  height: 16px;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, #d96b27, #8a3310);
  border-top: 2px solid var(--gold);
}

@keyframes flameDance {
  0% { transform: scale(1) rotate(-3deg); opacity: 0.9; }
  100% { transform: scale(1.12, 0.94) rotate(3deg); opacity: 1; }
}

/* Controls */
.controls {
  position: fixed;
  top: clamp(14px, 2.5vw, 24px);
  right: clamp(14px, 2.5vw, 24px);
  z-index: 25;
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--card-border);
  background: rgba(45, 7, 32, 0.78);
  color: var(--gold);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.ctrl-btn svg { width: 18px; height: 18px; }
.ctrl-btn:hover, .ctrl-btn:focus-visible {
  transform: translateY(-2px);
  background: rgba(232, 37, 122, 0.52);
  outline: none;
}
.ctrl-btn[aria-pressed="true"] { background: var(--saffron); color: #1b0416; border-color: var(--gold); }

#sound-btn .icon-on { display: none; }
#sound-btn[aria-pressed="true"] .icon-on { display: block; }
#sound-btn[aria-pressed="true"] .icon-off { display: none; }
#fullscreen-btn .icon-compress { display: none; }
body.is-fullscreen #fullscreen-btn .icon-compress { display: block; }
body.is-fullscreen #fullscreen-btn .icon-expand { display: none; }

.toast {
  position: fixed;
  top: 72px;
  right: clamp(14px, 2.5vw, 24px);
  z-index: 30;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(54, 8, 38, 0.95);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.84rem;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Stage */
.stage {
  position: relative;
  z-index: 10;
  width: min(920px, 92vw);
  padding: clamp(24px, 4vh, 48px) 0 clamp(82px, 12vh, 112px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(16px, 2.8vh, 28px);
}

.eyebrow {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.title {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 9.8vw, 6.8rem);
  font-weight: 400;
  line-height: 0.98;
  background: linear-gradient(180deg, #fffbe6 0%, #ffd452 50%, #ff7b00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 26px rgba(255, 123, 0, 0.45));
}

.milestone-badge {
  margin-top: 6px;
  padding: 6px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(232, 37, 122, 0.72), rgba(255, 123, 0, 0.72));
  border: 1px solid var(--gold);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Marigold & Magenta Illuminated Cards */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.2vw, 22px);
  width: 100%;
}

.diya-card {
  position: relative;
  padding: clamp(22px, 3.4vw, 36px) 10px clamp(16px, 2.4vw, 24px);
  border-radius: 26px 26px 14px 14px;
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 44px rgba(18, 2, 14, 0.6), 0 0 28px rgba(255, 123, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.diya-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 24px 50px rgba(18, 2, 14, 0.7), 0 0 38px rgba(255, 212, 82, 0.45);
}

body.final-ten .diya-card[data-unit="seconds"] {
  transform: scale(1.09);
  border-color: #fff;
  box-shadow: 0 0 54px rgba(255, 165, 30, 0.8);
}

.digits {
  display: inline-flex;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6.6vw, 5rem);
  line-height: 1.04;
  color: #fffaf0;
  text-shadow: 0 0 22px rgba(255, 180, 50, 0.5);
}

.digit-slot {
  position: relative;
  display: inline-block;
  width: 0.62em;
  height: 1.14em;
  overflow: hidden;
}

.digit-char {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.digit-char.enter { transform: translateY(75%) scale(0.85); opacity: 0; }
.digit-char.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}
.digit-char.exit {
  transform: translateY(-75%) scale(0.85);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.24s ease;
}

.unit-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.final-pulse {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(10rem, 32vw, 26rem);
  color: rgba(255, 212, 82, 0.18);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}
.final-pulse.pop { animation: sparkPop 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes sparkPop {
  0% { opacity: 0; transform: scale(0.65); }
  25% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 0; transform: scale(1.26); }
}

/* Progress */
.progress-wrap {
  width: min(580px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
}

#progress-percent { color: var(--gold); font-weight: 700; }

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 212, 82, 0.42);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--magenta), var(--saffron), var(--gold));
  box-shadow: 0 0 18px rgba(255, 165, 30, 0.55);
  transition: width 0.8s ease;
}

.fact-line {
  max-width: 58ch;
  min-height: 2.8em;
  font-size: clamp(0.95rem, 1.65vw, 1.12rem);
  line-height: 1.55;
  color: rgba(255, 245, 224, 0.92);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.fact-line.fading { opacity: 0; transform: translateY(5px); }

/* Celebration */
.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(232, 37, 122, 0.4), rgba(27, 4, 22, 0.88));
  backdrop-filter: blur(8px);
}
.celebration[hidden] { display: none; }

.celebration-card {
  max-width: 660px;
  padding: clamp(32px, 6vw, 56px) clamp(24px, 5vw, 48px);
  border-radius: 30px;
  background: linear-gradient(155deg, rgba(96, 16, 62, 0.9), rgba(38, 6, 28, 0.95));
  border: 2px solid var(--gold);
  box-shadow: 0 0 75px rgba(255, 145, 20, 0.45);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.celebration-kicker {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--gold);
}

.celebration-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5rem);
  background: linear-gradient(180deg, #fffbe8, #ffd452, #ff7b00);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.celebration-sub {
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  color: var(--ivory);
  max-width: 40ch;
}

.celebration-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

@media (max-width: 680px) {
  .countdown { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 380px; }
  .diya-row { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .rangoli-wheel, .diya .flame, .final-pulse.pop { animation: none !important; }
  .digit-char.active, .digit-char.exit, .fact-line, .progress-fill { transition: none !important; }
}
