/* RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #14141a;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

/* GAME CONTAINER */
.game-container {
  width: 100%;
  max-width: 520px;
  margin: auto;
  background: #1c1c25;
  border-radius: 28px;
  padding: 20px 18px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

/* GRID */
.grid-wrapper {
  background: #16161f;
  border-radius: 20px;
  padding: 12px;
  box-shadow: inset 0 0 0 1px #2c2c38;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  width: 100%;
}

.cell {
  aspect-ratio: 1 / 1;
  background: #222230;
  border-radius: 8px;
  transition: background 0.12s ease, transform 0.12s ease;
  will-change: transform;
}

/* COLORS */
.color-1 {
  background: linear-gradient(145deg, #c77dff, #9d4edd);
}

.color-2 {
  background: linear-gradient(145deg, #00eaff, #00bcd4);
}

.color-3 {
  background: linear-gradient(145deg, #4dabff, #1e88e5);
}

/* PIECES */
.pieces-container {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.piece {
  background: #16161f;
  border-radius: 18px;
  padding: 10px;
  width: 30%;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px #2c2c38;
  transition: transform 0.15s ease;
}

.piece.disabled {
  opacity: 0.25;
}

.piece-grid {
  display: grid;
  gap: 4px;
}

.piece-cell {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

/* GHOST PIECE */
.ghost-piece {
  position: absolute;
  pointer-events: none;
  opacity: 0.85;
  transform: translateZ(0);
  will-change: transform;
  z-index: 9999;
}

.ghost-piece .piece-cell {
  box-shadow: none !important;
}

.ghost-piece div {
  background: transparent !important;
}

/* FLOATING TEXT */
#floating-text-container {
  position: relative;
  height: 0;
}

/* GAME OVER */
.game-over {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 28px;
  padding: 16px;
}

.game-over.hidden {
  display: none;
}

.game-over-card {
  background: #1c1c25;
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  border: 1px solid #2c2c38;
}

.game-over-card h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.game-over-card p {
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.85);
}

.game-over-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.game-over-actions button,
.game-over-actions .menu-link {
  background: #7c3aed;
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.game-over-actions .menu-link {
  background: #2c2c38;
}

.floating-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  opacity: 0;
  font-size: 20px;
  animation: floatUp 1s ease forwards;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -40px); }
}

/* POP ANIMATION */
.pop {
  animation: pop 0.15s ease;
}

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

/* CLEAR ANIMATION */
.clear-anim {
  animation: clearFade 0.28s ease forwards;
}

@keyframes clearFade {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.75); }
}

/* FULL BOARD FLASH */
.full-board-flash {
  animation: flash 0.45s ease;
}

@keyframes flash {
  0% { background: rgba(255, 255, 255, 0.15); }
  100% { background: transparent; }
}

/* SCORE BUMP */
.score-bump {
  animation: pop 0.25s ease;
}
