body {
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #050505;
    color: #ffffff;
}

#lobby-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #050505 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 60px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-item {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin: 0;
}

.nav-item:hover,
.nav-item.active {
    color: #00d2ff;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #00d2ff;
    box-shadow: 0 0 10px #00d2ff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.05);
}

#player-name {
    font-weight: 600;
    letter-spacing: 1px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #333;
    border-radius: 4px;
    border: 1px solid #555;
}

#character-preview-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#character-preview {
    height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(0, 210, 255, 0.2));
    animation: floating 6s ease-in-out infinite;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(15, 15, 25, 0.8);
    padding: 60px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 20px;
    text-align: center;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 40px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mode-card:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 210, 255, 0.2);
}

.mode-title {
    font-size: 24px;
    font-weight: 900;
    color: #fff;
}

.mode-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 40px;
    border-radius: 30px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #fff;
    color: #000;
}

#instructions,
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* Changed from flex to none */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 10;
    cursor: pointer;
    pointer-events: auto;
    /* Ensure it catches clicks */
}

#game-over {
    display: none;
    background: rgba(50, 0, 0, 0.8);
}

#instructions h1,
#game-over h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 5px;
}

p {
    font-size: 1.2rem;
    margin: 5px;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    /* Hidden until game starts */
}

#top-score-tile {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 25, 0.85);
    border: 2px solid #00d2ff;
    border-radius: 12px;
    padding: 10px 40px;
    color: #fff;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 4px;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4), inset 0 0 10px rgba(0, 210, 255, 0.2);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    z-index: 5;
    pointer-events: none;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
}

#hud-left {
    position: absolute;
    bottom: 40px;
    left: 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#hud-right {
    position: absolute;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

#health {
    color: #ff4444;
    font-size: 42px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
}

#money-display {
    color: #4ade80;
    font-size: 32px;
    font-weight: 800;
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
}

#kills-display {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.9;
}

#ammo-display {
    color: #fbbf24;
    font-size: 36px;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    background: white;
    border: none;
    border-radius: 5px;
    color: black;
    pointer-events: auto;
}

button:hover {
    background: #ccc;
}

.matchmaking-content {
    background: rgba(10, 10, 15, 0.95);
    border-color: #00d2ff;
    max-width: 500px;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 210, 255, 0.1);
    border-left-color: #00d2ff;
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.matchmaking-details {
    margin: 30px 0;
    font-family: 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.matchmaking-details p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
}

#current-mode-display,
#found-count,
#required-count {
    color: #00d2ff;
    font-weight: 700;
}

#matchmaking-status {
    color: #ffcc00;
}

/* Auth Modal Styles */
.auth-content {
    max-width: 450px;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(0, 210, 255, 0.5);
    box-shadow: 0 0 40px rgba(0, 210, 255, 0.2);
}

.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 15px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin: 0;
}

.auth-tab.active {
    color: #00d2ff;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #00d2ff;
    box-shadow: 0 0 10px #00d2ff;
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.auth-form.active {
    display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.auth-submit {
    margin-top: 10px;
    background: #00d2ff;
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.auth-submit:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.3);
}

#close-auth {
    margin-top: 30px;
}

/* Team Selection Styles */
.team-selection-content {
    max-width: 800px;
    background: rgba(10, 10, 15, 0.95);
    padding: 40px;
}

.team-selection-content h2 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 40px;
    letter-spacing: 3px;
}

.teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.team-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.terrorist-card {
    border-color: rgba(255, 100, 50, 0.5);
}

.terrorist-card:hover {
    background: rgba(255, 100, 50, 0.1);
    border-color: #ff6432;
    box-shadow: 0 10px 30px rgba(255, 100, 50, 0.3);
}

.ct-card {
    border-color: rgba(0, 150, 255, 0.5);
}

.ct-card:hover {
    background: rgba(0, 150, 255, 0.1);
    border-color: #0096ff;
    box-shadow: 0 10px 30px rgba(0, 150, 255, 0.3);
}

.team-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.team-card h3 {
    font-size: 24px;
    margin: 15px 0;
    letter-spacing: 2px;
}

.team-card p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 25px;
}

.team-select-btn {
    background: #00d2ff;
    color: #000;
    border: none;
    padding: 12px 40px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-select-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.remember-me input {
    cursor: pointer;
    accent-color: #00d2ff;
}

/* Buy Menu Styles */
/* --- LOBBY SHOP & COLLECTION PREMIUM STYLES --- */
.skin-card {
    border: 1px solid rgba(255, 0, 255, 0.2);
    background: rgba(255, 0, 255, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    padding: 15px !important;
}

.skin-card:hover {
    transform: translateY(-8px);
    border-color: #ff00ff !important;
    background: rgba(255, 0, 255, 0.1) !important;
    box-shadow: 0 15px 35px rgba(255, 0, 255, 0.2);
}

.active-skin {
    border: 2px solid #ff00ff !important;
    background: rgba(255, 0, 255, 0.15) !important;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.4), inset 0 0 15px rgba(255, 0, 255, 0.1);
}

.shop-content,
.collection-content {
    background: rgba(5, 5, 10, 0.95) !important;
    backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 0, 255, 0.3) !important;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 255, 0.1);
}

