/* =============================================
   🍬 CANDY CRUSH — Premium Stylesheet
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Core Palette */
  --bg-primary: #1a0a2e;
  --bg-secondary: #16082a;
  --bg-gradient: linear-gradient(160deg, #1a0a2e 0%, #2d1b69 30%, #1a0a2e 60%, #0f0520 100%);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text-primary: #f5f0ff;
  --text-secondary: rgba(245, 240, 255, 0.65);
  --text-muted: rgba(245, 240, 255, 0.4);

  /* Candy Colors */
  --candy-red: #ff4757;
  --candy-orange: #ffa502;
  --candy-yellow: #ffd32a;
  --candy-green: #2ed573;
  --candy-blue: #3742fa;
  --candy-purple: #a55eea;

  /* Accents */
  --accent-pink: #ff6b9d;
  --accent-gold: #ffd700;
  --accent-glow: rgba(255, 107, 157, 0.4);

  /* Dimensions */
  --header-height: 60px;
  --board-gap: 3px;
  --cell-radius: 12px;
  --modal-radius: 24px;

  /* Fonts */
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Outfit', sans-serif;

  /* Transitions */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Background Particles ---------- */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-candy-particle {
  position: absolute;
  bottom: -40px;
  animation: floatUp linear infinite;
  filter: blur(1px);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: var(--particle-opacity, 0.2);
  }
  90% {
    opacity: var(--particle-opacity, 0.2);
  }
  100% {
    transform: translateY(calc(-100vh - 60px)) rotate(360deg);
    opacity: 0;
  }
}

/* ---------- App Wrapper ---------- */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

/* ---------- Screen Management ---------- */
.screen {
  display: none;
  min-height: 100dvh;
}

.screen-active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.4s var(--ease-smooth);
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* =============================================
   START SCREEN / LEVEL MAP
   ============================================= */
.start-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Logo Section */
.logo-section {
  text-align: center;
  padding: 32px 0 24px;
}

.logo-candy-wrapper {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.logo-candy {
  font-size: 32px;
  display: inline-block;
  animation: candyBounce 2s var(--ease-bounce) infinite;
}

.logo-candy.c0 { animation-delay: 0s; }
.logo-candy.c1 { animation-delay: 0.15s; }
.logo-candy.c2 { animation-delay: 0.3s; }
.logo-candy.c3 { animation-delay: 0.45s; }

@keyframes candyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-12px) scale(1.1); }
  50% { transform: translateY(0) scale(1); }
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
}

.title-candy {
  background: linear-gradient(135deg, #ff6b9d, #ff4757, #ffa502);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.title-crush {
  display: block;
  background: linear-gradient(135deg, #a55eea, #3742fa, #2ed573);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.game-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 300;
}

/* Level Map Section */
.level-map-section {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  padding-bottom: 80px;
}

.level-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.level-map-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.total-stars-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.star-icon {
  font-size: 14px;
}

.star-max {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Level Map Grid */
.level-map {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.world-header {
  width: 100%;
  padding: 16px 0 8px;
}

.world-header h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-pink);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

.world-header h3::before,
.world-header h3::after {
  content: '— ';
  color: var(--text-muted);
}
.world-header h3::after {
  content: ' —';
}

.level-btn {
  position: relative;
  width: 58px;
  height: 68px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-display);
  transition: all 0.25s var(--ease-smooth);
  outline: none;
}

.level-btn.level-unlocked {
  background: var(--glass-strong);
  border: 1.5px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}

.level-btn.level-unlocked:hover {
  background: var(--surface-hover);
  transform: translateY(-3px) scale(1.05);
  border-color: var(--accent-pink);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.2);
}

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

.level-btn.level-current {
  background: linear-gradient(135deg, rgba(255, 107, 157, 0.2), rgba(167, 94, 234, 0.2));
  border-color: var(--accent-pink);
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.15);
  animation: levelPulse 2s ease-in-out infinite;
}

@keyframes levelPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 107, 157, 0.15); }
  50% { box-shadow: 0 0 25px rgba(255, 107, 157, 0.3); }
}

.level-btn.level-locked {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.level-num {
  font-size: 1.15rem;
  font-weight: 700;
}

.lock-icon {
  width: 14px;
  height: 14px;
  opacity: 0.4;
}

.level-stars {
  display: flex;
  gap: 1px;
  font-size: 10px;
}

.star-sm.star-earned {
  color: var(--accent-gold);
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

.star-sm.star-empty {
  color: rgba(255, 255, 255, 0.15);
}

/* Start Footer */
.start-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(transparent, var(--bg-primary));
  z-index: 10;
}

.sound-toggles {
  display: flex;
  gap: 8px;
}

/* ---------- Icon Button ---------- */
.icon-btn {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
  backdrop-filter: blur(8px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent-pink);
}

.icon-btn.toggled-off {
  opacity: 0.4;
}

.icon-btn.toggled-off::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 2px;
  background: var(--candy-red);
  transform: rotate(-45deg);
  border-radius: 2px;
}

