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

:root {
  --banana: #FFE135;
  --banana-dark: #E6C800;
  --cream: #FFF8DC;
  --soda-red: #FF4444;
  --brown: #3E2723;
  --brown-light: #5D4037;
  --bg-warm: #FFF3B0;
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #FFF8DC 0%, #FFF3B0 40%, #FFEAA7 100%);
  color: var(--brown);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Bubble background */
#bubble-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

@keyframes bubble-rise {
  0% {
    transform: translateY(100vh) scale(0.3);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(255,225,53,0.2));
  border: 1px solid rgba(255,225,53,0.3);
  animation: bubble-rise linear infinite;
}

/* Header */
#header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px 16px 10px;
}

#header h1 {
  font-family: 'Bubblegum Sans', cursive;
  font-size: clamp(1.8rem, 5vw, 3rem);
  background: linear-gradient(135deg, var(--brown) 0%, var(--soda-red) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(2px 2px 0px rgba(255,225,53,0.5));
}

.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--brown-light);
  margin-top: 4px;
  font-weight: 500;
}

/* App layout */
#app-container {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 160px);
}

#left-panel {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 16px;
  border: 2px solid rgba(255,225,53,0.4);
  box-shadow: 0 4px 20px rgba(62,39,35,0.08);
}

.panel-card h3 {
  font-family: 'Bubblegum Sans', cursive;
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--brown);
}

/* Drop zone */
#drop-zone {
  border: 3px dashed var(--banana);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255,225,53,0.05);
}

#drop-zone:hover,
#drop-zone.drag-over {
  background: rgba(255,225,53,0.15);
  border-color: var(--banana-dark);
  transform: scale(1.02);
}

.drop-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

#drop-zone p {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 0.75rem;
  color: #999;
}

#thumbnail-preview {
  position: relative;
  margin-top: 10px;
  text-align: center;
}

#thumb-img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 12px;
  border: 2px solid var(--banana);
}

#clear-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--soda-red);
  color: white;
  border: none;
  font-size: 14px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255,68,68,0.4);
}

/* Controls */
.control-group {
  margin-bottom: 12px;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--brown-light);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#can-color {
  width: 40px; height: 34px;
  border: 2px solid var(--banana);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

#color-hex {
  font-size: 0.85rem;
  font-family: 'Fredoka', sans-serif;
  color: #888;
}

input[type="text"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid rgba(255,225,53,0.5);
  border-radius: 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  background: white;
  color: var(--brown);
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--banana-dark);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--banana-dark);
  height: 6px;
}

/* Buttons */
.button-row {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn.primary {
  flex: 1;
  background: linear-gradient(135deg, var(--banana) 0%, var(--banana-dark) 100%);
  color: var(--brown);
  box-shadow: 0 4px 15px rgba(255,225,53,0.5);
}

.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,225,53,0.7);
}

.action-btn.secondary {
  background: rgba(255,255,255,0.8);
  color: var(--brown);
  border: 2px solid rgba(255,225,53,0.5);
  width: 48px;
  justify-content: center;
  padding: 12px;
}

.action-btn.secondary:hover {
  background: rgba(255,225,53,0.2);
}

/* Scene container */
#scene-container {
  flex: 1;
  min-height: 500px;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background: #1a1a2e;
  box-shadow: 0 8px 40px rgba(62,39,35,0.15);
  border: 3px solid rgba(255,225,53,0.3);
}

#scene-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Loading overlay */
#loading-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(26,26,46,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes peel {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-15deg) scale(1.2); }
  50% { transform: rotate(15deg) scale(1.1); }
  75% { transform: rotate(-10deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1); }
}

.banana-loader {
  font-size: 4rem;
  animation: peel 1s ease-in-out infinite;
}

#loading-overlay p {
  color: var(--banana);
  font-family: 'Bubblegum Sans', cursive;
  font-size: 1.1rem;
  margin-top: 12px;
}

#click-counter {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,225,53,0.9);
  color: var(--brown);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 5;
}

/* Confetti */
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
  position: fixed;
  top: -20px;
  font-size: 1.5rem;
  z-index: 1000;
  animation: confetti-fall 3s ease-in forwards;
  pointer-events: none;
}

/* Footer */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--brown-light);
}

footer a {
  color: var(--soda-red);
  text-decoration: none;
  font-weight: 600;
  margin-left: 12px;
}

footer a:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  #app-container {
    flex-direction: column;
    padding: 12px;
  }

  #left-panel {
    width: 100%;
  }

  #scene-container {
    min-height: 400px;
    order: -1;
  }

  .button-row {
    position: sticky;
    bottom: 12px;
    z-index: 5;
  }

  .action-btn.primary {
    box-shadow: 0 4px 20px rgba(62,39,35,0.3);
  }
}