:root {
  --gold: #f3c969;
  --gold-soft: #ffe3a3;
  --red: #e94b4b;
  --green: #3fa564;
  --ink: #fefefe;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #1c1030 0%, #0a0916 55%, #05040c 100%);
}

/* ---------- Vertical "video" frame (9:16, TikTok / Reels / Shorts ready) ---------- */
.video-frame {
  position: relative;
  overflow: hidden;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  border-radius: clamp(0px, 1.4vw, 22px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: radial-gradient(ellipse at 50% 0%, #14213d 0%, #0b1230 45%, #060a1c 100%);
  transition: background 1.6s ease;
}

.video-frame[data-phase="waiting"] {
  background: radial-gradient(ellipse at 50% 20%, #101a2e 0%, #080d1a 50%, #04060d 100%);
}

.video-frame[data-phase="newyear"] {
  background: radial-gradient(ellipse at 50% 0%, #2a0b3d 0%, #180a2e 45%, #07051a 100%);
}

.video-frame[data-phase="celebration"] {
  background: radial-gradient(ellipse at 50% 20%, #3b0a4d 0%, #180a2e 50%, #05030f 100%);
}

/* ---------- Desktop / landscape: full-bleed instead of the letterboxed 9:16 frame ---------- */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 500px) {
  .video-frame {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---------- Cinematic vignette (depth of field) ---------- */
.video-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 14%, rgba(0, 0, 0, 0) 78%, rgba(0, 0, 0, 0.35) 100%);
}

/* ---------- Canvas particle layer ---------- */
#fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Static stars ---------- */
.sky-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 80% 10%, #fff, transparent 60%),
    radial-gradient(1px 1px at 60% 30%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 60%, #fff, transparent 60%),
    radial-gradient(1px 1px at 90% 50%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 45% 15%, #fff, transparent 60%),
    radial-gradient(1px 1px at 20% 80%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 70%, #fff, transparent 60%),
    radial-gradient(1px 1px at 15% 45%, #fff, transparent 60%),
    radial-gradient(1px 1px at 85% 85%, #fff, transparent 60%);
  opacity: 0.6;
  animation: twinkle-bg 4s ease-in-out infinite alternate;
}

@keyframes twinkle-bg {
  from { opacity: 0.3; }
  to { opacity: 0.85; }
}

/* ---------- Decorative scene ---------- */
.scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.moon {
  position: absolute;
  top: 5%;
  right: 12%;
  width: clamp(46px, 12vw, 76px);
  height: clamp(46px, 12vw, 76px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffdf0, var(--gold-soft) 60%, #e9c97a 100%);
  box-shadow: 0 0 40px 10px rgba(255, 236, 170, 0.35), 0 0 100px 40px rgba(255, 236, 170, 0.12);
  transition: opacity 1.2s ease;
}

.video-frame[data-phase="newyear"] .moon,
.video-frame[data-phase="celebration"] .moon {
  opacity: 0.15;
}

.disco-ball {
  position: absolute;
  top: 4%;
  left: 10%;
  font-size: clamp(28px, 8vw, 46px);
  opacity: 0;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.5));
  animation: disco-spin 6s linear infinite;
  transition: opacity 1.2s ease;
}

.video-frame[data-phase="newyear"] .disco-ball,
.video-frame[data-phase="celebration"] .disco-ball {
  opacity: 0.9;
}

@keyframes disco-spin {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-6px); }
}

.lights-garland {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-evenly;
  padding: 5px 2vw 0;
}

.lights-garland span {
  width: clamp(8px, 2.2vw, 12px);
  height: clamp(10px, 2.8vw, 16px);
  border-radius: 50%;
  margin-top: 6px;
  display: inline-block;
  animation: bulb-glow 1.6s ease-in-out infinite;
  box-shadow: 0 0 10px 3px currentColor;
}

.lights-garland span:nth-child(5n+1) { color: #ff5d5d; background: #ff5d5d; animation-delay: 0s; }
.lights-garland span:nth-child(5n+2) { color: #ffd54a; background: #ffd54a; animation-delay: .2s; }
.lights-garland span:nth-child(5n+3) { color: #4ade80; background: #4ade80; animation-delay: .4s; }
.lights-garland span:nth-child(5n+4) { color: #60a5fa; background: #60a5fa; animation-delay: .6s; }
.lights-garland span:nth-child(5n+5) { color: #f472b6; background: #f472b6; animation-delay: .8s; }

@keyframes bulb-glow {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

.hero-tree {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(140px, 42vw, 240px);
  filter: drop-shadow(0 0 26px rgba(243, 201, 105, 0.4)) drop-shadow(0 0 60px rgba(63, 165, 100, 0.25));
  animation: sway 6s ease-in-out infinite;
  transform-origin: bottom center;
  opacity: 0.55;
  transition: opacity 1.4s ease, filter 1.4s ease;
}

.hero-tree svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-tree .ornament {
  animation: ornament-twinkle 2.4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.hero-tree .ornament--a { animation-delay: 0s; }
.hero-tree .ornament--b { animation-delay: 0.6s; }
.hero-tree .ornament--c { animation-delay: 1.2s; }

@keyframes ornament-twinkle {
  0%, 100% { opacity: 0.65; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hero-tree .tree-star {
  animation: star-pulse 2.6s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes star-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 229, 138, 0.8)); }
  50% { filter: drop-shadow(0 0 12px rgba(255, 229, 138, 1)); }
}

.video-frame[data-phase="newyear"] .hero-tree,
.video-frame[data-phase="celebration"] .hero-tree {
  opacity: 0.3;
  filter: grayscale(0.5) brightness(0.65) drop-shadow(0 0 30px rgba(150, 90, 220, 0.35));
}

.skyline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 3vw;
  opacity: 0.7;
  filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.5));
}

.tree {
  filter: drop-shadow(0 0 10px rgba(63, 165, 100, 0.35));
  animation: sway 5s ease-in-out infinite;
  transform-origin: bottom center;
}

.tree--sm { font-size: clamp(20px, 6vw, 34px); animation-delay: 0.2s; }
.tree--md { font-size: clamp(28px, 8vw, 48px); animation-delay: 0.6s; }

@keyframes sway {
  0%, 100% { transform: translateX(-50%) rotate(-2deg); }
  50% { transform: translateX(-50%) rotate(2deg); }
}

.skyline .tree {
  transform-origin: bottom center;
  animation-name: sway-side;
}

@keyframes sway-side {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.video-frame[data-phase="newyear"] .tree,
.video-frame[data-phase="celebration"] .tree {
  filter: grayscale(0.55) brightness(0.7) drop-shadow(0 0 10px rgba(120, 80, 200, 0.35));
}

/* ---------- Sound toggle ---------- */
.sound-toggle {
  position: absolute;
  top: clamp(10px, 3vw, 18px);
  right: clamp(10px, 3vw, 18px);
  z-index: 5;
  width: clamp(34px, 9vw, 44px);
  height: clamp(34px, 9vw, 44px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 20, 0.45);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: clamp(15px, 4vw, 19px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.sound-toggle:hover { transform: scale(1.08); }
.sound-toggle:active { transform: scale(0.94); }
.sound-toggle[aria-pressed="true"] { background: rgba(243, 201, 105, 0.25); border-color: rgba(243, 201, 105, 0.6); }

/* ---------- Main stage ---------- */
.stage[hidden] {
  display: none;
}

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6vh 5vw;
  gap: 0;
}

.title {
  font-size: clamp(1.15rem, 6.4vw, 2rem);
  margin: 0 0 0.5rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(243, 201, 105, 0.55), 0 0 40px rgba(243, 201, 105, 0.25);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 800;
  line-height: 1.2;
  transition: color 1s ease, text-shadow 1s ease;
}

.video-frame[data-phase="newyear"] .title,
.video-frame[data-phase="celebration"] .title {
  color: #f3a9f2;
  text-shadow: 0 0 12px rgba(243, 169, 242, 0.55), 0 0 40px rgba(243, 169, 242, 0.3);
}

.subtitle {
  margin: 0 0 2.4rem;
  font-size: clamp(0.72rem, 3vw, 0.95rem);
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.03em;
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.3rem, 1.6vw, 0.7rem);
  flex-wrap: nowrap;
}

.countdown[hidden] {
  display: none;
}

.unit {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: clamp(0.55rem, 2.6vw, 1rem) clamp(0.4rem, 2.4vw, 0.9rem);
  min-width: clamp(52px, 16vw, 84px);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.value {
  font-size: clamp(1.35rem, 7.5vw, 2.3rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
  line-height: 1.1;
}

.label {
  margin-top: 0.25rem;
  font-size: clamp(0.52rem, 2.4vw, 0.7rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.65);
}

.sep {
  font-size: clamp(1.1rem, 5vw, 1.8rem);
  color: var(--gold);
  transform: translateY(-0.3rem);
  opacity: 0.7;
}

.video-frame[data-phase="newyear"] .sep,
.video-frame[data-phase="celebration"] .sep { color: #f3a9f2; }

.paris-caption[hidden] {
  display: none;
}

.paris-caption {
  margin: 1.1rem 0 0;
  font-size: clamp(0.6rem, 2.4vw, 0.78rem);
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
}

/* pulse on second change */
.value.tick {
  animation: pulse 0.4s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------- Persistent New Year celebration scene ---------- */
.celebration {
  margin-top: 1rem;
}

.celebration-text {
  font-size: clamp(1.5rem, 8.5vw, 2.6rem);
  font-weight: 800;
  margin: 0;
  background: linear-gradient(90deg, #ffd54a, #ff8bd0, #7fd8ff, #ffd54a);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 3.5s linear infinite, grow-in 0.8s ease;
  text-shadow: 0 0 30px rgba(255, 200, 120, 0.35);
}

@keyframes shimmer {
  to { background-position: 300% 0; }
}

@keyframes grow-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Zero-crossing overlay (Joyeux Noël) ---------- */
.zero-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vw;
  background: radial-gradient(ellipse at 50% 50%, rgba(30, 16, 8, 0.92), rgba(5, 3, 10, 0.97));
  animation: overlay-fade-in 0.6s ease;
}

.zero-overlay[hidden] { display: none; }

.zero-overlay-text {
  font-size: clamp(1.5rem, 9.5vw, 2.8rem);
  font-weight: 800;
  margin: 0;
  color: var(--gold-soft);
  text-shadow: 0 0 24px rgba(255, 220, 150, 0.75), 0 0 60px rgba(255, 200, 120, 0.4);
  animation: overlay-pop 1.1s cubic-bezier(0.2, 1.4, 0.4, 1);
  letter-spacing: 0.02em;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlay-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 340px) {
  .countdown { gap: 0.25rem; }
  .unit { padding: 0.5rem 0.4rem; min-width: 46px; border-radius: 10px; }
  .sep { display: none; }
}

/* ---------- Desktop / landscape composition ---------- */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 500px) {
  .stage {
    max-width: 900px;
    margin: 0 auto;
    padding: 3vh 2rem;
  }

  .title { font-size: clamp(2rem, 3.6vw, 3.1rem); }
  .subtitle { font-size: clamp(0.95rem, 1.3vw, 1.1rem); margin-bottom: 2.6rem; }
  .value { font-size: clamp(2.2rem, 4vw, 3.4rem); }
  .label { font-size: clamp(0.68rem, 1vw, 0.8rem); }
  .unit { min-width: clamp(84px, 8vw, 116px); padding: 1.2rem 1.4rem; }
  .sep { font-size: clamp(1.8rem, 3vw, 2.4rem); }
  .paris-caption { font-size: clamp(0.75rem, 1vw, 0.85rem); }
  .celebration-text { font-size: clamp(2.4rem, 5.5vw, 4rem); }
  .zero-overlay-text { font-size: clamp(2.4rem, 6vw, 4.2rem); }

  .hero-tree { width: clamp(180px, 16vw, 320px); bottom: 4%; }
  .moon { width: clamp(60px, 6vw, 96px); height: clamp(60px, 6vw, 96px); top: 6%; right: 8%; }
  .disco-ball { font-size: clamp(34px, 4vw, 56px); top: 5%; left: 8%; }
  .skyline { padding: 0 6vw; }
  .tree--sm { font-size: clamp(26px, 3vw, 44px); }
  .tree--md { font-size: clamp(36px, 4vw, 60px); }
  .sound-toggle { width: clamp(40px, 3vw, 48px); height: clamp(40px, 3vw, 48px); font-size: clamp(17px, 1.8vw, 21px); }
}
