*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #1a1a18;
  --bg-cell:    #242421;
  --bg-rev:     #2e2e2b;
  --border:     #3a3a37;
  --text:       #d3d1c7;
  --text-muted: #888780;
  --accent:     #1D9E75;
  --flag:       #D85A30;
  --mine:       #E24B4A;
  --surface:    #2c2c2a;
  --surface2:   #383835;
  --n1: #378ADD; --n2: #639922; --n3: #E24B4A; --n4: #7F77DD;
  --n5: #D85A30; --n6: #1D9E75; --n7: #D3D1C7; --n8: #888780;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 12px;
  gap: 10px;
}

/* HUD */
#hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

.stat {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.stat span { font-size: 14px; font-weight: 600; color: var(--text); margin-left: 4px; }

button {
  font-family: inherit; font-size: 12px; padding: 6px 14px;
  border-radius: 6px; border: 0.5px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .1s, border-color .1s, transform .08s;
}
button:hover  { background: var(--surface2); border-color: var(--text-muted); }
button:active { transform: scale(0.97); }
#mode-btn.flag { border-color: var(--flag); color: var(--flag); }

/* Board */
#wrap-rel { position: relative; flex: 1; min-height: 0; }
#board-wrap {
  width: 100%; height: 100%;
  overflow: hidden; border: 0.5px solid var(--border);
  border-radius: 8px; cursor: crosshair;
  touch-action: none; user-select: none;
}
canvas { display: block; image-rendering: pixelated; }

/* Ban screen */
#ban-screen {
  display: none;
  position: absolute; inset: 0;
  background: rgba(10,10,8,0.82);
  border-radius: 8px;
  align-items: center; justify-content: center;
  z-index: 20;
  backdrop-filter: blur(3px);
}
#ban-screen.active { display: flex; }

#ban-box {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  text-align: center;
  min-width: 220px;
}
#ban-icon   { font-size: 2.5rem; margin-bottom: 0.5rem; }
#ban-title  { font-size: 16px; font-weight: 700; color: var(--mine); margin-bottom: 0.5rem; }
#ban-sub    { font-size: 12px; color: var(--text-muted); margin-bottom: 0.25rem; }
#ban-timer  { font-size: 2.5rem; font-weight: 700; letter-spacing: 0.05em; color: var(--text); margin-bottom: 0.75rem; }
#ban-note   { font-size: 11px; color: var(--text-muted); }

/* Controls hint */
#controls-hint {
  font-size: 11px; color: var(--text-muted);
  text-align: center; flex-shrink: 0; letter-spacing: 0.02em;
}

#top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background .1s, border-color .1s, transform .08s;
}

.nav-link:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
}

.nav-link:active {
  transform: scale(0.97);
}

.nav-link.active {
  border-color: var(--accent);
  color: var(--accent);
}

#solo-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#solo-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

#solo-controls input {
  width: 72px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f1efe8; --bg-cell: #e2e0d9; --bg-rev: #f5f3ee;
    --border: #ccc9c0; --text: #2c2c2a; --text-muted: #888780;
    --surface: #e8e6df; --surface2: #dddbd4;
  }
}
