/* ==========================================================================
   DIWALI BLAST 2026 - CINEMATIC MIDNIGHT CELEBRATION STYLESHEET
   Crafted with custom CSS3, Glassmorphism, Golden Metallic Typography,
   Flickering SVG Diyas, Hanging Toran Lanterns, and Full Mobile Responsiveness.
   ========================================================================== */

/* --- Custom Variables & Palette --- */
:root {
  --color-bg-deep: #06030c;
  --color-bg-mid: #0f0720;
  --color-bg-purple: #1b0c36;

  --color-gold-1: #fff3b0;
  --color-gold-2: #ffd700;
  --color-gold-3: #ffb703;
  --color-gold-4: #fb8500;
  --color-gold-dark: #b45309;

  --color-festive-red: #ff0055;
  --color-festive-orange: #ff7700;
  --color-festive-cyan: #00f5d4;
  --color-festive-magenta: #ff007f;
  --color-festive-green: #25d366;

  --glass-bg: rgba(15, 8, 30, 0.82);
  --glass-bg-hover: rgba(28, 14, 52, 0.92);
  --glass-border: rgba(255, 215, 0, 0.3);
  --glass-border-glow: rgba(255, 215, 0, 0.65);
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(255, 215, 0, 0.12);

  --font-serif: 'Cinzel Decorative', 'Cinzel', Georgia, 'Times New Roman', serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-sans: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --transition-fast: 0.18s ease;
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Global Reset & Base Setup --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--color-bg-deep);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Background Atmosphere */
.cosmic-atmosphere {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%, var(--color-bg-purple) 0%, var(--color-bg-mid) 48%, var(--color-bg-deep) 100%);
  background-attachment: fixed;
}

/* Cosmic Stars/Dust Shimmer */
.starfield-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 100px 150px, #ffd700, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 250px 80px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 400px 220px, #e0aaff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 550px 70px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 700px 180px, #ffd700, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 850px 290px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 950px 110px, #ffb703, rgba(0,0,0,0));
  background-size: 1000px 400px;
  opacity: 0.55;
  animation: starPulse 6s ease-in-out infinite alternate;
}

@keyframes starPulse {
  0% { opacity: 0.35; transform: scale(1); }
  100% { opacity: 0.7; transform: scale(1.02); }
}

/* Fullscreen Canvas */
#fireworks-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
}

/* Sparkler Cursor State */
body.cursor-sparkler #fireworks-canvas,
body.cursor-sparkler {
  cursor: crosshair;
}

/* Screen Shake Effect */
.screen-shake {
  animation: shakeEffect 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeEffect {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 4px, 0); }
  40%, 60% { transform: translate3d(6px, -4px, 0); }
}

/* ==========================================================================
   FESTIVE DECORATIONS: HANGING LANTERNS (KANDIL) & DIYAS
   ========================================================================== */

/* Hanging Lanterns from ceiling */
.festive-lantern {
  position: fixed;
  top: -10px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(255, 183, 3, 0.45));
  transform-origin: top center;
  animation: lanternSway 5s ease-in-out infinite alternate;
  transition: transform var(--transition-smooth);
}

.festive-lantern.lantern-left {
  left: 3.5vw;
  animation-delay: 0s;
}

.festive-lantern.lantern-right {
  right: 3.5vw;
  animation-delay: -2.5s;
}

@keyframes lanternSway {
  0% { transform: rotate(-3.5deg); }
  100% { transform: rotate(3.5deg); }
}

/* Traditional Glowing Diya (Oil Lamp) */
.diya-container {
  position: fixed;
  bottom: 25px;
  z-index: 15;
  cursor: pointer;
  transition: transform var(--transition-fast), bottom var(--transition-smooth), opacity var(--transition-fast);
}

.diya-container:hover {
  transform: scale(1.08) translateY(-4px);
}

.diya-container:active {
  transform: scale(0.95);
}

.diya-container.diya-left {
  left: 35px;
}

.diya-container.diya-right {
  right: 35px;
}

.diya-svg {
  width: 90px;
  height: 90px;
  overflow: visible;
}

/* Diya Flame Animations */
.diya-flame-core {
  transform-origin: bottom center;
  animation: flameFlicker 1.4s ease-in-out infinite alternate;
}

.diya-flame-glow {
  transform-origin: bottom center;
  animation: flameGlowPulse 1.8s ease-in-out infinite alternate;
}

@keyframes flameFlicker {
  0% { transform: scale(1) skewX(0deg); }
  25% { transform: scale(1.08, 0.96) skewX(-2.5deg); }
  50% { transform: scale(0.95, 1.05) skewX(2deg); }
  75% { transform: scale(1.05, 0.98) skewX(-1.5deg); }
  100% { transform: scale(1.02, 1.02) skewX(1deg); }
}

