﻿:root {
  --bg1: #ffb3ff;
  --bg2: #9ad7ff;
  --bg3: #fff0a8;
  --accent1: #ff4d6d;
  --accent2: #3cffad;
  --accent3: #6f6bff;
  --dark: #1a1328;
  --light: #ffffff;
  --glow: 0 0 20px rgba(255, 77, 109, 0.6);
  --glow2: 0 0 30px rgba(111, 107, 255, 0.6);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Comic Sans MS", "Trebuchet MS", "Verdana", sans-serif;
  color: var(--dark);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at 10% 20%, var(--bg3), transparent 40%),
              radial-gradient(circle at 80% 10%, var(--bg1), transparent 45%),
              radial-gradient(circle at 30% 80%, var(--bg2), transparent 45%),
              linear-gradient(130deg, #ffe0f7, #c9f2ff);
  animation: bg-shift 18s ease-in-out infinite;
}

.stage::before {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle at 10% 30%, rgba(255, 255, 255, 0.5), transparent 40%),
              radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.35), transparent 40%);
  opacity: 0.6;
  pointer-events: none;
  animation: haze 20s ease-in-out infinite;
  z-index: 0;
}

@keyframes haze {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes bg-shift {
  0% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(30deg); }
  100% { filter: hue-rotate(0deg); }
}

.bg-noise {
  position: fixed;
  inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.12'/></svg>");
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: noise-drift 10s linear infinite;
}

@keyframes noise-drift {
  0% { transform: translate3d(0,0,0); }
  100% { transform: translate3d(-10%, -10%, 0); }
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.08), rgba(0,0,0,0.08) 1px, transparent 1px, transparent 3px);
  opacity: 0.15;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.controls {
  display: flex;
  gap: 10px;
}

.brand {
  padding: 8px 14px;
  background: rgba(255,255,255,0.7);
  border: 2px solid var(--dark);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: var(--glow2);
}

.toggle {
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--dark);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toggle:hover {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: var(--glow);
}

.stage {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
}

.ambient-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.ambient-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(26, 19, 40, 0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.35;
  mix-blend-mode: multiply;
  animation: dots-drift 18s linear infinite;
}

@keyframes dots-drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-20px, 20px, 0); }
}

.badge {
  position: absolute;
  padding: 8px 12px;
  font-weight: 800;
  border-radius: 999px;
  border: 2px solid var(--dark);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--glow);
  animation: float-badge 7s ease-in-out infinite;
}

.badge-a { top: 12%; left: 8%; transform: rotate(-8deg); animation-delay: 0s; }
.badge-b { top: 18%; right: 10%; transform: rotate(6deg); animation-delay: 1.5s; }
.badge-c { bottom: 22%; left: 12%; transform: rotate(3deg); animation-delay: 2.2s; }
.badge-d { bottom: 16%; right: 14%; transform: rotate(-4deg); animation-delay: 0.8s; }
.badge-e { top: 48%; left: 4%; transform: rotate(10deg); animation-delay: 3.4s; }
.badge-f { top: 54%; right: 6%; transform: rotate(-12deg); animation-delay: 2.8s; }

.sparkle {
  position: absolute;
  font-size: 18px;
  color: #fff7b0;
  text-shadow: 0 0 10px rgba(255, 247, 176, 0.9);
  animation: twinkle 4s ease-in-out infinite;
}

.s1 { top: 28%; left: 20%; animation-delay: 0.2s; }
.s2 { top: 36%; right: 18%; animation-delay: 1.1s; }
.s3 { bottom: 30%; left: 24%; animation-delay: 2.3s; }
.s4 { bottom: 26%; right: 20%; animation-delay: 0.6s; }
.s5 { top: 64%; left: 50%; animation-delay: 1.8s; }
.s6 { top: 42%; left: 70%; animation-delay: 2.9s; }

