/* ───────────────────────────────────────────────────────────────────────────
   Eclipse Services - Live Radar
   Dark / purple theme
   ─────────────────────────────────────────────────────────────────────────── */

:root {
    --bg-0:       #000000;
    --bg-1:       #000000;
    --panel:      rgba(20, 20, 20, 0.55);
    --panel-2:    rgba(20, 20, 20, 0.6);
    --stroke:     rgba(196, 0, 255, 0.35);
    --stroke-2:   rgba(196, 0, 255, 0.18);
    --text:       #ffffff;
    --text-dim:   #d1d5db;
    --text-faint: #9ca3af;
    --accent:     #c400ff;
    --accent-2:   #e879f9;
    --accent-3:   #c026ff;
    --ok:         #34d399;
    --warn:       #fbbf24;
    --bad:        #f87171;
    --radius:     18px;
    --radius-sm:  10px;
    --font:       "Rubik", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1100px 700px at 80% -10%, rgba(196, 0, 255, 0.18), transparent 60%),
        radial-gradient(900px 700px at -10% 110%, rgba(74, 0, 104, 0.28), transparent 55%),
        linear-gradient(160deg, var(--bg-1), var(--bg-0));
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── ambient glows ────────────────────────────────────────────────────────── */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .5;
    pointer-events: none;
    z-index: 0;
}
.bg-glow-a {
    width: 420px; height: 420px;
    background: rgba(196, 0, 255, 0.22);
    top: -120px; left: 50%;
    transform: translateX(-50%);
    animation: driftA 14s ease-in-out infinite;
}
.bg-glow-b {
    width: 380px; height: 380px;
    background: rgba(74, 0, 104, 0.3);
    bottom: -140px; left: -80px;
    animation: driftB 18s ease-in-out infinite;
}
@keyframes driftA {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-42%) translateY(26px); }
}
@keyframes driftB {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(70px, -24px); }
}

/* ── top bar ──────────────────────────────────────────────────────────────── */
.topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--stroke-2);
    background: rgba(10, 7, 20, 0.5);
    backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    color: var(--accent-2);
    background: linear-gradient(135deg, rgba(196, 0, 255, 0.28), rgba(196, 0, 255, 0.06));
    border: 1px solid var(--stroke);
    border-radius: 12px;
    box-shadow: 0 0 22px rgba(196, 0, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; letter-spacing: .5px; }
.brand-name em {
    font-style: normal;
    background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 2.5px; text-transform: uppercase; }

