/*
 * cake.css — Adapted from original style.css
 * Namespaced under #scene-cake for dark theme integration
 */

#scene-cake .cake {
  position: absolute;
  width: 250px;
  height: 200px;
  top: 50%;
  left: 50%;
  margin-top: -70px;
  margin-left: -125px;
  transform-style: preserve-3d;
  will-change: transform;
}

#scene-cake .candle-count-display {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 20px;
  font-family: var(--font-quote);
  font-size: var(--text-2xl);
  font-weight: bold;
  color: var(--color-text-primary);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-ambient), var(--shadow-rim-cyan);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: var(--glass-border);
  position: relative;
  z-index: 5;
}

#scene-cake .plate {
  width: 270px; height: 110px;
  position: absolute; bottom: -10px; left: -10px;
  background-color: #dcdcdc;
  border-radius: 50%;
  box-shadow: 
    0 2px 0 #b3b3b3, 
    0 4px 0 #999, 
    0 15px 50px rgba(0,0,0,0.8),
    inset 0 0 10px rgba(255, 255, 255, 0.2),
    inset 0 -2px 10px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#scene-cake .cake > * { position: absolute; }

#scene-cake .layer {
  position: absolute; display: block;
  width: 250px; height: 100px;
  border-radius: 50%;
  /* Premium vanilla/mocha sponge gradient */
  background: radial-gradient(circle at 30% 30%, #f4e8d3, #e3cbb0);
  /* Thick cake body and enhanced cyan rim lighting */
  box-shadow: 
    0 2px 0px #cba984, 0 4px 0px #cba984, 0 6px 0px #cba984, 0 8px 0px #cba984, 
    0 10px 0px #cba984, 0 12px 0px #cba984, 0 14px 0px #cba984, 0 16px 0px #cba984, 
    0 18px 0px #cba984, 0 20px 0px #cba984, 0 22px 0px #cba984, 0 24px 0px #cba984, 
    0 26px 0px #cba984, 0 28px 0px #cba984, 0 30px 0px #cba984,
    -10px 15px 30px rgba(0, 255, 255, 0.1), /* Soft cyan rim light */
    inset -15px -15px 25px rgba(0,0,0,0.5); /* Inner sponge shadow */
}

#scene-cake .layer-top { top: 0px; }
#scene-cake .layer-middle { top: 33px; }
#scene-cake .layer-bottom { top: 66px; }

#scene-cake .icing {
  top: 2px; left: 5px;
  background: linear-gradient(135deg, #fdfbf7, #f0e4d0);
  width: 240px; height: 90px;
  border-radius: 50%;
}
#scene-cake .icing:before {
  content: ""; position: absolute;
  top: 4px; right: 5px; bottom: 6px; left: 5px;
  background: linear-gradient(135deg, #ffffff, #f4ebdc);
  box-shadow: 0 0 4px #f6efe3, 0 0 4px #f6efe3, 0 0 4px #f6efe3;
  border-radius: 50%; z-index: 1;
}

#scene-cake .drip {
  display: block; width: 50px; height: 60px;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  background: linear-gradient(to bottom, #f0e4d0, #e6d5bb);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2), inset 1px -1px 3px rgba(255,255,255,0.2);
}
#scene-cake .drip1 { top: 53px; left: 5px; transform: skewY(15deg); height: 48px; width: 40px; }
#scene-cake .drip2 { top: 69px; left: 181px; transform: skewY(-15deg); }
#scene-cake .drip3 { top: 54px; left: 90px; width: 80px; border-bottom-left-radius: 40px; border-bottom-right-radius: 40px; }

#scene-cake .candle {
  background: linear-gradient(to right, #9e0210, #ff172e, #9e0210);
  width: 12px; height: 35px;
  border-radius: 6px/3px;
  top: -20px; left: 50%;
  margin-left: -8px; z-index: 10;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
#scene-cake .candle:before {
  content: ""; position: absolute;
  top: 0; left: 0;
  width: 12px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #ad030f, #4a0006);
}
#scene-cake .candle.out .flame { display: none; }

#scene-cake .flame {
  position: absolute;
  background: radial-gradient(ellipse at center, #fffbdf 0%, #ffdf00 40%, #ff8c00 80%, rgba(255,140,0,0) 100%);
  width: 12px; height: 28px;
  border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
  top: -34px; left: 50%; margin-left: -6px; z-index: 10;
  box-shadow: 
    0 0 10px rgba(255,200,0,0.8), 
    0 0 20px rgba(255,165,0,0.6), 
    0 -10px 40px rgba(255,100,0,0.4),
    0 0 60px rgba(255,50,0,0.3);
  transform-origin: 50% 90%;
  animation: flicker 0.1s ease-in-out alternate infinite, wave 2s ease-in-out infinite;
  mix-blend-mode: screen;
}
#scene-cake .flame.blowing {
  animation: flickerIntense 0.1s ease-in-out alternate infinite;
  filter: hue-rotate(-15deg);
}

@keyframes flicker {
  0% { transform: scaleY(1) scaleX(1) skewX(2deg); opacity: 0.9; }
  100% { transform: scaleY(1.1) scaleX(0.9) skewX(-2deg); opacity: 1; }
}
@keyframes wave {
  0%, 100% { margin-left: -6px; }
  50% { margin-left: -4px; }
}
@keyframes flickerIntense {
  0% { transform: skewX(25deg) scaleY(0.6) scaleX(1.2); opacity: 0.7; }
  100% { transform: skewX(-30deg) scaleY(0.4) scaleX(1.5); opacity: 0.4; }
}

#scene-cake .candle.out::after {
  content: ''; position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 20px;
  background: radial-gradient(circle at bottom, rgba(200,200,220,0.6), rgba(150,150,180,0.2), transparent 70%);
  border-radius: 50%;
  animation: smokeRise 2s ease-out forwards;
  pointer-events: none;
}
@keyframes smokeRise {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  50% { opacity: 0.6; transform: translateX(calc(-50% - 10px)) translateY(-20px) scale(1.5); }
  100% { opacity: 0; transform: translateX(calc(-50% + 15px)) translateY(-50px) scale(3); }
}

#scene-cake .cake-glow {
  position: absolute;
  width: 500px; height: 500px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 143, 171, 0.25) 0%, rgba(0, 255, 255, 0.1) 40%, transparent 70%);
  pointer-events: none; z-index: 0;
  animation: pulseGlow 4s ease-in-out infinite alternate;
}
@keyframes pulseGlow {
  from { opacity: 0.8; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1.2; transform: translate(-50%, -50%) scale(1.05); }
}

#scene-cake .cake-instruction {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  text-align: center; z-index: 20;
  white-space: nowrap;
}
