:root {
  --bg-top: #173b6d;
  --bg-mid: #5ba9e6;
  --bg-bottom: #f7d7a6;
  --panel: rgba(10, 20, 38, 0.72);
  --panel-border: rgba(255, 255, 255, 0.18);
  --text: #eff7ff;
  --muted: #c5ddf5;
  --accent: #ffd36b;
  --accent-2: #7ce0ff;
  --danger: #ff7d6b;
  --shadow: 0 18px 45px rgba(6, 14, 26, 0.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
}

a { color: #fff3c2; }
button { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topnav {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: rgba(255,255,255,0.82);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  padding: 22px 24px;
  margin-bottom: 18px;
}

.eyebrow, .mini, .label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--muted);
}

.hero h1, .side-panel h2, .board-head h2 {
  margin: 8px 0 10px;
}

.subtitle, .copy, .status, .rules {
  margin: 0;
  color: #f4fbff;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px 16px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.board-panel {
  padding: 18px;
}

.board-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.12);
  color: var(--text);
  cursor: pointer;
}

button:hover { filter: brightness(1.06); }
button.primary {
  background: linear-gradient(135deg, #ffd56e 0%, #ff9d5c 100%);
  color: #1d1f2b;
  font-weight: 700;
}

.status {
  margin: 14px 0 16px;
  min-height: 24px;
}

.playfield-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 20, 42, 0.5), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.2);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 38;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 9, 20, 0.34);
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: min(360px, 100%);
  padding: 20px;
  border-radius: 22px;
  background: rgba(8, 18, 34, 0.82);
  border: 1px solid rgba(255,255,255,0.18);
  text-align: center;
}

.overlay-card h3 {
  margin: 8px 0;
  font-size: 1.7rem;
}

.overlay-card p {
  margin: 0 0 14px;
  line-height: 1.5;
}

.side-column {
  display: grid;
  gap: 18px;
}

.side-panel {
  padding: 18px;
}

.rules {
  padding-left: 18px;
}

.rules li + li { margin-top: 10px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 16px, 1180px); padding-top: 14px; }
  .hero, .board-panel, .side-panel, .stat { border-radius: 20px; }
  .board-head { align-items: flex-start; flex-direction: column; }
  .button-row { width: 100%; }
  .button-row button { flex: 1 1 140px; }
}
