:root {
  --bg: #0a0a0a;
  --fg: #eaeaea;
  --muted: #b6b6b6;
  --accent: #ffffff;
  --panel: #141414;
  --line: #222;
  --red: #e74c3c;   /* Light side */
  --black: #111;    /* Board dark square */
  --brown: #2e2e2e; /* Board light square */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #0f0f0f;
}
#hud span { margin-left: 10px; font-size: 13px; color: var(--muted); }

.layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 14px;
  max-width: 1080px; margin: 0 auto; padding: 14px 14px 80px;
}

.board-wrap { position: relative; display: grid; place-items: center; }
#board { image-rendering: pixelated; width: min(100%, 512px); height: auto; border: 1px solid var(--line); background: #000; }

.overlay, .spectator, .postgame {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: rgba(0,0,0,0.45); padding: 16px;
}
.hidden { display: none !important; }

.rail { display: grid; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 12px; border-radius: 6px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px; font-size: 13px; color: var(--muted); }
.btn { background: #1b1b1b; color: var(--fg); border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: #444; }

.chat-list { height: 220px; overflow: auto; background: #0f0f0f; border: 1px solid var(--line); padding: 8px; border-radius: 6px; font-size: 13px; }
.chat-item { margin-bottom: 6px; }
.chat-item .me { color: #8ad; }
.chat-item .sys { color: #aaa; font-style: italic; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }

.howto { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* Footer */
#nv-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #050505; border-top: 1px solid #111; color: #ddd;
  padding: 8px 12px; font-size: 12px;
}
.footer-grid { display: grid; gap: 4px 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); max-width: 1080px; margin: 0 auto; }

/* Board colors (drawn in canvas, but hover outline) */