:root {
  --bg-top: #0a1931;
  --bg-bot: #150050;
  --card-bg: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.18);
  --cell-bg: rgba(255, 255, 255, 0.06);
  --cell-border: rgba(255, 255, 255, 0.15);
  --cell-hover: rgba(0, 229, 255, 0.2);
  --primary-glow: #00f2fe;
  --bubble-glow-1: #4facfe;
  --bubble-glow-2: #00c6ff;
  --bubble-glow-3: #ff0844;
  --text-main: #f0f6fc;
  --text-muted: #94a3b8;
  --accent-gold: #ffbe0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 20%, #1a365d 0%, #0d1b2a 60%, #050a14 100%);
  color: var(--text-main);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Ambient Floating Background Bubbles */
.ambient-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ambient-bubble {
  position: absolute;
  bottom: -60px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), rgba(0, 229, 255, 0.1) 60%, rgba(0, 150, 255, 0.05) 100%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.8) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.6;
  }
  85% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) scale(1.2) rotate(360deg);
    opacity: 0;
  }
}

/* Main Container */
.game-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* Header */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 4px 15px rgba(0, 242, 254, 0.5);
  display: flex;
  align-items: center;
  gap: 2px;
}

.bubble-letter {
  display: inline-block;
  background: linear-gradient(180deg, #ffffff 0%, #38ef7d 50%, #11998e 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bubble-letter:hover {
  transform: translateY(-4px) scale(1.15);
}

.pop-text {
  margin-left: 6px;
  color: #ff3366;
  background: linear-gradient(180deg, #ff9a9e 0%, #fecfef 20%, #ff0844 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 8, 68, 0.6));
  animation: pulsePop 1.5s ease-in-out infinite alternate;
}

@keyframes pulsePop {
  0% { transform: scale(1); }
  100% { transform: scale(1.08) rotate(2deg); }
}

.header-controls {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 242, 254, 0.3);
}

.icon-btn:active {
  transform: scale(0.92);
}

.diff-badge-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0 12px;
  height: 42px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.diff-badge-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 242, 254, 0.25);
}

.diff-badge-btn:active {
  transform: scale(0.95);
}

/* Stats Bar */
.stats-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-icon {
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 6px rgba(0, 229, 255, 0.4));
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0, 229, 255, 0.4);
}

#levelCard {
  border-color: rgba(255, 190, 11, 0.35);
  background: linear-gradient(135deg, rgba(255, 190, 11, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
}

#levelCard .stat-value {
  color: #ffbe0b;
  text-shadow: 0 2px 8px rgba(255, 190, 11, 0.5);
}

#dropsCard {
  border-color: rgba(0, 229, 255, 0.3);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
}

#dropsCard.low-drops {
  border-color: rgba(255, 8, 68, 0.5);
  background: linear-gradient(135deg, rgba(255, 8, 68, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
  animation: flashRed 1s infinite alternate;
}

@keyframes flashRed {
  0% { box-shadow: 0 0 8px rgba(255, 8, 68, 0.3); }
  100% { box-shadow: 0 0 20px rgba(255, 8, 68, 0.7); }
}

#dropsCard.bonus-gain {
  animation: bonusDropGlow 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bonusDropGlow {
  0% { transform: scale(1); }
  35% { transform: scale(1.14); border-color: #ffbe0b; box-shadow: 0 0 25px rgba(255, 190, 11, 0.8), 0 0 40px rgba(0, 242, 254, 0.6); }
  100% { transform: scale(1); }
}

#comboCard.active-combo {
  border-color: rgba(255, 190, 11, 0.6);
  background: linear-gradient(135deg, rgba(255, 190, 11, 0.2) 0%, rgba(255, 255, 255, 0.08) 100%);
  animation: comboPulse 0.35s ease-out;
}

@keyframes comboPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.floating-bonus-text {
  position: absolute;
  color: #ffbe0b;
  font-size: 1.2rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 50;
  text-shadow: 0 0 12px rgba(255, 190, 11, 0.9), 0 2px 6px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  gap: 4px;
  animation: floatBonusUp 1.25s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes floatBonusUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -75%) scale(1.25);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -120%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(0.85);
  }
}

/* Arena & Grid */
.arena-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid-backdrop {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 380px;
  background: radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.12) 0%, rgba(15, 23, 42, 0.6) 100%);
  border-radius: 28px;
  padding: 16px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.grid-board {
  width: 100%;
  height: 100%;
  display: grid;
}

.grid-board.grid-3x3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
}

.grid-board.grid-4x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
}

.grid-board.grid-5x5 {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
}

/* 4x4 specific cell and bubble scaling */
.grid-board.grid-4x4 .cell {
  border-radius: 14px;
}

.grid-board.grid-4x4 .cell-bubble.level-1 {
  width: 34px;
  height: 34px;
}

.grid-board.grid-4x4 .cell-bubble.level-2 {
  width: 44px;
  height: 44px;
}

