:root {
  color-scheme: dark;
  font-family: "Arial Black", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* ==================== PURE CHAOS GOOGLE FONTS ==================== */
.header h1 {
  font-family: "Bangers", "Bungee", "Arial Black", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.status {
  font-family: "Rubik Glitch", "Creepster", "Bangers", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
}

.death-warning {
  font-family: "Creepster", "Rubik Glitch", "Bangers", sans-serif;
  font-weight: 400;
}

.hype-warning {
  font-family: "Luckiest Guy", "Bungee", "Bangers", sans-serif;
  font-weight: 400;
}

.nerd-snipe,
#counter,
#difficulty,
#moves {
  font-family: "Press Start 2P", "Bungee", monospace;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.marquee {
  font-family: "Monoton", "Bungee", "Bangers", sans-serif;
  font-weight: 400;
  letter-spacing: 0.08em;
}

button,
.floating-player-header,
.chaos-close {
  font-family: "Bungee", "Bangers", "Luckiest Guy", sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.floating-player-footer {
  font-family: "Press Start 2P", monospace;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 0, 153, 0.28), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(0, 255, 255, 0.3), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(255, 153, 0, 0.3), transparent 30%),
    linear-gradient(120deg, #170326, #020617 40%, #1f0934);
  background-size: 120% 120%;
  animation: bgPulse 8s ease-in-out infinite alternate;
  color: #fff8ff;
  overflow-x: hidden;
}

#emoji-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 998;
}

.emoji {
  position: absolute;
  top: -10vh;
  font-size: clamp(1.1rem, 2vw, 2rem);
  animation: emojiDrop linear forwards;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

#flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 1000;
  background: white;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 999;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.95) 0 5px,
      rgba(255, 0, 204, 0.9) 5px 10px,
      rgba(0, 255, 255, 0.85) 10px 15px,
      rgba(255, 255, 0, 0.9) 15px 20px
    );
  mix-blend-mode: screen;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.header h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.8),
    0 0 14px rgba(255, 0, 191, 0.85),
    0 0 26px rgba(102, 0, 255, 0.9);
  animation: wobble 2.6s ease-in-out infinite;
}

.header p {
  margin-top: 0;
  opacity: 1;
  font-weight: 700;
  color: #ffe68f;
  text-shadow: 0 0 10px rgba(255, 196, 0, 0.6);
}

.marquee-wrap {
  margin: 10px 0 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 0, 170, 0.25), rgba(0, 229, 255, 0.2));
}

.marquee {
  display: inline-block;
  white-space: nowrap;
  padding: 8px 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  animation: marqueeScroll 12s linear infinite;
}

