/* Konflikt Multiplayer - palette sampled from the original game
   (play.konfliktgame.com): slate-950 page, slate-900 panels, the BLUE
   pieces #2563EB / #93C5FD, the WHITE pieces #F8FAFC, board ink #0A0A15 /
   #1A1A2E, purples #7C3AED / #4C1D95, golds #F59E0B / #FBBF24 / #FACC15,
   and purple->indigo gradient buttons. Same game, multiplayer layer on
   top. */
:root {
  --bg: #020617;          /* slate-950 */
  --panel: #0f172a;       /* slate-900 */
  --panel2: #1e293b;      /* slate-800 */
  --edge: #334155;        /* slate-700 */
  --text: #f8fafc;
  --muted: #94a3b8;       /* slate-400 */
  --blue: #2563eb;
  --blue-bright: #3b82f6;
  --blue-light: #93c5fd;
  --ink: #0a0a15;
  --ink2: #1a1a2e;
  --gold: #f59e0b;
  --gold-bright: #fbbf24;
  --yellow: #facc15;
  --purple: #9333ea;
  --indigo: #4f46e5;
  --green: #22c55e;
  --red: #e11d48;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1100px 550px at 50% -120px, #1e1b4b, var(--bg) 65%);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--edge);
  background: rgba(15, 23, 42, 0.8);
}

.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: 6px; color: var(--text); font-weight: 900; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }

