/* ===== CSS VARIABLES & THEMES ===== */
:root {
  --bg-1: #0d0221;
  --bg-2: #1a0533;
  --accent: #c084fc;
  --accent2: #f0abfc;
  --gold: #fbbf24;
  --text: #f3e8ff;
  --card-bg: rgba(255,255,255,0.07);
  --card-border: rgba(192,132,252,0.3);
  --btn-bg: linear-gradient(135deg, #a855f7, #ec4899);
  --btn-shadow: rgba(168,85,247,0.5);
  --name-color: #fbbf24;
}

body[data-theme="pink"] {
  --bg-1: #1a0010;
  --bg-2: #3d0030;
  --accent: #f472b6;
  --accent2: #fbcfe8;
  --card-border: rgba(244,114,182,0.3);
  --btn-bg: linear-gradient(135deg, #ec4899, #f43f5e);
  --btn-shadow: rgba(236,72,153,0.5);
}

body[data-theme="blue"] {
  --bg-1: #00091a;
  --bg-2: #001a3d;
  --accent: #60a5fa;
  --accent2: #bfdbfe;
  --card-border: rgba(96,165,250,0.3);
  --btn-bg: linear-gradient(135deg, #3b82f6, #06b6d4);
  --btn-shadow: rgba(59,130,246,0.5);
}

body[data-theme="gold"] {
  --bg-1: #1a1000;
  --bg-2: #3d2800;
  --accent: #fbbf24;
  --accent2: #fde68a;
  --card-border: rgba(251,191,36,0.3);
  --btn-bg: linear-gradient(135deg, #f59e0b, #ef4444);
  --btn-shadow: rgba(245,158,11,0.5);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Nunito', sans-serif;
  background: radial-gradient(ellipse at top, var(--bg-2) 0%, var(--bg-1) 70%);
  min-height: 100vh;
  color: var(--text);
  transition: background 0.5s ease;
}

/* ===== CANVAS ===== */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* ===== STARS ===== */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1); }
}

/* ===== BALLOONS ===== */
.balloons-container {
  position: fixed;
  bottom: -150px;
  left: 0; width: 100%;
  pointer-events: none;
  z-index: 1;
}

.balloon {
  position: absolute;
  font-size: 3rem;
  animation: floatUp var(--dur, 8s) ease-in infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(-5deg); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(-50vh) rotate(5deg); }
  90% { opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(-3deg); opacity: 0; }
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ===== SCREENS ===== */
.screen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.6s ease;
}

.screen.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== INPUT CARD ===== */
.input-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 0 60px rgba(168,85,247,0.15), 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
}

.cake-icon {
  font-size: 4rem;
  animation: bounce 2s ease-in-out infinite;
  display: block;
  margin-bottom: 0.5rem;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.brand-title {
  font-family: 'Pacifico', cursive;
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

.subtitle {
  color: var(--accent2);
  font-size: 0.95rem;
  margin-bottom: 1.8rem;
  opacity: 0.85;
}

/* ===== FORM ===== */
.form-group {
  margin-bottom: 1.2rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255,255,255,0.3);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192,132,252,0.2);
}

.form-group textarea { height: 90px; }

/* ===== THEME PICKER ===== */
.theme-picker {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

.theme-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: rgba(255,255,255,0.08);
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
}

.theme-btn:hover { transform: scale(1.15); }
.theme-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transform: scale(1.1);
}

/* ===== WISH BUTTON ===== */
.wish-btn {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--btn-bg);
  border: none;
  border-radius: 16px;
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 30px var(--btn-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}

.wish-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px var(--btn-shadow);
}

.wish-btn:active { transform: translateY(0); }

/* ===== WISH SCREEN ===== */
.wish-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
  padding: 2rem 1rem;
  animation: zoomIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== CANDLES ===== */
.candles-row {
  font-size: 1.8rem;
  margin-bottom: -0.5rem;
  letter-spacing: 0.2rem;
  min-height: 2.5rem;
}

.candle {
  display: inline-block;
  animation: candleFlicker 0.5s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

@keyframes candleFlicker {
  from { transform: scaleY(1) rotate(-2deg); }
  to { transform: scaleY(1.1) rotate(2deg); }
}

/* ===== BIG CAKE ===== */
.big-cake {
  font-size: 7rem;
  display: block;
  animation: cakePulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(251,191,36,0.6));
  line-height: 1;
}

@keyframes cakePulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(251,191,36,0.5)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 40px rgba(251,191,36,0.9)); }
}

.sparkle-ring {
  font-size: 1.4rem;
  letter-spacing: 0.5rem;
  margin: 0.5rem 0;
  animation: spin 8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== HAPPY BIRTHDAY TEXT ===== */
.happy-birthday-text {
  font-family: 'Pacifico', cursive;
  font-size: clamp(2rem, 8vw, 3.5rem);
  background: linear-gradient(135deg, var(--accent), var(--gold), var(--accent2));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  margin: 0.5rem 0 0.2rem;
  line-height: 1.2;
}

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

/* ===== NAME DISPLAY ===== */
.name-display {
  font-family: 'Pacifico', cursive;
  font-size: clamp(2.5rem, 10vw, 5rem);
  color: var(--name-color);
  text-shadow: 0 0 30px rgba(251,191,36,0.7), 0 0 60px rgba(251,191,36,0.4);
  margin: 0.3rem 0 1rem;
  animation: nameGlow 2s ease-in-out infinite;
  line-height: 1.1;
}

@keyframes nameGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(251,191,36,0.6), 0 0 40px rgba(251,191,36,0.3); }
  50% { text-shadow: 0 0 40px rgba(251,191,36,1), 0 0 80px rgba(251,191,36,0.6); }
}

/* ===== MESSAGE BOX ===== */
.message-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 1.2rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent2);
  line-height: 1.6;
  margin: 0 auto 1.2rem;
  max-width: 480px;
  box-shadow: 0 0 30px rgba(192,132,252,0.1);
  font-style: italic;
}

/* ===== EMOJI ROW ===== */
.emoji-row {
  font-size: 1.8rem;
  letter-spacing: 0.3rem;
  margin: 0.8rem 0 1.5rem;
  animation: emojiDance 1s ease-in-out infinite;
}

@keyframes emojiDance {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-5px); }
  75% { transform: translateY(5px); }
}

/* ===== ACTION BUTTONS ===== */
.action-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  padding: 0.8rem 1.6rem;
  border: none;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.blow-btn {
  background: var(--btn-bg);
  color: white;
  box-shadow: 0 6px 20px var(--btn-shadow);
}

.back-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1.5px solid var(--card-border);
}

.action-btn:hover { transform: translateY(-3px); }
.action-btn:active { transform: translateY(0); }

/* ===== BLOWN STATE ===== */
.candle.blown { filter: grayscale(1); animation: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .input-card { padding: 2rem 1.2rem; }
  .big-cake { font-size: 5rem; }
  .emoji-row { font-size: 1.3rem; letter-spacing: 0.15rem; }
  .action-btns { flex-direction: column; align-items: center; }
  .action-btn { width: 100%; max-width: 280px; }
}