:root {
  --bg1: #0f172a;
  --bg2: #1e293b;
  --panel: #0b1224;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #1d4ed8 0%, var(--bg1) 38%, #020617 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  padding: 16px;
}

.layout {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.2fr auto 0.9fr;
  gap: 18px;
  align-items: start;
}

.left-panel,
.right-panel {
  background: #0a1328cc;
  border: 1px solid #33415599;
  border-radius: 14px;
  padding: 14px;
}

h1,
h2 {
  margin: 0 0 10px;
}

.hint {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.card {
  background: #111d3b;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.card strong {
  font-size: 20px;
}

#start-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  cursor: pointer;
}

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

.mobile-controls button {
  border: 1px solid #64748b;
  background: #0f1c3a;
  color: #fff;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 19px;
  font-weight: 700;
}

.board-wrap {
  position: relative;
}

#board {
  border: 3px solid #e2e8f0;
  border-radius: 8px;
  background: #020617;
  box-shadow: 0 10px 28px #00000066;
}

#next {
  border: 2px solid #475569;
  border-radius: 8px;
  background: #020617;
}

.overlay {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: #020617cc;
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 16px;
}

.overlay:not(.visible) {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .left-panel,
  .right-panel {
    width: min(520px, 100%);
  }

  .mobile-controls {
    display: grid;
  }
}
