/* ==========================================================================
   cake.css - Interactive Birthday Cake, Candle & Flame Blow Mechanics
   ========================================================================== */

.cake-card {
  margin-bottom: 2rem;
  text-align: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.cake-stage {
  padding: 2.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 220px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

/* Cake Structure */
.cake-wrapper {
  position: relative;
  width: 200px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Candles on top */
.candles-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  position: relative;
  margin-bottom: -2px;
  z-index: 5;
}

.candle {
  position: relative;
  width: 12px;
  height: 42px;
  background: repeating-linear-gradient(
    45deg,
    #ffffff,
    #ffffff 4px,
    var(--accent-pink) 4px,
    var(--accent-pink) 8px
  );
  border-radius: 4px 4px 0 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.candle-wick {
  position: absolute;
  top: -6px;
  left: 5px;
  width: 2px;
  height: 6px;
  background: #2b1f1d;
  border-radius: 1px;
}

/* Flame & Flickering Animation */
.flame {
  position: absolute;
  top: -24px;
  left: -2px;
  width: 16px;
  height: 24px;
  background: radial-gradient(ellipse at bottom, #ffffff 10%, #ffd166 40%, #ff5e8e 85%, transparent 100%);
  border-radius: 50% 50% 20% 20%;
  box-shadow: 0 0 20px #ffd166, 0 0 35px #ff5e8e;
  animation: flicker 1.2s ease-in-out infinite alternate;
  transform-origin: bottom center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.candle:nth-child(2) .flame {
  animation-duration: 0.9s;
  animation-delay: 0.2s;
}

.candle:nth-child(3) .flame {
  animation-duration: 1.4s;
  animation-delay: 0.4s;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1.5deg); }
  25% { transform: scale(1.08, 0.95) rotate(2deg); }
  50% { transform: scale(0.95, 1.05) rotate(-2deg); }
  75% { transform: scale(1.05, 0.98) rotate(1deg); }
  100% { transform: scale(1) rotate(-1deg); }
}

/* Extinguished Candle State */
.flame.blown-out {
  opacity: 0;
  transform: translateY(-8px) scale(0.3);
  box-shadow: none;
}

/* Smoke effect on blown candles */
.smoke {
  position: absolute;
  top: -20px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: rgba(220, 220, 220, 0.8);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.candle.blown .smoke {
  animation: smokeRise 1.8s ease-out forwards;
}

@keyframes smokeRise {
  0% { opacity: 0.8; transform: translateY(0) scale(1); }
  50% { opacity: 0.5; transform: translateY(-25px) scale(2.5) translateX(6px); }
  100% { opacity: 0; transform: translateY(-50px) scale(4) translateX(-8px); }
}

/* Cake Tiers */
.cake-tier-top {
  width: 140px;
  height: 48px;
  background: linear-gradient(180deg, #ffe5ec 0%, #ffb3c6 100%);
  border-radius: 12px 12px 6px 6px;
  box-shadow: inset 0 -4px 0 #fb6f92, 0 4px 10px rgba(0,0,0,0.25);
  position: relative;
  z-index: 4;
}

.frosting-drip {
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 10px;
  background: radial-gradient(circle at 10px 0, #fb6f92 10px, transparent 11px);
  background-size: 20px 20px;
}

.cake-tier-bottom {
  width: 180px;
  height: 60px;
  background: linear-gradient(180deg, #ff85a2 0%, #ff5e8e 100%);
  border-radius: 14px 14px 10px 10px;
  box-shadow: inset 0 -6px 0 #d90429, 0 8px 18px rgba(0,0,0,0.35);
  position: relative;
  z-index: 3;
}

.cake-plate {
  width: 220px;
  height: 14px;
  background: linear-gradient(180deg, #f8f9fa 0%, #ced4da 100%);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 2;
  margin-top: -4px;
}

/* Cake Interactive Buttons & Status */
.cake-controls {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.btn-blow-candle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, var(--accent-gold), #ff85a2);
  color: #1a0b2e;
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 190, 11, 0.4);
  transition: all 0.25s ease;
}

.btn-blow-candle:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 25px rgba(255, 190, 11, 0.6);
}

.btn-blow-candle:active {
  transform: translateY(1px);
}

.cake-status-msg {
  font-size: 0.92rem;
  color: var(--accent-gold-light);
  min-height: 24px;
  transition: opacity 0.3s ease;
  font-weight: 600;
}

/* Mobile Responsiveness for Cake */
@media (max-width: 480px) {
  .cake-card {
    margin-bottom: 1rem;
    padding-top: 1.5rem;
  }

  .cake-stage {
    min-height: 195px;
    padding: 2.25rem 0 0.5rem;
    overflow: visible;
  }

  .cake-wrapper {
    transform: scale(0.88);
    transform-origin: center bottom;
    margin-top: 15px;
  }

  .cake-controls {
    margin-top: 0.5rem;
    gap: 0.5rem;
  }

  .btn-blow-candle {
    font-size: 0.88rem;
    padding: 0.65rem 1.35rem;
  }

  .cake-status-msg {
    font-size: 0.82rem;
    padding: 0 0.5rem;
  }
}
