/* =====================================================================
   Color Mixer Game Styles (Ages 3-5)
   Artist Studio: Easel, Magic Mixing Flask, Paint Tubes
   ===================================================================== */

:root {
  --game-bg: linear-gradient(180deg, #fbf5e6 0%, #e8dcc4 100%);
  --liquid-color: rgba(220, 240, 255, 0.4);
  --target-color: #ff9800;
  --studio-bg-top: #fbf5e6;
  --studio-bg-bottom: #e8dcc4;
  --easel-wood: #8d5b2e;
  --easel-light: #b07d4b;
  --easel-canvas: #ffffff;
}

body {
  background: linear-gradient(180deg, var(--studio-bg-top) 0%, var(--studio-bg-bottom) 100%);
  color: #2c2523;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------
   Workspace Layout (Easel, Flask, Palette)
   --------------------------------------------------------------------- */

.studio-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  gap: 16px;
  padding: 12px 16px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  position: relative;
}

/* ---------------------------------------------------------------------
   Left: Easel & Artwork Canvas
   --------------------------------------------------------------------- */

.easel-section {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.easel-stand {
  background: linear-gradient(135deg, var(--easel-wood) 0%, var(--easel-light) 50%, var(--easel-wood) 100%);
  padding: 14px;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  width: 100%;
  max-width: 380px;
}

.easel-frame {
  background: var(--easel-canvas);
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.easel-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-bottom: 6px;
  border-bottom: 2px dashed #f0e6d2;
}

.artist-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #5d4037;
}

.badge-icon {
  font-size: 1.4rem;
}

.recipe-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8f1e5;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease;
}

.recipe-badge:hover {
  transform: scale(1.04);
}

.recipe-badge:focus-visible {
  outline: 2px solid #ff9800;
  outline-offset: 2px;
}

.target-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background-color: var(--target-color);
}

.canvas-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 240px;
  background: radial-gradient(circle, #ffffff 60%, #fffcf5 100%);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 12px rgba(141, 91, 46, 0.1);
  overflow: hidden;
}

.artwork-stage {
  width: 85%;
  height: 85%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.artwork-stage svg {
  width: 100%;
  height: 100%;
  max-width: 220px;
  max-height: 220px;
}

.artwork-stage.celebrate {
  animation: artworkPop 0.8s ease forwards;
}

.canvas-caption {
  font-weight: 800;
  font-size: 1.15rem;
  color: #3e2723;
  text-align: center;
  min-height: 1.5em;
}

/* ---------------------------------------------------------------------
   Right: Magic Mixing Flask
   --------------------------------------------------------------------- */

.mixer-section {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.flask-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

.magic-flask {
  position: relative;
  width: 160px;
  height: 200px;
  cursor: pointer;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.15));
  border-radius: 40px;
}

.magic-flask:focus-visible {
  outline: 3px solid #ff9800;
  outline-offset: 4px;
}

.flask-neck {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 50px;
  background: rgba(255, 255, 255, 0.45);
  border: 4px solid rgba(180, 210, 230, 0.85);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  box-shadow: inset -4px 0 6px rgba(255, 255, 255, 0.6);
  z-index: 2;
}

.flask-neck::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 66px;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 4px solid rgba(180, 210, 230, 0.85);
  border-radius: 6px;
}

.flask-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 160px;
  background: rgba(255, 255, 255, 0.25);
  border: 4px solid rgba(180, 210, 230, 0.85);
  border-radius: 40px 40px 65px 65px;
  overflow: hidden;
  box-shadow: inset -8px -8px 16px rgba(255, 255, 255, 0.6), inset 8px 8px 16px rgba(180, 210, 230, 0.3);
}

/* Glass reflection shine */
.flask-body::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 12px;
  width: 16px;
  height: 90px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 10px;
  pointer-events: none;
}

.flask-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background-color: var(--liquid-color);
  transition: height 0.4s ease, background-color 0.5s ease;
  border-radius: 0 0 60px 60px;
}

.liquid-surface {
  position: absolute;
  top: -6px;
  left: 0;
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.liquid-bubbles .bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: bubbleRise 2s infinite ease-in;
}

.b1 { width: 8px; height: 8px; left: 25%; bottom: 6px; animation-delay: 0.2s; }
.b2 { width: 12px; height: 12px; left: 55%; bottom: 10px; animation-delay: 0.8s; }
.b3 { width: 6px; height: 6px; left: 75%; bottom: 4px; animation-delay: 1.4s; }

