/* Block Blast Game Styles */
:root {
  --bg: #0a0a14;
  --panel: #1a1a2e;
  --border: #2a2a4a;
  --text: #f0f0f5;
  --muted: #8888aa;
  --accent: #b7ff3c;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Chivo', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 16px;
}

.game-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4be3ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-display {
  text-align: right;
}

.score-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}

.best-score {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Game Grid */
#game-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  background: var(--border);
  padding: 2px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.grid-cell {
  aspect-ratio: 1;
  background: var(--panel);
  border-radius: 4px;
  transition: all 0.15s;
  cursor: pointer;
}

.grid-cell.filled {
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), inset 0 2px 0 rgba(255,255,255,0.2);
}

.grid-cell.preview-valid {
  transform: scale(0.95);
}

.grid-cell.preview-invalid {
  background: rgba(255, 100, 100, 0.3) !important;
}

.grid-cell.clearing {
  animation: clearPulse 0.3s ease;
}

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

/* Pieces Tray */
#pieces-tray {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border-radius: 12px;
  margin-bottom: 16px;
}

.piece-container {
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 70px;
}

.piece-container:hover:not(.used):not(.blocked) {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
}

.piece-container.selected {
  border-color: var(--accent);
  background: rgba(183, 255, 60, 0.1);
  transform: scale(1.05);
}

.piece-container.used {
  opacity: 0.2;
  pointer-events: none;
}

.piece-container.blocked {
  opacity: 0.4;
}

.piece-container.blocked::after {
  content: '✕';
  position: absolute;
  color: #ff6b6b;
  font-size: 1.5rem;
}

.piece {
  display: grid;
  gap: 2px;
}

.piece-block {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: transparent;
}

.piece-block.filled {
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.control-btn {
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background: rgba(255,255,255,0.05);
}

/* Combo Message */
#combo-msg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: var(--accent);
  color: var(--bg);
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 800;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

#combo-msg.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Game Over Panel */
#game-over-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 200;
}

#game-over-panel.show {
  opacity: 1;
  visibility: visible;
}

.game-over-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 320px;
}

.game-over-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
}

.game-over-stats {
  margin-bottom: 24px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--muted);
}

.stat-value {
  font-weight: 700;
}

.stat-value.highlight {
  color: var(--accent);
}

.game-over-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.game-over-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(183, 255, 60, 0.3);
}

/* Instructions */
.instructions {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: auto;
  padding: 16px 0;
}

/* Responsive */
@media (max-width: 400px) {
  .game-container { padding: 12px; }
  #game-grid { gap: 1px; padding: 1px; }
  .piece-block { width: 14px; height: 14px; }
  .piece-container { min-width: 60px; min-height: 60px; padding: 8px; }
}
