/* ===========================================================
   Tetris — game-specific styles only.
   Chrome, body, buttons, chips, #status and .hint come from
   shared.css. Colours use the shared CSS custom properties so
   the game tracks light / dark mode.
   =========================================================== */

/* Tighten the vertical rhythm a touch for this denser layout. */
body { gap: 14px; }

/* ---------- stat chips row ---------- */
.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- playfield + side panel ---------- */
.play-area {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Wraps the canvas so the overlay can be absolutely positioned over it. */
.well-wrap {
  position: relative;
  line-height: 0; /* kill descender gap under the canvas */
}

/* The well itself — width clamps so it always fits a phone. */
#board {
  width: clamp(180px, 46vw, 300px);
  height: auto;          /* keep the 1:2 aspect ratio (canvas is 200x400) */
  aspect-ratio: 1 / 2;
  background: var(--surface-2);
  border: 3px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px var(--shadow);
  touch-action: manipulation;
}

/* ---------- side panel ---------- */
.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.next-box {
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}
.next-box .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
  margin-bottom: 6px;
}
#next {
  width: 84px;
  height: 84px;
  background: var(--surface-2);
  border-radius: 6px;
}

/* Smaller pause button than the shared default. */
.ctrl-btn {
  padding: 10px 14px;
  font-size: 0.95rem;
}

/* ---------- game-over overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  line-height: normal;
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }
.overlay-msg {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.overlay-score {
  font-size: 1rem;
  color: var(--muted);
}

/* ---------- on-screen control pad ---------- */
.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: clamp(220px, 80vw, 320px);
}
.pad-btn {
  padding: 14px 0;
  font-size: 1.2rem;
  border-radius: 10px;
  touch-action: manipulation;
  user-select: none;
}
/* Soft-drop sits under the rotate column; hard-drop spans the row below. */
#btnSoft { grid-column: 2 / 3; }
.pad-wide { grid-column: 1 / 4; font-size: 1.05rem; }

/* ---------- narrow phones ---------- */
@media (max-width: 420px) {
  .play-area { gap: 10px; }
  #next { width: 64px; height: 64px; }
  .pad-btn { padding: 16px 0; } /* bigger touch targets */
}
