/* ==========================================================================
   CSS Reset & Variables (Banya & Epic Party Theme)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --bg-dark: #07080d;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border-glass: rgba(255, 255, 255, 0.09);
  
  /* Теплый янтарно-огненный и ледяной пар */
  --color-fire: #ff5500;
  --color-amber: #ffaa00;
  --color-gold: #ffd000;
  --color-steam: #00d9ff;
  
  --color-text-main: #f8fafc;
  --color-text-dim: #94a3b8;
  --color-text-muted: #64748b;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Syne', sans-serif;

  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--color-text-main);
  font-family: var(--font-main);
  overflow-x: hidden;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 20px) 20px env(safe-area-inset-bottom, 20px);
}

/* ==========================================================================
   Ambient Background Glows & Canvas
   ========================================================================== */
.bg-gradient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  will-change: transform;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.bg-orb-1 {
  width: 480px;
  height: 480px;
  top: -100px;
  left: -80px;
  background: radial-gradient(circle, rgba(255, 85, 0, 0.45) 0%, rgba(255, 170, 0, 0.25) 50%, transparent 75%);
}

.bg-orb-2 {
  width: 520px;
  height: 520px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, rgba(255, 120, 0, 0.4) 0%, rgba(0, 217, 255, 0.18) 50%, transparent 75%);
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.22;
  pointer-events: none;
  z-index: 1;
}

#fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

@keyframes floatOrb {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(50px, 35px, 0) scale(1.08); }
  100% { transform: translate3d(-35px, 70px, 0) scale(0.96); }
}

/* ==========================================================================
   Hardware-Accelerated Floating Party Emojis Layer
   ========================================================================== */
.emojis-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.floating-party-emoji {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 2.2rem;
  line-height: 1;
  pointer-events: none;
  will-change: transform, opacity;
  animation: floatPartyEmoji 3.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

@keyframes floatPartyEmoji {
  0% {
    transform: translate3d(var(--x-start), 105vh, 0) rotate(0deg) scale(0.6);
    opacity: 0;
  }
  15% {
    opacity: 1;
    transform: translate3d(var(--x-mid), 80vh, 0) rotate(var(--rot-mid)) scale(1.15);
  }
  80% {
    opacity: 0.95;
  }
  100% {
    transform: translate3d(var(--x-end), -12vh, 0) rotate(var(--rot-end)) scale(0.9);
    opacity: 0;
  }
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 920px;
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Status Badge */
.badge-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-amber);
  box-shadow: 0 0 10px var(--color-amber);
  animation: pulseNeon 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseNeon {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 12px var(--color-amber);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
    box-shadow: 0 0 4px var(--color-amber);
  }
}

.badge-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #cbd5e1;
}

/* Titles */
.main-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 15%, #ffd000 60%, #ff5500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  line-height: 1.1;
  filter: drop-shadow(0 4px 25px rgba(255, 120, 0, 0.3));
}

.subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.25rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--color-text-dim);
  text-transform: uppercase;
  margin-bottom: 48px;
}

/* ==========================================================================
   Timer Deck
   ========================================================================== */
.timer-deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  margin-bottom: 40px;
}

.timer-box {
  flex: 1;
  min-width: 76px;
  max-width: 165px;
  aspect-ratio: 1 / 1.18;
  position: relative;
}

.box-glass {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: 
    0 16px 36px -12px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  padding: 16px 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-spring), border-color 0.3s ease, box-shadow 0.3s ease;
}