@keyframes flameGlowPulse {
  0% { opacity: 0.65; transform: scale(0.95); }
  50% { opacity: 0.95; transform: scale(1.15); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* ==========================================================================
   HERO / WELCOME LANDING SECTION
   ========================================================================== */
#hero-section {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at center, rgba(16, 7, 34, 0.84) 0%, rgba(6, 3, 12, 0.96) 80%);
  backdrop-filter: blur(8px);
  transition: opacity 0.75s ease, visibility 0.75s ease, transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

#hero-section.fade-out {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  pointer-events: none;
}

.hero-content {
  max-width: 760px;
  width: 100%;
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Festive Pill Badge */
.festive-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 50px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid var(--color-gold-2);
  color: var(--color-gold-1);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.25);
  animation: badgeGlow 3s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
  0% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.2); }
  100% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.5); }
}

/* Grand Glowing Heading */
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.0rem, 6.5vw, 4.6rem);
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.15;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #fff2a3 25%, #ffd700 50%, #f59e0b 75%, #ffffff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 45px rgba(245, 158, 11, 0.35);
  animation: goldShimmer 7s linear infinite;
  word-break: break-word;
}

@keyframes goldShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Subtitle */
.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.8vw, 1.6rem);
  font-style: italic;
  font-weight: 500;
  color: #ffeed0;
  letter-spacing: 0.8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 215, 0, 0.3);
  max-width: 90%;
}

/* Personalized Greeting Banner */
.personalized-hero-greeting {
  display: none;
  padding: 8px 24px;
  border-radius: 12px;
  background: rgba(255, 183, 3, 0.15);
  border: 1px dashed var(--color-gold-3);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-gold-1);
}

.personalized-hero-greeting.visible {
  display: block;
}

.golden-highlight {
  color: var(--color-gold-2);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}

/* Glassmorphism Hero Action Box */
.hero-action-box {
  margin-top: 10px;
  padding: 28px 34px;
  border-radius: 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 480px;
}

/* Name Input Field */
.input-group {
  width: 100%;
  position: relative;
  text-align: left;
}

.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gold-1);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.festive-input {
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 16px; /* Explicitly 16px to prevent iOS Safari auto-zoom on focus */
  outline: none;
  transition: all var(--transition-fast);
}

.festive-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.festive-input:focus {
  border-color: var(--color-gold-2);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.35);
}

/* Glowing Start Celebration Button */
.btn-start-celebration {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 16px 32px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd700 0%, #ff9e00 50%, #e63946 100%);
  color: #2b0c00;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 10px 25px rgba(255, 158, 0, 0.45), 0 0 20px rgba(255, 215, 0, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-start-celebration::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transition: left 0.6s ease;
}

.btn-start-celebration:hover::before {
  left: 100%;
}

.btn-start-celebration:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 35px rgba(255, 158, 0, 0.65), 0 0 35px rgba(255, 215, 0, 0.7);
}

.btn-start-celebration:active {
  transform: translateY(1px) scale(0.98);
}

.hero-hint {
  font-size: 0.85rem;
  color: rgba(255, 240, 200, 0.75);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
  text-align: center;
}

/* ==========================================================================
   FLOATING INTERACTIVE CONTROL PANEL (DOCK)
   ========================================================================== */
#control-panel {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: 960px;
  width: calc(100% - 32px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth), max-height var(--transition-smooth);
}

#control-panel.collapsed {
  transform: translateX(-50%) translateY(calc(100% - 50px));
}

#control-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(40px);
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
}

.panel-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-gold-2);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.panel-mode-tag {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid var(--color-gold-3);
  color: var(--color-gold-1);
}

.panel-toggle-btn {
  background: transparent;
  border: none;
  color: var(--color-gold-1);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--transition-fast);
}

.panel-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Primary Fireworks Action Buttons Grid (7 main buttons) */
.primary-controls-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.control-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  outline: none;
  min-height: 64px;
  touch-action: manipulation;
}

.control-btn .btn-icon {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.control-btn .btn-label {
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.control-btn .shortcut-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 0.62rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.2);
  color: var(--color-gold-1);
  font-weight: 700;
  pointer-events: none;
}

/* Control Button Hover & Active States */
.control-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-glow);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 215, 0, 0.22);
}

.control-btn:hover .btn-icon {
  transform: scale(1.18);
}

.control-btn:active,
.control-btn.button-pressed {
  transform: translateY(1px) scale(0.96);
  background: rgba(255, 215, 0, 0.25);
  border-color: var(--color-gold-2);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
}

/* Grand Finale Special Glowing Button */
.control-btn.btn-grand-finale {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 0, 85, 0.25));
  border-color: var(--color-gold-2);
}

