/* Tokens ------------------------------------------------------------------ */
:root {
    --bg: #0b0e13;
    --panel: rgba(20, 25, 34, .72);
    --panel-solid: #141922;
    --line: rgba(255, 255, 255, .08);
    --text: #e8ecf2;
    --muted: #8a94a6;
    --accent: #5aa9ff;
    --ally: #4da3ff;
    --enemy: #ff5d5d;
    --ct: #5aa9ff;
    --t: #f0b44a;
    --ok: #3ddc84;
    --warn: #f0b44a;
    --bad: #ff5d5d;
    --radius: 14px;
    --hud-gap: 12px;
    --panel-w: 290px;
    --pl: 0px; /* width taken by the left panel on wide screens, set by the page */
    --pr: 0px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 90, 169, 255;
    --bs-secondary-color: var(--muted);
}

html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-feature-settings: "tnum" 1; }

.glass {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.glass-menu {
    background: var(--panel-solid);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 230px;
}

.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #79bbff; --bs-btn-hover-border-color: #79bbff; --bs-btn-color: #04121f; --bs-btn-hover-color: #04121f; --bs-btn-active-bg: #3f94ee; --bs-btn-active-color: #04121f; font-weight: 600; }
.form-control, .form-control:focus { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--text); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(90, 169, 255, .15); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* Landing ----------------------------------------------------------------- */
.landing {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(900px 500px at 50% -10%, rgba(90, 169, 255, .14), transparent 60%),
        var(--bg);
}
.landing-wrap { width: 100%; max-width: 460px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    background:
        radial-gradient(circle at 50% 50%, transparent 0 8px, rgba(90, 169, 255, .9) 8px 10px, transparent 10px),
        radial-gradient(circle at 50% 50%, transparent 0 17px, rgba(90, 169, 255, .45) 17px 18.5px, transparent 18.5px),
        linear-gradient(135deg, #172233, #0f1620);
    border: 1px solid var(--line);
    position: relative;
}
.brand-mark::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: conic-gradient(from 0deg, rgba(90, 169, 255, .55), transparent 28%);
    mask: radial-gradient(circle, #000 0 18px, transparent 19px);
    -webkit-mask: radial-gradient(circle, #000 0 18px, transparent 19px);
    animation: sweep 3.2s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.snippet {
    margin: 0; padding: 12px 40px 12px 12px; border-radius: 10px;
    background: rgba(0, 0, 0, .35); border: 1px solid var(--line);
    color: #c9d3e3; font-size: .8rem; overflow-x: auto;
}
.snippet-copy { position: absolute; top: 6px; right: 6px; }

/* Radar page -------------------------------------------------------------- */
.radar-page { overflow: hidden; position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#radar { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#radar.dragging { cursor: grabbing; }

.hud { position: absolute; z-index: 5; }
.hud-tl { top: calc(var(--hud-gap) + var(--safe-t)); left: calc(var(--pl) + var(--hud-gap) + var(--safe-l)); transition: left .22s ease; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px; }
.hud-tr { top: calc(var(--hud-gap) + var(--safe-t)); right: calc(var(--pr) + var(--hud-gap) + var(--safe-r)); transition: right .22s ease; }
.hud-tc { top: calc(var(--hud-gap) + var(--safe-t)); left: calc(var(--pl) + (100% - var(--pl) - var(--pr)) / 2); transform: translateX(-50%); transition: left .22s ease; display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-width: 230px; }
.hud-bl { left: calc(var(--pl) + var(--hud-gap) + var(--safe-l)); transition: left .22s ease; bottom: calc(8px + var(--safe-b)); pointer-events: none; opacity: .75; font-variant-numeric: tabular-nums; }
.hud-floors { right: calc(var(--pr) + var(--hud-gap) + var(--safe-r)); transition: right .22s ease; bottom: calc(var(--hud-gap) + var(--safe-b)); display: flex; padding: 4px; gap: 2px; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 currentColor; color: var(--warn); flex: none; }
.status-dot.live { background: var(--ok); color: var(--ok); animation: pulse 2s ease-out infinite; }
.status-dot.bad { background: var(--bad); color: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); } }

.tools { display: flex; align-items: center; gap: 2px; padding: 4px; }
.tool, .floor {
    appearance: none; border: 0; background: transparent; color: var(--muted);
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    font-size: 1.05rem; transition: background .15s, color .15s;
}
.tool:hover, .floor:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.tool.on, .floor.on { background: rgba(90, 169, 255, .18); color: var(--accent); }
.tool:focus-visible, .floor:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.floor { width: auto; padding: 0 12px; font-size: .82rem; font-weight: 600; }

/* bomb */
.bomb-icon { font-size: 1.4rem; color: var(--warn); }
.bomb-time { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.bomb-bar { position: relative; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); margin-top: 6px; }
#bombFill { border-radius: 4px; }
#bombTick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ok); }
#bombFill { height: 100%; width: 100%; background: var(--warn); transform-origin: left; will-change: transform; }
#bomb.hot .bomb-icon, #bomb.hot .bomb-time { color: var(--bad); }
#bomb.hot #bombFill { background: var(--bad); }
#bomb.hot { animation: throb .9s ease-in-out infinite; }
@keyframes throb { 50% { box-shadow: 0 0 0 1px rgba(255, 93, 93, .55), 0 6px 24px rgba(255, 93, 93, .25); } }

/* Weapon icons: the same font the overlay draws ------------------------------ */
@font-face {
    font-family: "WeaponIcons";
    src: url("../fonts/weapons.ttf") format("truetype");
    font-display: block;
}
.wi { font-family: "WeaponIcons"; font-style: normal; font-weight: normal; line-height: 1; }

/* Team panels ------------------------------------------------------------------ */
.team-panel {
    position: absolute; top: 0; bottom: 0; z-index: 7; width: var(--panel-w);
    display: flex; flex-direction: column;
    padding-top: var(--safe-t); padding-bottom: var(--safe-b);
    background: rgba(13, 17, 24, .84);
    -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
    transition: transform .22s ease;
}
.team-panel.left { left: 0; padding-left: var(--safe-l); border-right: 1px solid var(--line); }
.team-panel.right { right: 0; padding-right: var(--safe-r); border-left: 1px solid var(--line); }
.team-panel.left.collapsed { transform: translateX(-100%); }
.team-panel.right.collapsed { transform: translateX(100%); }

/* the handle hangs off the inner edge, so it stays reachable while the panel is away */
.panel-handle {
    position: absolute; top: calc(12px + var(--safe-t)); width: 30px; height: 36px; z-index: 2;
    display: grid; place-items: center; padding: 0; color: var(--muted); font-size: .85rem;
    background: rgba(13, 17, 24, .92); border: 1px solid var(--line);
}
.panel-handle:hover { color: var(--text); }
.team-panel.left .panel-handle { right: -30px; border-left: 0; border-radius: 0 10px 10px 0; }
.team-panel.right .panel-handle { left: -30px; border-right: 0; border-radius: 10px 0 0 10px; }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 16px 10px; }
.panel-title { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.panel-title.t { color: #f2c14e; }
.panel-title.ct { color: #5cc8ff; }
.panel-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 14px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }

.pcard {
    position: relative; flex: none; padding: 9px 10px 8px; cursor: pointer; overflow: hidden;
    background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 11px;
    transition: background .15s, border-color .15s, opacity .2s;
}
.pcard:hover { background: rgba(255, 255, 255, .075); }
.pcard.following { border-color: var(--accent); background: rgba(90, 169, 255, .09); }
.pcard.local::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, .6); }
.pcard.dead { opacity: .42; }

.pc-top { display: flex; align-items: center; gap: 8px; }
.pc-check { display: grid; margin: 0; }
.pc-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pc-name { flex: 1; min-width: 0; font-weight: 650; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.pc-money { font-size: .85rem; font-weight: 700; color: #7be495; font-variant-numeric: tabular-nums; }

.pc-mid { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.pc-avatar { position: relative; flex: none; width: 34px; height: 34px; border-radius: 7px; overflow: hidden; background: #1b222e; }
.pc-avatar img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.pc-avatar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1rem; color: #10141b; }
.pc-hp { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-hp small { margin-right: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.pc-hp b { font-size: 1.1rem; }
.pc-ammo { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-ammo small { margin-left: 1px; font-weight: 500; color: var(--muted); }
.pc-ammo.reload { color: var(--warn); }
.pc-gear { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 1.2rem; color: rgba(255, 255, 255, .7); }

.pc-slots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 9px; }
.slot {
    height: 27px; display: grid; place-items: center; overflow: hidden; white-space: nowrap;
    font-family: "WeaponIcons"; font-size: 19px; line-height: 1; color: rgba(255, 255, 255, .7);
    background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .07); border-radius: 6px;
}
.slot.active { color: #fff; background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .5); }
.pc-bar { height: 3px; margin-top: 8px; border-radius: 3px; background: rgba(255, 255, 255, .08); }
.pc-bar > i { display: block; height: 100%; width: 100%; border-radius: 3px; transform-origin: left; will-change: transform; }
.opt-title { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }

/* veil */
.veil { position: absolute; top: 0; bottom: 0; left: var(--pl); right: var(--pr); z-index: 8; display: grid; place-items: center; background: rgba(11, 14, 19, .55); transition: opacity .25s ease; padding: 16px; }
.veil.gone { opacity: 0; pointer-events: none; }
.veil-card { padding: 22px 28px; max-width: 360px; }

.dropdown-menu .form-check { margin-bottom: .45rem; }
.dropdown-menu .form-check:last-child { margin-bottom: 0; }

/* Small screens ----------------------------------------------------------- */
@media (max-width: 899px) {
    .team-panel { width: min(86vw, 310px); box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
    .hud-tc { top: calc(64px + var(--safe-t)); min-width: 0; width: calc(100% - 2 * var(--hud-gap)); max-width: 340px; left: 50%; }
    .tool { width: 34px; height: 34px; }
    .hud-tl .small { font-size: .72rem; }
}
@media (max-width: 560px) {
    /* the toolbar and the map chip must share one row */
    #btnCopy, #btnFull, .tool-sep { display: none !important; }
    .hud-tl #mapName { max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .hud-tl { padding: 6px 10px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .status-dot.live, #bomb.hot, .brand-mark::after { animation: none; }
}
