/* =========================================================
   NEW YEAR'S EVE — BLACK & GOLD LUXURY THEME VARIABLES
   ========================================================= */
:root {
  --bg-obsidian: #050507;
  --bg-charcoal: #111015;
  --gold-bright: #ffe699;
  --gold-main: #d8af4e;
  --gold-deep: #8b681f;
  --champagne: #f8ecd0;
  --muted: rgba(248, 236, 208, 0.65);

  --card-surface: linear-gradient(155deg, rgba(24, 21, 16, 0.85), rgba(8, 8, 10, 0.92));
  --card-border: rgba(216, 175, 78, 0.45);

  --font-display: "Cinzel", Georgia, serif;
  --font-digits: "Bodoni Moda", Georgia, serif;
  --font-ui: "Montserrat", 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% 0%, #241c0d 0%, var(--bg-charcoal) 36%, var(--bg-obsidian) 82%);
  color: var(--champagne);
  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;
}

/* Luxury Art Deco Scene */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.deco-frame {
  position: absolute;
  inset: clamp(12px, 2vw, 24px);
  border: 1px solid rgba(216, 175, 78, 0.16);
  pointer-events: none;
}

.deco-frame::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(216, 175, 78, 0.08);
}

/* Hanging Disco Ball */
.disco-wrap {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.disco-rod {
  width: 2px;
  height: clamp(22px, 4.5vh, 48px);
  background: linear-gradient(180deg, rgba(216, 175, 78, 0.2), var(--gold-bright));
}

.disco-ball {
  position: relative;
  width: clamp(54px, 7vw, 82px);
  height: clamp(54px, 7vw, 82px);
  border-radius: 50%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 236, 179, 0.24) 0 6px, rgba(16, 14, 10, 0.72) 6px 12px),
    repeating-linear-gradient(0deg, rgba(255, 230, 153, 0.2) 0 6px, transparent 6px 12px),
    radial-gradient(circle at 35% 30%, #fff6d2, #d8af4e 45%, #3d2c0b 90%);
  box-shadow:
    0 0 42px rgba(255, 224, 130, 0.45),
    inset -8px -10px 18px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  animation: discoSpin 10s linear infinite;
}

.disco-shine {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(255, 249, 220, 0.55) 50deg, transparent 65deg 180deg, rgba(255, 230, 150, 0.4) 195deg, transparent 215deg);
  animation: discoSpin 5s linear infinite;
}

.disco-halo {
  position: absolute;
  top: 10px;
  width: 320px;
  height: 180px;
  background: radial-gradient(ellipse at center, rgba(255, 224, 130, 0.22), transparent 68%);
  filter: blur(20px);
}

@keyframes discoSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.skyline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(110px, 23vh, 240px);
}

/* Controls */
.controls {
  position: fixed;
  top: clamp(18px, 2.8vw, 32px);
  right: clamp(18px, 2.8vw, 32px);
  z-index: 25;
  display: flex;
  gap: 10px;
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(216, 175, 78, 0.45);
  background: rgba(10, 9, 8, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  cursor: pointer;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ctrl-btn svg { width: 18px; height: 18px; }

.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  transform: translateY(-2px);
  background: rgba(216, 175, 78, 0.25);
  outline: none;
}

.ctrl-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--gold-main), var(--gold-deep));
  color: #090806;
}

#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: 78px;
  right: clamp(18px, 2.8vw, 32px);
  z-index: 30;
  padding: 9px 18px;
  border: 1px solid var(--gold-main);
  background: rgba(12, 11, 9, 0.94);
  color: var(--gold-bright);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-8px);
  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(980px, 90vw);
  padding: clamp(104px, 14vh, 140px) 0 clamp(44px, 6vh, 68px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(22px, 3.4vh, 36px);
  transition: opacity 0.45s ease;
}

.hero-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  font-size: clamp(0.72rem, 1.2vw, 0.88rem);
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--gold-main);
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6.8vw, 4.9rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fffdf4 0%, #f7d982 48%, #b68425 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.8));
}

