:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #111822;
  --panel-border: #223042;
  --text: #ecf2f8;
  --muted: #8d9aad;
  --cell: 28px;
  --board-w: calc(var(--cell) * 10);
  --board-h: calc(var(--cell) * 20);
  --gap: 16px;
  --cyan: #59d7ff;
  --yellow: #ffd84d;
  --purple: #c58cff;
  --green: #74e28a;
  --red: #ff6b6b;
  --blue: #6ea8ff;
  --orange: #ffaf5c;
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #13202d, var(--bg) 60%);
  color: var(--text);
  display: grid;
  place-items: center;
  min-width: 320px;
}

.app-shell {
  width: min(100vw - 24px, 560px);
  display: grid;
  gap: var(--gap);
  padding: 16px 0 24px;
}

.hud,
.instructions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.hud > div,
.instructions {
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(17, 24, 34, 0.9);
  backdrop-filter: blur(8px);
}

.label {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.next-piece {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}

.next-piece .cell,
.board .cell {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.board-wrap {
  position: relative;
  width: var(--board-w);
  height: var(--board-h);
  justify-self: center;
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(20, 1fr);
  gap: 1px;
  padding: 8px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.board .cell {
  background: rgba(255, 255, 255, 0.03);
}

.cell.filled {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 12, 0.72);
  border-radius: 20px;
  text-align: center;
}

.game-over h1,
.game-over p {
  margin: 0;
}

.game-over h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.instructions {
  grid-template-columns: repeat(3, 1fr);
  color: var(--muted);
}

.instructions p {
  margin: 0;
  text-align: center;
}

@media (max-width: 520px) {
  :root {
    --cell: min(7.6vw, 28px);
  }

  .hud,
  .instructions {
    grid-template-columns: 1fr 1fr;
  }

  .instructions {
    grid-template-columns: 1fr;
  }
}