.grid-board.grid-4x4 .cell-bubble.level-3 {
  width: 54px;
  height: 54px;
}

.grid-board.grid-4x4 .bubble-count {
  font-size: 0.95rem;
}

.grid-board.grid-4x4 .cell-bubble.level-1 .bubble-count { font-size: 0.8rem; }
.grid-board.grid-4x4 .cell-bubble.level-2 .bubble-count { font-size: 0.95rem; }
.grid-board.grid-4x4 .cell-bubble.level-3 .bubble-count { font-size: 1.15rem; }

/* 5x5 specific cell and bubble scaling */
.grid-board.grid-5x5 .cell {
  border-radius: 11px;
}

.grid-board.grid-5x5 .cell-bubble.level-1 {
  width: 27px;
  height: 27px;
}

.grid-board.grid-5x5 .cell-bubble.level-2 {
  width: 35px;
  height: 35px;
}

.grid-board.grid-5x5 .cell-bubble.level-3 {
  width: 43px;
  height: 43px;
}

.grid-board.grid-5x5 .bubble-count {
  font-size: 0.82rem;
}

.grid-board.grid-5x5 .cell-bubble.level-1 .bubble-count { font-size: 0.72rem; }
.grid-board.grid-5x5 .cell-bubble.level-2 .bubble-count { font-size: 0.82rem; }
.grid-board.grid-5x5 .cell-bubble.level-3 .bubble-count { font-size: 0.95rem; }

/* Grid Cell */
.cell {
  position: relative;
  background: var(--cell-bg);
  border: 1.5px solid var(--cell-border);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: visible;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.cell::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.15), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.cell:hover {
  background: var(--cell-hover);
  border-color: rgba(0, 242, 254, 0.5);
  transform: translateY(-2px);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 242, 254, 0.25);
}

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

.cell.disabled {
  cursor: not-allowed;
}

.cell.popping {
  animation: cellPopShake 0.25s ease-out;
}

@keyframes cellPopShake {
  0% { transform: scale(1.18); filter: brightness(1.5); }
  50% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* Cell Droplets */
.cell-bubble {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Drop Level 1: Small Calm Droplet */
.cell-bubble.level-1 {
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 35% 30%, #a1ffce 0%, #4facfe 50%, #0072ff 100%);
  box-shadow: 
    inset -3px -3px 8px rgba(0, 0, 0, 0.3),
    inset 2px 2px 6px rgba(255, 255, 255, 0.8),
    0 4px 12px rgba(79, 172, 254, 0.5);
  animation: dropletBreath 3s ease-in-out infinite;
}

/* Drop Level 2: Medium Energized Droplet */
.cell-bubble.level-2 {
  width: 58px;
  height: 58px;
  background: radial-gradient(circle at 35% 30%, #fbc2eb 0%, #a6c1ee 30%, #00c6ff 70%, #0072ff 100%);
  box-shadow: 
    inset -4px -4px 10px rgba(0, 0, 0, 0.3),
    inset 3px 3px 8px rgba(255, 255, 255, 0.9),
    0 6px 18px rgba(0, 198, 255, 0.6);
  animation: dropletWobble 2s ease-in-out infinite;
}

/* Drop Level 3: Large Ready to Pop! */
.cell-bubble.level-3 {
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at 35% 30%, #ffdde1 0%, #ee9ca7 30%, #ff416c 70%, #ff4b2b 100%);
  box-shadow: 
    inset -5px -5px 12px rgba(0, 0, 0, 0.35),
    inset 4px 4px 10px rgba(255, 255, 255, 0.95),
    0 0 20px rgba(255, 65, 108, 0.8),
    0 8px 24px rgba(255, 75, 43, 0.5);
  animation: dropletDanger 0.8s ease-in-out infinite alternate;
}

/* Glossy highlight inside bubble */
.bubble-highlight {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 28%;
  height: 24%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  filter: blur(1px);
  transform: rotate(-35deg);
  pointer-events: none;
}

.bubble-highlight-sub {
  position: absolute;
  bottom: 18%;
  right: 22%;
  width: 14%;
  height: 12%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

/* Count badge on bubble */
.bubble-count {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  z-index: 2;
  pointer-events: none;
}

.level-1 .bubble-count { font-size: 0.95rem; }
.level-2 .bubble-count { font-size: 1.15rem; }
.level-3 .bubble-count { 
  font-size: 1.35rem; 
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* Bubble Animations */
@keyframes dropletBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes dropletWobble {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.06, 0.94) rotate(3deg); }
  75% { transform: scale(0.94, 1.06) rotate(-3deg); }
}

@keyframes dropletDanger {
  0% { 
    transform: scale(0.96); 
    box-shadow: 0 0 14px rgba(255, 65, 108, 0.6);
  }
  100% { 
    transform: scale(1.08); 
    box-shadow: 0 0 28px rgba(255, 65, 108, 0.95), 0 0 10px #ff4b2b;
  }
}

/* Canvas Overlay */
#fxCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 28px;
  z-index: 10;
}

/* Footer Hint */
.game-footer {
  width: 100%;
  text-align: center;
}

.hint-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hint-text strong {
  color: #00f2fe;
}

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

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 242, 254, 0.2);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: bounceModalIcon 1s ease infinite alternate;
}