.control-btn.btn-grand-finale:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 0, 85, 0.45));
  box-shadow: 0 6px 22px rgba(255, 0, 85, 0.4), 0 0 15px rgba(255, 215, 0, 0.5);
}

/* Active Sparkler State */
.control-btn.active-sparkler {
  background: rgba(255, 215, 0, 0.3);
  border-color: var(--color-gold-2);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.6);
  animation: sparklerPulse 1.2s infinite alternate;
}

@keyframes sparklerPulse {
  0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
  100% { box-shadow: 0 0 22px rgba(255, 215, 0, 0.85); }
}

/* Secondary Utility Action Bar */
.secondary-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}

.util-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 215, 0, 0.3);
  color: #ffffff;
}

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

.util-btn.active {
  background: rgba(255, 215, 0, 0.18);
  border-color: var(--color-gold-2);
  color: var(--color-gold-1);
}

.util-btn.btn-wishes-action {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(18, 140, 126, 0.25));
  border-color: rgba(37, 211, 102, 0.5);
  color: #90f5b4;
}

.util-btn.btn-wishes-action:hover {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.35), rgba(18, 140, 126, 0.4));
  box-shadow: 0 0 16px rgba(37, 211, 102, 0.4);
}

/* ==========================================================================
   GRAND FINALE CINEMATIC OVERLAY
   ========================================================================== */
#grand-finale-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at center, rgba(16, 7, 34, 0.88) 0%, rgba(6, 3, 12, 0.96) 75%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#grand-finale-overlay.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

.finale-card {
  max-width: 820px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 30px;
  border-radius: 32px;
  background: var(--glass-bg);
  border: 1px solid var(--color-gold-2);
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.35), var(--glass-shadow);
  animation: finaleCardPulse 4s infinite alternate;
}

@keyframes finaleCardPulse {
  0% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.25); }
  100% { box-shadow: 0 0 80px rgba(255, 215, 0, 0.55); }
}

.finale-ornament {
  width: 60px;
  height: 60px;
  color: var(--color-gold-2);
}

.finale-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 0%, #fff0a3 30%, #ffd700 60%, #ff8800 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 60px rgba(245, 158, 11, 0.4);
}

.finale-message {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.2vw, 1.85rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
  color: #fff4d6;
  max-width: 660px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.3);
}

.finale-recipient-note {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-gold-1);
}

.btn-finale-close {
  min-height: 48px;
  padding: 14px 34px;
  border-radius: 50px;
  border: 1px solid var(--color-gold-2);
  background: rgba(255, 215, 0, 0.15);
  color: var(--color-gold-1);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}

.btn-finale-close:hover {
  background: var(--color-gold-2);
  color: #06030c;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  transform: translateY(-2px);
}

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

/* ==========================================================================
   PERSONALIZED WISHES & WHATSAPP MODAL
   ========================================================================== */
#wishes-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 3, 14, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

#wishes-modal.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wishes-card {
  max-width: 580px;
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
  padding-bottom: 12px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-gold-2);
  letter-spacing: 1px;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.8rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.btn-modal-close:hover {
  color: #ffffff;
}

.wishes-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Greeting Theme Chips */
.wish-theme-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wish-theme-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wish-chip {
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 20px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #ffeed0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}

.wish-chip:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--color-gold-2);
}

