:root {
  --bg: #ffffff;
  --fg: #0b0b0b;
  --muted: #7a7a7a;
  --border: #dddddd;
  --error-bg: #0b0b0b;
  --error-fg: #ffffff;

  --logo-glow-strength: 0;
  --logo-shine-strength: 1;
  --fog-opacity: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Layout */
.center-stack {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* Fog */
.fog-overlay {
  position: fixed;
  inset: -12%;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: var(--fog-opacity);
  filter: blur(6px);
  background-image:
    radial-gradient(circle at 15% 10%,  rgba(255,255,255,0.18) 0, transparent 55%),
    radial-gradient(circle at 85% 0%,   rgba(255,255,255,0.15) 0, transparent 60%),
    radial-gradient(circle at 40% 65%,  rgba(255,255,255,0.17) 0, transparent 50%),
    radial-gradient(circle at 80% 75%,  rgba(255,255,255,0.14) 0, transparent 55%);
  background-size: 180% 180%;
  animation: fog-drift 45s linear infinite;
  z-index: 0;
}

/* Red fog for boogeyman */
.fog-red-overlay {
  position: fixed;
  inset: -12%;
  pointer-events: none;
  opacity: 0;
  filter: blur(6px);
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 15% 10%,  rgba(255, 0, 0, 0.3) 0, transparent 55%),
    radial-gradient(circle at 85% 0%,   rgba(255, 40, 40, 0.3) 0, transparent 60%),
    radial-gradient(circle at 40% 65%,  rgba(255, 0, 50, 0.35) 0, transparent 50%),
    radial-gradient(circle at 80% 75%,  rgba(255, 0, 0, 0.3) 0, transparent 55%);
  background-size: 180% 180%;
  z-index: 0;
}

.fog-red-overlay.red-fog-active {
  animation: red-fog-flash 15s ease-out forwards;
}

/* Getting color overlay */
.color-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.color-overlay.color-active {
  opacity: 1;
  background:
    radial-gradient(circle at 10% 20%, rgba(180, 0, 0, 0.58) 0, transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(165, 0, 0, 0.65) 0, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(150, 0, 0, 0.6) 0, transparent 55%),
    linear-gradient(
      120deg,
      transparent 0%,
      transparent 44%,
      rgba(160, 0, 0, 0.9) 45%,
      var(--fg) 47%,
      var(--bg) 49%,
      var(--fg) 51%,
      rgba(160, 0, 0, 0.9) 53%,
      transparent 56%,
      transparent 100%
    );
  mix-blend-mode: multiply;
}

.color-overlay.color-pos-1 {
  background-position: 12% 20%, 82% 30%, 42% 78%, 50% 40%;
}

.color-overlay.color-pos-2 {
  background-position: 18% 70%, 70% 20%, 30% 30%, 60% 60%;
}

.color-overlay.color-pos-3 {
  background-position: 5% 50%, 90% 40%, 50% 90%, 40% 35%;
}

.color-overlay.color-level-1 {
  filter: blur(0.2px);
}

.color-overlay.color-level-2 {
  filter: blur(0.4px);
  box-shadow: inset 0 0 24px rgba(160, 0, 0, 0.7);
}

.color-overlay.color-level-3 {
  filter: blur(0.6px);
  box-shadow: inset 0 0 35px rgba(160, 0, 0, 0.8);
}

.color-overlay.color-level-4 {
  filter: blur(0.8px);
  box-shadow: inset 0 0 45px rgba(160, 0, 0, 0.95);
}

.color-overlay.color-level-5 {
  filter: blur(1.1px);
  box-shadow: inset 0 0 60px rgba(160, 0, 0, 1);
}

/* Fade-out after 3-count */
.color-overlay.color-active.color-fading-out {
  opacity: 0;
  transition: opacity 5s ease-out;
}

/* Fog drift */
@keyframes fog-drift {
  0%   { transform: translate3d(0, 0, 0); }
  27%  { transform: translate3d(-4%, -2%, 0); }
  52%  { transform: translate3d(5%, 3%, 0); }
  76%  { transform: translate3d(-3%, 1%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Red fog timeline */
@keyframes red-fog-flash {
  0%   { opacity: 0; }
  5%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Content region */
.fog-region {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1;
}

/* Logo shell */
.logo-shell {
  position: relative;
  display: inline-block;
  box-shadow:
    0 0 calc(6px + 18px * var(--logo-glow-strength))
    rgba(255, 255, 255, calc(0.15 + 0.25 * var(--logo-glow-strength)));
  border-radius: 16px;
  transform-origin: center bottom;
}

#logo {
  width: 256px;
  max-width: 60vw;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Shine */
.logo-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 35%,
    rgba(255, 255, 255, 0.1) 55%,
    rgba(255, 255, 255, 0) 80%
  );
  mix-blend-mode: screen;
  opacity: 0;
  transform: translateX(-150%);
  pointer-events: none;
}

.logo-shell.shimmer-on::before {
  opacity: 1;
  animation: logo-shine 1.2s linear forwards;
}

@keyframes logo-shine {
  0%   { transform: translateX(-150%); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateX(150%); opacity: 0; }
}

/* Bumps, kickout, celebration */
.logo-bump-small { animation: logo-bump-small 0.18s ease-out; }
.logo-bump-medium { animation: logo-bump-medium 0.22s ease-out; }
.logo-bump-big { animation: logo-bump-big 0.3s ease-out; }
.logo-kickout { animation: logo-kickout 2.1s ease-out; }
.logo-celebrate { animation: logo-celebrate 0.2s ease-out 0s 10; }

@keyframes logo-bump-small {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  30%  { transform: translate3d(-2px, -1px, 0) rotate(-0.8deg); }
  60%  { transform: translate3d(2px, 1px, 0) rotate(0.8deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

@keyframes logo-bump-medium {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  25%  { transform: translate3d(-4px, -2px, 0) rotate(-1.2deg); }
  55%  { transform: translate3d(4px, 2px, 0) rotate(1.2deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

@keyframes logo-bump-big {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  20%  { transform: translate3d(-6px, -3px, 0) rotate(-2deg); }
  50%  { transform: translate3d(6px, 3px, 0) rotate(2deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

@keyframes logo-kickout {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  25%  { transform: translate3d(8px, 4px, 0) rotate(12deg); }
  55%  { transform: translate3d(10px, 6px, 0) rotate(14deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

@keyframes logo-celebrate {
  0%   { transform: translate3d(0, 0, 0); }
  40%  { transform: translate3d(0, -12px, 0); }
  70%  { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Pyro */
.pyro {
  position: absolute;
  bottom: 0;
  width: 34px;
  height: 120px;
  pointer-events: none;
  opacity: 0;
  filter: blur(0.4px);
  background:
    radial-gradient(circle, rgba(255,247,210,0.95) 0, rgba(255,247,210,0.8) 26%, transparent 60%);
  background-repeat: no-repeat;
  background-position: center bottom;
  box-shadow:
    0 -10px 0 rgba(255,230,150,0.95),
    5px -22px 0 rgba(255,210,120,0.85),
    -6px -28px 0 rgba(255,200,100,0.75),
    3px -38px 0 rgba(255,240,200,0.8),
    -4px -46px 0 rgba(255,220,150,0.7);
}

.pyro-left { left: -42px; }
.pyro-right { right: -42px; }

.pyro.pyro-active {
  opacity: 1;
  animation: pyro-burst 0.8s ease-out forwards;
}

@keyframes pyro-burst {
  0%   { transform: translateY(12px) scale(0.7); opacity: 1; }
  60%  { transform: translateY(-70px) scale(1.05); opacity: 1; }
  100% { transform: translateY(-110px) scale(1.15); opacity: 0; }
}

/* Text */
.headline {
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.subhead {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}

.signup-copy {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* Theme toggle (unused currently but kept for future) */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 3;
}

.theme-toggle .theme-button {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle .theme-button.active {
  background: var(--fg);
  color: #ffffff;
}

.theme-icon-button {
  width: 26px;
  height: 26px;
  justify-content: center;
}

.theme-toggle .theme-button[data-mode="auto"] {
  font-size: 11px;
}

/* Audio toggle group */
.audio-toggle-group {
  position: fixed;
  right: 16px;
  bottom: 52px;
  display: flex;
  gap: 8px;
  z-index: 3;
}

/* Audio toggle button */
.audio-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #000000;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #666666;
  padding: 0;
  box-sizing: border-box;
}

.audio-toggle .audio-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.audio-toggle .audio-icon::before {
  content: "🔊";
  font-size: 18px;
  display: block;
}

/* Shared states */
.audio-toggle.audio-on {
  border-color: #000000;
  background-color: #ffffff;
  color: #666666;
}

.audio-toggle.audio-muted {
  border-color: #cc0000;
  background-color: #ffffff;
  color: #cc0000;
}

.audio-toggle.audio-muted .audio-icon::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 50%;
  height: 3px;
  background-color: #cc0000;
  transform: rotate(-35deg);
  transform-origin: center;
}

/* Footer */
footer {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #9a9a9a;
}

/* Mobile */
@media (max-width: 480px) {
  .center-stack {
    padding: 16px;
    gap: 16px;
  }

  #logo {
    width: 220px;
  }
}

/* Tag Me In CTA */
.tag-me-in-button {
  margin-top: 16px;
  padding: 18px 40px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #000000;
  background: #f5f5f5;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease;
}

.tag-me-in-button:hover {
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.tag-me-in-button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ============================
   Signup modal layout
   ============================ */

.signup-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
  transition:
    opacity 0.22s ease-out,
    transform 0.22s ease-out;
}

.signup-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.signup-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
}

.signup-modal-dialog {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

.signup-modal-dialog .ml-form-embedContainer {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

/* Close button */
.signup-close {
  position: absolute;
  top: 10px;
  right: 18px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.signup-close:hover {
  background: rgba(0, 0, 0, 0.95);
}

@media (max-width: 480px) {
  .signup-modal-dialog {
    padding: 0 12px;
  }
}