.timer-box:hover .box-glass {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255, 170, 0, 0.4);
  box-shadow: 
    0 24px 48px -12px rgba(0, 0, 0, 0.8),
    0 0 24px rgba(255, 120, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.digit {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 5.5vw, 4.4rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 4px 18px rgba(255, 255, 255, 0.2);
  margin-bottom: 6px;
  display: inline-block;
  will-change: transform;
}

.digit.tick {
  animation: digitBounce 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes digitBounce {
  0% { transform: translateY(-4px) scale(1.04); opacity: 0.9; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.label {
  font-size: clamp(0.6rem, 1.3vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--color-text-dim);
  text-transform: uppercase;
}

.divider {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 18px;
  animation: blinkDivider 2s ease-in-out infinite;
}

@keyframes blinkDivider {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.2; }
}

/* Target info indicator */
.target-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.calendar-icon {
  width: 16px;
  height: 16px;
  stroke: var(--color-amber);
}

/* ==========================================================================
   Celebration State Screen (ПОНЕСЛАСЬ!)
   ========================================================================== */
.celebration-content {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s var(--ease-smooth), transform 0.6s var(--ease-spring);
}

.celebration-content.show {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.party-hero-icons {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-emoji {
  font-size: clamp(3rem, 7vw, 5rem);
  filter: drop-shadow(0 0 25px rgba(255, 170, 0, 0.6));
  animation: heroBounce 1.5s ease-in-out infinite alternate;
}

.hero-emoji:nth-child(1) { animation-delay: 0s; }
.hero-emoji.main-steam { animation-delay: 0.2s; transform: scale(1.15); }
.hero-emoji:nth-child(3) { animation-delay: 0.4s; }

@keyframes heroBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-12px) scale(1.12); }
}

.meet-heading {
  font-family: var(--font-title);
  font-size: clamp(2.6rem, 8vw, 5.8rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #ffd000 45%, #ff5500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 35px rgba(255, 120, 0, 0.55));
  margin-bottom: 12px;
  line-height: 1.1;
}

.meet-text {
  font-size: clamp(1rem, 2.8vw, 1.35rem);
  color: #e2e8f0;
  font-weight: 500;
  letter-spacing: 0.05em;
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.meet-subtext {
  display: block;
  margin-top: 10px;
  color: var(--color-amber);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(0.9rem, 2.4vw, 1.15rem);
  text-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
}

/* ==========================================================================
   Анимация лопающейся лампочки (Exploding Lightbulb)
   ========================================================================== */
.bulb-burst-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px auto 28px;
  width: 140px;
  height: 140px;
  cursor: pointer;
  perspective: 800px;
}

.bulb-stage {
  position: relative;
  width: 110px;
  height: 125px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
}

.bulb-burst-wrapper:hover .bulb-stage {
  transform: scale(1.05);
}

.bulb-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Вспышка в момент взрыва */
.bulb-flash {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #ffea00 50%, transparent 80%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

/* Накаленная нить и свечение */
.filament-wire {
  filter: drop-shadow(0 0 8px #ffffff);
  transition: opacity 0.2s ease;
}

.filament-glow-core {
  filter: drop-shadow(0 0 16px #ffea00);
  animation: filamentBuzz 0.12s infinite alternate;
}

@keyframes filamentBuzz {
  0% { opacity: 0.85; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* Осколки колбы */
.shard {
  transform-origin: 60px 54px;
  transition: transform 0.65s cubic-bezier(0.12, 0.85, 0.35, 1.2), opacity 0.5s ease;
  will-change: transform, opacity;
}

/* Электрические молнии */
.bulb-zaps {
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* СОСТОЯНИЕ: ЛАМПОЧКА ЛОПНУЛА (.is-shattered) */
.bulb-stage.is-shattered .bulb-flash {
  animation: flashPop 0.5s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes flashPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  35% { transform: translate(-50%, -50%) scale(9); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(14); opacity: 0; }
}

.bulb-stage.is-shattered .filament-wire,
.bulb-stage.is-shattered .filament-glow-core {
  opacity: 0.15;
  filter: none;
}

.bulb-stage.is-shattered .bulb-zaps {
  opacity: 1;
  animation: zapFade 0.4s ease-out forwards;
}

@keyframes zapFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Траектории разлёта каждого осколка */
.bulb-stage.is-shattered .shard-1 {
  transform: translate3d(-65px, -65px, 0) rotate(-75deg) scale(0.65);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-2 {
  transform: translate3d(65px, -65px, 0) rotate(80deg) scale(0.65);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-3 {
  transform: translate3d(-80px, 8px, 0) rotate(-110deg) scale(0.6);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-4 {
  transform: translate3d(80px, 8px, 0) rotate(115deg) scale(0.6);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-5 {
  transform: translate3d(-48px, 60px, 0) rotate(-45deg) scale(0.55);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-6 {
  transform: translate3d(48px, 60px, 0) rotate(50deg) scale(0.55);
  opacity: 0;
}

.bulb-stage.is-shattered .shard-7 {
  transform: translate3d(0px, -35px, 0) rotate(190deg) scale(0.4);
  opacity: 0;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: linear-gradient(135deg, #ff5500, #ffaa00);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255, 120, 0, 0.45);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease, filter 0.3s ease;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 35px rgba(255, 120, 0, 0.65);
  filter: brightness(1.1);
}

.action-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* Скрытие таймера во время финала */
.is-celebrating .timer-deck,
.is-celebrating .target-info,
.is-celebrating .subtitle,
.is-celebrating .main-title {
  display: none !important;
}

/* ==========================================================================
   Mobile Responsive Optimizations
   ========================================================================== */
@media (max-width: 640px) {
  .container {
    padding: 20px 12px;
  }

  .timer-deck {
    gap: 8px;
  }

  .timer-box {
    min-width: 68px;
    border-radius: 18px;
  }

  .box-glass {
    border-radius: 18px;
    padding: 12px 4px;
  }

  .divider {
    font-size: 1.4rem;
    margin-bottom: 12px;
  }

  .bg-orb-1, .bg-orb-2 {
    width: 280px;
    height: 280px;
    filter: blur(70px);
  }
  
  .footer-bar {
    bottom: 16px;
  }
}
