* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #090b0f;
    color: #f2f4f8;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* ============================================================
   Лобби
   ============================================================ */

#lobby {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(
            circle at 50% 20%,
            #263447 0%,
            #101722 40%,
            #07090d 100%
        );
    z-index: 100;
}

.lobby-card {
    width: min(900px, 94vw);
    padding: 32px;
    border: 1px solid #39475b;
    border-radius: 18px;
    background: rgba(12, 17, 24, 0.93);
    box-shadow:
        0 30px 100px rgba(0, 0, 0, 0.55);
}

.lobby-title {
    margin: 0 0 6px;
    font-size: 38px;
    letter-spacing: -1px;
}

.lobby-subtitle {
    margin: 0 0 28px;
    color: #9ba9bb;
}

.lobby-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(260px, 0.8fr);
    gap: 24px;
}

.panel {
    padding: 20px;
    border-radius: 12px;
    background: #121923;
    border: 1px solid #263242;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: #9ba9bb;
    font-size: 13px;
}

.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #354458;
    background: #0a0f15;
    color: #fff;
    outline: none;
}

.field input:focus {
    border-color: #6e91bc;
}

.primary-button {
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-radius: 8px;
    background: #d8e5f4;
    color: #101820;
    font-weight: 700;
}

.primary-button:hover {
    background: #ffffff;
}

.secondary-button {
    padding: 9px 12px;
    border-radius: 7px;
    border: 1px solid #3a4a60;
    background: #161f2b;
    color: #dfe8f3;
}

.rooms {
    max-height: 300px;
    overflow: auto;
}

.room-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 11px;
    margin-bottom: 7px;
    border-radius: 7px;
    background: #0b1119;
    border: 1px solid #202d3c;
}

.room-row button {
    padding: 6px 9px;
    border-radius: 6px;
    border: 1px solid #42536a;
    background: #192332;
    color: white;
}

.lobby-error {
    min-height: 22px;
    margin-top: 12px;
    color: #ff8c8c;
    font-size: 14px;
}

/* ============================================================
   Игра
   ============================================================ */

#game {
    position: fixed;
    inset: 0;
}

#game canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================================
   Прицел
   ============================================================ */

#crosshair {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 20;
}

#crosshair::before,
#crosshair::after {
    content: "";
    position: absolute;
    background: rgba(255,255,255,.9);
}

#crosshair::before {
    width: 2px;
    height: 20px;
    left: 9px;
    top: 0;
}

#crosshair::after {
    width: 20px;
    height: 2px;
    left: 0;
    top: 9px;
}

/* ============================================================
   HUD
   ============================================================ */

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

#hud-bottom-left {
    position: absolute;
    left: 28px;
    bottom: 26px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-value {
    padding: 7px 11px;
    width: max-content;
    border-radius: 5px;
    background: rgba(5, 8, 12, .78);
    border: 1px solid rgba(255,255,255,.08);
    font-weight: 700;
    font-size: 16px;
}

#hud-hp {
    color: #73e38d;
}

#hud-armor {
    color: #83b7ff;
}

#hud-bottom-right {
    position: absolute;
    right: 28px;
    bottom: 26px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#hud-weapon {
    font-size: 20px;
}

#hud-ammo {
    font-size: 28px;
}

#hud-score {
    color: #aebbd0;
}

/* ============================================================
   Killfeed
   ============================================================ */

#killfeed {
    position: absolute;
    right: 20px;
    top: 24px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.killfeed-entry {
    padding: 7px 10px;
    border-radius: 5px;
    background: rgba(6, 9, 13, .72);
    border: 1px solid rgba(255,255,255,.06);
    font-size: 13px;
}

.kill-killer {
    color: #9ed4ff;
}

.kill-weapon {
    color: #f5d67b;
}

.kill-victim {
    color: #ff9999;
}

/* ============================================================
   Notice
   ============================================================ */

#notice {
    position: absolute;
    left: 50%;
    top: 70px;
    transform: translateX(-50%);
    padding: 9px 15px;
    border-radius: 7px;
    background: rgba(5,8,12,.88);
    border: 1px solid #334155;
    opacity: 0;
    transition: opacity .2s;
}

#notice.visible {
    opacity: 1;
}

/* ============================================================
   Смерть
   ============================================================ */

#death-screen {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    background: rgba(100, 0, 0, .18);
    z-index: 15;
}

.death-text {
    padding: 20px 30px;
    border-radius: 10px;
    background: rgba(10, 5, 5, .8);
    border: 1px solid rgba(255,100,100,.25);
    color: #ff8d8d;
    font-size: 28px;
    font-weight: 800;
}

/* ============================================================
   Reload
   ============================================================ */

#reload-indicator {
    position: absolute;
    left: 50%;
    top: calc(50% + 34px);
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 12px;
}

/* ============================================================
   Scoreboard
   ============================================================ */

#scoreboard {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,.58);
    z-index: 50;
}

.scoreboard-card {
    width: min(760px, 90vw);
    max-height: 80vh;
    overflow: auto;
    padding: 22px;
    border-radius: 12px;
    background: #101722;
    border: 1px solid #35465b;
}

.scoreboard-card h2 {
    margin: 0 0 16px;
}

.scoreboard-card table {
    width: 100%;
    border-collapse: collapse;
}

.scoreboard-card th,
.scoreboard-card td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid #273443;
}

.scoreboard-card th {
    color: #8998aa;
    font-size: 12px;
}

/* ============================================================
   Scope
   ============================================================ */

#scope {
    position: fixed;
    inset: 0;
    display: none;
    pointer-events: none;
    z-index: 30;
    background:
        radial-gradient(
            circle,
            transparent 0,
            transparent 30%,
            rgba(0,0,0,.88) 31%,
            rgba(0,0,0,.96) 100%
        );
}

#scope::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 60vw;
    height: 60vw;
    max-width: 760px;
    max-height: 760px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,.55);
    border-radius: 50%;
}

#scope::after {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    color: rgba(255,255,255,.75);
    font-size: 28px;
}

/* ============================================================
   Mobile / narrow
   ============================================================ */

@media (max-width: 760px) {
    .lobby-grid {
        grid-template-columns: 1fr;
    }

    .lobby-card {
        padding: 18px;
    }

    .lobby-title {
        font-size: 29px;
    }

    #killfeed {
        width: 260px;
    }
}
