:root {
  --bg: #0a0c14; --accent: #14f195; --accent2: #9945ff; --danger: #ff4d6d;
  --fg: #e8eaf2; --muted: #8b93ad;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
code { background: #1c2236; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- overlay / lobby ---------- */
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 500px at 50% -10%, #241247, #0a0c14 70%); z-index: 20; }
.panel { width: min(440px, 92vw); background: #12162a; border: 1px solid #262c47;
  border-radius: 18px; padding: 28px; text-align: center; }
h1 { font-size: 30px; letter-spacing: .5px; }
.net { font-size: 12px; background: var(--accent2); color: #fff; padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.tag { color: var(--muted); margin: 6px 0 22px; font-size: 14px; }
button { width: 100%; border: 0; border-radius: 12px; padding: 15px; font-size: 16px; font-weight: 700;
  cursor: pointer; background: linear-gradient(90deg, var(--accent), #0bd17f); color: #04130c; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; border: 1px solid #2c3350; color: var(--muted); margin-top: 10px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; line-height: 1.5; }
.or { color: var(--muted); font-size: 12px; margin: 16px 0 12px; letter-spacing: 1px; }
#ranked-ready { margin-top: 12px; }
#ranked-ready button { background: linear-gradient(90deg, var(--accent2), #7a36cc); color: #fff; }
.wallet { color: var(--muted); font-size: 13px; margin-bottom: 14px; word-break: break-all; }
.controls { color: var(--muted); font-size: 12px; margin-top: 20px; line-height: 1.6;
  border-top: 1px solid #20263f; padding-top: 14px; }
.log { color: var(--accent); font-size: 12px; min-height: 16px; margin-top: 10px; white-space: pre-wrap; }
.spinner { width: 30px; height: 30px; border: 3px solid #2a3150; border-top-color: var(--accent);
  border-radius: 50%; margin: 6px auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
/* gapped 4-tick crosshair + center dot (Valorant/CS style) */
#crosshair { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%);
  background: radial-gradient(circle at center, #fff 0 1.3px, transparent 1.6px); filter: drop-shadow(0 0 1.5px #000); }
#crosshair::before, #crosshair::after { content: ""; position: absolute; opacity: .92; }
#crosshair::before { left: 50%; top: 0; width: 1.6px; height: 100%; transform: translateX(-50%);
  background: linear-gradient(to bottom, #fff 0 36%, transparent 36% 64%, #fff 64% 100%); }
#crosshair::after { top: 50%; left: 0; height: 1.6px; width: 100%; transform: translateY(-50%);
  background: linear-gradient(to right, #fff 0 36%, transparent 36% 64%, #fff 64% 100%); }

#hp-wrap { position: absolute; left: 22px; bottom: 22px; width: 230px; height: 26px;
  background: rgba(8,11,20,.62); border: 1px solid rgba(150,170,210,.25); border-radius: 9px;
  overflow: hidden; box-shadow: 0 4px 16px #0007, inset 0 1px 0 #ffffff14; }
#hp-bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--danger), #ff8a5c); transition: width .12s;
  box-shadow: 0 0 12px #ff5a4c66; }
#hp-num { position: absolute; right: 10px; top: 3px; font-weight: 800; font-size: 15px; text-shadow: 0 1px 2px #000; }
#armor-wrap { position: absolute; left: 22px; bottom: 52px; width: 230px; height: 15px;
  background: rgba(8,11,20,.62); border: 1px solid rgba(150,170,210,.25); border-radius: 7px; overflow: hidden; box-shadow: 0 3px 10px #0006; }
#armor-wrap.hidden { display: none; }
#armor-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #2f7fd6, #74c2ff); transition: width .12s; box-shadow: 0 0 10px #4aa0ff66; }
#armor-num { position: absolute; right: 9px; top: 0; font-weight: 800; font-size: 11px; line-height: 15px; text-shadow: 0 1px 2px #000; color: #cfe6ff; }

#timer { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-size: 24px;
  font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 6px #000; }

#ammo { position: absolute; right: 22px; bottom: 20px; font-weight: 800; text-shadow: 0 2px 4px #000;
  display: flex; align-items: baseline; gap: 6px; padding: 6px 14px;
  background: rgba(8,11,20,.58); border: 1px solid rgba(150,170,210,.22); border-radius: 10px; }
#mag { font-size: 34px; }
#ammo.reloading #mag { color: var(--accent); animation: blink .5s steps(2) infinite; }
#ammo .sep, #reserve { font-size: 18px; color: var(--muted); }
@keyframes blink { 50% { opacity: .3; } }

#dmg-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 160px 40px rgba(255,30,50,0.85); transition: opacity .35s ease-out; }
#dmg-vignette.hit { opacity: 1 !important; transition: opacity .05s; }

#killfeed { position: absolute; top: 16px; right: 16px; width: 280px; text-align: right;
  font-size: 13px; display: flex; flex-direction: column; gap: 5px; }
.kf { background: #0009; padding: 5px 9px; border-radius: 7px; animation: fade 4s forwards; }
.kf b { color: var(--accent); }
.kf .v { color: var(--danger); }
@keyframes fade { 0%,80% { opacity: 1; } 100% { opacity: 0; } }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
  transform: translate(-50%,-50%) rotate(45deg); opacity: 0; }
#hitmarker.show { animation: hm .25s ease-out; }
#hitmarker::before, #hitmarker::after { content:""; position:absolute; background: var(--accent); }
#hitmarker::before { left: 8px; top: 0; width: 2px; height: 18px; }
#hitmarker::after { top: 8px; left: 0; height: 2px; width: 18px; }
@keyframes hm { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.4); } 100% { opacity: 0; } }

#scoreboard { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: #0e1224ee; border: 1px solid #2c3350; border-radius: 14px; padding: 20px 26px; min-width: 320px; }
#scoreboard h3 { text-align: center; letter-spacing: 2px; color: var(--muted); margin-bottom: 12px; }
#score-table { width: 100%; border-collapse: collapse; }
#score-table td { padding: 6px 10px; font-size: 15px; }
#score-table tr.me { color: var(--accent); font-weight: 700; }
#score-table td:last-child { text-align: right; font-weight: 800; }
.tabhint { text-align: center; color: var(--muted); font-size: 11px; margin-top: 10px; }

/* killcam red wash — clear-ish center so the zoomed killer reads, red vignette at the edges */
#killcam-red { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s ease;
  background: radial-gradient(ellipse at center, rgba(150,0,0,0) 30%, rgba(140,0,0,.6) 100%), rgba(120,0,0,.16); }
#killcam-red.show { opacity: 1; }

#dead-overlay { position: absolute; inset: 0; background: transparent; display: flex; align-items: flex-start; justify-content: center; padding-top: 11vh; }
.dead-card { text-align: center; }
.dead-card h2 { font-size: 40px; color: var(--danger); text-shadow: 0 2px 10px #000; }
.dead-card p { color: var(--fg); margin: 8px 0; }
#respawn-count { font-size: 30px; font-weight: 800; margin-top: 8px; }

#pause { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8,10,18,.72); backdrop-filter: blur(3px); z-index: 22; }
#pause.hidden { display: none; }

#round-banner { position: fixed; top: 28%; left: 50%; transform: translateX(-50%); z-index: 15;
  background: #0e1224ee; border: 1px solid var(--accent); border-radius: 14px; padding: 22px 34px;
  text-align: center; pointer-events: none; }
#round-banner h2 { color: var(--accent); font-size: 26px; }
#round-banner p { color: var(--muted); margin-top: 6px; }
#round-banner a { color: var(--accent); pointer-events: auto; }

/* ---------- lobby chat (right side, lobby phase only) ---------- */
#lobby-chat { position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 280px; max-width: 38vw; pointer-events: auto; display: flex; flex-direction: column;
  background: rgba(10,13,24,.74); border: 1px solid #2c3350; border-radius: 12px; overflow: hidden;
  box-shadow: 0 6px 24px #0008; }
#chat-head { font-size: 11px; letter-spacing: 2px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid #20263f; }
#chat-log { height: 240px; overflow-y: auto; padding: 8px 12px; font-size: 13px; line-height: 1.5;
  display: flex; flex-direction: column; gap: 3px; }
#chat-log .cmsg { word-break: break-word; color: var(--fg); }
#chat-log .cmsg b { color: var(--accent); }
#chat-form { border-top: 1px solid #20263f; }
#chat-input { width: 100%; padding: 10px 12px; border: 0; background: #0c1020; color: var(--fg); font-size: 14px; }
#chat-input:focus { outline: none; background: #11162b; }

/* ---------- graphics quality toggle (pause menu) ---------- */
#gfx-opts { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
#gfx-opts span { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin-right: 4px; }
#gfx-opts button { width: auto; flex: 1; min-width: 84px; padding: 9px 10px; font-size: 13px; font-weight: 600; margin: 0;
  background: transparent; border: 1px solid #2c3350; color: var(--muted); border-radius: 9px; }
#gfx-opts button.on { background: linear-gradient(90deg, var(--accent), #0bd17f); color: #04130c; border-color: transparent; }

/* ============================================================
   SOL Arena UI — leaderboard, profile, balance, duel, spectate,
   verify, cosmetics, touch controls. Matches the lobby panel style.
   ============================================================ */

/* small "chip" buttons used in menu bars / actions (auto width, not full-width) */
.chip { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
  font-size: 13px; font-weight: 700; border-radius: 10px; background: rgba(255,255,255,.04);
  border: 1px solid #2c3350; color: var(--fg); }
.chip:hover { border-color: var(--accent2); }
button.mini { width: auto; padding: 10px 14px; font-size: 13.5px; }
button.mini.ghost { background: transparent; border: 1px solid #2c3350; color: var(--muted); }

/* menu bar (leaderboard + watch) above the mode buttons */
.menu-bar { display: flex; gap: 10px; justify-content: center; margin: 0 0 18px; }

/* balance + profile cards inside ranked-ready */
.card-row { background: #0e1326; border: 1px solid #242b48; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; text-align: left; }
.bal-line { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.bal-label { color: var(--muted); font-size: 12.5px; letter-spacing: .5px; }
#bal-amount { font-size: 18px; font-weight: 800; color: var(--accent); }
.bal-btns { display: flex; gap: 8px; }
.bal-btns .mini { flex: 1; }

.pf-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
#pf-name { font-weight: 800; font-size: 14px; word-break: break-all; }
.pf-tag { color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.pf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pf-grid > div { text-align: center; background: #0a0f20; border: 1px solid #1d2440; border-radius: 9px; padding: 8px 4px; }
.pf-n { display: block; font-size: 18px; font-weight: 800; color: var(--fg); }
.pf-l { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: .5px; }

#btn-duel { background: linear-gradient(90deg, var(--accent2), #7a36cc); color: #fff; }

/* cosmetics skin picker */
.cosmetics { display: flex; align-items: center; gap: 12px; justify-content: center;
  margin-top: 18px; border-top: 1px solid #20263f; padding-top: 16px; }
.cos-label { color: var(--muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.skin-picker { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.skin-swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--swatch);
  border: 2px solid #2c3350; cursor: pointer; transition: transform .12s, border-color .12s; }
.skin-swatch:hover { transform: scale(1.12); }
.skin-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--swatch); }

/* ---------- generic modal ---------- */
.ui-modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(6,8,16,.78); backdrop-filter: blur(4px); padding: 20px; }
.ui-modal-card { width: min(480px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: #12162a; border: 1px solid #262c47; border-radius: 18px; padding: 22px 24px; }
.ui-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ui-modal-head h2 { font-size: 22px; }
.ui-x { width: auto; background: transparent; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px; cursor: pointer; }
.ui-x:hover { color: var(--fg); }

/* leaderboard table */
.lb-scroll { overflow-y: auto; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 8px; border-bottom: 1px solid #242b48; position: sticky; top: 0; background: #12162a; }
.lb-table td { padding: 9px 8px; font-size: 14px; border-bottom: 1px solid #1a2038; }
.lb-table tbody tr:hover { background: #161b32; }
.lb-rank { width: 36px; font-weight: 800; }
.lb-name { font-weight: 700; word-break: break-all; }
.lb-elo { color: var(--accent); font-weight: 800; }
.lb-kills { font-weight: 700; }
.lb-table th:nth-child(3), .lb-table th:nth-child(4), .lb-table th:nth-child(5),
.lb-table td.lb-elo, .lb-table td:nth-child(4), .lb-table td.lb-kills { text-align: right; }

/* verify panel */
.verify-out { font-size: 14px; }
.spinner.sp-sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; margin: 0 6px -2px 0; }
.vf-pending { color: var(--muted); }
.vf-verdict { font-size: 18px; font-weight: 800; padding: 12px; border-radius: 11px; text-align: center; margin-bottom: 14px; }
.vf-pass { color: #062; background: rgba(20,241,149,.14); border: 1px solid var(--accent); color: var(--accent); }
.vf-fail { color: var(--danger); background: rgba(255,77,109,.12); border: 1px solid var(--danger); }
.vf-checks { list-style: none; display: grid; gap: 6px; margin: 0 0 14px; }
.vf-checks li { font-size: 13.5px; }
.vf-checks li.ok { color: var(--accent); }
.vf-checks li.bad { color: var(--danger); }
.vf-record { margin: 0 0 12px; }
.vf-record dt { color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-top: 8px; }
.vf-record dd { margin: 2px 0 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.vf-key { color: var(--muted); font-size: 12px; margin-top: 8px; }
.vf-link { margin-top: 12px; }
.vf-link a { color: var(--accent); font-weight: 700; }

/* ---------- round-over screen (app.js managed) ---------- */
#roundover-screen { position: fixed; inset: 0; z-index: 18; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(800px 460px at 50% 30%, rgba(20,241,149,.10), rgba(6,8,16,.86) 70%); }
.ro-card { width: min(420px, 92vw); background: #12162a; border: 1px solid var(--accent); border-radius: 18px;
  padding: 30px 28px; text-align: center; box-shadow: 0 0 40px rgba(20,241,149,.18); }
.ro-card h2 { font-size: 28px; }
.ro-prize { font-size: 20px; font-weight: 800; color: var(--accent); margin: 12px 0 4px; }
.ro-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.ro-actions .chip { border-color: var(--accent); }

/* ---------- spectate screen ---------- */
#spectate-screen { position: fixed; inset: 0; z-index: 19; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 520px at 50% 0%, #1a1030, #0a0c14 72%); padding: 18px; }
.spec-panel { width: min(440px, 95vw); background: #12162a; border: 1px solid #262c47; border-radius: 18px; padding: 20px; }
.spec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.spec-live { color: var(--danger); font-weight: 800; font-size: 12px; letter-spacing: 1px; }
#spec-sub { color: var(--muted); font-size: 13px; }
#spec-radar { width: 100%; max-width: 360px; aspect-ratio: 1; display: block; margin: 0 auto 16px;
  background: #090d1c; border: 1px solid #20263f; border-radius: 12px; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 5px 8px; border-bottom: 1px solid #242b48; }
.spec-table td { padding: 7px 8px; font-size: 14px; border-bottom: 1px solid #1a2038; }
.spec-state { width: 20px; color: var(--accent); }
.spec-name { font-weight: 700; }
.spec-score { text-align: right; font-weight: 800; }
.spec-table th:last-child { text-align: right; }
.spec-dead { opacity: .45; }
.spec-dead .spec-state { color: var(--danger); }

/* ============================================================
   Touch / mobile controls — hidden unless body.touch-device
   ============================================================ */
#touch-controls { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.ts-stick { position: absolute; left: 26px; bottom: 30px; width: 132px; height: 132px; border-radius: 50%;
  background: rgba(12,16,32,.42); border: 2px solid rgba(150,170,210,.28); pointer-events: auto; touch-action: none; }
.ts-nub { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #1cf6a0, #0bd17f); box-shadow: 0 4px 14px #0008; }
.ts-look { position: absolute; right: 0; top: 0; width: 55%; height: 70%; pointer-events: auto; touch-action: none; }
.ts-btns { position: absolute; right: 22px; bottom: 26px; display: grid;
  grid-template-columns: repeat(2, 78px); gap: 12px; pointer-events: auto; }
.ts-btn { width: 78px; height: 78px; border-radius: 50%; font-size: 13px; font-weight: 800; padding: 0;
  background: rgba(12,16,32,.5); border: 2px solid rgba(150,170,210,.3); color: var(--fg);
  pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; }
.ts-btn.pressed { background: rgba(20,241,149,.3); border-color: var(--accent); }
.ts-fire { background: rgba(255,77,109,.32); border-color: rgba(255,120,140,.6); color: #fff; }
.ts-fire.pressed { background: rgba(255,77,109,.6); }
.ts-sprint { position: absolute; left: 30px; bottom: 176px; width: auto; height: auto; padding: 10px 16px; border-radius: 12px; font-size: 12px; }
body.touch-device .controls { display: none; } /* keyboard hints irrelevant on touch */

/* ============================================================
   Custodial account UI — auth modal, account bar, deposit,
   withdraw, recovery code. Appended; does not override above.
   ============================================================ */

/* auth modal card */
.auth-card { max-width: 380px; }
.auth-title { font-size: 26px; margin-bottom: 4px; }

/* tab bar */
.atab-bar { display: flex; gap: 6px; margin-bottom: 18px; }
.atab { flex: 1; background: transparent; border: 1px solid #2c3350; color: var(--muted);
  padding: 9px 8px; font-size: 13px; font-weight: 600; border-radius: 9px; }
.atab-on { background: rgba(153,69,255,.18); border-color: var(--accent2); color: var(--fg); }

/* inputs inside auth forms */
.auth-input { display: block; width: 100%; background: #0c1020; border: 1px solid #2c3350;
  border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--fg);
  margin-bottom: 10px; }
.auth-input:focus { outline: none; border-color: var(--accent2); }

/* error / success message */
.auth-msg { font-size: 13px; margin-top: 10px; padding: 8px 12px; border-radius: 8px; }
.auth-msg-err { background: rgba(255,77,109,.14); color: var(--danger); border: 1px solid rgba(255,77,109,.3); }
.auth-msg-ok  { background: rgba(20,241,149,.12); color: var(--accent); border: 1px solid rgba(20,241,149,.25); }

/* account bar — username + logout shown at top of overlay panel */
.account-bar { display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 14px; padding: 8px 12px; background: #0e1326;
  border: 1px solid #242b48; border-radius: 10px; }
.acct-name { font-size: 13px; font-weight: 700; color: var(--accent); }
.acct-logout { padding: 6px 12px; font-size: 12px; }

/* deposit card */
.dep-head { font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; }
.dep-hint { margin-bottom: 8px; }
.dep-addr-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dep-addr { flex: 1; font-size: 11px; word-break: break-all; color: var(--fg); }
.dep-copy { padding: 6px 10px; font-size: 12px; flex-shrink: 0; }

/* recovery code modal */
.recovery-warn { color: var(--danger); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }
.recovery-box { background: #090d1c; border: 1px solid var(--accent2); border-radius: 10px;
  padding: 16px; text-align: center; }
.recovery-code { font-size: 15px; letter-spacing: 2px; color: var(--accent); word-break: break-all; }