/* Round board logo in the original's own colors */
.board-logo {
  position: relative; width: 54px; height: 54px; border-radius: 50%; flex: none;
  background: radial-gradient(circle, var(--ink) 0 22%, var(--ink2) 23% 68%, #111127 69% 100%);
  border: 3px solid var(--blue);
  box-shadow: 0 0 0 2px #1d4ed8, inset 0 0 12px rgba(0,0,0,.7);
}
.board-logo .pip { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-light); border: 1px solid #1d4ed8; }
.board-logo .p1 { top: 4px; left: 23px; }
.board-logo .p2 { top: 23px; right: 4px; }
.board-logo .p3 { bottom: 4px; left: 23px; }
.board-logo .p4 { top: 23px; left: 4px; }
.board-logo .pit { position: absolute; top: 50%; left: 50%; width: 13px; height: 13px; transform: translate(-50%, -50%); border-radius: 50%; background: #000; border: 2px solid #c2600a; }

nav { display: flex; gap: 8px; }
.nav-btn {
  font: inherit; cursor: pointer; background: transparent; color: var(--muted);
  border: 1px solid var(--edge); border-radius: 8px; padding: 8px 18px; letter-spacing: 1px;
}
.nav-btn:hover { color: var(--text); border-color: var(--blue-bright); }
.nav-btn.active { color: #fff; background: var(--blue); border-color: var(--blue); font-weight: bold; }

.identity { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.identity label { color: var(--muted); font-size: 14px; }
.identity input {
  font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--edge); background: #020617; color: var(--text);
}
.identity button, .mini-btn {
  font: inherit; cursor: pointer; font-weight: bold; color: #fff;
  background: linear-gradient(180deg, var(--blue-bright), var(--blue));
  border: 1px solid #1d4ed8; border-radius: 8px; padding: 8px 14px;
}
.identity button:hover, .mini-btn:hover { filter: brightness(1.1); }
.conn { font-size: 12px; color: var(--muted); }
.conn.ok { color: var(--green); }

main { max-width: 1280px; margin: 0 auto; padding: 18px 16px 50px; }
.hidden { display: none !important; }
.motto { text-align: center; color: rgba(250, 204, 21, .8); font-style: italic; font-weight: 600; margin-top: 26px; }

/* ---------- Play layout: panel left (~1/3), game right (~2/3).
   Controls first, board last (Billy, 2026-11-07): on a phone the columns
   stack in DOM order, so the lobby and the Play Solo / Play a Friend
   buttons sit on top and the game loads below them. ---------- */
.play-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .play-layout { grid-template-columns: 1fr; } }

.game-topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(15, 23, 42, .8); border: 1px solid var(--edge); border-bottom: none;
  border-radius: 12px 12px 0 0; padding: 9px 14px; font-weight: 700;
}
.game-turn { color: var(--gold-bright); font-size: 14px; }

.frame-wrap {
  position: relative; border: 1px solid var(--edge); border-radius: 0 0 12px 12px;
  overflow: hidden; background: var(--ink); min-height: 640px;
}
#game-frame { width: 100%; height: 78vh; min-height: 640px; border: 0; display: block; background: var(--bg); }

.veil {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(2, 6, 23, .45);
  display: flex; align-items: flex-start; justify-content: center;
  cursor: not-allowed;
}
.veil-text {
  margin-top: 18px; background: rgba(15, 23, 42, .92); color: var(--gold-bright);
  border: 1px solid var(--gold); border-radius: 999px; padding: 9px 20px;
  font-weight: 700; letter-spacing: .4px; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.under-note { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }
.under-note a { color: var(--blue-light); }

/* ---------- Panel ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: 12px; padding: 18px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 10px; font-size: 21px; }
.panel h3 { margin: 16px 0 8px; font-size: 15px; color: var(--blue-light); letter-spacing: .6px; text-transform: uppercase; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; line-height: 1.45; }
.hint.center { text-align: center; }

.big-btn {
  display: block; width: 100%; font: inherit; font-size: 19px; font-weight: 800;
  cursor: pointer; border-radius: 12px; padding: 15px 16px; margin-top: 10px;
  border: 1px solid transparent; color: #fff; transition: all .15s;
}
.big-btn.primary { background: linear-gradient(90deg, var(--purple), var(--indigo)); box-shadow: 0 8px 24px rgba(76, 29, 149, .45); }
.big-btn.primary:hover { filter: brightness(1.12); }
.big-btn.primary:active { transform: scale(.98); }
.big-btn.friend { background: var(--panel2); border-color: var(--gold); color: var(--gold-bright); }
.big-btn.friend:hover { background: #2b3a55; }
.big-btn.danger { background: transparent; border-color: var(--red); color: #fb7185; }
.big-btn.danger:hover { background: rgba(225, 29, 72, .12); }
.big-btn.ghost { background: transparent; border-color: var(--edge); color: var(--muted); }
.big-btn.ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Players ---------- */
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li {
  padding: 9px 10px; border-bottom: 1px solid #263248;
  display: flex; align-items: center; gap: 9px;
}
.player-list li:last-child { border-bottom: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.dot.busy { background: var(--gold); }
.pname { font-weight: 700; }
.wl { color: var(--muted); font-size: 12px; }
.status-tag { font-size: 11px; color: var(--gold-bright); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 8px; }
.you-tag { color: var(--blue-light); font-size: 12px; }
.spacer { flex: 1; }
.challenge-btn {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  border-radius: 8px; padding: 6px 12px; color: #14100b;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold)); border: 1px solid #b45309;
}
.challenge-btn:hover { filter: brightness(1.08); }
.challenge-btn:disabled { opacity: .4; cursor: default; }
.you-line { color: var(--muted); font-size: 14px; }
.you-line strong { color: var(--text); }

.outgoing-card {
  border: 1px solid var(--gold); border-radius: 10px; padding: 10px 12px; margin-top: 12px;
  background: rgba(245, 158, 11, .08); font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}

/* ---------- Challenge banner ---------- */
.challenge-banner {
  border: 2px solid var(--gold); border-radius: 12px; margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(245,158,11,.16), rgba(245,158,11,.05));
  padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 17px;
}
.challenge-banner .cb-btns { margin-left: auto; display: flex; gap: 10px; }
.cb-accept {
  font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; color: #06280f;
  background: linear-gradient(180deg, #4ade80, #16a34a); border: 1px solid #15803d;
  border-radius: 10px; padding: 10px 22px;
}
.cb-decline {
  font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; color: #fecdd3;
  background: transparent; border: 1px solid var(--red); border-radius: 10px; padding: 10px 18px;
}

/* ---------- Match room ---------- */
.versus { display: flex; align-items: stretch; gap: 10px; margin-bottom: 12px; }
.seat {
  flex: 1; text-align: center; border-radius: 10px; padding: 10px 6px;
  border: 2px solid var(--edge); background: var(--panel2);
}
.seat .seat-name { font-weight: 800; font-size: 16px; display: block; }
.seat .seat-color { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.seat.blue { border-color: var(--blue); }
.seat.blue .seat-color { color: var(--blue-light); }
.seat.white { border-color: #cbd5e1; }
.seat.white .seat-color { color: #e2e8f0; }
.seat.turn { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(245, 158, 11, .35); }
.vs { align-self: center; color: var(--muted); font-style: italic; }
.match-status {
  text-align: center; font-size: 16px; font-weight: 700; color: var(--gold-bright);
  background: rgba(15, 23, 42, .6); border: 1px solid var(--edge); border-radius: 10px;
  padding: 10px; margin-bottom: 6px; min-height: 22px;
}
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: var(--gold-bright); border: 1px solid var(--gold);
  padding: 10px 18px; border-radius: 8px; z-index: 50; max-width: 90vw; text-align: center;
}

/* v8: first-move tip + table talk (chat) */
.match-tip {
  margin-top: 10px; padding: 10px 12px; border: 1px solid var(--violet, #a855f7);
  border-radius: 10px; background: rgba(124, 58, 237, .14);
  font-size: 14px; line-height: 1.45; text-align: center;
}
.chat { margin-top: 14px; border-top: 1px solid var(--edge); padding-top: 10px; }
.chat h3 {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted); text-align: center;
}
.chat-log {
  max-height: 180px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 6px; margin-bottom: 8px; padding: 8px; border: 1px solid var(--edge);
  border-radius: 10px; background: rgba(15, 23, 42, .6);
}
.chat-msg { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.chat-msg.me { color: var(--blue-light); }
.chat-empty { font-size: 13px; color: var(--muted); text-align: center; }
.chat-row { display: flex; gap: 8px; }
.chat-row input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--edge); background: var(--panel2); color: inherit; font-size: 14px;
}