.wish-chip.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 158, 0, 0.35));
  border-color: var(--color-gold-2);
  color: var(--color-gold-1);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.wishes-preview-box {
  padding: 18px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px dashed rgba(255, 215, 0, 0.4);
  font-size: 0.92rem;
  line-height: 1.6;
  color: #ffeed0;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

.wishes-actions {
  display: flex;
  gap: 12px;
}

.btn-action-primary {
  flex: 1;
  min-height: 48px;
  padding: 13px 20px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}

.btn-copy-greeting {
  background: rgba(255, 215, 0, 0.18);
  border: 1px solid var(--color-gold-2);
  color: var(--color-gold-1);
}

.btn-copy-greeting:hover {
  background: var(--color-gold-2);
  color: #06030c;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.btn-copy-greeting:active {
  transform: scale(0.97);
}

.btn-whatsapp-share {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp-share:hover {
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.55);
  transform: translateY(-2px);
}

.btn-whatsapp-share:active {
  transform: scale(0.97);
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */
#toast-container {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 20px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast-message {
  padding: 10px 22px;
  border-radius: 50px;
  background: rgba(18, 9, 36, 0.94);
  border: 1px solid var(--color-gold-2);
  color: var(--color-gold-1);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(255, 215, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(-12px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-message.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   TABLET & MOBILE RESPONSIVE OPTIMIZATIONS
   ========================================================================== */

/* Tablet & Smaller Desktops (<= 992px) */
@media (max-width: 992px) {
  .primary-controls-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .control-btn.btn-grand-finale {
    grid-column: span 2;
  }

  .diya-svg {
    width: 75px;
    height: 75px;
  }

  .diya-container.diya-left {
    left: 20px;
    bottom: 20px;
  }

  .diya-container.diya-right {
    right: 20px;
    bottom: 20px;
  }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  /* Dock layout on mobile */
  #control-panel {
    width: calc(100% - 20px);
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    padding: 12px 14px;
    border-radius: 20px;
    gap: 10px;
  }

  .panel-title {
    font-size: 0.82rem;
    letter-spacing: 1px;
  }

  .panel-mode-tag {
    font-size: 0.68rem;
    padding: 2px 8px;
  }

  /* 4 on Row 1, 3 on Row 2 with Finale spanning 2 */
  .primary-controls-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .control-btn {
    min-height: 58px;
    padding: 8px 4px;
    font-size: 0.68rem;
    border-radius: 12px;
  }

  .control-btn .btn-icon {
    font-size: 1.2rem;
  }

  .control-btn .shortcut-badge {
    display: none; /* Hide shortcut key badge on touch devices */
  }

  .control-btn.btn-grand-finale {
    grid-column: span 2;
  }

  /* Secondary controls bar: horizontal scrollable pills */
  .secondary-controls-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .secondary-controls-bar::-webkit-scrollbar {
    display: none;
  }

  .util-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    min-height: 34px;
    font-size: 0.74rem;
  }

  /* Reposition Diyas above the mobile control dock on the side edges */
  .diya-container {
    bottom: calc(175px + env(safe-area-inset-bottom, 0px));
    transform: scale(0.68);
    opacity: 0.9;
  }

  .diya-container.diya-left {
    left: -6px;
  }

  .diya-container.diya-right {
    right: -6px;
  }

  /* Tucked Hanging Lanterns on top corners */
  .festive-lantern {
    top: -20px;
    transform: scale(0.65);
  }

  .festive-lantern.lantern-left {
    left: 1vw;
  }

  .festive-lantern.lantern-right {
    right: 1vw;
  }

  /* Hero Section adjustments */
  .hero-content {
    gap: 14px;
  }

  .hero-title {
    font-size: clamp(1.9rem, 8vw, 3.2rem);
    letter-spacing: 1.5px;
  }

  .hero-subtitle {
    font-size: clamp(0.95rem, 3.8vw, 1.3rem);
  }

  .hero-action-box {
    padding: 22px 20px;
    border-radius: 20px;
    gap: 16px;
  }

  .btn-start-celebration {
    font-size: 1.02rem;
    min-height: 50px;
    padding: 14px 20px;
  }

  /* Modals */
  .wishes-card {
    padding: 22px 18px;
    border-radius: 22px;
    max-height: 85vh;
  }

  .wishes-form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .wishes-actions {
    flex-direction: column;
    gap: 8px;
  }

  .finale-card {
    padding: 28px 20px;
    border-radius: 24px;
    gap: 16px;
  }

  .finale-title {
    font-size: clamp(2.0rem, 9vw, 3.4rem);
    letter-spacing: 2px;
  }

  .finale-message {
    font-size: 1.15rem;
  }

  .btn-finale-close {
    width: 100%;
  }
}

/* Extra Small Phones (<= 380px) */
@media (max-width: 380px) {
  .primary-controls-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .control-btn.btn-grand-finale {
    grid-column: span 3;
  }

  .control-btn .btn-label {
    font-size: 0.65rem;
  }

  .control-btn {
    min-height: 52px;
    padding: 6px 2px;
  }

  .diya-container {
    transform: scale(0.55);
  }
}

/* Landscape Mode for Smartphones */
@media (max-height: 520px) and (orientation: landscape) {
  #hero-section {
    padding: 12px;
  }

  .hero-content {
    gap: 10px;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-action-box {
    padding: 14px 20px;
    gap: 10px;
  }

  #control-panel {
    bottom: 6px;
    padding: 8px 12px;
    gap: 6px;
  }

  .control-btn {
    min-height: 44px;
    padding: 4px;
  }

  .control-btn .btn-icon {
    font-size: 1.05rem;
  }

  .diya-container {
    bottom: 85px;
    transform: scale(0.5);
  }

  .festive-lantern {
    display: none;
  }
}

/* Reduced Motion Mode Support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .starfield-overlay {
    animation: none;
    opacity: 0.5;
  }

  .festive-lantern {
    animation: none;
  }

  .diya-flame-core,
  .diya-flame-glow {
    animation: none;
  }
}
