/* ==========================================================================
   main.css - Core Design Tokens, Base Styles, Background & Layout
   ========================================================================== */

:root {
  /* Color Palette - Elegant Birthday & Romantic Twilight */
  --bg-dark: #0c0914;
  --bg-surface: rgba(23, 17, 38, 0.72);
  --bg-card: rgba(33, 25, 54, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-hover: rgba(255, 255, 255, 0.12);

  --accent-pink: #ff5e8e;
  --accent-rose: #ff758c;
  --accent-gold: #ffbe0b;
  --accent-gold-light: #ffe599;
  --accent-purple: #9b5de5;
  --accent-cyan: #00f5d4;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.72);
  --text-muted: rgba(255, 255, 255, 0.42);
  --text-active: #ffbe0b;

  --border-light: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(255, 117, 140, 0.35);

  /* Shadows */
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(255, 94, 142, 0.35);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-script: 'Caveat', cursive, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Glowing Animated Background */
.ambient-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(circle at 15% 20%, #201035 0%, #0d0917 60%, #05040a 100%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.42;
  animation: orbFloat 18s ease-in-out infinite alternate;
  pointer-events: none;
}

.orb-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--accent-rose), transparent 70%);
  top: -10%;
  right: -5%;
  animation-duration: 22s;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
  bottom: 5%;
  left: -10%;
  animation-duration: 26s;
  animation-delay: -5s;
}

.orb-3 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--accent-gold), transparent 70%);
  top: 40%;
  left: 45%;
  animation-duration: 18s;
  animation-delay: -8s;
  opacity: 0.28;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -50px) scale(1.12); }
  100% { transform: translate(-30px, 30px) scale(0.92); }
}

/* Canvas Confetti Layer */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
}

/* Container & Layout */
.app-container {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.left-col, .right-col {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .app-container {
    padding: 0.75rem 0.5rem 2.5rem;
    overflow-x: hidden;
  }
  .main-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
  }
}

/* Mobile Segmented Tab Bar */
.mobile-tab-bar {
  display: none;
  background: rgba(25, 17, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 1rem;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .mobile-tab-bar {
    display: flex;
  }
  body[data-view="lyrics"] .cake-card {
    display: none !important;
  }
  body[data-view="cake"] .right-col {
    display: none !important;
  }
}

.mobile-tab-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: clamp(0.72rem, 2.8vw, 0.86rem);
  font-weight: 700;
  padding: 0.55rem 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.mobile-tab-btn:hover {
  color: #fff;
}

.mobile-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-rose));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 94, 142, 0.4);
}

.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .glass-panel {
    padding: 1.15rem 0.85rem;
    border-radius: 20px;
  }
}

.glass-panel:hover {
  border-color: var(--border-glow);
}

/* Section Header Styles */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.section-title span.icon {
  font-size: 1.4rem;
}

/* Welcome Overlay / Autoplay Unlock Modal */
.welcome-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.welcome-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-card {
  max-width: 480px;
  width: 100%;
  background: linear-gradient(145deg, rgba(38, 22, 60, 0.95), rgba(20, 12, 35, 0.98));
  border: 1px solid rgba(255, 117, 140, 0.4);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 94, 142, 0.25);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
  from {
    transform: translateY(35px) scale(0.92);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid rgba(255, 190, 11, 0.4);
  color: var(--accent-gold);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-rose) 80%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.btn-start-party {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #ff5e8e, #ff85a2, #ffbe0b);
  color: #12091c;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.95rem 2rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(255, 94, 142, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  width: 100%;
}

.btn-start-party:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px rgba(255, 94, 142, 0.65);
}

.btn-start-party:active {
  transform: translateY(1px);
}

/* Floating Balloons Layer */
.floating-balloon {
  position: fixed;
  bottom: -100px;
  width: 50px;
  height: 65px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  pointer-events: none;
  z-index: 90;
  animation: balloonFly 12s linear forwards;
  opacity: 0.9;
}

.floating-balloon::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 23px;
  width: 2px;
  height: 16px;
  background: rgba(255, 255, 255, 0.6);
}

@keyframes balloonFly {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-55vh) translateX(30px) rotate(8deg);
  }
  100% {
    transform: translateY(-120vh) translateX(-20px) rotate(-8deg);
    opacity: 0;
  }
}