.collection-content {
    border-color: rgba(0, 255, 255, 0.3) !important;
}

.shop-header h2 {
    font-size: 36px;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.6);
}

.collection-content h2 {
    font-size: 36px;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
}

#lobby-mata-display {
    background: rgba(255, 0, 255, 0.1);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 0, 255, 0.3);
}

.buy-menu-content {
    max-width: 1000px;
    background: rgba(10, 10, 15, 0.95);
    padding: 30px;
}

.buy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.buy-header h2 {
    font-size: 28px;
    letter-spacing: 3px;
}

.buy-info {
    display: flex;
    gap: 30px;
    font-size: 20px;
    font-weight: 700;
}

#player-money {
    color: #4ade80;
}

#buy-timer {
    color: #fbbf24;
}

.buy-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.buy-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 1px;
}

.buy-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.buy-tab.active {
    background: #00d2ff;
    color: #000;
    border-color: #00d2ff;
}

.buy-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
}

.weapon-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.weapon-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00d2ff;
    transform: translateY(-2px);
}

.weapon-card.owned {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.weapon-card.cannot-afford {
    opacity: 0.4;
    cursor: not-allowed;
}

.weapon-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.weapon-price {
    color: #fbbf24;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.weapon-stats {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

#close-buy-menu {
    margin-top: 10px;
}

.logout-small {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid rgba(255, 68, 68, 0.4);
    font-size: 10px;
    padding: 4px 8px;
    margin-left: 10px;
    height: auto;
    color: white;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-small:hover {
    background: rgba(255, 68, 68, 0.8);
    border-color: #ff4444;
}

/* ── IN-GAME BUY MENU ── */
#ingame-buy-menu {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 800;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}
#ingame-buy-menu.open { display: flex; }

.buy-panel {
    width: 920px;
    max-width: 96vw;
    background: rgba(8,10,16,0.98);
    border: 1px solid rgba(0,210,255,0.22);
    border-radius: 14px;
    padding: 28px 28px 22px;
    box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 30px rgba(0,210,255,0.08);
}
.buy-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.buy-hint-text {
    font-size: 11px;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 4px;
}
.buy-title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 5px;
    color: #fff;
}
.buy-budget-block {
    text-align: right;
}
.buy-budget-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 3px;
}
#ingame-money {
    font-size: 30px;
    font-weight: 900;
    color: #4ade80;
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(74,222,128,0.35);
    transition: color 0.3s;
}
#ingame-money.spent { color: #ff4444; text-shadow: 0 0 12px rgba(255,68,68,0.4); }

#buy-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.ingame-tab {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.55);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}
.ingame-tab:hover { background: rgba(255,255,255,0.09); color: #fff; }
.ingame-tab.active {
    background: rgba(0,210,255,0.15);
    border-color: #00d2ff;
    color: #00d2ff;
}

#ingame-buy-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
    max-height: 390px;
    overflow-y: auto;
    padding-right: 4px;
}
#ingame-buy-items::-webkit-scrollbar { width: 4px; }
#ingame-buy-items::-webkit-scrollbar-track { background: transparent; }
#ingame-buy-items::-webkit-scrollbar-thumb { background: rgba(0,210,255,0.3); border-radius: 2px; }

.buy-item-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 8px;
    padding: 14px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.2s;
    cursor: default;
}
.buy-item-card:not(.disabled):hover {
    background: rgba(0,210,255,0.07);
    border-color: rgba(0,210,255,0.4);
    transform: translateY(-2px);
}
.buy-item-card.disabled { opacity: 0.32; }

.buy-item-side {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 2px 5px;
    border-radius: 3px;
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 2px;
}
.buy-item-side.t  { background: rgba(255,100,40,0.2);  color: #ff8040; border: 1px solid rgba(255,100,40,0.3); }
.buy-item-side.ct { background: rgba(40,120,255,0.2);  color: #60b0ff; border: 1px solid rgba(40,120,255,0.3); }

.buy-item-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.buy-item-price {
    font-size: 16px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251,191,36,0.25);
    margin-top: 2px;
}
.buy-item-btn {
    margin-top: 8px;
    padding: 6px 0;
    background: rgba(0,210,255,0.15);
    border: 1px solid rgba(0,210,255,0.35);
    color: #00d2ff;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.buy-item-btn:hover:not(:disabled) {
    background: #00d2ff;
    color: #000;
}
.buy-item-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}