:root {
  --bg: #1e1e2e;
  --panel: #2a2a3d;
  --accent: #7c9eff;
  --accent-dark: #5a78d9;
  --text: #eaeaf2;
  --muted: #9a9ab0;
  --danger: #e05c5c;
  --border: #3a3a52;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

/* ---- Auth / landing pages ---- */
.auth-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 16px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

.auth-box h1 { text-align: center; margin-bottom: 4px; }
.auth-box h2 { font-size: 18px; color: var(--muted); margin-top: 24px; }

.identity-card, .action-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

form { display: flex; flex-direction: column; gap: 8px; }
form.inline-form { flex-direction: row; }

input[type=text], input[type=password] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #14141f;
  color: var(--text);
  flex: 1;
}

label { font-size: 13px; color: var(--muted); margin-top: 6px; }

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #14141f;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); color: white; }

.alert {
  background: #4a2233;
  border: 1px solid var(--danger);
  color: #ffb3b3;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 12px;
}

.muted { color: var(--muted); font-size: 13px; }

/* ---- Game page ---- */
.game-page { padding: 16px; }

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.back-link { font-size: 13px; }
.board-code { color: var(--accent); letter-spacing: 2px; }
.me-badge { background: var(--panel); padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border); }

.game-layout {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.board-col { flex: 1 1 480px; max-width: 480px; }
.side-col { flex: 1 1 280px; min-width: 260px; }

.status-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-weight: 600;
}

.board-actions { margin-top: 12px; }

.danger-btn { background: var(--danger); color: white; }
.danger-btn:hover { background: #c94747; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.panel h3 { margin: 0 0 10px 0; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.player-slot { padding: 6px 0; }

.spectator-list, .move-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  font-size: 14px;
}
.spectator-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.move-list li { padding: 3px 0; font-family: monospace; }

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 360px;
  text-align: center;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.primary-btn { background: var(--accent); }
.secondary-btn { background: var(--border); color: var(--text); }
.countdown { font-size: 22px; font-weight: 700; color: var(--danger); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #14141f;
  border: 1px solid var(--accent);
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 1100;
}
