:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1d2130;
  --line: #2b3040;
  --ink: #e7eaf3;
  --dim: #8b93a7;
  --red: #d9534f;
  --red-soft: #3a1f22;
  --blue: #3f7fd9;
  --blue-soft: #16233a;
  --gold: #e3b341;
  --green: #57b97f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1100px 600px at 50% -15%, #1a1f2d, var(--bg));
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  flex-wrap: wrap; padding: 18px 26px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 30px; color: var(--gold); line-height: 1; }
h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.tag { margin: 2px 0 0; color: var(--dim); font-size: 12.5px; }
.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.controls label {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px;
}
select, input[type="text"] {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit;
}
button {
  background: var(--gold); color: #1a1503; border: 0; border-radius: 8px;
  padding: 9px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--dim); font-weight: 400; padding: 6px 9px; }
button.ghost:hover { color: var(--ink); }

/* ---------- score bar ---------- */
.scorebar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 26px; border-bottom: 1px solid var(--line); background: rgba(23,26,35,.6);
  flex-wrap: wrap;
}
.scorebar-players {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.player {
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  padding: 3px 8px; border-radius: 6px; transition: background 0.15s, opacity 0.15s;
  opacity: 0.7;
}
.player[hidden] { display: none !important; }
.player.active {
  color: #fff; opacity: 1;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.player.active b { text-shadow: 0 0 10px currentColor; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); }
.dot.blue { background: var(--blue); }
.dot.green { background: var(--green); }
.dot.gold { background: var(--gold); }
.hex-count {
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px;
}
.turn { color: var(--gold); font-size: 13px; letter-spacing: .4px; }
.turn-box { display: flex; align-items: center; gap: 12px; }
.btn-scorebar-end {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-scorebar-end:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
  color: #fca5a5;
}
.btn-scorebar-end[hidden] {
  display: none !important;
}

/* ---------- layout ---------- */
main {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px; padding: 22px 26px; align-items: start;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

.boardwrap { position: relative; min-height: 380px; }
#board { width: 100%; height: auto; max-height: 72vh; display: block; overflow: visible; }
.hint { text-align: center; color: var(--dim); font-size: 12.5px; margin-top: 6px; }

/* ---------- board loader & smooth progress bar ---------- */
.board-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 20;
  border-radius: 12px;
  opacity: 1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.board-loader[hidden] {
  display: none !important;
}

.board-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-inner {
  width: 75%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loader-label {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #f8fafc;
}

.loader-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.loader-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.7);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ---------- hexes ---------- */
.hex { cursor: pointer; }
.hex polygon {
  fill: #eef2f6; stroke: #9ba8ba; stroke-width: 2;
  transition: fill .16s ease, stroke .16s ease;
}
.hex.owned-0 polygon { fill: #f87171; stroke: #b91c1c; stroke-width: 3; }
.hex.owned-1 polygon { fill: #60a5fa; stroke: #1d4ed8; stroke-width: 3; }
.hex.owned-2 polygon { fill: #34d399; stroke: #047857; stroke-width: 3; }
.hex.owned-3 polygon { fill: #fbbf24; stroke: #b45309; stroke-width: 3; }
.hex.own { cursor: default; }
.hex.enemy:hover polygon { stroke: #fbbf24; stroke-width: 3.5; stroke-dasharray: 6 4; }
.hex:not(.taken):hover polygon { fill: #ffffff; stroke: var(--gold); }
.hex.selected polygon { stroke: var(--gold); stroke-width: 3.5; }
.hex.cascade-highlight polygon {
  stroke: #06b6d4 !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.85));
  transition: all 0.14s ease;
}
.crest-mono {
  font-size: 14px; font-weight: 700; text-anchor: middle; fill: #fff;
  letter-spacing: .6px; pointer-events: none;
  paint-order: stroke; stroke: rgba(0,0,0,.45); stroke-width: 2.5px;
}
.hex-label {
  fill: #0f172a; font-size: 13px; font-weight: 600; text-anchor: middle;
  pointer-events: none;
}
.hex-kind {
  fill: #475569; font-size: 8px; font-weight: 600; letter-spacing: 0.4px; text-anchor: middle;
  pointer-events: none; text-transform: uppercase;
}
.hex.taken .hex-kind {
  fill: #0f172a; font-weight: 700;
  paint-order: stroke; stroke: rgba(255, 255, 255, 0.7); stroke-width: 1.5px;
}
.hex.flash polygon { animation: flash .55s ease; }
@keyframes flash {
  0% { stroke: var(--gold); stroke-width: 5; }
  100% { stroke-width: 2; }
}

/* ---------- claim panel ---------- */
.side { display: flex; flex-direction: column; gap: 16px; }
.claim, .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.claim-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.claim-hex { font-size: 15px; font-weight: 600; }
.claim-hex small { color: var(--dim); font-weight: 400; margin-left: 6px; font-size: 11px; text-transform: uppercase; }
.typeahead { position: relative; }
.typeahead input { width: 100%; padding: 11px 12px; font-size: 15px; }
#suggestions {
  list-style: none; margin: 6px 0 0; padding: 5px; position: absolute; z-index: 20; width: 100%;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 34px rgba(0,0,0,.5); max-height: 250px; overflow: auto;
}
#suggestions[hidden] { display: none; }
#suggestions li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
#suggestions li .label { font-size: 14px; }
#suggestions li .meta {
  float: right; color: var(--dim);
  font: 11px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
#suggestions li.active { background: #2c3346; }
#suggestions li.none { color: var(--dim); cursor: default; font-size: 13px; }
.submit { width: 100%; margin-top: 10px; }
.claim-note { color: var(--dim); font-size: 12px; margin: 8px 0 0; min-height: 16px; }

.panel h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--dim); margin: 0 0 8px; font-weight: 600;
}
.panel h2 + h2, .message + h2 { margin-top: 16px; }
.message { margin: 0; font-size: 13.5px; }
.message.ok { color: var(--green); }
.message.bad { color: var(--red); }
.metrics { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 0; font-size: 12.5px; }
.metrics dt { color: var(--dim); }
.metrics dd { margin: 0; text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.metrics dd.good { color: var(--green); }
.metrics dd.bad { color: var(--red); }

/* ---------- log ---------- */
.log { padding: 4px 26px 40px; }
.log h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--dim); }
#log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#log li {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--dim);
}
#log li.ok { border-left-color: var(--green); color: var(--ink); }
#log li.bad { border-left-color: var(--red); }
#log li .who { font-weight: 600; margin-right: 8px; }
#log li .who.red { color: var(--red); }
#log li .who.blue { color: var(--blue); }
#log li .who.green { color: var(--green); }
#log li .who.gold { color: var(--gold); }

/* ---------- answers panel ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; }
button.small { padding: 5px 10px; font-size: 12px; }
.panel-note { color: var(--dim); font-size: 12px; margin: 10px 0 0; }

.toggle-answers-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toggle-answers-btn:hover {
  border-color: #06b6d4;
  color: #38bdf8;
}
.toggle-answers-btn.active {
  background: rgba(6, 182, 212, 0.2) !important;
  border-color: #06b6d4 !important;
  color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.btn-claim-toggle {
  margin-top: 8px;
  width: 100%;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-claim-toggle:hover {
  border-color: #06b6d4;
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.08);
}
.btn-claim-toggle.active {
  border-color: #06b6d4;
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.15);
}

.selected-hex-header {
  margin-top: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.selected-hex-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.selected-hex-badge {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 24px;
}
.selected-hex-name-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.selected-hex-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-hex-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dim);
}
.selected-hex-count {
  margin-left: auto;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.answers {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 44vh;
  overflow-y: auto;
}
.answers[hidden] { display: none; }
.answer-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}
.answer-card:hover {
  background: var(--panel);
  border-color: #06b6d4;
  border-left-color: #06b6d4;
  transform: translateX(2px);
}
.answer-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.answer-player-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.answer-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.answer-player-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.score-pill.jackpot {
  background: rgba(249, 115, 22, 0.18);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.45);
}
.score-pill.triple {
  background: rgba(234, 179, 8, 0.18);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.45);
}
.score-pill.combo {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
}
.score-pill.solo {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.answer-card-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.answer-gain-text {
  color: #34d399;
  font-weight: 500;
}
.answer-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.answer-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.answer-empty {
  color: var(--dim);
  font-size: 12px;
  padding: 10px;
  text-align: center;
}

/* ---------- modals & overlays ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 12, 18, 0.84);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  max-width: 440px; width: 100%; padding: 24px 28px; box-shadow: 0 20px 40px rgba(0,0,0,.6);
}
.modal-brand { text-align: center; margin-bottom: 22px; }
.modal-brand .logo { font-size: 38px; color: var(--gold); }
.modal-brand h2 { margin: 8px 0 4px; font-size: 20px; }
.mode-options { display: flex; flex-direction: column; gap: 12px; }
.mode-card {
  display: flex; align-items: center; gap: 16px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  cursor: pointer; text-align: left; transition: transform .15s, border-color .15s, background .15s;
  color: var(--ink); font-weight: normal;
}
.mode-card:hover {
  transform: translateY(-2px); border-color: var(--gold); background: #232838;
}
.mode-card.primary {
  border-color: rgba(227, 179, 65, 0.45);
}
.mode-icon { font-size: 28px; flex: 0 0 auto; }
.mode-info h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: #fff; }
.mode-info p { margin: 0; font-size: 12.5px; color: var(--dim); }

.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.room-status { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14px; color: var(--gold); }
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--gold);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.modal-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 14px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line);
}
.modal-divider span {
  padding: 0 10px;
}

.join-room-form {
  display: flex;
  flex-direction: column;
}
.join-input-group {
  display: flex;
  gap: 8px;
}
.room-code-input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}
.room-code-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(227, 179, 65, 0.25);
}
.room-code-input::placeholder {
  letter-spacing: 1.5px;
  font-size: 13px;
  color: var(--dim);
  font-weight: 500;
}
.join-input-group button.submit {
  padding: 0 22px;
  font-size: 14px;
  font-weight: 600;
}
.modal-error {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--red);
}
.modal-error[hidden] {
  display: none;
}

.code-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.code-box-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
  margin-bottom: 6px;
}
.code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--gold);
  margin-bottom: 14px;
  user-select: all;
}
.copy-code-btn {
  background: var(--gold);
  color: #12151c;
  font-weight: 600;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background 0.15s, transform 0.1s;
}
.copy-code-btn:hover {
  background: #eec455;
  transform: translateY(-1px);
}
.share-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--dim);
}
.modal-note { font-size: 12.5px; color: var(--dim); margin: 0; line-height: 1.4; }

.player .badge-role {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--line); border-radius: 4px; padding: 2px 5px; margin-left: 4px;
}

/* ---------- 4-player lobby & board size selector ---------- */
.lobby-section {
  margin-bottom: 16px;
}
.lobby-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.lobby-roster-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.size-options {
  display: flex;
  gap: 10px;
}
.size-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--dim);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.size-pill:has(input:checked) {
  border-color: var(--gold);
  color: #fff;
  background: rgba(227, 179, 65, 0.1);
  font-weight: 600;
}
.size-pill input {
  cursor: pointer;
  accent-color: var(--gold);
  margin: 0;
}
.size-pill.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.lobby-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.lobby-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--dim);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lobby-slot.connected {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  background: #232838;
}
.lobby-slot .slot-name {
  flex: 1;
  font-weight: 500;
}
.lobby-slot .slot-status {
  font-size: 11px;
  color: var(--dim);
}
.lobby-slot .slot-status.ready {
  color: var(--green);
  font-weight: 600;
}
.lobby-action {
  margin: 18px 0 14px;
}
.large-btn {
  width: 100%;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 600;
  transition: opacity 0.15s, filter 0.15s;
}
.large-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.guest-waiting-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: rgba(227, 179, 65, 0.08);
  border: 1px solid rgba(227, 179, 65, 0.25);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--gold);
}
.guest-waiting-msg[hidden] {
  display: none !important;
}

/* ---------- topbar leave & end game buttons ---------- */
.btn-leave, .btn-end-game {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-leave:hover, .btn-end-game:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
  color: #fca5a5;
}
.btn-leave[hidden], .btn-end-game[hidden] {
  display: none !important;
}

.modal-head-right {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: -10px;
}

/* ---------- match finished / game over modal ---------- */
.game-over-card {
  text-align: center;
}
.modal-badge-icon {
  font-size: 44px;
  display: inline-block;
  margin-bottom: 8px;
}
.game-over-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
}
.game-over-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.game-over-row.winner {
  font-weight: 700;
}
.game-over-name {
  flex: 1;
  text-align: left;
}
.game-over-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  color: var(--dim);
}
.game-over-row.winner .game-over-count {
  color: var(--gold);
}
.game-over-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