.status {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-dim);
    background: var(--panel-2);
    border: 1px solid var(--stroke-2);
    border-radius: 999px;
    padding: 7px 14px;
}
.status-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 10px var(--warn);
    transition: background .3s, box-shadow .3s;
}
.status.live .status-dot  { background: var(--ok);  box-shadow: 0 0 10px var(--ok); }
.status.dead .status-dot  { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.status.conn .status-dot  { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ── layout ───────────────────────────────────────────────────────────────── */
.layout {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 26px 28px 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
}
.radar-col { display: flex; justify-content: center; }
.side-col  { display: flex; flex-direction: column; gap: 18px; }

.screen { display: flex; align-items: center; justify-content: center; }
.screen.hidden { display: none; }
.layout:has(.screen) { display: flex; min-height: calc(100vh - 73px); }

/* ── panels / cards ───────────────────────────────────────────────────────── */
.panel {
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.gate {
    width: min(430px, 92vw);
    padding: 40px 36px 34px;
    text-align: center;
}
.gate h1 {
    font-size: 22px;
    margin: 18px 0 8px;
    background: linear-gradient(90deg, var(--text), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.gate p { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin-bottom: 22px; }
.gate-icon {
    width: 84px; height: 84px;
    margin: 0 auto;
    display: grid; place-items: center;
    color: var(--accent-2);
    background: linear-gradient(135deg, rgba(196, 0, 255, 0.22), rgba(196, 0, 255, 0.04));
    border: 1px solid var(--stroke);
    border-radius: 26px;
    box-shadow: 0 0 30px rgba(196, 0, 255, 0.3);
}
.gate .field {
    display: flex; gap: 10px;
    margin-bottom: 10px;
}
.gate input {
    flex: 1;
    min-width: 0;
    background: rgba(7, 5, 14, 0.75);
    color: var(--text);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.gate input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 0, 255, 0.18);
}

/* ── buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7a00a8);
    color: #fff;
    box-shadow: 0 8px 24px rgba(122, 0, 168, 0.45);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(196, 0, 255, 0.55); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--stroke);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 8px 12px; border-radius: 8px; }

/* ── username suggestions ─────────────────────────────────────────────────── */
.suggest {
    margin-top: 8px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    background: rgba(10, 7, 20, 0.9);
    max-height: 260px;
    overflow-y: auto;
    text-align: left;
}
.suggest .sug-row {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.suggest .sug-row:hover, .suggest .sug-row.active { background: rgba(196, 0, 255, 0.16); }
.suggest .sug-head {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--stroke-2);
    display: grid; place-items: center;
    color: var(--text-faint);
    font-size: 11px;
    overflow: hidden;
}
.suggest .sug-head img { width: 100%; height: 100%; object-fit: cover; display: block; }
.suggest .sug-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .sug-you { color: var(--accent-2); font-size: 12px; }
.suggest .empty { padding: 14px; color: var(--text-faint); font-size: 13px; text-align: center; }

/* ── radar canvas ─────────────────────────────────────────────────────────── */
.radar-panel {
    position: relative;
    width: min(640px, 100%);
    aspect-ratio: 1 / 1;
    padding: 0;
    overflow: hidden;
}
.radar-panel canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
}
.radar-overlay {
    position: absolute;
    inset: 0;
    padding: 16px;
    pointer-events: none;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
}
.you-pill {
    background: rgba(10, 7, 20, 0.75);
    border: 1px solid var(--accent);
    color: var(--accent-3);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12.5px;
    box-shadow: 0 0 18px rgba(196, 0, 255, 0.35);
}
.you-pill b { color: #fff; font-weight: 600; }

/* ── player list ──────────────────────────────────────────────────────────── */
.list-panel {
    display: flex;
    flex-direction: column;
    max-height: 560px;
    overflow: hidden;
}
.list-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--stroke-2);
}
.list-head h2 { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.count {
    display: inline-grid; place-items: center;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    font-size: 12px;
    color: var(--accent-2);
    background: rgba(196, 0, 255, 0.16);
    border: 1px solid var(--stroke);
    border-radius: 999px;
}
.player-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}
.player-list::-webkit-scrollbar, .suggest::-webkit-scrollbar { width: 7px; }
.player-list::-webkit-scrollbar-thumb, .suggest::-webkit-scrollbar-thumb {
    background: rgba(196, 0, 255, 0.35);
    border-radius: 4px;
}
.pl-row {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background .15s;
}
.pl-row:hover { background: rgba(196, 0, 255, 0.1); }
.pl-row.me { background: rgba(196, 0, 255, 0.18); border: 1px solid var(--stroke); }
.pl-head {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--stroke-2);
    display: grid; place-items: center;
    color: var(--text-faint); font-size: 11px;
    overflow: hidden;
}
.pl-head img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-info { flex: 1; min-width: 0; }
.pl-name {
    font-size: 13.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-name .tag-host { color: var(--accent-2); font-size: 10.5px; margin-left: 6px; letter-spacing: 1px; }
.pl-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.pl-dist { font-size: 11px; color: var(--text-faint); }
.hp { flex: 1; max-width: 90px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.hp > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #16a34a); border-radius: 3px; }
.hp > i.low { background: linear-gradient(90deg, var(--bad), #b91c1c); }

.list-foot {
    padding: 10px 18px 14px;
    border-top: 1px solid var(--stroke-2);
    font-size: 12px;
    color: var(--text-faint);
}

/* ── legend ───────────────────────────────────────────────────────────────── */
.legend-panel { padding: 16px 18px; }
.legend-panel h3 {
    font-size: 12px; text-transform: uppercase; letter-spacing: 2px;
    color: var(--text-faint); margin-bottom: 10px;
}
.legend-panel ul { list-style: none; }
.legend-panel li {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-dim);
    padding: 4px 0;
}
.swatch { width: 12px; height: 12px; border-radius: 50%; }
.swatch-you   { background: #e879f9; box-shadow: 0 0 8px #e879f9; border: 2px solid #fff; }
.swatch-host  { background: #ffffff; }
.swatch-enemy { background: #f87171; }

/* ── errors ───────────────────────────────────────────────────────────────── */
.form-err {
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: var(--bad);
    font-size: 13px;
    text-align: left;
}

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .side-col { order: 2; }
    .list-panel { max-height: 380px; }
}