/* ---------- Button Styles ---------- */
.btn {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 28px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b9d, #ff4757);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4);
}

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

.btn-secondary {
  background: var(--glass-strong);
  border: 1.5px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent-pink);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.btn-glow {
  animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(255, 71, 87, 0.5), 0 0 40px rgba(255, 107, 157, 0.2); }
}

/* =============================================
   GAME SCREEN
   ============================================= */
#screen-game {
  padding: 0 8px;
  align-items: center;
}

/* Game Header / HUD */
.game-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 8px;
}

.hud-bar {
  flex: 1;
  display: flex;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 8px 12px;
  backdrop-filter: blur(12px);
}

.hud-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hud-level .hud-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-score .hud-value {
  color: var(--accent-gold);
}

.hud-moves .hud-value {
  color: var(--candy-green);
}

.hud-moves.moves-warning .hud-value {
  color: var(--candy-red);
  animation: movesFlash 0.6s ease-in-out infinite alternate;
}

@keyframes movesFlash {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.7; transform: scale(1.15); }
}

/* Progress Bar */
.progress-container {
  width: 100%;
  max-width: 520px;
  padding: 4px 4px 8px;
}

.progress-track {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-pink), var(--accent-gold));
  border-radius: 10px;
  transition: width 0.5s var(--ease-smooth);
  position: relative;
  box-shadow: 0 0 12px rgba(255, 107, 157, 0.4);
}

.progress-star {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
  transition: all 0.3s;
}

.progress-star-1 { left: 33%; }
.progress-star-2 { left: 66%; }
.progress-star-3 { left: 96%; }

/* Combo Text */
.combo-text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  height: 40px;
  line-height: 40px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-pink), var(--candy-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  pointer-events: none;
}

.combo-text.combo-animate {
  animation: comboPopIn 0.8s var(--ease-bounce);
}

@keyframes comboPopIn {
  0% { opacity: 0; transform: scale(0.3) translateY(20px); }
  30% { opacity: 1; transform: scale(1.2) translateY(-5px); }
  60% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.9) translateY(-15px); }
}

/* Board Wrapper */
.board-wrapper {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* =============================================
   GAME BOARD
   ============================================= */
.game-board {
  display: grid;
  grid-template-columns: repeat(var(--board-cols, 8), 1fr);
  grid-template-rows: repeat(var(--board-rows, 8), 1fr);
  gap: var(--board-gap);
  width: 100%;
  aspect-ratio: 1;
  background: var(--glass);
  border: 1.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 6px;
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Candy Cell */
.candy-cell {
  position: relative;
  border-radius: var(--cell-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease-smooth);
  background: rgba(255, 255, 255, 0.03);
  overflow: visible;
}

.candy-cell svg {
  width: 80%;
  height: 80%;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.candy-cell .special-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.candy-cell:hover {
  transform: scale(1.08);
  z-index: 2;
}

.candy-cell:active {
  transform: scale(0.95);
}

/* Candy Type Background Glows */
.candy-type-0 { background: rgba(255, 71, 87, 0.12); }
.candy-type-1 { background: rgba(255, 165, 2, 0.12); }
.candy-type-2 { background: rgba(255, 211, 42, 0.12); }
.candy-type-3 { background: rgba(46, 213, 115, 0.12); }
.candy-type-4 { background: rgba(55, 66, 250, 0.12); }
.candy-type-5 { background: rgba(165, 94, 234, 0.12); }

/* Selected State */
.candy-selected {
  transform: scale(1.1);
  z-index: 3;
  box-shadow: 0 0 0 3px var(--accent-pink), 0 0 20px rgba(255, 107, 157, 0.4);
  border-radius: var(--cell-radius);
}

/* Special candy glow */
.candy-special {
  animation: specialGlow 1.5s ease-in-out infinite alternate;
}

.candy-striped_h,
.candy-striped_v {
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.candy-wrapped {
  box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.3);
}

.candy-color_bomb {
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.3);
  animation: colorBombPulse 1s ease-in-out infinite alternate;
}

@keyframes specialGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.2); }
}

@keyframes colorBombPulse {
  from { filter: brightness(1) hue-rotate(0deg); }
  to { filter: brightness(1.3) hue-rotate(30deg); }
}

/* =============================================
   CANDY ANIMATIONS
   ============================================= */

/* Spawn - bounce in */
.candy-spawn {
  animation: candySpawnIn 0.4s var(--ease-bounce) both;
}

