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

/* ── Global themed scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(10,18,30,0.4); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #1e3d5c; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2e5a8a; }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: #1e3d5c rgba(10,18,30,0.4); }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.site-footer {
  width: 100%;
  text-align: center;
  padding: 0.55rem 1rem 0.7rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.03em;
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
}

.footer-stats {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.footer-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf82;
  box-shadow: 0 0 5px #4caf82aa;
  animation: footerPulse 2.2s ease-in-out infinite;
}

@keyframes footerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.footer-copy {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.22);
}

.footer-dev {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.2);
}

.site-footer a {
  color: rgba(255,255,255,0.38);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: rgba(255,255,255,0.75);
}

#app {
  text-align: center;
  margin: auto 0;
  padding-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.home-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #e94560;
  margin: 0 0 0.25rem 0;
  text-shadow: 0 2px 18px rgba(233,69,96,0.35);
}

.home-title-version {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(233,69,96,0.45);
  margin-bottom: 0.55rem;
}

/* ── World / Public chat bar ─────────────────────────────────────────────── */
.world-chat-panel {
  width: 100%;
  max-width: 1280px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.world-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.world-chat-header:hover { background: rgba(255,255,255,0.055); }
.world-chat-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7ac8f0;
  text-transform: uppercase;
}
.world-chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.world-chat-hint {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
}
.wc-collapse-icon {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  transition: transform 0.2s;
  line-height: 1;
}
.world-chat-panel.wc-collapsed .wc-collapse-icon { transform: rotate(180deg); }
.world-chat-panel.wc-collapsed .world-chat-header { border-bottom-color: transparent; }

/* Name-change warning */
.name-change-warning {
  font-size: 0.73rem;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 6px;
  padding: 0.32rem 0.6rem;
  margin: 0.1rem 0 0;
  line-height: 1.4;
  animation: wcFadeIn 0.2s ease;
}
.name-change-warning.hidden { display: none; }

/* Hide world chat entirely */
.world-chat-panel.wc-hidden { display: none; }
/* Admin-level hide — overrides user preference, pill also hidden */
.world-chat-panel.wc-admin-hidden { display: none !important; }

.wc-hide-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.22);
  font-size: 0.7rem;
  padding: 0 0 0 0.45rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.wc-hide-btn:hover { color: rgba(255,100,100,0.7); }

