/* ==========================================================================
   ФАКЕЛ · INFINITE PROGRESS SCREEN («ДИКОЕ ПЛАМЯ»)
   Brand Design System & Animation Engine
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Brand Palette from Fakel */
  --bg: #130a08;
  --bg-deep: #0c0605;
  --panel: #1d100d;
  --panel-raised: #28130e;
  --ink: #fff2d8;
  --ink-bright: #ffffff;
  --muted: #b29a8f;
  --muted-dark: #6e5950;
  --line: rgba(255, 220, 188, 0.14);
  --line-bright: rgba(255, 195, 142, 0.38);
  
  /* Fire & Ember Accents */
  --fire: #ee4d17;
  --fire-bright: #ff7823;
  --fire-hot: #ff3b00;
  --ember: #ffb51b;
  --ember-light: #ffe68d;
  --ember-white: #fff7d6;

  /* Typography */
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  /* Sizing & Transitions */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Layers */
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.09;
  background-image: radial-gradient(rgba(255, 219, 173, 0.4) 0.6px, transparent 0.7px);
  background-size: 8px 8px;
}

.bg-ambient-glow {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: 
    radial-gradient(1000px 700px at 70% 30%, rgba(238, 77, 23, 0.18), transparent 70%),
    radial-gradient(800px 600px at 20% 80%, rgba(255, 120, 35, 0.12), transparent 70%),
    radial-gradient(500px 500px at 50% 50%, rgba(255, 181, 27, 0.05), transparent 60%);
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* Floating Sound Toggle Button */
.floating-sound-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(29, 16, 13, 0.75);
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

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

.floating-sound-btn:hover {
  color: var(--ink);
  border-color: var(--fire-bright);
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(238, 77, 23, 0.35);
}

.floating-sound-btn.active {
  background: rgba(238, 77, 23, 0.25);
  border-color: var(--fire-bright);
  color: var(--ember);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   MAIN HERO VIEWPORT & CONTENT
   ========================================================================== */

.hero-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wild-flame-stage {
  position: relative;
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 50px;
}

.flame-backdrop-glow {
  position: absolute;
  top: 50%;
  left: 26%;
  transform: translate(-50%, -50%);
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 77, 23, 0.28) 0%, rgba(255, 120, 35, 0.12) 45%, transparent 70%);
  filter: blur(45px);
  pointer-events: none;
  z-index: 1;
}

/* Torch Sculpture (CSS Organic Multilayer Flame) */
.torch-sculpture {
  position: relative;
  width: 290px;
  height: 400px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 3;
}

.torch-body {
  position: relative;
  width: 190px;
  height: 260px;
  filter: drop-shadow(0 0 50px rgba(238, 77, 23, 0.75));
}

.flame-layer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: bottom center;
}

.flame-outer {
  width: 170px;
  height: 235px;
  border-radius: 50% 12% 50% 50%;
  background: linear-gradient(155deg, #ffb51b 0%, #ff5a14 45%, #cd2d10 80%);
  transform: translateX(-50%) rotate(10deg);
  animation: flame-wild-breathe 3.2s ease-in-out infinite alternate;
  box-shadow: 0 0 90px rgba(255, 75, 15, 0.65);
}

.flame-mid {
  width: 118px;
  height: 172px;
  border-radius: 48% 10% 48% 50%;
  background: linear-gradient(150deg, #ffe68d 0%, #ff7823 55%, #e53112 100%);
  transform: translateX(-50%) rotate(-8deg);
  animation: flame-wild-inner 2.4s ease-in-out infinite alternate;
}

.flame-core {
  width: 62px;
  height: 102px;
  border-radius: 45% 10% 45% 50%;
  background: #fff7d6;
  box-shadow: 0 0 30px #ffffff;
  transform: translateX(-50%) rotate(4deg);
  animation: flame-core-flicker 1.6s ease-in-out infinite alternate;
}

.flame-sparkle {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px #ffb51b;
}

.flame-sparkle.s1 { width: 5px; height: 5px; top: 20%; left: 30%; animation: spark-ascend 2s infinite ease-out; }
.flame-sparkle.s2 { width: 4px; height: 4px; top: 10%; right: 25%; animation: spark-ascend 2.5s infinite 0.7s ease-out; }
.flame-sparkle.s3 { width: 6px; height: 6px; top: 35%; right: 40%; animation: spark-ascend 1.8s infinite 1.2s ease-out; }

.torch-handle {
  width: 34px;
  height: 96px;
  background: linear-gradient(180deg, #381912 0%, #1a0a07 100%);
  border: 1px solid rgba(255, 195, 142, 0.22);
  border-radius: 6px 6px 14px 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8), inset 0 2px 8px rgba(255, 120, 35, 0.3);
  margin-top: -10px;
  position: relative;
  z-index: 2;
}

.torch-handle::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--fire-bright);
  opacity: 0.5;
}

