html, body {
  background: #0b0d10;
}

.game-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.game-card {
  background: var(--card, #11151b);
  border: 1px solid var(--border, #243041);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

.game-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.game-head h1 {
  margin: 0;
}

.game-head p {
  color: var(--muted, #a4b0c2);
  margin: 4px 0 0;
}

.game-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

.board-wrap {
  position: relative;
  width: 300px;
}

#board {
  display: block;
  width: 300px;
  height: 600px;
  background:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px),
    #070a0f;
  background-size: 30px 30px;
  border: 1px solid #2b3a50;
  border-radius: 14px;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.score-table th,
.score-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #243041;
}

.score-table th {
  color: #a4b0c2;
  font-weight: 600;
}

.score-table td:nth-child(1),
.score-table td:nth-child(3) {
  text-align: right;
}

.pager {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.piece-preview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.next-box,
.hold-box {
  padding: 8px;
  min-width: 0;
}

.next-box span,
.hold-box span {
  display: block;
  text-align: center;
  font-size: 12px;
}

.next-box canvas,
.hold-box canvas {
  width: 80px;
  height: 80px;
  margin: 6px auto 0;
}

.hold-box .tiny {
  text-align: center;
  margin-top: 4px;
  font-size: 11px;
}

.leaderboard {
  background: #0e1217;
  border: 1px solid #243041;
  border-radius: 14px;
  padding: 14px;
}

.leaderboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.leaderboard-head h2 {
  margin: 0;
}

.leaderboard-head a {
  font-size: 12px;
  color: #38bdf8;
  text-decoration: none;
}

.leaderboard-head a:hover {
  text-decoration: underline;
}

.leaderboard-sub {
  color: #a4b0c2;
  font-size: 11px;
  margin: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.leaderboard h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.leaderboard ol {
  margin: 0;
  padding-left: 22px;
  color: #a4b0c2;
}

.leaderboard li {
  margin: 2px 0;
  font-size: 13px;
}

.leaderboard strong {
  color: #e8eef6;
}

.today-champion {
  text-align: center;
  padding: 8px 10px;
  border: 1px solid #243041;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.06);
}

.today-champion .initials {
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
}

.today-champion .score {
  font-size: 16px;
  margin-top: 2px;
}

.today-champion .date {
  font-size: 11px;
  color: #a4b0c2;
  margin-top: 4px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(7,10,15,.72);
  border-radius: 14px;
  color: #e8eef6;
}

.overlay.hidden {
  display: none;
}

.overlay strong {
  font-size: 28px;
}

.overlay span {
  color: #a4b0c2;
  margin-top: 6px;
}

.side-panel {
  display: grid;
  gap: 8px;
}

.metric,
.next-box,
.hold-box,
.controls {
  background: #0e1217;
  border: 1px solid #243041;
  border-radius: 14px;
  padding: 10px;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric span,
.next-box span,
.hold-box {
  color: #a4b0c2;
  font-size: 13px;
}

.metric strong {
  font-size: 18px;
}

.next-box canvas,
.hold-box canvas {
  display: block;
  margin: 10px auto 0;
  background: #070a0f;
  border-radius: 10px;
}

.controls h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.controls p {
  margin: 2px 0;
  font-size: 13px;
  color: #a4b0c2;
}

.mobile-controls {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.mobile-controls button {
  background: #1d2633;
  border: 1px solid #33445c;
  color: #e8eef6;
  border-radius: 12px;
  padding: 14px 8px;
  font-weight: 800;
  font-size: 16px;
}

.mobile-controls button[data-control="start"],
.mobile-controls button[data-control="drop"] {
  grid-column: span 3;
}

@media (max-width: 760px) {
  .mobile-controls {
    display: grid;
    position: sticky;
    bottom: 8px;
    z-index: 20;
  }

  .game-shell {
    padding: 10px;
  }

  .board-wrap,
  #board {
    width: min(300px, 94vw);
  }

  #board {
    height: calc(min(300px, 94vw) * 2);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(14,18,23,.96);
  border: 1px solid #38bdf8;
  color: #e8eef6;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
  z-index: 50;
  font-weight: 700;
}

.toast.hidden {
  display: none;
}

.piece-preview-row .next-box,
.piece-preview-row .hold-box {
  background: #0e1217;
  border: 1px solid #243041;
  border-radius: 14px;
  padding: 8px;
  min-width: 0;
  box-sizing: border-box;
}

.piece-preview-row .next-box span,
.piece-preview-row .hold-box span {
  display: block;
  text-align: center;
  font-size: 12px;
  color: #a4b0c2;
}

.piece-preview-row .next-box canvas,
.piece-preview-row .hold-box canvas {
  display: block;
  width: 80px;
  height: 80px;
  margin: 6px auto 0;
  background: #070a0f;
  border-radius: 10px;
}

.piece-preview-row .hold-box .tiny {
  text-align: center;
  margin-top: 4px;
  font-size: 11px;
}

kbd {
  background: #1d2633;
  border: 1px solid #33445c;
  border-radius: 6px;
  padding: 1px 6px;
  color: #e8eef6;
}

@media (max-width: 760px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .board-wrap {
    margin: 0 auto;
  }

  .game-head {
    flex-direction: column;
  }
}