@keyframes candySpawnIn {
  0% {
    opacity: 0;
    transform: scale(0) translateY(-30px);
  }
  60% {
    opacity: 1;
    transform: scale(1.1) translateY(3px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Swap animation */
.candy-swapping {
  animation: candySwap 0.25s var(--ease-smooth) forwards;
  z-index: 10;
}

@keyframes candySwap {
  0% { transform: translate(0, 0); }
  100% { transform: translate(var(--swap-x, 0), var(--swap-y, 0)); }
}

/* Pop / match animation */
.candy-pop {
  animation: candyPop 0.3s var(--ease-smooth) forwards;
  z-index: 5;
}

@keyframes candyPop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(1.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Drop / gravity fall */
.candy-drop {
  animation: candyDrop 0.35s var(--ease-bounce) both;
}

@keyframes candyDrop {
  0% {
    transform: translateY(var(--drop-distance, -100%));
  }
  100% {
    transform: translateY(0);
  }
}

/* Shake (invalid swap) */
.candy-shake {
  animation: candyShake 0.4s ease;
}

@keyframes candyShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Empty cell */
.candy-empty {
  background: rgba(255, 255, 255, 0.015) !important;
  cursor: default;
}

/* =============================================
   PARTICLE EFFECTS
   ============================================= */
.pop-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--particle-color, #fff);
  pointer-events: none;
  z-index: 20;
  animation: particleBurst 0.5s ease-out forwards;
  box-shadow: 0 0 6px var(--particle-color, #fff);
}

@keyframes particleBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform:
      translate(
        calc(cos(var(--particle-angle, 0deg)) * var(--particle-distance, 30px)),
        calc(sin(var(--particle-angle, 0deg)) * var(--particle-distance, 30px))
      )
      scale(0);
    opacity: 0;
  }
}

/* Floating score */
.floating-score {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  pointer-events: none;
  z-index: 30;
  animation: scoreFloat 0.9s ease-out forwards;
  white-space: nowrap;
}

@keyframes scoreFloat {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(0.5);
  }
  20% {
    transform: translateX(-50%) translateY(-10px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px) scale(0.8);
  }
}

/* Screen Flash */
.screen-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
  pointer-events: none;
  z-index: 100;
  animation: flashFade 0.5s ease-out forwards;
}

@keyframes flashFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 20, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-smooth);
}

.modal-overlay.modal-open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: relative;
  max-width: 380px;
  width: 90%;
  padding: 36px 32px;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s var(--ease-bounce);
}

.modal-open .modal {
  transform: scale(1) translateY(0);
}

.glass-panel {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--modal-radius);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.victory-title {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gameover-title {
  color: var(--candy-red);
}

.gameover-subtitle {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

/* Victory Stars */
.victory-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.star {
  font-size: 3rem;
  display: inline-block;
}

.star-earned {
  color: var(--accent-gold);
  animation: starEarned 0.5s var(--ease-bounce) both;
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.6));
}

.star-empty {
  color: rgba(255, 255, 255, 0.1);
}

@keyframes starEarned {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Score display in modals */
.victory-score,
.gameover-score {
  margin-bottom: 24px;
}

.victory-score .label,
.gameover-score .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.victory-score .value,
.gameover-score .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Confetti in modal */
.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--modal-radius);
}

/* Shuffle Message */
.shuffle-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--glass);
  border: 1px solid var(--candy-orange);
  border-radius: 14px;
  margin-top: 12px;
  animation: slideUp 0.3s var(--ease-smooth);
}

.shuffle-msg span {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--candy-orange);
}

.shuffle-msg .btn {
  font-size: 0.85rem;
  padding: 8px 16px;
}

.hidden {
  display: none !important;
}

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

/* =============================================
   RESPONSIVE
   ============================================= */

/* Small phones */
@media (max-width: 380px) {
  .game-board {
    padding: 4px;
    border-radius: 14px;
  }

  .candy-cell {
    border-radius: 8px;
  }

  .hud-value {
    font-size: 0.9rem;
  }

  .level-btn {
    width: 50px;
    height: 60px;
  }

  :root {
    --board-gap: 2px;
    --cell-radius: 8px;
  }
}

/* Tablets and up */
@media (min-width: 768px) {
  .start-container {
    padding: 40px 24px;
  }

  .board-wrapper {
    max-width: 480px;
  }

  .game-header {
    max-width: 480px;
  }

  .progress-container {
    max-width: 480px;
  }

  .level-btn {
    width: 65px;
    height: 75px;
  }

  .level-btn .level-num {
    font-size: 1.3rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .board-wrapper {
    max-width: 500px;
  }

  .candy-cell:hover {
    transform: scale(1.12);
  }
}

/* Prevent pull-to-refresh on mobile */
@media (pointer: coarse) {
  body {
    overscroll-behavior: none;
  }
}

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