.wc-show-pill {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: rgba(15,28,50,0.88);
  border: 1px solid rgba(80,140,220,0.3);
  border-radius: 99px;
  color: #7ab8e8;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 1rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: opacity 0.15s, transform 0.15s;
  letter-spacing: 0.03em;
}
.wc-show-pill:hover { opacity: 0.85; transform: translateX(-50%) translateY(-1px); }
.wc-show-pill.hidden { display: none; }
.world-chat-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 300px;
  transition: max-height 0.22s ease, opacity 0.18s ease;
  opacity: 1;
}
.world-chat-panel.wc-collapsed .world-chat-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Game Master sticky announcement ─────────────────────────────────────── */
.wc-announcement {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.75rem;
  background: rgba(255,180,0,0.08);
  border-bottom: 1px solid rgba(255,180,0,0.22);
  border-left: 3px solid #ffb400;
  flex-shrink: 0;
}
.wc-ann-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #ffb400;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
}
.wc-ann-text {
  font-size: 0.82rem;
  color: #ffe08a;
  flex: 1;
  word-break: break-word;
}
.wc-ann-timer {
  font-size: 0.67rem;
  color: rgba(255,180,0,0.45);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.world-chat-messages {
  list-style: none;
  height: 72px;
  overflow-y: auto;
  padding: 0.35rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
}
.world-chat-messages li {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #ccc;
  word-break: break-word;
  text-align: left;
  width: 100%;
}
.world-chat-messages li .wc-name {
  font-weight: 700;
  color: #7ac8f0;
  margin-right: 0.3em;
  cursor: pointer;
  transition: color 0.15s;
}
.world-chat-messages li .wc-name:hover { color: #c8e8ff; text-decoration: underline; }
.world-chat-messages li.wc-bot .wc-name {
  color: #a0d0a0;
}

.world-chat-input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.world-chat-input-row input {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #eee;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  outline: none;
  transition: border-color 0.15s;
}
.world-chat-input-row input:focus { border-color: rgba(122,200,240,0.4); }
.world-chat-input-row button {
  background: rgba(122,200,240,0.12);
  border: 1px solid rgba(122,200,240,0.3);
  border-radius: 6px;
  color: #7ac8f0;
  font-size: 0.9rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
}
.world-chat-input-row button:hover { background: rgba(122,200,240,0.22); }

.hidden {
  display: none !important;
}

/* Home layout: create/join | open games | leaderboard */
.home-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1280px;
}

.home-form-panel {
  flex-shrink: 0;
  width: 390px;
}

.home-right-col {
  flex: 1;
  min-width: 300px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-gamelist-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Leaderboard gets its own dedicated column */
.home-lb-col {
  flex-shrink: 0;
  width: 270px;
  display: flex;
  flex-direction: column;
}

.home-lb-col .lb-panel {
  flex: 1;
}

/* ── Sidebar leaderboard responsive overrides ────────────────────────────── */

/* Let the content area scroll instead of pushing the page down */
.home-lb-col .lb-content {
  overflow-y: auto;
  max-height: 480px;
}

/* Tighter cell padding */
.home-lb-col .lb-table { font-size: 0.75rem; }
.home-lb-col .lb-table thead th { padding: 0.2rem 0.45rem; font-size: 0.66rem; }
.home-lb-col .lb-table td       { padding: 0.2rem 0.45rem; }
.home-lb-col .lb-table th:first-child,
.home-lb-col .lb-table td:first-child { width: 20px; }

/* Narrower name cell so stat columns have space */
.home-lb-col .lb-name-cell { max-width: 82px; }

/* Stack Last Game teams vertically — no room for side-by-side at 270px */
.home-lb-col .lb-lastgame-teams { flex-direction: column; gap: 0.6rem; }
.home-lb-col .lb-lastgame-wrap  { padding: 0.3rem 0.5rem 0.5rem; }
.home-lb-col .lb-lastgame-meta  { font-size: 0.68rem; margin-bottom: 0.35rem; }

/* Last game tables: no rank col, just Player/K/D/K/D — give name more room */
.home-lb-col .lb-lastgame-team .lb-name-cell { max-width: 100px; }

/* ── Info quick-link buttons ─────────────────────────────────────────────── */
.home-info-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* ── Leaderboard panel ───────────────────────────────────────────────────── */
.lb-panel {
  padding: 0 !important;
  overflow: hidden;
}
.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem 0.45rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.lb-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffd700;
  text-transform: uppercase;
}
.lb-tabs {
  display: flex;
  gap: 0.3rem;
}
.lb-tab {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  color: #888;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lb-tab:hover         { border-color: rgba(255,215,0,0.35); color: #ccc; }
.lb-tab.lb-tab-active { border-color: rgba(255,215,0,0.5);  color: #ffd700; background: rgba(255,215,0,0.07); }

.lb-content {
  padding: 0.35rem 0;
}

/* Session table */
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.lb-table thead th {
  padding: 0.25rem 0.7rem;
  text-align: left;
  color: #666;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lb-table th:first-child,
.lb-table td:first-child { text-align: center; width: 28px; color: #555; }
.lb-table tbody tr { transition: background 0.1s; }
.lb-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.lb-table td {
  padding: 0.28rem 0.7rem;
  color: #ccc;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.lb-table td.lb-rank-1  { color: #ffd700; font-weight: 700; }
.lb-table td.lb-rank-2  { color: #c0c0c0; font-weight: 700; }
.lb-table td.lb-rank-3  { color: #cd7f32; font-weight: 700; }
.lb-name-cell { font-weight: 600; color: #ddd; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name-bot  { color: #a0d0a0; }
.lb-name-you  { color: #7ac8f0; }

.lb-empty {
  text-align: center;
  color: #444;
  font-size: 0.8rem;
  padding: 1rem 0.5rem;
}

/* Last game mini-scoreboard */
.lb-lastgame-wrap {
  padding: 0.4rem 0.7rem;
}
.lb-lastgame-meta {
  font-size: 0.72rem;
  color: #666;
  margin-bottom: 0.5rem;
  text-align: center;
}
.lb-lastgame-teams {
  display: flex;
  gap: 0.5rem;
}
.lb-lastgame-team { flex: 1; }
.lb-lastgame-team-hdr {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.4rem;
  border-radius: 4px 4px 0 0;
  margin-bottom: 0.2rem;
}
.lb-lastgame-team-hdr.lb-hdr-a { background: rgba(90,140,220,0.18); color: #8ab4f8; }
.lb-lastgame-team-hdr.lb-hdr-b { background: rgba(220,90,90,0.18);  color: #f48a8a; }
.lb-lastgame-team-hdr.lb-hdr-win::after { content: ' 🏆'; }

/* View more row */
.lb-view-more-row {
  text-align: center;
  padding: 0.4rem 0.7rem 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.lb-view-more-btn {
  background: transparent;
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 6px;
  color: #ffd700;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.04em;
}
.lb-view-more-btn:hover { background: rgba(255,215,0,0.1); border-color: rgba(255,215,0,0.55); }

/* Full leaderboard modal overrides */
.lb-modal-box {
  max-width: 560px !important;
  width: 92vw !important;
}
.lb-modal-body {
  overflow-y: auto;
  max-height: 52vh;
  margin: 0 -0.5rem;
}
.lb-modal-table { width: 100%; }
.lb-modal-table th,
.lb-modal-table td { padding: 0.32rem 0.8rem; }

/* Pagination */
.lb-modal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.75rem 0 0.1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 0.5rem;
}
.lb-page-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #ccc;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lb-page-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.lb-page-btn:disabled { opacity: 0.3; cursor: default; }
.lb-page-info { font-size: 0.78rem; color: #888; min-width: 90px; text-align: center; }

.info-btn {
  min-width: 0;
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #aac4ee;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.info-btn:hover {
  background: #1e2f55;
  border-color: #4a90d9;
  color: #fff;
}
.info-btn.info-btn-coffee {
  background: #1e1408;
  border-color: rgba(255,180,60,0.3);
  color: #f5a623;
}
.info-btn.info-btn-coffee:hover {
  background: #2b1e0a;
  border-color: #f5a623;
  color: #ffd080;
}
.info-btn.info-btn-share {
  background: #0d1e2e;
  border-color: rgba(70,170,255,0.25);
  color: #70c0f8;
}
.info-btn.info-btn-share:hover {
  background: #102840;
  border-color: #46aaff;
  color: #c0e8ff;
}
.info-btn.info-btn-report {
  background: #1e0d14;
  border-color: rgba(233,69,96,0.25);
  color: #e9788a;
}
.info-btn.info-btn-report:hover {
  background: #2d1020;
  border-color: #e94560;
  color: #ffaab5;
}
.info-btn.info-btn-settings {
  background: #111e1a;
  border-color: rgba(80,220,160,0.25);
  color: #60d0a0;
}
.info-btn.info-btn-settings:hover {
  background: #162820;
  border-color: #50dc9f;
  color: #a0f0d0;
}

/* ── Share modal social buttons ──────────────────────────────────────────── */
.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.share-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  color: #fff;
}
.share-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.share-btn-fb     { background: #1877f2; border-color: #1877f2; }
.share-btn-tw     { background: #000; border-color: #333; }
.share-btn-wa     { background: #25d366; border-color: #25d366; color: #000; }
.share-btn-tg     { background: #26a5e4; border-color: #26a5e4; }
.share-btn-reddit { background: #ff4500; border-color: #ff4500; }
.share-btn-copy   { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.2); color: #ccc; grid-column: span 2; justify-content: center; }
.share-btn-copy.copied { background: rgba(76,175,130,0.18); border-color: #4caf82; color: #4caf82; }
.share-icon { font-size: 1.05rem; line-height: 1; }
.share-hashtags {
  margin-top: 0.85rem;
  font-size: 0.72rem;
  color: #556;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ── Key Bindings settings modal ─────────────────────────────────────────── */
.settings-modal-box { max-width: 380px !important; }

.settings-note {
  font-size: 0.75rem;
  color: #556;
  margin: 0 0 1.1rem;
  line-height: 1.5;
}

.kb-table { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1rem; }

.kb-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
}
.kb-action {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c0cce8;
}
.kb-current {
  min-width: 54px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: #0f3460;
  border: 2px solid #1a4080;
  border-radius: 6px;
  padding: 0.28rem 0.5rem;
  letter-spacing: 0.06em;
  transition: border-color 0.15s, background 0.15s;
}
.kb-current.capturing {
  border-color: #50dc9f;
  background: rgba(80,220,160,0.12);
  color: #80f0c0;
  animation: kb-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes kb-pulse {
  from { border-color: #50dc9f; box-shadow: 0 0 0 0 rgba(80,220,160,0.3); }
  to   { border-color: #a0f0d0; box-shadow: 0 0 0 4px rgba(80,220,160,0); }
}
.kb-set-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: 5px;
  border: 1px solid rgba(80,220,160,0.3);
  background: rgba(80,220,160,0.08);
  color: #60d0a0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.kb-set-btn:hover { background: rgba(80,220,160,0.18); border-color: #50dc9f; }
.kb-set-btn:disabled { opacity: 0.4; cursor: default; }

.kb-capture-hint {
  font-size: 0.78rem;
  color: #80f0c0;
  text-align: center;
  margin: 0 0 0.4rem;
  animation: kb-pulse 0.7s ease-in-out infinite alternate;
}
.kb-error {
  font-size: 0.78rem;
  color: #e94560;
  text-align: center;
  margin: 0 0 0.5rem;
  min-height: 1.1em;
}
.kb-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.kb-btn-reset {
  font-size: 0.78rem;
  padding: 0.38rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #778;
  cursor: pointer;
  transition: background 0.15s;
}
.kb-btn-reset:hover { background: rgba(255,255,255,0.1); color: #aab; }
.kb-btn-save {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.38rem 1.1rem;
  border-radius: 6px;
  border: none;
  background: #50dc9f;
  color: #0a1a12;
  cursor: pointer;
  transition: background 0.15s;
}
.kb-btn-save:hover { background: #70f0b8; }

/* ── Report Issue modal ───────────────────────────────────────────────────── */
.report-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.3rem; }
.report-form label { font-size: 0.75rem; color: #8a9bc0; margin-bottom: 0.15rem; display: block; }
.report-form input[type="text"],
.report-form input[type="email"],
.report-form select,
.report-form textarea {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  color: #fff;
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.report-form input:focus,
.report-form select:focus,
.report-form textarea:focus { outline: none; border-color: rgba(74,144,217,0.6); }
.report-form textarea { resize: vertical; min-height: 90px; }
.report-form select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%23888'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; }
.report-submit-btn {
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s;
}
.report-submit-btn:hover { opacity: 0.88; }
.report-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.report-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
  font-size: 0.9rem;
  color: #8a9bc0;
}
.report-spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.report-success {
  text-align: center;
  padding: 1.5rem 0.5rem;
}
.report-success-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.report-success h3 { color: #4caf82; margin: 0 0 0.4rem; font-size: 1.05rem; }
.report-success p  { color: #8a9bc0; font-size: 0.82rem; margin: 0; }
.report-security-note {
  font-size: 0.68rem;
  color: #445;
  text-align: center;
  margin-top: 0.2rem;
}
/* honeypot */
.report-hp { display: none !important; }

/* ── Info modals ─────────────────────────────────────────────────────────── */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  backdrop-filter: blur(3px);
  padding: 1rem;
}
.info-modal.hidden { display: none; }

.info-modal-box {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 2rem 2.2rem;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
}
.info-modal-box::-webkit-scrollbar { width: 4px; }

.info-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  background: transparent;
  border: none;
  color: #666;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.info-modal-close:hover { color: #e94560; }

.info-modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 1.2rem;
  text-align: left;
}

.info-modal-body {
  color: #c0cfe8;
  font-size: 0.85rem;
  line-height: 1.65;
  text-align: left;
}
.info-modal-body p { margin: 0 0 0.55rem; text-align: left; }
.info-modal-body ul {
  margin: 0 0 0.9rem 0;
  padding: 0;
  list-style: none;
}
.info-modal-body li {
  margin-bottom: 0.45rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.info-modal-body li > kbd { flex-shrink: 0; }
.info-modal-body strong { color: #fff; }

.info-section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #4a90d9;
  margin: 1.1rem 0 0.4rem !important;
  text-align: left;
}

kbd {
  display: inline-flex;
  align-items: center;
  background: #0d1828;
  border: 1px solid rgba(255,255,255,0.2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08rem 0.48rem;
  font-family: monospace;
  font-size: 0.76rem;
  color: #e0eaff;
  white-space: nowrap;
  line-height: 1.5;
}

.mode-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.mode-card-title {
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.4rem !important;
  font-size: 0.93rem;
  text-align: left;
}

.about-dev {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}
.about-dev-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #667;
  margin: 0 0 0.2rem !important;
}
.about-dev-name {
  font-weight: 800;
  color: #fff;
  font-size: 1rem;
  margin: 0 0 0.3rem !important;
}
.about-dev-link {
  color: #4a90d9;
  font-size: 0.82rem;
  text-decoration: none;
}
.about-dev-link:hover { text-decoration: underline; }

/* Home & Lobby screens */
.lobby-screen {
  background: #16213e;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* h1 is now the standalone .home-title above the layout, not inside a card */

.home-form-panel .home-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* Create / Join sections */
.home-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.home-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  align-self: flex-start;
}

/* Two-column create grid */
.create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

/* Single-column centered variant (used when only max-per-team is shown) */
.create-grid-centered {
  grid-template-columns: 1fr;
  max-width: 180px;
  margin: 0 auto;
}

.create-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.create-field .create-label {
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.create-field .select-limit {
  width: 100%;
}

/* ── Game mode carousel ───────────────────────────────────────────────────── */
.mode-carousel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.mode-car-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  color: #ccc;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}
.mode-car-btn:hover {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}
.mode-car-btn:active { transform: scale(0.92); }
.mode-car-btn:disabled { opacity: 0.3; cursor: default; }

.mode-car-stage {
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
}

.mode-car-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  padding: 0.9rem 1rem 0.85rem;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  min-height: 88px;
  transition: border-color 0.22s, background 0.22s;
}

.mode-car-icon {
  font-size: 1.9rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px currentColor);
}

.mode-car-name {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
  line-height: 1.2;
}

.mode-car-desc {
  font-size: 0.64rem;
  color: #777;
  text-align: center;
  line-height: 1.3;
}

.mode-car-dots {
  display: flex;
  justify-content: center;
  gap: 0.42rem;
  margin-top: -0.2rem;
  margin-bottom: 0.3rem;
}

.mode-car-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transition: background 0.2s, transform 0.2s, width 0.2s;
  cursor: pointer;
}
.mode-car-dot.active {
  transform: scale(1.4);
  width: 14px;
  border-radius: 3px;
}

@keyframes carFromRight {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes carFromLeft {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: translateX(0);     }
}
.car-anim-right { animation: carFromRight 0.18s ease-out forwards; }
.car-anim-left  { animation: carFromLeft  0.18s ease-out forwards; }

.btn-create {
  width: 100%;
  margin-top: 0.1rem;
}

/* ── Social action confirm modal ─────────────────────────────────────────── */
.social-confirm-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  padding: 1rem;
}
.social-confirm-overlay.hidden { display: none; }
.social-confirm-box {
  background: linear-gradient(160deg, #0f1c30 0%, #0a1220 100%);
  border: 1.5px solid rgba(80,140,220,0.2);
  border-radius: 14px; padding: 1.4rem 1.6rem 1.2rem;
  max-width: 300px; width: 100%;
  display: flex; flex-direction: column; gap: 1rem;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
  animation: scPop 0.18s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes scPop {
  from { opacity:0; transform: scale(0.92); }
  to   { opacity:1; transform: scale(1); }
}
.social-confirm-msg {
  font-size: 0.88rem; color: #c8d8f0; text-align: center;
  margin: 0; line-height: 1.5;
}
.social-confirm-actions { display: flex; gap: 0.6rem; justify-content: center; }
.social-confirm-btn {
  padding: 0.45rem 1.1rem; border-radius: 8px; font-size: 0.82rem;
  font-weight: 700; cursor: pointer; border: 1.5px solid; transition: opacity 0.15s;
}
.social-confirm-btn:hover { opacity: 0.8; }
.social-confirm-btn-cancel { background: rgba(255,255,255,0.05); border-color: #334; color: #7a9abf; }
.social-confirm-btn-ok     { background: rgba(239,68,68,0.15);   border-color: #7a2020; color: #f87171; }

/* ── Maintenance countdown overlay ──────────────────────────────────────── */
.maint-countdown-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(8px);
  padding: 1rem;
}
.maint-countdown-overlay.hidden { display: none; }

.maint-countdown-box {
  background: linear-gradient(160deg, #120a0a 0%, #0a0808 100%);
  border: 1.5px solid rgba(239,68,68,0.3);
  border-radius: 20px; padding: 2.5rem 2rem 2rem;
  max-width: 380px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  box-shadow: 0 0 60px rgba(239,68,68,0.15);
  animation: maintPop 0.35s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes maintPop {
  from { opacity:0; transform: scale(0.88); }
  to   { opacity:1; transform: scale(1); }
}
.maint-countdown-icon { font-size: 2.4rem; }
.maint-countdown-title {
  font-size: 1.15rem; font-weight: 800; color: #f87171;
  margin: 0; text-align: center;
}
.maint-countdown-desc {
  font-size: 0.82rem; color: #9a6060; text-align: center; margin: 0; line-height: 1.5;
}
.maint-countdown-ring {
  width: 90px; height: 90px; border-radius: 50%;
  border: 4px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  display: flex; align-items: center; justify-content: center;
  margin: 0.4rem 0;
  box-shadow: 0 0 20px rgba(239,68,68,0.2);
  position: relative;
}
#maintCountdownNum {
  font-size: 2rem; font-weight: 900; color: #f87171; font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.maint-countdown-ring.urgent #maintCountdownNum { color: #ef4444; }
.maint-countdown-ring.urgent {
  border-color: rgba(239,68,68,0.7);
  animation: maintPulse 0.8s ease-in-out infinite;
}
@keyframes maintPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(239,68,68,0.3); }
  50%       { box-shadow: 0 0 28px rgba(239,68,68,0.7); }
}
.maint-countdown-sub { font-size: 0.72rem; color: #554040; text-align: center; margin: 0; }

/* ── PM Widget ───────────────────────────────────────────────────────────── */
.pm-widget {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
.pm-widget.hidden { display: none; }

.pm-toggle-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #0f2040);
  border: 1.5px solid rgba(80,140,220,0.4);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pm-toggle-btn:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,0.6); }

.pm-unread-badge {
  position: absolute; top: -2px; right: -2px;
  background: #e94560; color: #fff;
  font-size: 0.6rem; font-weight: 800;
  border-radius: 99px; padding: 1px 5px;
  min-width: 16px; text-align: center;
  border: 1.5px solid #0a1220;
}
.pm-unread-badge.hidden { display: none; }

.pm-panel {
  width: 420px;
  max-width: calc(100vw - 2rem);
  height: 360px;
  background: linear-gradient(160deg, #0e1c32 0%, #080f1e 100%);
  border: 1px solid rgba(80,140,220,0.2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
  animation: pmSlideUp 0.2s ease forwards;
}
@keyframes pmSlideUp {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

.pm-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.pm-panel-title { font-size: 0.85rem; font-weight: 700; color: #c8d8f0; }
.pm-panel-close  {
  background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 0.85rem; cursor: pointer; padding: 0 0.2rem;
  transition: color 0.15s;
}
.pm-panel-close:hover { color: #f87171; }

.pm-body {
  display: flex; flex: 1; overflow: hidden;
}

.pm-sidebar {
  width: 130px; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pm-sidebar-label {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: #334; padding: 0.45rem 0.6rem 0.2rem; flex-shrink: 0;
}
.pm-online-list { flex: 1; overflow-y: auto; padding: 0.2rem 0; }
.pm-online-item {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.6rem; cursor: pointer;
  font-size: 0.78rem; color: #8ab; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: background 0.12s;
  border-radius: 0;
}
.pm-online-item:hover { background: rgba(255,255,255,0.05); }
.pm-online-item.active { background: rgba(58,123,213,0.15); color: #c8d8f0; }
.pm-online-item.has-unread { color: #fff; font-weight: 700; }
.pm-online-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
/* offline friend dot is grey — set inline; this is just the fallback */
.pm-online-item[title$="(offline)"] { opacity: 0.6; }

.pm-blocked-item {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.76rem; color: #7a4040;
}
.pm-blocked-dot { font-size: 0.65rem; flex-shrink: 0; }
.pm-blocked-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pm-unblock-btn {
  background: none; border: 1px solid #7a2020; border-radius: 4px;
  color: #f87171; font-size: 0.6rem; padding: 1px 5px; cursor: pointer;
  flex-shrink: 0; transition: background 0.12s;
  line-height: 1.4;
}
.pm-unblock-btn:hover { background: rgba(239,68,68,0.15); }
.pm-online-name { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.pm-convo {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.pm-convo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.78rem; font-weight: 600; color: #7a9abf;
  flex-shrink: 0;
}
.pm-profile-link {
  background: none; border: none; color: #556; font-size: 0.82rem;
  cursor: pointer; padding: 0; transition: color 0.15s;
}
.pm-profile-link:hover { color: #7ac; }
.pm-profile-link.hidden { display: none; }

.pm-messages {
  flex: 1; overflow-y: auto; padding: 0.5rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.pm-empty { font-size: 0.76rem; color: #334; text-align: center; margin: auto 0; }
.pm-convo-hint { padding: 1rem 0; }

.pm-msg { display: flex; flex-direction: column; max-width: 82%; }
.pm-msg.mine { align-self: flex-end; align-items: flex-end; }
.pm-msg.theirs { align-self: flex-start; align-items: flex-start; }
.pm-bubble {
  padding: 0.38rem 0.65rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: break-word;
}
.pm-msg.mine   .pm-bubble { background: rgba(37,99,235,0.7); color: #e8f0ff; border-bottom-right-radius: 3px; }
.pm-msg.theirs .pm-bubble { background: rgba(255,255,255,0.08); color: #c8d8f0; border-bottom-left-radius: 3px; }
.pm-msg-time { font-size: 0.62rem; color: #334; margin-top: 2px; }

.pm-input-row {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.pm-input {
  flex: 1; padding: 0.42rem 0.65rem;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(80,140,220,0.2);
  border-radius: 8px; color: #fff; font-size: 0.82rem; outline: none;
  transition: border-color 0.15s;
}
.pm-input:focus { border-color: #3a7bd5; }
.pm-input::placeholder { color: rgba(255,255,255,0.25); }
.pm-input:disabled { opacity: 0.3; }
.pm-send-btn {
  padding: 0.42rem 0.7rem; background: #1e3a5f; border: 1px solid #3a7bd5;
  color: #7ac; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
  transition: background 0.15s;
}
.pm-send-btn:hover:not(:disabled) { background: #2a4f7a; }
.pm-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Player Profile Modal ─────────────────────────────────────────────────── */
.profile-modal-overlay {
  position: fixed; inset: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
  padding: 1rem;
}
.profile-modal-overlay.hidden { display: none; }

.profile-modal-box {
  background: linear-gradient(160deg, #0f1c30 0%, #0a1220 100%);
  border: 1.5px solid rgba(80,140,220,0.22);
  border-radius: 18px; padding: 2rem 1.8rem 1.6rem;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  position: relative;
  animation: profilePop 0.25s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes profilePop {
  from { opacity:0; transform:scale(0.9) translateY(12px); }
  to   { opacity:1; transform:scale(1)   translateY(0); }
}

.profile-modal-close {
  position: absolute; top: 0.8rem; right: 0.9rem;
  background: none; border: none; color: rgba(255,255,255,0.28);
  font-size: 0.9rem; cursor: pointer; transition: color 0.15s;
}
.profile-modal-close:hover { color: #f87171; }

.profile-avatar {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #0f2040);
  border: 2px solid rgba(80,140,220,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800; color: #c8d8f0;
  text-transform: uppercase;
}
.profile-name {
  font-size: 1.1rem; font-weight: 800; color: #e8f0ff; letter-spacing: -0.01em;
}
.profile-status {
  font-size: 0.78rem; font-weight: 600;
}
.profile-status.online  { color: #4ade80; }
.profile-status.offline { color: #556; }

.profile-stats {
  width: 100%; margin: 0.4rem 0 0.2rem;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.profile-stat-tile {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px; padding: 0.5rem 0.6rem; text-align: center;
}
.profile-stat-tile.wide { grid-column: 1 / -1; }
.profile-stat-num  { font-size: 1.1rem; font-weight: 800; color: #60a5fa; }
.profile-stat-lbl  { font-size: 0.62rem; color: #445; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }

.profile-actions {
  display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center;
  margin-top: 0.4rem; width: 100%;
}
.profile-btn {
  padding: 0.45rem 0.9rem; border-radius: 8px; border: 1px solid;
  font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s;
}
.profile-btn:hover { opacity: 0.8; }
.profile-btn.hidden { display: none; }
.profile-btn-msg    { background: rgba(37,99,235,0.2); border-color: #3a7bd5; color: #7ac; }
.profile-btn-friend { background: rgba(52,211,153,0.1); border-color: #2a5a4a; color: #4ade80; }
.profile-btn-block  { background: rgba(239,68,68,0.1);  border-color: #7a2020; color: #f87171; }

/* ── First-time username modal ───────────────────────────────────────────── */
.username-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 28, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 1rem;
}

.username-modal-overlay.hidden { display: none; }

.username-modal-box {
  background: linear-gradient(160deg, #0f1c30 0%, #0a1220 100%);
  border: 1.5px solid rgba(80,140,220,0.25);
  border-radius: 18px;
  padding: 2.2rem 2rem 1.8rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(60,120,200,0.08);
  animation: umPop 0.3s cubic-bezier(0.22,1,0.36,1) forwards;
}

@keyframes umPop {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.username-modal-icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.username-modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #e8f0ff;
  text-align: center;
  letter-spacing: -0.01em;
}

.username-modal-sub {
  font-size: 0.9rem;
  color: #7a9abf;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

.username-modal-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(80,140,220,0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  text-align: center;
  letter-spacing: 0.03em;
}

.username-modal-input:focus {
  border-color: #3a7bd5;
  box-shadow: 0 0 0 3px rgba(58,123,213,0.2);
}

.username-modal-input::placeholder { color: rgba(255,255,255,0.28); }

.username-modal-error {
  font-size: 0.78rem;
  color: #f87171;
  min-height: 1rem;
  text-align: center;
}

.username-modal-btn {
  width: 100%;
  padding: 0.72rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 0.2rem;
}

.username-modal-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.username-modal-btn:active:not(:disabled) { transform: translateY(0); }

.username-modal-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.username-modal-note {
  font-size: 0.72rem;
  color: #3a5a7a;
  text-align: center;
  line-height: 1.5;
  margin-top: 0.2rem;
}

/* Divider between create and join */
.home-divider-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0;
  color: #444;
  font-size: 0.8rem;
}

.home-divider-line::before,
.home-divider-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

.home-divider-line span {
  white-space: nowrap;
  color: #555;
}

/* Game list panel */
.gamelist-header-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #0f3460;
}

.gamelist-title {
  font-size: 1rem;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.gamelist-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4caf8a;
  background: rgba(76, 175, 138, 0.12);
  border: 1px solid rgba(76, 175, 138, 0.3);
  border-radius: 99px;
  padding: 0.1em 0.55em;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ── Gamelist filters ──────────────────────────────────────────────────────── */
.gamelist-filters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.gamelist-filter-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.gl-filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 3.2rem;
  flex-shrink: 0;
}

.gl-filter {
  font-size: 0.72rem;
  font-weight: 500;
  color: #778;
  background: #0d1d35;
  border: 1px solid #1a3060;
  border-radius: 99px;
  padding: 0.18em 0.7em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.gl-filter:hover {
  background: #122040;
  color: #aac;
  border-color: #2a4a80;
}

.gl-filter.gl-filter-active {
  background: #163060;
  color: #7fdbff;
  border-color: #2a6aaa;
  font-weight: 700;
}

.gamelist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  flex: 1;
  max-height: 420px;
  padding-right: 2px; /* space for scrollbar */
}

.gamelist::-webkit-scrollbar { width: 4px; }

.gamelist-empty {
  color: #555;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.gamelist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f2040;
  border: 1px solid #1a3a6a;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  gap: 0.75rem;
}

.gamelist-code {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7fdbff;
  font-family: monospace;
}

.gamelist-players {
  font-size: 0.8rem;
  color: #888;
  flex: 1;
}
.gamelist-slots {
  font-size: 0.73rem;
  color: #4caf8a;
  margin-left: 0.2em;
}

.gamelist-join {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.gamelist-join:hover {
  background: #ff6b6b;
}

.gamelist-item-ongoing {
  opacity: 0.6;
  border-color: #2a3a5a;
}

.gamelist-ongoing {
  font-size: 0.75rem;
  color: #aaa;
  background: #1a2a40;
  border: 1px solid #2a3a5a;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Game mode badge — lobby */
.lobby-mode-badge {
  font-size: 0.8rem;
  border-radius: 12px;
  padding: 0.25rem 0.85rem;
  display: inline-block;
  margin-bottom: 0.5rem;
  margin-left: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lobby-mode-normal {
  background: #1a2a3a;
  border: 1px solid #2a5a8a;
  color: #7ac8f0;
}

.lobby-mode-tdm {
  background: #2a1a1a;
  border: 1px solid #8a2a2a;
  color: #f07a7a;
}
.lobby-mode-tug {
  background: #1a2a1a;
  border: 1px solid #3a7a3a;
  color: #7af07a;
}
.lobby-mode-practice {
  background: #1e1a2a;
  border: 1px solid #6a4aaa;
  color: #c0a0f0;
}
.lobby-mode-runes {
  background: #1c0e30;
  border: 1px solid #7c3aed;
  color: #d8b4fe;
}

/* ── Map picker (create game form) ─────────────────────────────────────────── */
.map-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.map-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.55rem 0.3rem 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: #bbb;
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.3;
}
.map-tile:hover {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.map-tile-active {
  border-color: #a855f7;
  background: rgba(168,85,247,0.12);
  color: #e9d5ff;
}
.map-tile-icon { font-size: 1.3rem; line-height: 1; }
.map-tile-name { font-weight: 700; font-size: 0.75rem; color: inherit; }
.map-tile-desc { font-size: 0.62rem; opacity: 0.7; }

/* Map badge in lobby */
.lobby-map-badge {
  font-size: 0.8rem;
  border-radius: 12px;
  padding: 0.25rem 0.85rem;
  display: inline-block;
  margin-bottom: 0.5rem;
  margin-left: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.lobby-map-default  { background: #1a1a2a; border: 1px solid #444; color: #aaa; }
.lobby-map-whack-hole { background: #1a0a1a; border: 1px solid #9c3bc6; color: #d8a4fe; }
.lobby-map-chaos    { background: #0a1a2a; border: 1px solid #06b6d4; color: #67e8f9; }

/* Game mode badge — HUD */
.hud-mode-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.65rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ccc;
  white-space: nowrap;
}
.hud-mode-normal { border-color: #2a5a8a; color: #7ac8f0; background: rgba(26,42,58,0.7); }
.hud-mode-tdm    { border-color: #8a2a2a; color: #f07a7a; background: rgba(42,26,26,0.7); }
.hud-mode-tug      { border-color: #3a7a3a; color: #7af07a; background: rgba(26,42,26,0.7); }
.hud-mode-practice { border-color: #6a4aaa; color: #c0a0f0; background: rgba(30,22,42,0.7); }
.hud-mode-runes    { border-color: #7c3aed; color: #d8b4fe; background: rgba(28,14,48,0.8); }

/* Zigzag hook buff on skill button */
@keyframes zigzag-pulse {
  0%, 100% { box-shadow: 0 0 6px 2px rgba(192,132,252,0.5), inset 0 0 6px rgba(192,132,252,0.2); border-color: #c084fc; }
  50%       { box-shadow: 0 0 14px 5px rgba(192,132,252,0.8), inset 0 0 10px rgba(192,132,252,0.4); border-color: #e9d5ff; }
}
.skill-zigzag-buff {
  animation: zigzag-pulse 0.9s ease-in-out infinite !important;
}

/* ── Leave button at the bottom of the roster panel ─────────────────────── */
.roster-quit-btn {
  display: block;
  width: 100%;
  margin-top: auto;
  padding: 0.35rem 0;
  background: none;
  border: none;
  border-top: 1px solid rgba(233,69,96,0.18);
  color: rgba(233,69,96,0.45);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-radius: 0 0 6px 6px;
}
.roster-quit-btn:hover {
  color: #e94560;
  background: rgba(233,69,96,0.08);
}

/* ── Tug of War progress bar ─────────────────────────────────────────────── */
.tug-bar {
  width: 100%;
  padding: 0 0 4px;
  background: #0e1628;
  user-select: none;
}
.tug-bar-track {
  position: relative;
  height: 12px;
  display: flex;
  border-radius: 0;
  overflow: hidden;
}
.tug-bar-blue {
  background: linear-gradient(to right, #2255bb, #3a7bd5);
  height: 100%;
  transition: width 0.35s ease;
}
.tug-bar-red {
  background: linear-gradient(to left, #aa2222, #e05050);
  height: 100%;
  flex: 1;
  transition: width 0.35s ease;
}
.tug-bar-divider {
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
  transition: left 0.35s ease;
  pointer-events: none;
}
.tug-bar-labels {
  display: flex;
  justify-content: space-between;
  padding: 2px 6px 0;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.tug-label-a { color: #5a9fef; }
.tug-label-b { color: #ef7a7a; }

/* ── Quit confirmation modal ─────────────────────────────────────────────── */
.quit-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.quit-modal-box {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 1.8rem 2.2rem;
  text-align: center;
  min-width: 240px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.quit-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.4rem;
}
.quit-modal-sub {
  font-size: 0.8rem;
  color: #888;
  margin: 0 0 1.2rem;
}
.quit-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.quit-btn-yes {
  background: #e94560;
  border: none;
  border-radius: 7px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
}
.quit-btn-yes:hover { background: #c73550; }
.quit-btn-no {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px;
  color: #ccc;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
}
.quit-btn-no:hover { background: rgba(255,255,255,0.14); }

/* ── Global error / info modal ─────────────────────────────────────────────── */
.error-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.error-modal.hidden { display: none; }
.error-modal-box {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 1.8rem 2.2rem;
  text-align: center;
  min-width: 260px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.error-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.4rem;
}
.error-modal-msg {
  font-size: 0.82rem;
  color: #aaa;
  margin: 0 0 1.3rem;
  line-height: 1.45;
}
.error-modal-ok {
  background: #e94560;
  border: none;
  border-radius: 7px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.6rem;
  cursor: pointer;
  transition: background 0.15s;
}
.error-modal-ok:hover { background: #c73550; }

#hudLeftBadges {
  position: absolute;
  left: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Game mode tag — game list */
.gamelist-mode {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.15rem 0.55rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.gamelist-mode-normal {
  background: #1a2a3a;
  border: 1px solid #2a5a8a;
  color: #7ac8f0;
}

.gamelist-mode-tdm {
  background: #2a1a1a;
  border: 1px solid #8a2a2a;
  color: #f07a7a;
}
.gamelist-mode-tug {
  background: #1a2a1a;
  border: 1px solid #3a7a3a;
  color: #7af07a;
}
.gamelist-mode-practice {
  background: #1e1a2a;
  border: 1px solid #6a4aaa;
  color: #c0a0f0;
}

/* Privacy toggle */
.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #ccc;
  user-select: none;
  margin-top: 0.25rem;
}

.privacy-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #e94560;
  cursor: pointer;
}

.privacy-hint {
  font-size: 0.78rem;
  color: #666;
}

/* Lobby privacy badge */
.lobby-privacy-badge {
  font-size: 0.8rem;
  border-radius: 12px;
  padding: 0.2rem 0.75rem;
  display: inline-block;
  margin-bottom: 0.5rem;
  margin-left: 0.4rem;
  background: #1a2a1a;
  border: 1px solid #2a5a2a;
  color: #6fcf97;
}

/* Private game row */
.gamelist-item-private {
  opacity: 0.75;
  border-color: #3a2a4a;
  background: #0e1828;
}

.gamelist-code-masked {
  color: #666 !important;
  letter-spacing: 0.3em;
}

.gamelist-private-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.gamelist-join-locked {
  background: #2a2a3a !important;
  color: #666 !important;
  cursor: not-allowed !important;
  border: 1px solid #3a3a5a;
}

/* ─── Kick vote popup ────────────────────────────────────────────────────── */
.kick-vote-popup {
  background: #1a1a2e;
  border: 1px solid #e9456088;
  border-left: 3px solid #e94560;
  border-radius: 0 6px 6px 0;
  padding: 0.55rem 0.7rem;
  margin: 0.4rem 0.4rem 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kvp-timer {
  font-variant-numeric: tabular-nums;
  color: #aaa;
  transition: color 0.3s;
}
.kvp-title {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e94560;
}

.kvp-info {
  font-size: 0.72rem;
  color: #ccc;
  line-height: 1.3;
}

.kvp-count {
  font-size: 0.68rem;
  color: #778899;
}

.kvp-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.kvp-btn {
  flex: 1;
  padding: 0.3rem 0;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: filter 0.15s;
}

.kvp-btn:hover { filter: brightness(1.2); }

.kvp-yes {
  background: #1a4a1a;
  border: 1px solid #2a8a2a;
  color: #6fcf97;
}

.kvp-no {
  background: #4a1a1a;
  border: 1px solid #8a2a2a;
  color: #f07a7a;
}

/* ─── Kicked spectator overlay ───────────────────────────────────────────── */
.kicked-overlay {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 10, 10, 0.88);
  border: 2px solid #e94560;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  text-align: center;
  z-index: 40;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.kicked-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.kicked-title {
  font-size: 1rem;
  font-weight: 800;
  color: #e94560;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kicked-sub {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.2rem;
}

/* ─── Persistent spectator badge ─────────────────────────────────────────── */
.spectator-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(10, 20, 40, 0.82);
  border: 1.5px solid rgba(96, 165, 250, 0.55);
  border-radius: 99px;
  padding: 0.35rem 1rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #93c5fd;
  text-transform: uppercase;
  z-index: 45;
  pointer-events: none;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.2), inset 0 0 8px rgba(96, 165, 250, 0.05);
  animation: spectator-pulse 2.5s ease-in-out infinite;
}
.spectator-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 6px #60a5fa;
  animation: spectator-dot-blink 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes spectator-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(96,165,250,0.2), inset 0 0 8px rgba(96,165,250,0.05); }
  50%       { box-shadow: 0 0 22px rgba(96,165,250,0.38), inset 0 0 10px rgba(96,165,250,0.1); }
}
@keyframes spectator-dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Roster: kick button + kicked state ─────────────────────────────────── */
.roster-list li {
  position: relative;
}

.roster-kick-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #e94560;
  font-size: 0.68rem;
  cursor: pointer;
  padding: 1px 3px;
  line-height: 1;
  margin-left: 3px;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s, border-color 0.15s;
}

.roster-kick-btn:hover {
  opacity: 1;
  border-color: #e9456066;
  background: rgba(233,69,96,0.12);
}

.kicked-player {
  opacity: 0.4;
  text-decoration: line-through;
}

.spectator-player {
  opacity: 0.55;
  font-style: italic;
}

.roster-spectator-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.35);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.roster-kicked-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e94560;
  background: rgba(233,69,96,0.15);
  border: 1px solid #e9456055;
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Chat: kicked badge */
.chat-msg .chat-kicked-badge {
  font-size: 0.6rem;
  color: #e94560;
  margin-left: 3px;
  font-style: italic;
}

/* ─── Kill announcement banner ───────────────────────────────────────────── */
.kill-banner {
  position: absolute;
  top: 52px; /* below HUD */
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  text-align: center;
  min-width: 260px;
  max-width: 420px;
}

@keyframes kbEnter {
  0%   { opacity: 0; transform: translateX(-50%) scale(1.3) translateY(-10px); }
  18%  { opacity: 1; transform: translateX(-50%) scale(1.0) translateY(0);     }
  100% { opacity: 1; transform: translateX(-50%) scale(1.0) translateY(0);     }
}

@keyframes kbExit {
  0%   { opacity: 1; transform: translateX(-50%) scale(1.0) translateY(0);  }
  100% { opacity: 0; transform: translateX(-50%) scale(0.85) translateY(8px); }
}

.kill-banner.kb-enter {
  animation: kbEnter 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.kill-banner.kb-exit {
  animation: kbExit 0.5s ease-in forwards;
}

.kb-killer {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.9;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.kb-label {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  -webkit-text-stroke: 1px rgba(0,0,0,0.4);
  filter: drop-shadow(0 2px 8px currentColor);
}

.kb-victim {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  margin-top: 0.1rem;
}

/* ─── Rune announcement banner ───────────────────────────────────────────── */
.kb-rune-player {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.kb-rune-label {
  font-size: 2.4rem !important;
  letter-spacing: 0.12em !important;
  filter: drop-shadow(0 0 12px currentColor) drop-shadow(0 2px 10px currentColor) !important;
}

@keyframes kbRuneEnter {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.6) translateY(-16px); }
  30%  { opacity: 1; transform: translateX(-50%) scale(1.12) translateY(4px);  }
  55%  { transform: translateX(-50%) scale(0.97) translateY(0);                }
  100% { opacity: 1; transform: translateX(-50%) scale(1.0) translateY(0);     }
}

.kill-banner.kb-rune-enter {
  animation: kbRuneEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ─── Screen shake (Bad Egg rune) ─────────────────────────────────────────── */
@keyframes screen-shake {
  0%   { transform: translate(0, 0) rotate(0deg);        }
  10%  { transform: translate(-5px, 3px) rotate(-0.4deg); }
  20%  { transform: translate(4px, -4px) rotate(0.3deg);  }
  30%  { transform: translate(-4px, 5px) rotate(-0.3deg); }
  40%  { transform: translate(5px, -3px) rotate(0.4deg);  }
  50%  { transform: translate(-3px, 4px) rotate(-0.2deg); }
  60%  { transform: translate(4px, -5px) rotate(0.3deg);  }
  70%  { transform: translate(-5px, 3px) rotate(-0.4deg); }
  80%  { transform: translate(4px, -3px) rotate(0.3deg);  }
  90%  { transform: translate(-3px, 4px) rotate(-0.2deg); }
  100% { transform: translate(0, 0) rotate(0deg);         }
}

.screen-shaking {
  animation: screen-shake 0.14s linear infinite;
}

/* Create options row (legacy, kept for any remaining uses) */
.create-options {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.create-label {
  font-size: 0.85rem;
  color: #aaa;
}

.select-limit {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border: 2px solid #0f3460;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  cursor: pointer;
}

.select-limit:focus { outline: none; border-color: #e94560; }

/* Lobby limit badge */
.lobby-limit-badge {
  font-size: 0.8rem;
  color: #7fdbff;
  background: #0f2a4a;
  border: 1px solid #1a4a7a;
  border-radius: 12px;
  padding: 0.2rem 0.75rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

#homeScreen .btn-primary {
  padding: 0.7rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

#homeScreen .btn-primary:hover:not(:disabled) {
  background: #ff6b6b;
}

#homeScreen .btn-primary:disabled {
  background: #555;
  cursor: not-allowed;
}

/* .home-divider removed — replaced by .home-divider-line */

.join-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

.join-form input[type="text"] {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 2px solid #0f3460;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  width: 220px;
  text-align: center;
}

.join-form input[type="text"]::placeholder {
  color: #666;
}

#inputGameCode {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
}

.game-code-display {
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  color: #7fdbff;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* ─── Lobby panel (redesigned) ────────────────────────────────────────────── */
.lobby-panel {
  background: #16213e;
  border-radius: 14px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.4);
  padding: 1.5rem 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 720px;
  max-width: 1020px;
  width: 100%;
}

.lobby-settings-btn {
  font-size: 1.1rem;
  line-height: 1;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: #556;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.lobby-settings-btn:hover {
  color: #60d0a0;
  border-color: rgba(80,220,160,0.4);
  background: rgba(80,220,160,0.07);
}

.lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding-bottom: 0.9rem;
}

.lobby-topbar h1 {
  color: #e94560;
  font-size: 1.8rem;
  margin: 0;
}

.lobby-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.lobby-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* Remove margin from individual badges when inside the row */
.lobby-badges-row .lobby-limit-badge,
.lobby-badges-row .lobby-privacy-badge,
.lobby-badges-row .lobby-mode-badge {
  margin: 0;
}

/* ─── Lobby spectator banner ──────────────────────────────────────────────── */
.lobby-spectator-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 1.5rem 0.75rem;
  padding: 0.55rem 1rem;
  background: rgba(30, 58, 100, 0.45);
  border: 1.5px solid rgba(96, 165, 250, 0.45);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #93c5fd;
  backdrop-filter: blur(4px);
  animation: spectator-pulse 2.5s ease-in-out infinite;
}
.lobby-spectator-banner strong { color: #bfdbfe; }
.lobby-spectator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 6px #60a5fa;
  flex-shrink: 0;
  animation: spectator-dot-blink 1.4s ease-in-out infinite;
}

.lobby-body {
  display: flex;
  gap: 1rem;
  align-items: stretch; /* all columns same height */
  height: 280px;        /* bounded height → enables scroll in children */
}

/* Team breakdown */
.lobby-teams-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.lobby-teams-row {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.lobby-team-col {
  flex: 1;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.lobby-team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.6rem 0.4rem 0.8rem;
  border-bottom: 2px solid;
  flex-shrink: 0;
}

.lt-header-a {
  color: #5a9eff;
  border-color: #3a7bd5;
  background: rgba(58,123,213,0.12);
}

.lt-header-b {
  color: #ff7070;
  border-color: #c0392b;
  background: rgba(192,57,43,0.12);
}

/* "Join" button inside team header */
.lt-join-btn {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.lt-join-btn-a {
  color: #5a9eff;
  border-color: #3a7bd5;
  background: rgba(58,123,213,0.15);
}
.lt-join-btn-a:hover { background: rgba(58,123,213,0.35); }

.lt-join-btn-b {
  color: #ff7070;
  border-color: #c0392b;
  background: rgba(192,57,43,0.15);
}
.lt-join-btn-b:hover { background: rgba(192,57,43,0.35); }

.lt-join-btn.lt-active {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.lt-switch-hint {
  font-size: 0.7rem;
  color: #445;
  text-align: center;
  padding-top: 0.3rem;
  font-style: italic;
}

.lobby-team-list {
  list-style: none;
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.lobby-team-list::-webkit-scrollbar { width: 3px; }

.lt-player {
  font-size: 0.85rem;
  color: #ddd;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lt-me {
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.lt-empty {
  font-size: 0.78rem;
  color: #444;
  padding: 0.5rem;
  font-style: italic;
}

/* Lobby chat */
.lobby-chat-panel {
  width: 260px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* stretches to match .lobby-body height via align-items: stretch */
}

.lobby-chat-header {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  padding: 0.45rem 0.75rem 0.35rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.lobby-chat-messages {
  list-style: none;
  flex: 1;
  min-height: 0; /* critical: allows flex child to shrink and scroll */
  overflow-y: auto;
  padding: 0.4rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scroll-behavior: smooth;
}

.lobby-chat-messages::-webkit-scrollbar { width: 3px; }

.lc-msg { font-size: 0.78rem; line-height: 1.35; word-break: break-word; }

.lc-msg-system .lc-text  { color: #556677; font-style: italic; }
.lc-msg-player .lc-text  { color: #ccc; }

.lc-name   { font-weight: 700; }
.lc-name-a { color: #5a9eff; }
.lc-name-b { color: #ff6b6b; }
.lc-colon  { color: #445; }

.lobby-chat-input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

#lobbyChatInput {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #eee;
  font-size: 0.78rem;
  padding: 0.28rem 0.5rem;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

#lobbyChatInput::placeholder { color: #444; font-style: italic; }
#lobbyChatInput:focus { border-color: #3a6a9a; }

#btnLobbyChat {
  background: #1a3a5a;
  border: 1px solid #2a5a8a;
  border-radius: 5px;
  color: #7fdbff;
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

#btnLobbyChat:hover { background: #2a5a8a; }

/* Lobby footer */
.lobby-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  gap: 1rem;
}

.lobby-footer .lobby-hint {
  margin: 0;
  flex: 1;
}

.lobby-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-leave-lobby {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 7px;
  color: #aaa;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-leave-lobby:hover {
  border-color: #e94560;
  color: #e94560;
}

/* Ready button */
.btn-ready {
  background: transparent;
  border: 1px solid rgba(76, 175, 138, 0.45);
  border-radius: 7px;
  color: #4caf8a;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-ready:hover {
  background: rgba(76, 175, 138, 0.12);
  border-color: #4caf8a;
}
.btn-ready.btn-ready-active {
  background: rgba(76, 175, 138, 0.22);
  border-color: #4caf8a;
  color: #7fffd4;
}

/* Ready dots in lobby player list */
.lt-ready-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lt-ready-dot.lt-ready    { background: #4caf8a; box-shadow: 0 0 5px rgba(76,175,138,0.6); }
.lt-ready-dot.lt-notready { background: #555; }
.lt-ready-dot.lt-spectator-dot {
  background: transparent;
  box-shadow: none;
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spectator-dot-blink 1.4s ease-in-out infinite;
}
.lt-spectator {
  opacity: 0.65;
  font-style: italic;
}
.lt-spectator-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.35);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.lt-name {
  flex: 1;
  min-width: 0;           /* lets flex item shrink below content size */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lt-you  { font-size: 0.75em; color: #888; font-weight: 400; }

/* Host kick button in lobby player list */
.lt-kick-btn {
  background: transparent;
  border: 1px solid rgba(233,69,96,0.35);
  border-radius: 4px;
  color: #e94560;
  font-size: 0.7rem;
  padding: 0.1em 0.35em;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.lt-kick-btn:hover { opacity: 1; background: rgba(233,69,96,0.15); }

/* End Practice button — same 48×48 box as .skill hotkeys */
.btn-end-practice {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #0f3460;
  border: 2px solid #7050c0;
  color: #c8a8ff;
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  text-align: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  white-space: pre-line;
}
.btn-end-practice:hover {
  background: rgba(120,80,200,0.35);
  border-color: #a07ae0;
  color: #d8c0ff;
}

/* "Yes, kick" button variant in the lobby kick-confirm modal */
.kick-confirm-btn {
  background: #e94560 !important;
  border-color: #e94560 !important;
  color: #fff !important;
}
.kick-confirm-btn:hover {
  background: #c73050 !important;
  border-color: #c73050 !important;
}

/* Host kick button style in in-game roster */
.roster-host-kick {
  background: transparent;
  border: 1px solid rgba(233,69,96,0.4);
  border-radius: 4px;
  color: #e94560;
  font-size: 0.68rem;
  padding: 0.1em 0.3em;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.roster-host-kick:hover { opacity: 1; }

/* Old lobby form styles (kept for compatibility) */
.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

#playerName {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 2px solid #0f3460;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  width: 220px;
}

.team-select {
  display: flex;
  gap: 0.5rem;
}

.team-btn {
  padding: 0.5rem 1.2rem;
  font-size: 1rem;
  border: 2px solid #0f3460;
  border-radius: 8px;
  background: #1a1a2e;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
}

.team-btn:hover {
  border-color: #e94560;
  color: #eee;
}

.team-btn.active {
  border-color: #e94560;
  background: #e94560;
  color: #fff;
}

.team-btn.team-a.active { background: #3a7bd5; border-color: #3a7bd5; }
.team-btn.team-b.active { background: #c0392b; border-color: #c0392b; }

#btnJoinGame, #btnStart, #btnPlayAgain {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

#btnJoinGame:hover:not(:disabled), #btnStart:hover:not(:disabled), #btnPlayAgain:hover {
  background: #ff6b6b;
}

#btnStart:disabled, #btnJoinGame:disabled {
  background: #555;
  cursor: not-allowed;
}

#playerList {
  margin: 1.5rem 0;
  text-align: left;
}

#playerList h3 {
  margin-bottom: 0.5rem;
  color: #aaa;
  font-size: 0.9rem;
}

#playerListItems {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

#playerListItems li {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #0f3460;
}

#playerListItems li.team-a { border-left: 3px solid #3a7bd5; }
#playerListItems li.team-b { border-left: 3px solid #c0392b; }
#playerListItems li.no-team { border-left: 3px solid #666; }

.lobby-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #e94560;
}

/* Countdown */
#countdown {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 30, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.cd-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #e94560;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 24px rgba(233,69,96,0.45);
  margin-bottom: 0.1rem;
}

.cd-mode-badge {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #aaa;
}
.cd-mode-normal { border-color: #2a5a8a; color: #7ac8f0; background: rgba(26,42,58,0.7); }
.cd-mode-tdm    { border-color: #8a2a2a; color: #f07a7a; background: rgba(42,26,26,0.7); }
.cd-mode-tug      { border-color: #3a7a3a; color: #7af07a; background: rgba(26,42,26,0.7); }
.cd-mode-practice { border-color: #6a4aaa; color: #c0a0f0; background: rgba(30,22,42,0.7); }
.cd-mode-runes    { border-color: #7c3aed; color: #d8b4fe; background: rgba(28,14,48,0.8); }

.cd-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}

#countdownNumber {
  font-size: 8rem;
  font-weight: 800;
  color: #e94560;
  text-shadow: 0 0 40px rgba(233,69,96,0.5);
  animation: pulse 1s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.9; }
}

/* Game */
#game {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

#hud {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: 1280px; /* default: 160px chat + 960px canvas + 160px roster; updated via JS */
  padding: 0.4rem 0.75rem;
  background: #16213e;
  border-radius: 8px 8px 0 0;
}

#timer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

#gameLayout {
  display: flex;
  gap: 0;
  align-items: flex-start;
}

/* Roster panel */
#rosterPanel {
  width: 160px;
  background: #16213e;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 500px; /* match canvas height */
  overflow-y: auto;
  border-radius: 0 8px 8px 0;
}

.roster-team {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.25rem;
}

.roster-header-a { color: #3a7bd5; border-bottom: 2px solid #3a7bd5; }
.roster-header-b { color: #c0392b; border-bottom: 2px solid #c0392b; }

.roster-score {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.roster-list {
  list-style: none;
  padding: 0 0.5rem;
}

.roster-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.28rem 0.4rem;
  border-radius: 5px;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.roster-list li.dead {
  opacity: 0.4;
}

.roster-list li .roster-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ddd;
}

.roster-list li.me .roster-name {
  color: #fff;
  font-weight: 700;
}

.roster-kd {
  font-size: 0.72rem;
  color: #888;
  white-space: nowrap;
  margin-left: 0.4rem;
  flex-shrink: 0;
}

/* ─── Chat panel ──────────────────────────────────────────────────────────── */
#chatPanel {
  width: 160px;
  flex-shrink: 0;
  background: #16213e;
  display: flex;
  flex-direction: column;
  height: 560px; /* updated by JS */
  border-radius: 8px 0 0 8px;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.chat-header {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  padding: 0.45rem 0.75rem 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

#chatMessages {
  list-style: none;
  flex: 1;
  min-height: 0; /* critical: allows flex child to shrink and scroll */
  overflow-y: auto;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  scroll-behavior: smooth;
}

#chatMessages::-webkit-scrollbar { width: 3px; }

.chat-msg {
  font-size: 0.72rem;
  line-height: 1.35;
  word-break: break-word;
}

/* System message (game started, etc.) */
.chat-msg-system .chat-text {
  color: #778899;
  font-style: italic;
}

/* Kill feed */
.chat-msg-kill .chat-text {
  color: #e8a87c;
}

/* Streak announcements */
.chat-msg-streak .chat-text {
  color: #c084fc;
  font-weight: 600;
}

/* Player chat */
.chat-msg-player .chat-text {
  color: #ddd;
}

.chat-name {
  font-weight: 700;
}

.chat-name-a { color: #5a9eff; }
.chat-name-b { color: #ff6b6b; }

.chat-colon {
  color: #555;
}

/* Chat input */
.chat-input-row {
  padding: 0.4rem 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

#chatInput {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #eee;
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
  outline: none;
  transition: border-color 0.15s;
}

#chatInput::placeholder {
  color: #444;
  font-style: italic;
}

#chatInput:focus {
  border-color: #3a6a9a;
  background: rgba(255,255,255,0.1);
}

#timer {
  font-size: 1.5rem;
  font-weight: 700;
  color: #eee;
  justify-self: center;
  text-align: center;
}

.skills {
  display: flex;
  gap: 0.5rem;
}

.skill {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #0f3460;
  border: 2px solid #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  overflow: hidden;
}

/* iOS-style clock sweep overlay */
.skill.on-cooldown::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: conic-gradient(
    from -90deg,
    transparent calc(var(--cd-pct, 0) * 360deg),
    rgba(0, 0, 0, 0.62) calc(var(--cd-pct, 0) * 360deg)
  );
  pointer-events: none;
  z-index: 1;
}

.skill-key { font-size: 0.75rem; color: #aaa; position: relative; z-index: 2; }
.skill-cd {
  font-size: 0.88rem;
  font-weight: 700;
  color: #e94560;
  position: relative;
  z-index: 2;
  line-height: 1;
}
.skill.on-cooldown .skill-cd { color: #fff; }
/* No opacity fade — the pie sweep is the indicator */

#canvas {
  display: block;
  width: 800px;  /* updated via JS on mapConfig */
  height: 500px;
  background: #2a4a7a;
  border: 4px solid #16213e;
  border-top: none;
  cursor: crosshair;
}

.controls-row {
  width: 960px; /* updated via JS alongside canvas */
}
.hud-settings-btn {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
  border-radius: 8px;
  background: #0f3460;
  border: 2px solid #1a1a2e;
}

.controls {
  font-size: 0.85rem;
  color: #888;
  width: 100%;
  text-align: center;
}

/* Game Over */
#gameOver {
  background: #16213e;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

#gameOver h2 {
  margin-bottom: 1rem;
  font-size: 1.8rem;
  color: #e94560;
}

#finalScore {
  margin-bottom: 1rem;
  color: #aaa;
}

.gameover-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  max-height: 40vh;
  overflow-y: auto;
}

.scoreboard-section {
  min-width: 180px;
}

.scoreboard-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #aaa;
}

.kd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.kd-table th,
.kd-table td {
  padding: 0.35rem 0.6rem;
  text-align: left;
}

.kd-table th {
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #333;
}

.kd-table td {
  color: #ccc;
  border-bottom: 1px solid #2a2a2a;
}

.kd-table th:not(:first-child),
.kd-table td:not(:first-child) {
  text-align: center;
}
.scoreboard-spectator-row td {
  opacity: 0.55;
  font-style: italic;
}
.scoreboard-spectator-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.35);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 5px;
  vertical-align: middle;
  font-style: normal;
}


.gameover-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

#btnPlayAgain {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
}

#btnBackToMenu {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #ccc;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
#btnBackToMenu:hover {
  border-color: #e94560;
  color: #e94560;
}

#btnShareScore {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
  background: transparent;
  border: 1px solid rgba(34,211,238,0.45);
  border-radius: 8px;
  color: #22d3ee;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#btnShareScore:hover {
  background: rgba(34,211,238,0.1);
  border-color: #22d3ee;
  color: #fff;
}
#btnShareScore:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Match result overlay (VICTORY / DEFEAT) ─────────────────────────────── */
.match-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(8, 12, 25, 0.72);
  pointer-events: none;
}

.match-result-overlay.mr-show {
  animation: mr-bg-in 0.45s ease-out forwards;
}
.match-result-overlay.mr-hide {
  animation: mr-bg-out 0.55s ease-in forwards;
}

@keyframes mr-bg-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes mr-bg-out { from { opacity: 1; } to { opacity: 0; } }

.mr-text {
  font-size: clamp(3.5rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  animation: mr-pop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.mr-text.mr-victory {
  color: #ffd700;
  text-shadow: 0 0 35px rgba(255,215,0,0.7), 0 0 80px rgba(255,215,0,0.35);
}
.mr-text.mr-defeat {
  color: #e94560;
  text-shadow: 0 0 35px rgba(233,69,96,0.7), 0 0 80px rgba(233,69,96,0.35);
}
.mr-text.mr-draw {
  color: #aaa;
  text-shadow: 0 0 30px rgba(170,170,170,0.5);
}

@keyframes mr-pop {
  0%   { transform: scale(0.25) rotate(-4deg); opacity: 0; }
  55%  { transform: scale(1.1)  rotate(1deg);  opacity: 1; }
  75%  { transform: scale(0.96) rotate(0deg); }
  100% { transform: scale(1)    rotate(0deg); }
}

.mr-sub {
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-top: 0.9rem;
  animation: mr-sub-in 0.5s 0.35s ease-out both;
}

@keyframes mr-sub-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