.nerd-snipe {
  margin: 12px 0 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.nerd-snipe .nerd-label {
  display: block;
  font-family: "Bangers", "Creepster", "Bungee", sans-serif;
  font-weight: 400;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}

.nerd-snipe a {
  display: block;
  color: #7cf0ff;
  text-decoration: none;
  margin: 3px 0;
  font-weight: 700;
}

.nerd-snipe a:hover {
  color: #fff;
  text-decoration: underline;
  text-shadow: 0 0 6px rgba(124, 240, 255, 0.8);
}

/* ==================== FLOATING MINI YOUTUBE PLAYER (non-blocking) ==================== */
.floating-player {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: min(340px, 42vw);
  background: linear-gradient(145deg, #1a0033, #2a0022);
  border: 4px solid #ffd700;
  border-radius: 10px;
  box-shadow:
    0 0 18px rgba(255, 215, 0, 0.7),
    0 0 36px rgba(255, 0, 170, 0.5);
  color: #fff;
  z-index: 1500;
  overflow: hidden;
  font-family: "Arial Black", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.floating-player.hidden {
  display: none;
}

.floating-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 215, 0, 0.15);
  padding: 6px 10px;
  font-family: "Bangers", "Bungee", "Creepster", sans-serif;
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #ffd700;
}

.floating-player-header span {
  text-shadow: 0 0 6px #ffd700;
}

.mini-close {
  background: #ff2a2a;
  color: white;
  border: 2px solid #fff;
  border-radius: 4px;
  width: 26px;
  height: 24px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.mini-close:hover {
  background: #ff00aa;
  transform: scale(1.1);
}

.floating-player-body {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.floating-player-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.floating-player-footer {
  padding: 5px 8px;
  font-size: 0.68rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fffa8f;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

button {
  background: linear-gradient(135deg, #ff00aa, #7f5cff 55%, #00d4ff);
  border: 2px solid rgba(255, 255, 255, 0.55);
  color: white;
  font-weight: 900;
  letter-spacing: 0.03em;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.35),
    0 0 20px rgba(153, 51, 255, 0.35);
  transition: transform 0.08s ease, filter 0.12s ease;
}

button:hover {
  filter: brightness(1.14) saturate(1.2);
  transform: translateY(-1px) scale(1.01);
}

button:active {
  transform: translateY(2px) scale(0.99);
}

.controls span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

.board-wrap {
  position: relative;
  width: min(84vw, 620px);
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  padding: 6px;
  background: linear-gradient(135deg, #ff00aa, #ffd000, #00e5ff, #8f00ff);
  background-size: 300% 300%;
  animation: borderDance 2.1s linear infinite;
  box-shadow:
    0 0 24px rgba(255, 0, 170, 0.45),
    0 0 48px rgba(0, 229, 255, 0.3);
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 3px;
  background: #080c1a;
  border-radius: 12px;
  overflow: hidden;
}

.tile {
  border: 0;
  cursor: pointer;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.tile.empty {
  cursor: default;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.09),
      rgba(255, 255, 255, 0.09) 10px,
      rgba(255, 255, 255, 0.03) 10px,
      rgba(255, 255, 255, 0.03) 20px
    ),
    #05070f;
}

.preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.status {
  min-height: 1.3rem;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  /* Much tighter, readable glow with dark outline so the letters don't dissolve */
  text-shadow:
    0 0 2px #000,
    0 0 4px #000,
    0 0 2px #ff0,
    0 0 6px #ff0,
    0 0 10px #f0f;
}

.party-pulse .header h1 {
  animation:
    wobble 0.45s ease-in-out infinite,
    glowPop 0.35s ease-in-out infinite alternate;
}

/* Status gets wobble but a much gentler glow so it stays readable */
.party-pulse .status {
  animation: wobble 0.45s ease-in-out infinite;
}

.party-pulse .controls button,
.party-pulse .controls span {
  animation: jitter 0.16s linear infinite;
}

.hidden {
  display: none;
}

/* Password gate — blocks private photos until unlocked */
body.gate-locked {
  overflow: hidden;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 0, 153, 0.35), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(0, 255, 200, 0.25), transparent 40%),
    rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(8px);
}

.gate-card {
  width: min(100%, 22rem);
  margin: 0;
  padding: 1.5rem 1.35rem;
  border-radius: 1rem;
  border: 3px solid rgba(255, 215, 0, 0.65);
  background: linear-gradient(145deg, rgba(31, 9, 52, 0.95), rgba(2, 6, 23, 0.98));
  box-shadow:
    0 0 30px rgba(255, 0, 153, 0.35),
    0 0 60px rgba(0, 255, 200, 0.15);
  text-align: center;
}

.gate-card h2 {
  margin: 0 0 0.5rem;
  font-family: "Bangers", "Bungee", sans-serif;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  line-height: 1.15;
  color: #ffe566;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.gate-lead {
  margin: 0 0 1rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  line-height: 1.7;
  color: #e9d5ff;
}

.gate-label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: "Bungee", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: #a7f3d0;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  border: 2px solid rgba(167, 243, 208, 0.5);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

.gate-input:focus {
  outline: none;
  border-color: #ffe566;
  box-shadow: 0 0 0 3px rgba(255, 229, 102, 0.25);
}

#gate-submit {
  width: 100%;
}

.gate-error {
  margin: 0.75rem 0 0;
  font-family: "Rubik Glitch", "Creepster", sans-serif;
  font-size: 0.9rem;
  color: #fca5a5;
}

body.chaos-burst {
  animation:
    bgPulse 0.25s linear infinite alternate,
    chaosShake 0.11s linear infinite;
  filter: saturate(1.8) contrast(1.3) hue-rotate(35deg);
}

body.chaos-burst::before {
  opacity: 0.9;
  animation: strobeFlicker 0.08s steps(1, end) infinite;
}

body.chaos-burst #flash-overlay {
  opacity: 0.95;
  animation: hardFlash 0.08s steps(1, end) infinite;
}

