body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: white;
}

#game-container {
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

#level-info, #game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 400px;
  margin: 10px auto;
}

#game-board {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-template-rows: repeat(8, 50px);
  gap: 5px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 10px;
  border-radius: 10px;
  transition: opacity 0.5s ease-in;
}

.tile {
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 5px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.tile:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.tile.selected {
  animation: pulse 1s infinite;
  border: 2px solid white;
}

.tile.match {
  animation: match-animation 0.5s;
}

.tile.falling {
  animation: fall-animation 0.5s ease-in;
}

.special-tile {
  position: relative;
  overflow: visible !important;
}

.special-tile::before {
  content: '★';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 24px;
  text-shadow: 0 0 10px gold;
  animation: rotate 3s linear infinite;
}

.special-effect {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid gold;
  border-radius: 8px;
  animation: glow 1.5s ease-in-out infinite alternate;
}

.level-up-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  color: gold;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: levelUp 2s ease-out forwards;
  z-index: 1000;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes match-animation {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes fall-animation {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(0); }
}

@keyframes rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes glow {
  from { box-shadow: 0 0 5px gold, 0 0 10px gold, 0 0 15px gold; }
  to { box-shadow: 0 0 10px gold, 0 0 20px gold, 0 0 30px gold; }
}

@keyframes levelUp {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

button {
  padding: 10px 20px;
  border: none;
  background: linear-gradient(45deg, #FF5733, #FFD733);
  color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.combo-text {
  position: absolute;
  color: white;
  font-weight: bold;
  font-size: 24px;
  pointer-events: none;
  animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

#combo-display {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 24px;
  color: #FFD733;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}