.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --accent: #a855f7;
  --text: #e8e8f0;
  --muted: #8888a0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid #1e1e2e;
  position: relative;
  z-index: 10;
}

.btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn:hover { background: rgba(255,255,255,0.12); }

.game-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

canvas {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid #1e1e2e;
  display: block;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-box {
  background: var(--surface);
  border: 1px solid #1e1e2e;
  border-radius: 10px;
  padding: 1rem;
  min-width: 110px;
  text-align: center;
}

.panel-box .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}

.panel-box .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  gap: 1rem;
}

.overlay h2 {
  font-size: 2rem;
  color: var(--accent);
}

.overlay p {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  line-height: 1.5;
}

.overlay.hidden { display: none; }

.btn-accent {
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.3);
  color: var(--accent);
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-accent:hover { background: rgba(168,85,247,0.25); }

/* Mobile controls */
.touch-controls {
  display: none;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.touch-controls .row {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid #1e1e2e;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.touch-btn:active { background: rgba(168,85,247,0.2); }

.touch-btn.wide {
  width: 120px;
  font-size: 0.85rem;
}

@media (pointer: coarse) {
  .touch-controls { display: grid; }
  .side-panel { display: none; }
}

@media (max-width: 600px) {
  .game-area { flex-direction: column; gap: 0.75rem; }
  .side-panel { flex-direction: row; gap: 0.75rem; }
  .side-panel .panel-box { min-width: 80px; padding: 0.75rem; }
}