.milestone-badge {
  padding: 6px 20px;
  border: 1px solid var(--gold-main);
  background: rgba(216, 175, 78, 0.14);
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 0 28px rgba(216, 175, 78, 0.25);
}

/* Art Deco Chamfered Digit Cards */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.2vw, 24px);
  width: 100%;
}

.deco-card {
  position: relative;
  padding: clamp(20px, 3.2vw, 34px) 10px clamp(16px, 2.4vw, 24px);
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  box-shadow: inset 0 0 36px rgba(216, 175, 78, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.deco-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 18%;
  right: 18%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}

.deco-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold-bright);
}

.digits {
  display: inline-flex;
  justify-content: center;
  font-family: var(--font-digits);
  font-size: clamp(2.2rem, 6.4vw, 4.9rem);
  font-weight: 800;
  line-height: 1.05;
  color: #fffaf0;
  text-shadow: 0 0 24px rgba(247, 217, 130, 0.38);
}

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

.digit-char {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  will-change: transform, opacity;
}

.digit-char.enter { transform: scale(0.72) translateY(55%); opacity: 0; }
.digit-char.active {
  transform: scale(1) translateY(0%);
  opacity: 1;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.digit-char.exit {
  transform: scale(1.12) translateY(-55%);
  opacity: 0;
  transition: transform 0.32s ease, opacity 0.25s ease;
}

.unit-label {
  font-size: clamp(0.66rem, 1.05vw, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-main);
}

/* GIANT FINAL-10-SECONDS TAKEOVER */
.final-takeover {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(216, 175, 78, 0.18), rgba(5, 5, 7, 0.76));
  transition: opacity 0.3s ease;
}

body.final-ten .final-takeover { opacity: 1; }
body.final-ten .stage { opacity: 0.14; }

.final-giant-num {
  font-family: var(--font-digits);
  font-size: clamp(11rem, 34vw, 28rem);
  font-weight: 800;
  line-height: 0.9;
  background: linear-gradient(180deg, #ffffff 0%, #ffe699 45%, #b98520 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 65px rgba(247, 217, 130, 0.65));
}

.final-giant-num.slam {
  animation: giantSlam 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes giantSlam {
  0% { transform: scale(1.45); opacity: 0.2; }
  35% { transform: scale(0.96); opacity: 1; }
  100% { transform: scale(1); opacity: 0.94; }
}

.final-giant-sub {
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  letter-spacing: 0.42em;
  color: var(--gold-bright);
}

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

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(216, 175, 78, 0.26);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-main), var(--gold-bright));
  box-shadow: 0 0 18px rgba(255, 230, 153, 0.55);
  transition: width 0.8s ease;
}

/* Fact Line */
.fact-line {
  max-width: 60ch;
  min-height: 2.8em;
  font-size: clamp(0.9rem, 1.5vw, 1.08rem);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.03em;
  color: rgba(248, 236, 208, 0.86);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fact-line.fading { opacity: 0; transform: translateY(6px); }

/* Celebration */
.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(216, 175, 78, 0.25), rgba(5, 5, 7, 0.82));
  backdrop-filter: blur(6px);
}

.celebration[hidden] { display: none; }

.celebration-box {
  max-width: 720px;
  padding: clamp(32px, 6vw, 60px) clamp(24px, 5vw, 54px);
  border: 1.5px solid var(--gold-main);
  background: rgba(10, 9, 8, 0.84);
  box-shadow: 0 0 80px rgba(216, 175, 78, 0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.celebration-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.42em;
  color: var(--gold-main);
}

.celebration-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  background: linear-gradient(180deg, #fffdf5, #ffe28c 55%, #b58322);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.celebration-sub {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-weight: 300;
  color: var(--champagne);
  max-width: 42ch;
}

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

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

@media (prefers-reduced-motion: reduce) {
  .disco-ball, .disco-shine, .final-giant-num.slam { animation: none !important; }
  .digit-char.active, .digit-char.exit, .fact-line, .progress-fill { transition: none !important; }
}
