/*
 * © 2026 Browning PC LLC — Proprietary. All rights reserved.
 * GameKit — shared UI for every BrowningPC game: Google sign-in, wins leaderboard,
 * the shared "BrowningPC Games" chat, an online lobby (challenge → match), and save/resume.
 * Ships readable (external module). All classes are `gk-` scoped to avoid colliding with a game's CSS.
 */
.gk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.gk-bar[hidden] { display: none; }
.gk-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; cursor: pointer; border-radius: 999px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; line-height: 1;
  background: #1e3a8a; color: #fff; transition: background .15s, transform .05s;
  position: relative; white-space: nowrap;
}
.gk-btn:hover { background: #2563eb; }
.gk-btn:active { transform: translateY(1px); }
.gk-btn.gk-outline { background: transparent; color: #cbd5e1; box-shadow: inset 0 0 0 1.5px #334155; }
.gk-btn.gk-outline:hover { background: rgba(255,255,255,.06); color: #fff; }
.gk-btn:disabled { opacity: .5; cursor: default; }
.gk-btn[hidden] { display: none; }
.gk-gsi { display: inline-flex; min-height: 40px; align-items: center; }
.gk-gsi[hidden] { display: none; }
.gk-signed { display: inline-flex; align-items: center; gap: 8px; color: #e2e8f0; font-size: 14px; }
.gk-signed[hidden] { display: none; }
.gk-signed .gk-name { font-weight: 700; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gk-signout { color: #94a3b8; text-decoration: underline; cursor: pointer; font-size: 12.5px; background: none; border: 0; padding: 0; }
.gk-signout:hover { color: #e2e8f0; }
.gk-badge {
  position: absolute; top: -7px; right: -7px;
  background: #16a34a; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 2px 7px; box-shadow: 0 0 0 2px #0b1220;
}
.gk-badge[hidden] { display: none; }

/* ---- Overlay + modal ---- */
.gk-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(3, 7, 18, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.gk-overlay[hidden] { display: none; }
.gk-modal {
  width: 100%; max-width: 460px; max-height: 90vh; display: flex; flex-direction: column;
  background: #0f172a; color: #e2e8f0; border: 1px solid #1e293b;
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden;
}
.gk-modal.gk-wide { max-width: 520px; }
.gk-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 18px; border-bottom: 1px solid #1e293b; background: #0a2a5e;
}
.gk-modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; color: #fff; }
.gk-x {
  border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-size: 18px; line-height: 1;
}
.gk-x:hover { background: rgba(255,255,255,.22); }
.gk-modal-body { padding: 16px 18px; overflow-y: auto; }
.gk-note { color: #94a3b8; font-size: 13.5px; line-height: 1.5; text-align: center; padding: 22px 6px; }
.gk-note b { color: #e2e8f0; }

/* ---- Leaderboard ---- */
.gk-lb-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.gk-lb-table th { text-align: left; color: #64748b; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid #1e293b; }
.gk-lb-table td { padding: 9px 8px; border-bottom: 1px solid #131c2e; }
.gk-lb-table td.r, .gk-lb-table th.r { text-align: right; }
.gk-rank { width: 34px; font-weight: 800; color: #64748b; }
.gk-rank.gold { color: #fbbf24; } .gk-rank.silver { color: #cbd5e1; } .gk-rank.bronze { color: #d97706; }
.gk-lb-nm { font-weight: 600; }
.gk-lb-w { font-weight: 800; color: #4ade80; }
.gk-lb-rec { color: #94a3b8; font-size: 13px; }

/* ---- Online lobby (roster + shared chat) ---- */
.gk-lobby { display: flex; flex-direction: column; gap: 12px; min-height: 340px; }
.gk-banner { border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; }
.gk-banner[hidden] { display: none; }
.gk-banner.gk-challenge { background: #14532d; border: 1px solid #16a34a; }
.gk-banner.gk-waiting { background: #422006; border: 1px solid #b45309; }
.gk-bn-row { display: flex; gap: 8px; margin-top: 10px; }
.gk-section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin: 2px 0; }
.gk-roster { display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; }
.gk-player { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #131c2e; border-radius: 10px; padding: 8px 12px; }
.gk-player .gk-pnm { font-weight: 600; font-size: 14px; }
.gk-you-tag { color: #64748b; font-weight: 500; font-size: 12px; }
.gk-chal { border: 0; cursor: pointer; background: #2563eb; color: #fff; border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 700; }
.gk-chal:hover { background: #3b82f6; } .gk-chal:disabled { opacity: .5; cursor: default; }
.gk-empty { color: #64748b; font-size: 13px; text-align: center; padding: 16px 8px; line-height: 1.5; }
.gk-chat { display: flex; flex-direction: column; flex: 1; min-height: 120px; }
.gk-chat-log { flex: 1; overflow-y: auto; background: #0a1120; border: 1px solid #1e293b; border-radius: 10px; padding: 8px 10px; min-height: 110px; max-height: 200px; }
.gk-chat-line { font-size: 13.5px; line-height: 1.5; margin: 1px 0; word-wrap: break-word; }
.gk-chat-line .gk-who { color: #60a5fa; font-weight: 700; }
.gk-chat-line.gk-sys { color: #64748b; font-style: italic; }
.gk-chat-form { display: flex; gap: 6px; margin-top: 8px; }
.gk-chat-form input { flex: 1; background: #0a1120; border: 1px solid #334155; color: #e2e8f0; border-radius: 999px; padding: 9px 14px; font-size: 14px; outline: none; }
.gk-chat-form input:focus { border-color: #2563eb; }
.gk-chat-send { border: 0; cursor: pointer; background: #16a34a; color: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 14px; }
.gk-chat-send:hover { background: #22c55e; }

@media (max-width: 480px) {
  .gk-modal { max-height: 94vh; }
  .gk-btn { padding: 8px 13px; font-size: 13px; }
}