.stir-wand {
  position: absolute;
  top: -10px;
  right: 25px;
  font-size: 2.2rem;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
  transform-origin: bottom center;
}

.magic-flask.stirring .stir-wand {
  animation: stirWand 0.8s infinite ease-in-out;
}

.magic-flask.stirring .flask-liquid {
  animation: swirlLiquid 0.8s infinite ease-in-out;
}

/* Drops indicator */
.flask-drops-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.drop-slot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px dashed #b0bec5;
  transition: transform 0.2s ease, background 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.drop-slot.filled {
  border-style: solid;
  border-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
  cursor: pointer;
}

.drop-slot.filled:hover {
  transform: scale(1.22);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.drop-slot.filled:focus-visible {
  outline: 2px solid #ff9800;
  outline-offset: 2px;
}

.drop-slot.slot-red { background: #e53935; }
.drop-slot.slot-yellow { background: #fdd835; }
.drop-slot.slot-blue { background: #1e88e5; }
.drop-slot.slot-white { background: #f5f5f5; border-color: #cfd8dc; }

.plus-sign {
  font-weight: 800;
  font-size: 1.1rem;
  color: #78909c;
}

.hidden {
  display: none !important;
}

/* Action buttons */
.mixer-controls {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.action-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  padding: 10px 18px;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease, filter 0.2s ease, opacity 0.2s ease;
}

.action-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.mix-btn {
  background: linear-gradient(135deg, #ab47bc 0%, #7b1fa2 100%);
  color: #ffffff;
}

.mix-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.wash-btn {
  background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
  color: #37474f;
}

.wash-btn.pulse-hint {
  animation: washPulse 0.9s infinite alternate;
}

@keyframes washPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(33, 150, 243, 0.85);
  }
}

.mix-btn.pulse-hint {
  animation: mixPulse 0.85s infinite alternate;
}

@keyframes mixPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(171, 71, 188, 0.9);
  }
}

.paint-tray.tray-hint {
  animation: trayWobble 0.6s ease;
}

@keyframes trayWobble {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 0 18px rgba(255, 152, 0, 0.65); }
}

/* ---------------------------------------------------------------------
   Bottom: Paint Tubes Palette
   --------------------------------------------------------------------- */

.palette-section {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.paint-tray {
  background: linear-gradient(135deg, #d7ccc8 0%, #a1887f 100%);
  border-radius: 28px;
  padding: 10px 20px;
  display: flex;
  gap: 16px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  max-width: 600px;
  width: 100%;
  justify-content: space-around;
}

.paint-tube {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 16px;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 72px;
}

.paint-tube:focus-visible {
  outline: 3px solid #ff9800;
  outline-offset: 2px;
}

.paint-tube:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.05);
}

.paint-tube:active:not(:disabled) {
  transform: translateY(2px) scale(0.94);
}

.tube-cap {
  width: 22px;
  height: 10px;
  background: #424242;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.tube-body {
  width: 44px;
  height: 52px;
  border-radius: 8px 8px 14px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 -3px 6px rgba(0, 0, 0, 0.15), inset 0 3px 6px rgba(255, 255, 255, 0.3);
}

.tube-drop {
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.tube-label {
  font-weight: 800;
  font-size: 0.88rem;
  color: #3e2723;
  margin-top: 2px;
  white-space: nowrap;
}

.tube-red .tube-body { background: linear-gradient(135deg, #ef5350 0%, #c62828 100%); }
.tube-yellow .tube-body { background: linear-gradient(135deg, #ffee58 0%, #fbc02d 100%); }
.tube-blue .tube-body { background: linear-gradient(135deg, #42a5f5 0%, #1565c0 100%); }
.tube-white .tube-body { background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%); }

/* ---------------------------------------------------------------------
   Droplet Flight Animation
   --------------------------------------------------------------------- */

.flying-drop {
  position: fixed;
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.45s ease;
}

.flying-drop.drop-red { background: #ef5350; }
.flying-drop.drop-yellow { background: #fbc02d; }
.flying-drop.drop-blue { background: #1e88e5; }
.flying-drop.drop-white { background: #ffffff; border: 1px solid #cfd8dc; }

/* ---------------------------------------------------------------------
   Sparkle Effects
   --------------------------------------------------------------------- */

.sparkle-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 10;
}

.sparkle-item {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.4rem;
  animation: sparkleFly 0.8s ease-out forwards;
}

@keyframes sparkleFly {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  60% {
    opacity: 1;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px) * 1.3), calc(-50% + var(--dy, 0px) * 1.3)) scale(0.6);
  }
}

/* ---------------------------------------------------------------------
   Celebration Overlay
   --------------------------------------------------------------------- */

.celebration-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44, 37, 35, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 16px;
}

.celebration-card {
  background: #ffffff;
  padding: 24px 32px;
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
  max-width: 420px;
  width: 100%;
  animation: cardBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-emoji {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

.celebration-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #3e2723;
  margin-bottom: 18px;
  line-height: 1.4;
}

.btn-next {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 12px 28px;
  border-radius: 30px;
  background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(46, 125, 50, 0.35);
  transition: transform 0.1s ease;
}

.btn-next:active {
  transform: scale(0.96);
}

/* ---------------------------------------------------------------------
   Animations & Keyframes
   --------------------------------------------------------------------- */

@keyframes bubbleRise {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: translateY(-40px) scale(1.1); opacity: 0; }
}

@keyframes stirWand {
  0% { transform: rotate(0deg) translate(0, 0); }
  25% { transform: rotate(-15deg) translate(-10px, 10px); }
  50% { transform: rotate(10deg) translate(10px, 15px); }
  75% { transform: rotate(-8deg) translate(-5px, 5px); }
  100% { transform: rotate(0deg) translate(0, 0); }
}

@keyframes swirlLiquid {
  0% { transform: scale(1); }
  50% { transform: scale(1.04) rotate(1deg); }
  100% { transform: scale(1); }
}

@keyframes artworkPop {
  0% { transform: scale(0.8) rotate(-4deg); }
  50% { transform: scale(1.12) rotate(3deg); }
  70% { transform: scale(0.96) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes cardBounce {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------
   Responsive Layout (Mobile Portrait & Small Screens)
   --------------------------------------------------------------------- */

@media (max-width: 640px) {
  .studio-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
    padding: 8px 10px;
    overflow-y: auto;
  }

  .easel-section {
    order: 1;
  }

  .canvas-card {
    max-height: 170px;
  }

  .mixer-section {
    order: 2;
  }

  .magic-flask {
    width: 130px;
    height: 160px;
  }

  .flask-body {
    width: 120px;
    height: 130px;
  }

  .palette-section {
    order: 3;
  }

  .paint-tray {
    gap: 8px;
    padding: 8px 12px;
  }

  .paint-tube {
    min-width: 58px;
    padding: 4px 6px;
  }

  .tube-body {
    width: 36px;
    height: 42px;
  }
}

@media (max-height: 520px) {
  .studio-workspace {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 8px;
    padding: 4px 10px;
    overflow-y: auto;
  }

  .canvas-card {
    max-height: 140px;
  }

  .easel-stand {
    padding: 8px;
    max-width: 300px;
  }

  .easel-frame {
    padding: 8px;
    gap: 4px;
  }

  .artist-badge {
    font-size: 0.8rem;
  }

  .badge-icon {
    font-size: 1.1rem;
  }

  .recipe-badge {
    font-size: 0.78rem;
    padding: 2px 8px;
  }

  .target-dot {
    width: 14px;
    height: 14px;
  }

  .canvas-caption {
    font-size: 0.95rem;
    min-height: 1.2em;
  }

  .magic-flask {
    width: 110px;
    height: 140px;
  }

  .flask-neck {
    width: 40px;
    height: 35px;
  }

  .flask-neck::before {
    width: 50px;
    height: 8px;
  }

  .flask-body {
    width: 100px;
    height: 115px;
  }

  .stir-wand {
    font-size: 1.6rem;
    right: 15px;
    top: -5px;
  }

  .flask-wrapper {
    gap: 6px;
  }

  .action-btn {
    padding: 6px 14px;
    font-size: 0.88rem;
  }

  .paint-tray {
    padding: 4px 12px;
    gap: 8px;
  }

  .paint-tube {
    min-width: 50px;
    padding: 2px 4px;
  }

  .tube-body {
    width: 32px;
    height: 36px;
  }

  .tube-cap {
    width: 18px;
    height: 8px;
  }

  .tube-drop {
    font-size: 1rem;
  }

  .tube-label {
    font-size: 0.75rem;
  }
}

/* ---------------------------------------------------------------------
   Reduced Motion
   --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .liquid-bubbles .bubble,
  .magic-flask.stirring .stir-wand,
  .magic-flask.stirring .flask-liquid,
  .artwork-stage.celebrate,
  .celebration-card,
  .wash-btn.pulse-hint,
  .mix-btn.pulse-hint,
  .paint-tray.tray-hint,
  .sparkle-item,
  .flying-drop {
    animation: none !important;
    transition: none !important;
  }
}