/* Stage Typography */
.stage-typography {
  position: relative;
  z-index: 4;
}

.flame-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: rgba(238, 77, 23, 0.12);
  border: 1px solid rgba(255, 120, 35, 0.3);
  margin-bottom: 22px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px var(--fire-bright);
  animation: pulse-ember 1.8s infinite alternate;
}

.badge-text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--fire-bright);
  text-transform: uppercase;
}

.wild-title {
  font-family: var(--font-serif);
  font-size: clamp(44px, 5.8vw, 76px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--ink);
  margin-bottom: 18px;
}

.wild-title em {
  font-style: italic;
  color: var(--fire-bright);
  text-shadow: 0 0 45px rgba(255, 90, 31, 0.45);
}

.wild-subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 500px;
  margin-bottom: 38px;
  min-height: 26px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Molten Infinite Progress Bar */
.progress-container.molten-progress {
  width: 100%;
  max-width: 500px;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 11px;
  background: rgba(40, 19, 14, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: visible;
}

.progress-fill.infinite-molten-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(238, 77, 23, 0.6) 20%,
    #ff7823 50%,
    #ffb51b 80%,
    #ffffff 100%
  );
  box-shadow: 0 0 20px rgba(255, 120, 35, 0.9), 0 0 40px rgba(238, 77, 23, 0.6);
  animation: molten-infinite-sweep 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.progress-spark {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 12px #fff, 0 0 24px #ffb51b, 0 0 36px #ff5a14;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
}

.meta-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.pulse-fire {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fire-bright);
  box-shadow: 0 0 8px var(--fire-bright);
  animation: pulse-ember 1.2s infinite;
}

.meta-dynamic-counter {
  font-family: var(--font-mono);
  color: var(--ember);
  letter-spacing: 0.05em;
}

/* Floating Embers */
.stage-embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage-embers i {
  position: absolute;
  bottom: 10%;
  left: var(--left);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px var(--fire-bright);
  animation: ember-rise-stage 3.5s ease-out infinite;
  animation-delay: var(--delay);
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */

@keyframes flame-wild-breathe {
  0% { transform: translateX(-50%) rotate(8deg) scale(0.96); filter: brightness(0.95); }
  50% { transform: translateX(-50%) rotate(12deg) scale(1.04); filter: brightness(1.15); }
  100% { transform: translateX(-50%) rotate(7deg) scale(0.98); filter: brightness(1); }
}

@keyframes flame-wild-inner {
  0% { transform: translateX(-50%) rotate(-10deg) scale(0.95); }
  100% { transform: translateX(-50%) rotate(-6deg) scale(1.05); }
}

@keyframes flame-core-flicker {
  0% { transform: translateX(-50%) rotate(2deg) scale(0.9); opacity: 0.85; }
  100% { transform: translateX(-50%) rotate(6deg) scale(1.1); opacity: 1; }
}

@keyframes spark-ascend {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-70px) scale(0.2); opacity: 0; }
}

@keyframes molten-infinite-sweep {
  0% { left: -42%; width: 35%; opacity: 0.6; }
  50% { width: 55%; opacity: 1; }
  100% { left: 100%; width: 35%; opacity: 0.6; }
}

@keyframes pulse-ember {
  0% { opacity: 0.6; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.1); }
}

@keyframes ember-rise-stage {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--drift), -140px) scale(0.2); }
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */

@media (max-width: 900px) {
  html, body {
    overflow-y: auto;
  }

  .hero-container {
    height: auto;
    min-height: 100vh;
    padding: 60px 20px 40px;
  }

  .wild-flame-stage {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 20px;
  }

  .torch-sculpture {
    transform: scale(0.8);
    height: 300px;
    margin-bottom: -20px;
  }

  .flame-backdrop-glow {
    left: 50%;
    top: 30%;
    width: 360px;
    height: 360px;
  }

  .wild-title {
    font-size: 42px;
  }

  .wild-subtitle {
    margin: 0 auto 28px;
  }

  .progress-container.molten-progress {
    margin: 0 auto;
  }
}