/* Gentle solve celebration when crazy effects are turned off */
body.celebrate-solved .board-wrap {
  animation: gentleCelebrate 1s ease-out;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.55),
    0 0 36px rgba(0, 255, 136, 0.3);
}

body.celebrate-solved .status {
  text-shadow:
    0 0 2px #000,
    0 0 8px rgba(255, 215, 0, 0.7);
}

@keyframes gentleCelebrate {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.02);
  }
}

@keyframes bgPulse {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-1deg) scale(1);
  }
  50% {
    transform: rotate(1.2deg) scale(1.01);
  }
}

@keyframes marqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes borderDance {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes glowPop {
  from {
    text-shadow:
      0 0 6px rgba(255, 255, 255, 0.8),
      0 0 14px rgba(255, 0, 191, 0.85),
      0 0 26px rgba(102, 0, 255, 0.9);
  }
  to {
    text-shadow:
      0 0 10px rgba(255, 255, 255, 0.95),
      0 0 22px rgba(255, 0, 191, 1),
      0 0 40px rgba(0, 229, 255, 0.95);
  }
}

@keyframes jitter {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(1px, -1px) rotate(0.5deg);
  }
  50% {
    transform: translate(-1px, 1px) rotate(-0.5deg);
  }
  75% {
    transform: translate(1px, 1px) rotate(0.2deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

@keyframes emojiDrop {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 0.95;
  }
  100% {
    transform: translateY(120vh) rotate(540deg);
    opacity: 0.1;
  }
}

@keyframes strobeFlicker {
  0%,
  100% {
    opacity: 0.05;
  }
  15% {
    opacity: 0.95;
  }
  30% {
    opacity: 0.25;
  }
  45% {
    opacity: 1;
  }
  60% {
    opacity: 0.15;
  }
  75% {
    opacity: 0.85;
  }
}

@keyframes hardFlash {
  0%,
  100% {
    opacity: 0;
  }
  40% {
    opacity: 0.9;
  }
  60% {
    opacity: 0.2;
  }
}

@keyframes chaosShake {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-2px, 1px);
  }
  40% {
    transform: translate(2px, -1px);
  }
  60% {
    transform: translate(-1px, 2px);
  }
  80% {
    transform: translate(2px, 1px);
  }
  100% {
    transform: translate(0, 0);
  }
}

#death-warnings {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 997;
  overflow: visible;
}

.death-warning {
  position: absolute;
  font-family: "Arial Black", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ff2a2a;
  text-shadow:
    0 0 6px #000,
    0 0 12px #ff2a2a,
    0 0 20px #ff8800;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.95;
  animation: deathFloat 1.65s ease-out forwards;
  transform: rotate(var(--rot, 0deg));
}

.hype-warning {
  position: absolute;
  font-family: "Arial Black", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(0.95rem, 2.2vw, 1.4rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffd700;
  text-shadow:
    0 0 6px #000,
    0 0 14px #ffd700,
    0 0 26px #7fff00,
    0 0 38px #00ffaa;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.98;
  animation: hypeFloat 2.05s ease-out forwards;
  transform: rotate(var(--rot, 0deg));
}

@keyframes deathFloat {
  0% {
    opacity: 0.95;
    transform: translateY(0) rotate(var(--rot, 0deg)) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translateY(-8px) rotate(var(--rot, 0deg)) scale(1.05);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-78px) rotate(var(--rot, 0deg)) scale(0.7);
  }
}

@keyframes hypeFloat {
  0% {
    opacity: 0.98;
    transform: translateY(0) rotate(var(--rot, 0deg)) scale(0.55);
  }
  12% {
    opacity: 1;
    transform: translateY(-12px) rotate(var(--rot, 0deg)) scale(1.08);
  }
  65% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-95px) rotate(var(--rot, 0deg)) scale(0.65);
  }
}

/* Download button next to Next Photo after solving */
.footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

#download-button {
  background: linear-gradient(135deg, #00c853, #ffd600);
  color: #111;
  font-weight: 900;
  border: 2px solid #111;
  box-shadow: 0 0 12px rgba(0, 200, 83, 0.5);
}

#download-button:hover {
  filter: brightness(1.1) saturate(1.2);
}
