@import url('https://fonts.googleapis.com/css2?family=DynaPuff:wght@400..700&family=Fredoka:wght@400;600;700&family=Sniglet:wght@400;800&family=Syne+Mono&display=swap');

:root {
  /* Cotton-Candy Pearl x Lisa Frank x Care Bears Light Palette */
  --bg-deep: #fcf2fa;
  --bg-panel: rgba(255, 244, 253, 0.88);
  --bg-group: rgba(255, 255, 255, 0.78);
  --bg-control: rgba(255, 235, 248, 0.8);
  
  --line-subtle: rgba(230, 120, 210, 0.3);
  --line-bright: #ff60c8;
  --line-chrome: linear-gradient(135deg, #ffffff 0%, #ff7fe4 30%, #5ce5ff 70%, #ffdf00 100%);

  /* High contrast ink on pastel light background */
  --ink: #380d4a;
  --ink-dim: #753b8f;
  --ink-muted: #a672bf;

  /* Saturated Candy Accents */
  --pink-neon: #ff1493;
  --pink-bubble: #ff52bf;
  --pink-glow: rgba(255, 20, 147, 0.35);
  --aqua-neon: #00beed;
  --aqua-glow: rgba(0, 190, 237, 0.35);
  --yellow-neon: #ffbe00;
  --lime-neon: #5edb00;
  --purple-gem: #b01eff;

  --font-display: "DynaPuff", "Sniglet", cursive;
  --font-header: "Sniglet", cursive, sans-serif;
  --font-sans: "Fredoka", system-ui, -apple-system, sans-serif;
  --font-mono: "Syne Mono", monospace;

  /* Bouncy Cloud Radii */
  --radius-shell: 32px 20px 36px 24px;
  --radius-card: 22px 16px 24px 18px;
  --radius-btn: 16px 12px 18px 14px;
  --radius-pill: 9999px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 12% 18%, rgba(255, 175, 230, 0.45) 0%, transparent 45%),
    radial-gradient(circle at 88% 82%, rgba(165, 235, 255, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 50% 45%, rgba(255, 240, 180, 0.35) 0%, transparent 55%),
    linear-gradient(135deg, #fdf4fb 0%, #f6e8ff 50%, #ebf7ff 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.5 var(--font-sans);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ---- Keyframe Animations ---- */

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

@keyframes float-twinkle {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0.9; }
  50% { transform: translateY(-4px) scale(1.2) rotate(14deg); filter: drop-shadow(0 0 10px var(--pink-neon)); }
}

@keyframes cloud-pulse {
  0%, 100% { border-color: rgba(255, 80, 190, 0.5); box-shadow: 0 10px 30px rgba(255, 80, 190, 0.2); }
  50% { border-color: rgba(0, 190, 237, 0.6); box-shadow: 0 12px 36px rgba(0, 190, 237, 0.28); }
}

/* ---- Header Bar (Cotton-Candy Pearl Studio Header) ---- */

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 244, 253, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 3px solid transparent;
  border-image: var(--line-chrome) 1;
  box-shadow: 0 4px 20px rgba(200, 100, 180, 0.15), inset 0 -1px 0 rgba(255, 255, 255, 0.8);
  z-index: 10;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sparkle-icon {
  font-size: 18px;
  animation: float-twinkle 3s ease-in-out infinite;
  display: inline-block;
}

.brand-wrap .sparkle-icon:nth-child(3) {
  animation-delay: 1.5s;
}

.bar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  background: linear-gradient(90deg, var(--pink-neon), var(--purple-gem), var(--aqua-neon), var(--yellow-neon), var(--pink-neon));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer-rainbow 6s ease infinite;
  filter: drop-shadow(0 2px 8px rgba(255, 20, 147, 0.3));
}

.sub {
  margin: 0;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.bar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* ---- Layout ---- */

main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 315px;
}

.stage-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  overflow: auto;
}

/* ---- Empty Drop Zone (Sugar Cloud & Ribbon Badge) ---- */

.empty {
  position: relative;
  border-radius: var(--radius-shell);
  border: 3px dashed var(--pink-bubble);
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95) 0%, rgba(255, 236, 250, 0.9) 100%);
  backdrop-filter: blur(14px);
  padding: 68px 52px;
  text-align: center;
  color: var(--ink-dim);
  cursor: pointer;
  box-shadow: 0 12px 35px rgba(255, 80, 190, 0.18), inset 0 0 30px rgba(255, 255, 255, 0.9);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.empty-icon-cloud {
  font-size: 24px;
  margin-bottom: 12px;
  letter-spacing: 0.3em;
  animation: float-twinkle 4s ease-in-out infinite;
}

.empty:hover,
.empty.is-over {
  border-style: solid;
  border-color: var(--aqua-neon);
  color: var(--ink);
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 18px 45px rgba(0, 190, 237, 0.28), inset 0 0 35px rgba(255, 255, 255, 1);
}

.empty p {
  margin: 0;
  font-family: var(--font-header);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.empty .hint {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ---- Stage & Canvases (Iridescent Pearl Frame) ---- */

.stage {
  position: relative;
  line-height: 0;
  max-width: 100%;
  border-radius: 20px;
  padding: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #ff9ce8 30%, #7ee8ff 70%, #ffe600 100%);
  box-shadow: 0 14px 45px rgba(200, 80, 180, 0.25), 0 0 25px rgba(255, 255, 255, 0.8);
  animation: cloud-pulse 6s ease-in-out infinite;
}

.stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.stage #base {
  background: #ffffff;
}

.stage #sparkle,
.stage #overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  background: transparent !important;
  pointer-events: none;
}