@keyframes bounceModalIcon {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px) scale(1.05); }
}

.modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff, #38ef7d);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.modal-stats {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.modal-stat-row strong {
  font-size: 1.15rem;
  color: #00f2fe;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  color: #051329;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
  transition: all 0.2s ease;
}

.primary-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 242, 254, 0.6);
}

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

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

.secondary-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

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

/* Difficulty Selection Modal */
.difficulty-card {
  max-width: 400px;
  text-align: center;
}

.diff-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.diff-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  color: inherit;
}

.diff-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
}

.diff-btn:active {
  transform: scale(0.98);
}

.diff-btn.diff-easy {
  border-color: rgba(56, 239, 125, 0.4);
}
.diff-btn.diff-easy:hover {
  border-color: #38ef7d;
  box-shadow: 0 6px 20px rgba(56, 239, 125, 0.3);
}

.diff-btn.diff-medium {
  border-color: rgba(255, 190, 11, 0.4);
}
.diff-btn.diff-medium:hover {
  border-color: #ffbe0b;
  box-shadow: 0 6px 20px rgba(255, 190, 11, 0.3);
}

.diff-btn.diff-hard {
  border-color: rgba(255, 65, 108, 0.4);
}
.diff-btn.diff-hard:hover {
  border-color: #ff416c;
  box-shadow: 0 6px 20px rgba(255, 65, 108, 0.3);
}

.diff-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.diff-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.diff-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.diff-easy .diff-tag {
  color: #38ef7d;
  background: rgba(56, 239, 125, 0.15);
  border: 1px solid rgba(56, 239, 125, 0.3);
}

.diff-medium .diff-tag {
  color: #ffbe0b;
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid rgba(255, 190, 11, 0.3);
}

.diff-hard .diff-tag {
  color: #ff4b2b;
  background: rgba(255, 75, 43, 0.15);
  border: 1px solid rgba(255, 75, 43, 0.3);
}

.diff-detail {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.diff-detail strong {
  color: #fff;
}

/* Help Modal Styling */
.help-card {
  text-align: left;
  max-width: 420px;
}

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

.modal-header-row h2 {
  font-size: 1.5rem;
  color: #fff;
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.help-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.help-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: #00f2fe;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
}

/* Responsive adjustments */
@media (max-height: 680px) {
  .game-wrapper {
    gap: 10px;
    padding: 8px 16px;
  }
  .grid-backdrop {
    max-width: 320px;
    padding: 12px;
  }
  .grid-board {
    gap: 8px;
  }
  .cell-bubble.level-1 { width: 36px; height: 36px; }
  .cell-bubble.level-2 { width: 48px; height: 48px; }
  .cell-bubble.level-3 { width: 60px; height: 60px; }
}

@media (max-width: 420px) {
  .game-title {
    font-size: 1.6rem;
  }
  .diff-badge-btn {
    padding: 0 8px;
    height: 38px;
    font-size: 0.78rem;
  }
  .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }
  .header-controls {
    gap: 6px;
  }
  .stats-bar {
    gap: 5px;
  }
  .stat-card {
    padding: 6px 6px;
    border-radius: 10px;
  }
  .stat-icon {
    font-size: 1.05rem;
  }
  .stat-value {
    font-size: 1.05rem;
  }
  .stat-label {
    font-size: 0.58rem;
  }
  .grid-board.grid-4x4 {
    gap: 6px;
  }
  .grid-board.grid-4x4 .cell-bubble.level-1 { width: 28px; height: 28px; }
  .grid-board.grid-4x4 .cell-bubble.level-2 { width: 36px; height: 36px; }
  .grid-board.grid-4x4 .cell-bubble.level-3 { width: 44px; height: 44px; }
  .grid-board.grid-5x5 {
    gap: 4px;
  }
  .grid-board.grid-5x5 .cell-bubble.level-1 { width: 22px; height: 22px; }
  .grid-board.grid-5x5 .cell-bubble.level-2 { width: 28px; height: 28px; }
  .grid-board.grid-5x5 .cell-bubble.level-3 { width: 36px; height: 36px; }
  .grid-board.grid-5x5 .bubble-count { font-size: 0.72rem; }
}

@media (max-width: 380px) {
  .game-title {
    font-size: 1.35rem;
  }
  .diff-badge-btn {
    padding: 0 6px;
    font-size: 0.72rem;
  }
  .stat-card {
    padding: 6px 4px;
  }
  .stat-value {
    font-size: 0.95rem;
  }
}