.ribbon {
  position: absolute;
  top: 6%;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  padding: 6px 16px;
  font-weight: 800;
  text-transform: lowercase;
  background: linear-gradient(120deg, #ffd36a, #ff7ad9);
  border: 2px solid var(--dark);
  border-radius: 999px;
  box-shadow: var(--glow2);
  animation: float-badge 8s ease-in-out infinite;
}

.corner-tag {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  padding: 6px 12px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--dark);
  font-weight: 800;
  box-shadow: var(--glow);
  animation: wiggle 5s ease-in-out infinite;
}

@keyframes float-badge {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

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

.stage.glitch {
  animation: glitch 0.2s steps(2, end);
}

@keyframes glitch {
  0% { transform: translate(0, 0); filter: hue-rotate(0deg); }
  20% { transform: translate(-4px, 2px); filter: hue-rotate(20deg); }
  40% { transform: translate(3px, -2px); filter: hue-rotate(-15deg); }
  60% { transform: translate(-2px, -3px); filter: hue-rotate(10deg); }
  80% { transform: translate(2px, 3px); filter: hue-rotate(-10deg); }
  100% { transform: translate(0, 0); filter: hue-rotate(0deg); }
}

.jelly {
  width: 240px;
  height: 240px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 30% 30%, #fff, #ff7ad9 40%, #ff3faa 70%);
  box-shadow: 0 18px 40px rgba(255, 63, 170, 0.35), var(--glow2);
  animation: wobble 3s ease-in-out infinite;
  position: relative;
  z-index: 3;
}

.jelly-core {
  width: 80%;
  height: 80%;
  margin: 10%;
  border-radius: 50%;
  background: radial-gradient(circle at 60% 40%, #fff, #ffd1f1 60%, #ff82c8 100%);
  display: grid;
  place-items: center;
  animation: pulse 2.6s ease-in-out infinite;
}

.jelly-text {
  font-size: 44px;
  font-weight: 800;
  color: #6b1441;
  text-shadow: 2px 2px 0 #fff, 0 0 18px rgba(255, 63, 170, 0.6);
}

.jelly:active {
  transform: scale(0.97) skewX(2deg);
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.orbital {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 440px;
  height: 440px;
  margin: -220px 0 0 -220px;
  border-radius: 50%;
  border: 2px dashed rgba(26, 19, 40, 0.2);
  animation: spin linear infinite;
}

.orbit:nth-child(2) {
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
}

.orbit:nth-child(3) {
  width: 610px;
  height: 610px;
  margin: -305px 0 0 -305px;
}

.orbit:nth-child(4) {
  width: 690px;
  height: 690px;
  margin: -345px 0 0 -345px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.terminal {
  position: absolute;
  right: 6%;
  bottom: 10%;
  width: 220px;
  background: rgba(0, 0, 0, 0.75);
  color: #8dff8d;
  border: 2px solid #5cffc9;
  border-radius: 10px;
  box-shadow: var(--glow);
  transform: rotate(-2deg);
  animation: float 6s ease-in-out infinite;
  z-index: 2;
}

.terminal-bar {
  padding: 6px 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.terminal-body {
  margin: 0;
  padding: 10px;
  font-size: 12px;
}

.hint {
  position: absolute;
  left: 6%;
  bottom: 12%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.7);
  border: 2px solid var(--dark);
  border-radius: 999px;
  font-weight: 700;
  animation: bounce 3s ease-in-out infinite;
  z-index: 2;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.sticker, .popup, .packet, .emoji, .wave, .foot, .spark, .banner, .streak, .rune, .confetti {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.sticker {
  padding: 6px 10px;
  background: #fff;
  border: 2px solid var(--dark);
  border-radius: 999px;
  font-weight: 800;
  animation: pop 1.2s ease forwards;
  box-shadow: var(--glow2);
}

.popup {
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffe0ff;
  border: 2px solid var(--dark);
  font-weight: 700;
  animation: drop 1.6s ease forwards;
  box-shadow: var(--glow);
}

.packet {
  font-family: "Courier New", monospace;
  font-size: 12px;
  padding: 4px 6px;
  background: rgba(26, 19, 40, 0.8);
  color: #fff0a8;
  border-radius: 6px;
  animation: fall 3.8s linear forwards;
}

.emoji {
  font-size: 22px;
  animation: drift 4s ease-out forwards;
}

.wave {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(26, 19, 40, 0.4);
  animation: ripple 2.4s ease-out forwards;
}

.foot {
  width: 40px;
  height: 20px;
  border-radius: 30px 10px 30px 10px;
  background: rgba(26, 19, 40, 0.15);
  animation: fade 3.4s ease-out forwards;
  transform: rotate(-8deg);
}

.spark {
  font-size: 18px;
  font-weight: 800;
  color: #ffe066;
  text-shadow: 0 0 12px rgba(255, 224, 102, 0.9);
  animation: spark 1.6s ease-out forwards;
}

.banner {
  padding: 10px 14px;
  font-weight: 800;
  border-radius: 12px;
  border: 2px solid var(--dark);
  background: linear-gradient(120deg, #ff8ad8, #7df9ff);
  box-shadow: var(--glow);
  animation: slide-banner 2.4s ease forwards;
}

.streak {
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff, rgba(255,255,255,0));
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.8);
  animation: streak 1.2s ease-out forwards;
}

.rune {
  font-size: 22px;
  color: #c8b6ff;
  text-shadow: 0 0 12px rgba(200, 182, 255, 0.9);
  animation: rune-drift 4.4s ease-out forwards;
}

.confetti {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--confetti-color, #ffd36a);
  animation: confetti-fly 1.8s ease-out forwards;
}

@keyframes pop {
  0% { transform: scale(0.4) rotate(-6deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 0; }
}

@keyframes drop {
  0% { transform: translateY(-20px) rotate(-3deg); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateY(40px) rotate(2deg); opacity: 0; }
}

@keyframes fall {
  0% { transform: translateY(-10px); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(80vh); opacity: 0; }
}

@keyframes drift {
  0% { transform: translateX(0) translateY(0) scale(0.8); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(80px) translateY(-120px) scale(1.2); opacity: 0; }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(20); opacity: 0; }
}

@keyframes fade {
  0% { opacity: 0; }
  20% { opacity: 0.6; }
  100% { opacity: 0; }
}

@keyframes spark {
  0% { transform: scale(0.4) rotate(0deg); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scale(1.6) rotate(120deg); opacity: 0; }
}

@keyframes slide-banner {
  0% { transform: translateX(-20px) translateY(-20px) rotate(-3deg); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateX(40px) translateY(20px) rotate(2deg); opacity: 0; }
}

@keyframes streak {
  0% { transform: translateX(-40px) rotate(8deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(200px) rotate(8deg); opacity: 0; }
}

@keyframes rune-drift {
  0% { transform: translateY(20px) scale(0.6) rotate(0deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-140px) scale(1.2) rotate(180deg); opacity: 0; }
}

@keyframes confetti-fly {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--dx, 60px), var(--dy, 140px)) rotate(220deg); opacity: 0; }
}

body.chaos .jelly {
  animation-duration: 1.6s;
}

body.chaos .orbital .orbit {
  border-color: rgba(26, 19, 40, 0.35);
}

body.chaos .scanlines {
  opacity: 0.3;
}

@media (max-width: 820px) {
  .terminal { display: none; }
  .orbit { width: 320px; height: 320px; margin: -160px 0 0 -160px; }
  .orbit:nth-child(2) { width: 380px; height: 380px; margin: -190px 0 0 -190px; }
  .orbit:nth-child(3) { width: 440px; height: 440px; margin: -220px 0 0 -220px; }
  .orbit:nth-child(4) { width: 500px; height: 500px; margin: -250px 0 0 -250px; }
}
