/* ── Title ─────────────────────────────────────────────────── */
.tetris-title {
  text-align: center !important;
  color: #0f0 !important;
  font-family: 'Press Start 2P', monospace;
  font-size: 2.2rem;
  text-shadow: 0 0 12px rgba(0, 255, 0, 0.5);
  margin: 1rem auto 0 auto;
  max-width: 560px;
  width: 100%;
}

/* ── CRT Container ─────────────────────────────────────────── */
.tetris-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.5rem;
  background: #0a0a0a;
  border: 2px solid #0f0;
  border-radius: 8px;
  box-shadow:
    0 0 12px rgba(0, 255, 0, 0.15),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  font-family: 'Press Start 2P', monospace;
  color: #0f0;
  position: relative;
  overflow: hidden;
  max-width: 560px;
  margin: 1.5rem auto;
}

/* Scanline overlay */
.tetris-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 10;
}

/* Phosphor flicker */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
}
.tetris-wrapper {
  animation: flicker 4s infinite;
}

/* ── Game Canvas ───────────────────────────────────────────── */
#tetris-canvas {
  border: 1px solid #0a0;
  background: #050505;
  image-rendering: pixelated;
  display: block;
}

/* ── Side Panel ────────────────────────────────────────────── */
.tetris-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 140px;
}

.tetris-panel {
  background: #050505;
  border: 1px solid #0a0;
  padding: 0.6rem;
  text-align: center;
}

.tetris-panel h3 {
  font-size: 0.5rem;
  margin: 0 0 0.5rem 0;
  color: #0c0;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.tetris-panel .value {
  font-size: 0.7rem;
  color: #0f0;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

#next-canvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
}

/* ── Controls Info ─────────────────────────────────────────── */
.tetris-controls {
  font-size: 0.35rem;
  line-height: 1.8;
  color: #080;
  padding: 0.4rem;
}

.tetris-controls span {
  color: #0c0;
}

/* ── Overlay (Pause / Game Over) ───────────────────────────── */
.tetris-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  gap: 0.8rem;
}

.tetris-overlay.hidden {
  display: none;
}

.tetris-overlay h2 {
  font-size: 0.8rem;
  color: #0f0;
  text-shadow: 0 0 12px rgba(0, 255, 0, 0.7);
  margin: 0;
}

.tetris-overlay p {
  font-size: 0.4rem;
  color: #0a0;
  margin: 0;
}

.tetris-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  color: #0f0;
  background: transparent;
  border: 2px solid #0f0;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
  transition: background 0.15s, box-shadow 0.15s;
}

.tetris-btn:hover {
  background: rgba(0, 255, 0, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* ── Sound toggle ──────────────────────────────────────────── */
.tetris-sound-toggle {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem;
  color: #080;
  background: none;
  border: 1px solid #080;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
  z-index: 15;
}

.tetris-sound-toggle:hover {
  color: #0f0;
  border-color: #0f0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 500px) {
  .tetris-wrapper {
    flex-direction: column;
    align-items: center;
    padding: 1rem;
  }
  .tetris-side {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    min-width: unset;
  }
}