.stage #overlay {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}

/* ---- Transport Deck (Bubble Cloud Deck) ---- */

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 660px;
  padding: 10px 20px;
  background: rgba(255, 245, 253, 0.94);
  backdrop-filter: blur(16px);
  border: 2px solid var(--line-subtle);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 25px rgba(220, 100, 180, 0.18), inset 0 2px 3px rgba(255, 255, 255, 1);
}

.transport #btn-play {
  min-width: 80px;
}

.transport input[type="range"] {
  flex: 1;
}

.frame-label {
  color: var(--pink-neon);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status {
  margin: 0;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-height: 1.5em;
  text-align: center;
}

/* ---- Panel (Candy Rack) ---- */

.panel {
  border-left: 2px solid var(--line-subtle);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  padding: 16px 14px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: -8px 0 25px rgba(220, 100, 180, 0.12);
}

.panel::-webkit-scrollbar {
  width: 7px;
}
.panel::-webkit-scrollbar-track {
  background: rgba(255, 235, 250, 0.5);
}
.panel::-webkit-scrollbar-thumb {
  background: var(--pink-bubble);
  border-radius: 4px;
}

.group {
  padding: 14px 16px;
  background: var(--bg-group);
  border: 2px solid rgba(255, 180, 230, 0.4);
  border-radius: var(--radius-card);
  box-shadow: 0 6px 18px rgba(220, 120, 190, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.group:hover {
  border-color: var(--pink-bubble);
  box-shadow: 0 8px 22px rgba(255, 80, 190, 0.18);
}

.group h2 {
  margin: 0 0 12px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pink-neon);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group h2::after {
  content: "💖";
  font-size: 11px;
}

.ctl {
  margin-bottom: 12px;
}

.ctl:last-child {
  margin-bottom: 0;
}

.ctl label,
.ctl .lab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 600;
}

.ctl .val {
  color: var(--purple-gem);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #ffffff;
  padding: 1px 7px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 80, 190, 0.3);
  box-shadow: 0 2px 4px rgba(200, 100, 180, 0.1);
}

/* ---- Controls: Sliders ---- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 9px;
  background: #fce8f7;
  border-radius: 5px;
  border: 1.5px solid var(--line-subtle);
  outline: none;
  box-shadow: inset 0 2px 4px rgba(200, 100, 180, 0.15);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ff52bf 60%, #ff1493 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(255, 20, 147, 0.4), 0 0 10px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.22);
  box-shadow: 0 4px 12px rgba(0, 190, 237, 0.5), 0 0 12px rgba(255, 255, 255, 1);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ff52bf 60%, #ff1493 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(255, 20, 147, 0.4);
  cursor: pointer;
}

/* ---- Controls: Select Dropdowns ---- */

.ctl select {
  width: 100%;
  background: #ffffff;
  color: var(--ink);
  border: 2px solid var(--line-subtle);
  border-radius: 12px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(220, 120, 190, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ctl select:hover,
.ctl select:focus {
  border-color: var(--pink-neon);
  box-shadow: 0 0 12px rgba(255, 20, 147, 0.25);
}

.ctl select option {
  background: #ffffff;
  color: var(--ink);
}

/* ---- Buttons (3D Strawberry Candy Gel) ---- */

button {
  background: linear-gradient(180deg, #ffffff 0%, #ffe4f6 45%, #ffd1f0 100%);
  color: var(--ink);
  border: 2px solid rgba(255, 130, 210, 0.5);
  border-radius: var(--radius-btn);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 100, 180, 0.18), inset 0 1px 2px rgba(255, 255, 255, 1);
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:hover:not(:disabled) {
  border-color: var(--pink-neon);
  color: var(--pink-neon);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 20, 147, 0.3), inset 0 1px 2px #ffffff;
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 2px 5px rgba(200, 50, 150, 0.3);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
  border-color: var(--line-subtle);
}

button.is-on {
  background: linear-gradient(180deg, #ff8fe4 0%, #ff1493 50%, #c4006b 100%);
  border-color: #ffffff;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 5px 20px var(--pink-glow), inset 0 1.5px 2px rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(100, 0, 50, 0.4);
}

button.is-on:hover:not(:disabled) {
  background: linear-gradient(180deg, #6eeaff 0%, #00beed 50%, #0081a8 100%);
  color: #ffffff;
  box-shadow: 0 5px 20px var(--aqua-glow), inset 0 1.5px 2px rgba(255, 255, 255, 0.9);
}

/* ---- Special Control Groupings ---- */

.modes {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: #ffffff;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line-subtle);
  box-shadow: inset 0 2px 4px rgba(200, 100, 180, 0.1);
}

.modes .mode {
  flex: 1;
  border-radius: var(--radius-pill);
  border: none;
  padding: 7px 12px;
  background: transparent;
  box-shadow: none;
  color: var(--ink-dim);
}

.modes .mode.is-on {
  background: linear-gradient(180deg, #ff7fe4 0%, var(--pink-neon) 100%);
  color: #ffffff;
  box-shadow: 0 3px 12px var(--pink-glow);
}

.multi {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.multi button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 12px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.row button {
  flex: 1;
}

/* ---- Responsive Tweaks ---- */

@media (max-width: 760px) {
  main {
    grid-template-columns: 1fr;
  }
  .panel {
    border-left: 0;
    border-top: 2px solid var(--line-subtle);
    box-shadow: 0 -8px 25px rgba(220, 100, 180, 0.15);
  }
  .bar {
    padding: 10px 14px;
  }
  .bar h1 {
    font-size: 20px;
  }
}
