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

body {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #fff;
  overflow: hidden;
}

h1 {
  margin-top: 18px;
  font-size: 2.2rem;
  text-shadow: 0 0 20px rgba(255, 150, 200, 0.5);
  letter-spacing: 2px;
}

.header {
  display: flex;
  gap: 40px;
  margin: 12px 0 10px;
  font-size: 1.1rem;
}

.header span {
  background: rgba(255,255,255,0.1);
  padding: 6px 18px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

#board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  touch-action: none;
  user-select: none;
}

.cell {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, opacity 0.25s;
  position: relative;
}

.cell img {
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.cell:hover { background: rgba(255,255,255,0.12); transform: scale(1.05); }
.cell.selected { background: rgba(255,200,50,0.3); transform: scale(1.12); box-shadow: 0 0 12px rgba(255,200,50,0.4); }
.cell.matched { animation: pop 0.35s ease-out forwards; }
.cell.falling { transition: transform 0.3s ease-in; }
.cell.hint { animation: hintPulse 0.8s ease-in-out infinite; }

@keyframes pop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0); opacity: 0; }
}

.firework-particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  animation: firework 0.6s ease-out forwards;
}

@keyframes firework {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); box-shadow: 0 0 16px rgba(255,255,100,0.5); }
}

.combo-text {
  position: fixed;
  font-size: 2rem;
  font-weight: bold;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 10;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.5); }
}

.moves-warning { color: #ff6b6b; }

#game-over {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

#game-over.show { display: flex; }

#game-over div {
  background: linear-gradient(135deg, #1e1e3a, #2a2a5a);
  padding: 40px 60px;
  border-radius: 20px;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.15);
}

#game-over h2 { font-size: 2rem; margin-bottom: 10px; }
#game-over p { font-size: 1.2rem; margin: 8px 0; opacity: 0.8; }

#game-over button, #hint-btn {
  margin-top: 16px;
  padding: 10px 30px;
  font-size: 1.1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #e84393, #fd79a8);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s;
}

#game-over button:hover, #hint-btn:hover { transform: scale(1.05); }

#hint-btn {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  padding: 6px 18px;
  font-size: 0.95rem;
  margin-top: 0;
}
