/* Full Steam - Unified CSS Styles */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;500;600&display=swap');

:root {
    --primary-bg: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
    --card-bg: rgba(42, 42, 60, 0.9);
    --card-border: rgba(100, 200, 255, 0.3);
    --accent-blue: #7cb9e8;
    --accent-green: #5fc4b8;
    --accent-purple: #9b72cf;
    --accent-orange: #e8943a;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

/* === GLOBAL STYLES === */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--primary-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Exo 2', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 200, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Simplified background for game page */
body.game-page::before {
    background: linear-gradient(135deg, rgba(120, 119, 198, 0.1) 0%, transparent 30%, rgba(120, 200, 255, 0.05) 100%);
    will-change: auto;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes contentSlideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === TYPOGRAPHY (lobby pages) === */
h1 {
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 3em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

h2 {
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.8em;
    margin: 40px 0 25px 0;
    color: var(--accent-blue);
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
}

/* ===================================================================
   LOBBY STYLES (lobby.html)
   =================================================================== */

#lobby-wrapper {
    width: 100%;
    max-width: 900px;
    padding: 40px 20px;
    animation: fadeIn 0.8s ease-out;
}

.subtitle {
    text-align: center;
    font-size: 1.1em;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 300;
}

#stats-bar {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
}

.stat-item { text-align: center; flex: 1; }

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 2em;
    font-weight: 600;
    color: var(--accent-green);
    display: block;
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 5px;
}

#games-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 15px;
}

.game-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.game-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-green));
    opacity: 0;
}

.game-item:hover { border-color: var(--accent-blue); }
.game-item:hover::before { opacity: 1; }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.game-type {
    font-family: 'Orbitron', monospace;
    font-size: 1.4em;
    font-weight: 600;
    color: var(--accent-blue);
}

.game-status {
    background: var(--accent-green);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.game-status.full { background: var(--accent-orange); }

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item { display: flex; align-items: center; gap: 8px; }
.info-icon { width: 16px; height: 16px; opacity: 0.7; }
.info-label { font-size: 0.9em; color: var(--text-muted); }
.info-value { font-weight: 500; color: var(--text-secondary); }

.game-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.player-indicator { display: inline-flex; align-items: center; gap: 5px; }

.player-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
}

.player-dot.full { background: var(--accent-orange); }

#create-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 15px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--card-border);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* === LOBBY BUTTONS === */
.join-button, #create-buttons > button, #create-buttons .preset-btn-main {
    font-family: 'Exo 2', sans-serif;
    font-size: 1em;
    font-weight: 500;
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.spectate-button {
    background: linear-gradient(45deg, var(--accent-purple), #9333ea);
}

.join-button:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

.join-button:disabled:hover { box-shadow: none; }

/* ===================================================================
   GAME INFO OVERLAY (in-game help panel)
   =================================================================== */

#game-info-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(15, 15, 35, 0.95);
    display: none;
    z-index: 1000;
    overflow-y: auto;
    animation: overlayFadeIn 0.3s ease-out;
}

#game-info-content {
    max-width: 900px;
    margin: 50px auto;
    padding: 40px;
    background: rgba(42, 42, 60, 0.95);
    border: 2px solid rgba(100, 200, 255, 0.4);
    border-radius: 20px;
    color: var(--text-primary);
    animation: contentSlideIn 0.4s ease-out;
}

#game-info-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 25px;
    position: relative;
}

#game-info-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 150px; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(100, 200, 255, 0.8), transparent);
}

#game-info-header h1 {
    margin: 0 0 15px 0;
    color: var(--accent-gold);
    font-family: 'Orbitron', monospace;
    font-size: 2.8em;
    font-weight: 900;
    letter-spacing: 2px;
}

#game-info-header .game-mode-subtitle {
    color: var(--text-secondary);
    font-size: 1.3em;
    font-style: italic;
    font-weight: 300;
}

.info-section { margin-bottom: 30px; }

.info-section h2 {
    color: var(--accent-gold);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.5em;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.info-section h2::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 60px; height: 2px;
    background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.objective-text {
    font-size: 1.15em;
    line-height: 1.7;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-left: 4px solid var(--accent-gold);
    border-radius: 12px;
}

.team-objective { display: flex; gap: 20px; margin-bottom: 15px; }
.team-objective > div { flex: 1; padding: 20px; border-radius: 12px; }
.team1-objective { background: rgba(0, 114, 178, 0.1); border: 1px solid var(--team1-primary); }
.team2-objective { background: rgba(230, 159, 0, 0.1); border: 1px solid var(--team2-primary); }

.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

.controls-column h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--accent-blue);
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 1.2em;
}

.controls-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

.controls-table th,
.controls-table td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-table th {
    background: rgba(100, 200, 255, 0.1);
    color: var(--text-secondary);
    font-weight: 600;
    font-family: 'Orbitron', monospace;
    font-size: 0.9em;
}

.controls-table td { color: var(--text-muted); font-size: 0.95em; }
.controls-table tr:hover { background: rgba(255, 255, 255, 0.05); }

.close-hint {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 8px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95em;
}

/* ===================================================================
   GAME PAGE (game.html)
   =================================================================== */

/* Override base body for the full-screen game canvas */
body.game-page,
body.game-page html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #1a1a1a;
    font-family: 'Arial', sans-serif;
    /* reset lobby centering */
    display: block;
    min-height: unset;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* --- Loading screen --- */
#loading-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content { text-align: center; color: white; }

.loading-bar {
    width: 300px; height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #0072B2, #5fc4b8);
    width: 0%;
    transition: width 0.3s ease;
}

/* --- Game UI overlay --- */
#game-ui {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
}

#pixi-container { width: 100%; height: 100%; }

/* --- End-game scoreboard --- */
#scoreboard {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 20px;
    min-width: 400px;
    max-height: 80vh;
    color: white;
    pointer-events: all;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

#scoreboard-content {
    overflow-y: auto;
    max-height: calc(80vh - 100px);
    padding-right: 10px;
}

#scoreboard-content::-webkit-scrollbar { width: 8px; }
#scoreboard-content::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
#scoreboard-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 4px; }
#scoreboard-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5); }

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-family: 'Orbitron', monospace;
    font-size: 1.5em;
    font-weight: 700;
    color: rgba(100, 200, 255, 0.9);
}

#close-scoreboard {
    background: #e74c3c;
    border: none;
    color: white;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

/* --- Capture progress --- */
#capture-progress {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 30px;
    border-radius: 10px;
    color: white;
    text-align: center;
}

.capture-bar {
    position: relative;
    width: 300px; height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.capture-fill {
    height: 100%;
    background: linear-gradient(90deg, #0072B2, #5fc4b8);
    width: 0%;
    transition: width 0.1s ease;
}

.capture-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* --- Death / respawn screen --- */
#death-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all;
}

.death-content {
    background: rgba(20, 20, 20, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    border: 2px solid #e74c3c;
}

#respawn-timer { margin-top: 20px; font-size: 18px; color: #f39c12; }

/* ===================================================================
   SPECTATOR MODE
   =================================================================== */

#spectator-hud { display: none; pointer-events: none; }

.spectator-banner {
    position: fixed;
    top: 80px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #56B4E9;
    border-radius: 8px;
    padding: 10px 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    font-family: 'Arial', sans-serif;
    z-index: 1000;
    pointer-events: all;
}

.spectator-icon { font-size: 24px; }

.spectator-label {
    font-size: 18px;
    font-weight: bold;
    color: #56B4E9;
    text-shadow: 0 0 10px #56B4E9;
}

.spectator-count { font-size: 14px; color: #888; }

.spectator-controls {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #56B4E9;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    gap: 20px;
    z-index: 1000;
    pointer-events: all;
}

.camera-mode, .following-player {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.spectator-controls button {
    background: #56B4E9;
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.spectator-controls button:hover { background: #3d9cd6; }

.spectator-player-list {
    position: fixed;
    right: 20px; top: 80px;
    width: 300px;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #56B4E9;
    border-radius: 8px;
    padding: 10px;
    z-index: 999;
    pointer-events: all;
}

.spectator-player-list h3 {
    margin: 0 0 10px 0;
    color: #56B4E9;
    font-size: 16px;
    text-align: center;
}

.spectator-team { margin-bottom: 15px; }

.spectator-team h4 {
    margin: 5px 0;
    color: #888;
    font-size: 14px;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}

.spectator-player-item {
    padding: 8px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    color: white;
    font-size: 13px;
}

.spectator-player-item:hover { background: rgba(86, 180, 233, 0.2); }
.spectator-player-item.following { background: rgba(86, 180, 233, 0.3); border: 1px solid #56B4E9; }

.player-name { font-weight: bold; margin-bottom: 5px; }

.player-health-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 5px 0;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FFC300, #00B4D8);
    transition: width 0.2s;
}

.player-weapon { font-size: 11px; color: #888; }

.spectator-player-list::-webkit-scrollbar { width: 6px; }
.spectator-player-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.spectator-player-list::-webkit-scrollbar-thumb { background: rgba(86, 180, 233, 0.5); border-radius: 3px; }

/* ===================================================================
   LOADOUT MODAL
   =================================================================== */

/* --- Name picker (lives in column 1 of the customization grid) --- */
#name-picker { margin-bottom: 10px; }

#name-picker h3 {
    color: #5fc4b8;
    margin: 0 0 8px 0;
    font-size: 1.05em;
    text-align: center;
}

.name-picker-row { display: flex; gap: 6px; align-items: center; }

#name-select {
    flex: 1;
    padding: 6px 8px;
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85em;
    cursor: pointer;
    appearance: auto;
    min-width: 0;
}

#name-select:focus { outline: none; border-color: #5fc4b8; }

#name-randomize {
    padding: 6px 10px;
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.15s ease;
    flex-shrink: 0;
}

#name-randomize:hover { border-color: #5fc4b8; }

/* --- Modal shell --- */
#loadout-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 5000;
    pointer-events: all;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

#loadout-modal.visible { display: flex; }

#loadout-modal .modal-content {
    background: rgba(20, 20, 20, 0.97);
    border: 2px solid #5fc4b8;
    border-radius: 12px;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    color: white;
    font-family: 'Arial', sans-serif;
    box-shadow: 0 10px 50px rgba(95, 196, 184, 0.25);
}

#loadout-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
}

#loadout-modal .modal-header h2 { margin: 0; color: #5fc4b8; font-size: 1.6em; }

#loadout-modal .modal-banner {
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid #ffaa00;
    color: #ffaa00;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.95em;
    display: none;
}

#loadout-modal .modal-banner.visible { display: block; }

#loadout-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333;
    align-items: center;
}

#loadout-modal #lobby-countdown { color: #aaa; font-size: 0.95em; margin-right: auto; }

#loadout-modal #ready-up {
    padding: 14px 36px;
    font-size: 1.1em;
    font-weight: bold;
    background: linear-gradient(45deg, #5fc4b8, #3db3a8);
    border: none;
    border-radius: 8px;
    color: #000;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 15px rgba(95, 196, 184, 0.3);
}

#loadout-modal #ready-up:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(95, 196, 184, 0.45);
}

#loadout-modal #ready-up:disabled { background: #555; color: #999; cursor: not-allowed; box-shadow: none; }

/* --- Customization grid (4 columns) --- */
#loadout-modal .customization-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

@media (max-width: 1200px) {
    #loadout-modal .customization-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    #loadout-modal .customization-grid { grid-template-columns: minmax(0, 1fr); }
}

#loadout-modal .customization-section {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 14px;
    min-width: 0;
    box-sizing: border-box;
}

#loadout-modal .customization-section h3 {
    color: #5fc4b8;
    margin: 0 0 12px 0;
    text-align: center;
    font-size: 1.05em;
}

/* --- Munitions section: single-select dropdowns (ordnance + utility) --- */
#loadout-modal .loadout-select {
    width: 100%;
    padding: 6px 8px;
    background: #1a1a1a;
    border: 2px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85em;
    cursor: pointer;
    appearance: auto;
    box-sizing: border-box;
}
#loadout-modal .loadout-select:focus { outline: none; border-color: #5fc4b8; }

#loadout-modal .munitions-field { margin-bottom: 16px; }
#loadout-modal .munitions-field:last-child { margin-bottom: 0; }
#loadout-modal .munitions-label {
    display: block;
    color: #aaa;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 4px;
}
#loadout-modal .munitions-detail {
    color: #888;
    font-size: 0.75em;
    line-height: 1.35;
    margin-top: 5px;
    min-height: 2.4em;
}

/* Resulting Stats pinned as the right rail (only in the 4-column layout, so it
   stays visible without scrolling; auto-flows normally on narrower screens). */
@media (min-width: 1201px) {
    #loadout-modal .customization-section.rs-rail {
        position: sticky;
        top: 0;
        align-self: start;
    }
}

/* --- Point tracker (single line) --- */
#loadout-modal .point-tracker {
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 8px 0;
    margin-bottom: 12px;
}

#loadout-modal .point-status-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    white-space: nowrap;
    flex-wrap: nowrap;
    overflow: hidden;
}

#loadout-modal .pt-allocation {
    display: inline-flex;
    align-items: baseline;
    flex-shrink: 0;
    white-space: nowrap;
}

#loadout-modal .pt-used {
    font-size: 1.15em;
    font-weight: bold;
    display: inline-block;
    min-width: 3ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

#loadout-modal .pt-sep   { color: #666; margin: 0 1px; }
#loadout-modal .pt-max   { font-weight: bold; color: #aaa; display: inline-block; min-width: 3ch; font-variant-numeric: tabular-nums; }
#loadout-modal .pt-label { color: #aaa; margin-right: 4px; }

#loadout-modal .points-over  { color: #ff4444; }
#loadout-modal .points-under { color: #ffaa00; }
#loadout-modal .points-used  { color: #5fc4b8; }

#loadout-modal .alloc-icon {
    font-size: 1em;
    display: inline-block;
    width: 1.4em;
    text-align: center;
    flex-shrink: 0;
}
#loadout-modal .alloc-perfect { color: #5fc4b8; }
#loadout-modal .alloc-under   { color: #ffaa00; }
#loadout-modal .alloc-over    { color: #ff4444; }

#loadout-modal .pt-breakdown-label { color: #888; margin-left: 6px; flex-shrink: 0; }
#loadout-modal .pt-breakdown-value {
    color: #fff;
    font-weight: bold;
    margin-right: 2px;
    display: inline-block;
    min-width: 2ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#loadout-modal .hidden { display: none; }

/* --- Resulting Stats panel (server-resolved) --- */
#loadout-modal .resolved-stats {
    font-size: 0.85em;
    color: #ddd;
}

#loadout-modal .rs-section {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #333;
}
#loadout-modal .rs-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#loadout-modal .rs-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
}
#loadout-modal .rs-label { color: #aaa; }
#loadout-modal .rs-val   { color: #fff; font-weight: bold; text-align: right; }

#loadout-modal .rs-derived .rs-val { color: #5fc4b8; }

#loadout-modal .rs-subhead {
    color: #5fc4b8;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

/* Muted "(base …)" note shown next to a coupled attribute's value */
#loadout-modal .coupling-tag {
    font-size: 0.8em;
    font-weight: normal;
    color: #888;
    margin-left: 4px;
    white-space: nowrap;
}

/* Active-couplings list */
#loadout-modal .rs-coupling {
    padding: 2px 0;
    font-size: 0.9em;
}
#loadout-modal .rs-coupling.up   { color: #5fc4b8; }
#loadout-modal .rs-coupling.down { color: #ff8866; }
#loadout-modal .rs-coupling.none { color: #666; font-style: italic; }

#loadout-modal .rs-budget {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #333;
    text-align: center;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}
#loadout-modal .rs-budget.ok   { color: #5fc4b8; }
#loadout-modal .rs-budget.over { color: #ff4444; }

/* --- Weapon presets --- */
#loadout-modal .preset-section {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 12px;
}

#loadout-modal .preset-section h3 {
    color: #5fc4b8;
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 1em;
}

#loadout-modal .preset-tabs {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 2px solid #444;
}

#loadout-modal .preset-tab {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 0.9em;
}

#loadout-modal .preset-tab.active { background: #5fc4b8; color: #000; font-weight: bold; }
#loadout-modal .preset-tab:hover:not(.active) { background: rgba(255, 255, 255, 0.1); color: #fff; }
#loadout-modal .preset-category { display: none; }
#loadout-modal .preset-category.active { display: block; }

#loadout-modal .preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

#loadout-modal .preset-button {
    background: linear-gradient(45deg, #333, #555);
    border: 2px solid #666;
    border-radius: 5px;
    color: #fff;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 0.85em;
}

#loadout-modal .preset-button:hover { border-color: #5fc4b8; transform: translateY(-1px); }
#loadout-modal .preset-name { font-weight: bold; margin-bottom: 2px; }
#loadout-modal .preset-points { color: #ffaa00; font-size: 0.85em; }

/* --- Attribute sliders --- */
#loadout-modal .attribute-slider { margin-bottom: 10px; }

/* Attribute gated off for the current ordnance (e.g. KNOCKBACK on a beam) */
#loadout-modal .attribute-slider.disabled { opacity: 0.4; cursor: not-allowed; }
#loadout-modal .attribute-slider.disabled .slider { cursor: not-allowed; }

#loadout-modal .attribute-slider label {
    display: block;
    color: #fff;
    font-size: 0.85em;
    margin-bottom: 4px;
}

#loadout-modal .slider-container { display: flex; align-items: center; gap: 8px; }

#loadout-modal .slider {
    flex: 1;
    height: 5px;
    background: #333;
    border-radius: 3px;
    -webkit-appearance: none;
}

#loadout-modal .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: #5fc4b8;
    border-radius: 50%;
    cursor: pointer;
}

#loadout-modal .slider::-moz-range-thumb {
    width: 16px; height: 16px;
    background: #5fc4b8;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#loadout-modal .slider-value {
    color: #5fc4b8;
    font-weight: bold;
    min-width: 52px;
    text-align: right;
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
}

/* --- Effect / ordinance / utility options --- */
#loadout-modal .effect-checkbox,
#loadout-modal .ordinance-option,
#loadout-modal .utility-weapon-option {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    cursor: pointer;
}

#loadout-modal .effect-checkbox:hover,
#loadout-modal .ordinance-option:hover,
#loadout-modal .utility-weapon-option:hover { background: rgba(255, 255, 255, 0.1); }

/* Effect disabled for the current ordnance (e.g. HOMING on a beam weapon) */
#loadout-modal .effect-checkbox.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}
#loadout-modal .effect-checkbox.disabled:hover { background: rgba(255, 255, 255, 0.02); }
#loadout-modal .effect-checkbox.disabled input { cursor: not-allowed; }

#loadout-modal .effect-checkbox input,
#loadout-modal .ordinance-option input,
#loadout-modal .utility-weapon-option input { margin-right: 8px; transform: scale(1.1); }

#loadout-modal .effect-info,
#loadout-modal .ordinance-info,
#loadout-modal .utility-info { flex: 1; }

#loadout-modal .effect-name,
#loadout-modal .ordinance-name,
#loadout-modal .utility-name { color: #fff; font-weight: bold; font-size: 0.85em; }

#loadout-modal .effect-description,
#loadout-modal .ordinance-description,
#loadout-modal .utility-description { color: #ccc; font-size: 0.75em; margin-top: 2px; }

#loadout-modal .effect-cost,
#loadout-modal .ordinance-cost,
#loadout-modal .utility-cooldown { color: #ffaa00; font-weight: bold; font-size: 0.85em; }

#loadout-modal .utility-category { color: #5fc4b8; font-weight: bold; font-size: 0.75em; }

#loadout-modal .loading { text-align: center; color: #5fc4b8; font-size: 1.1em; padding: 30px; }

/* ===================================================================
   JOIN-REJECTED OVERLAY
   =================================================================== */

#join-rejected {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 6000;
    pointer-events: all;
}

#join-rejected.visible { display: flex; }

#join-rejected .panel {
    background: rgba(20, 20, 20, 0.97);
    border: 2px solid #ff4444;
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    color: white;
    max-width: 480px;
}

#join-rejected h2 { color: #ff4444; margin: 0 0 12px 0; }
#join-rejected p  { color: #ccc; margin: 0 0 20px 0; }

#join-rejected button {
    padding: 10px 28px;
    background: #5fc4b8;
    border: none;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
}

/* ===================================================================
   GAME EVENT FEED  (top-right toast notifications)
   =================================================================== */

#game-events {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 380px;
    max-width: 35vw;
    z-index: 1000;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

@keyframes game-event-enter {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes game-event-exit {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px) scale(0.95); }
}

.game-event {
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 4px;
    font-weight: 500;
    text-align: left;
    font-size: 12px;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    max-width: 100%;
    word-wrap: break-word;
    animation: game-event-enter 0.3s ease-out forwards;
}

.game-event.removing {
    animation: game-event-exit 0.3s ease-in forwards;
    pointer-events: none;
}

.game-event.event-kill        { border-left: 3px solid rgba(230, 126, 34, 0.7); }
.game-event.event-capture     { border-left: 3px solid rgba(46, 196, 182, 0.7); }
.game-event.event-system      { border-left: 3px solid rgba(255, 170, 0, 0.6); }
.game-event.event-warning     { border-left: 3px solid rgba(255, 136, 0, 0.6); }
.game-event.event-info        { border-left: 3px solid rgba(0, 170, 255, 0.6); }
.game-event.event-achievement {
    border-left: 3px solid rgba(255, 215, 0, 0.6);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(0, 0, 0, 0.85));
}

/* ===================================================================
   SHARED SCOREBOARD UTILITIES
   =================================================================== */

@keyframes score-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.scores-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Team header row inside scoreboard */
.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 4px solid transparent; /* color set inline (team colour) */
}

.team-header-name {
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    /* color set inline (team colour) */
}

.team-header-stats {
    display: flex;
    gap: 20px;
    color: #ccc;
    font-size: 16px;
    font-weight: bold;
}

/* Per-player score row */
.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid transparent; /* color set inline (team colour) */
}

.score-row.local-player {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 215, 0, 0.6) !important;
}

.score-row-name {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
    /* color set inline */
}

.score-row-stats {
    display: flex;
    gap: 20px;
    color: #ccc;
    font-size: 14px;
}

/* Stat colours shared by game-over rows */
.stat-kills    { color: #60a5fa; }
.stat-deaths   { color: #fb923c; }
.stat-kd       { color: #fbbf24; }
.stat-captures { color: #FFD700; }
.stat-score    { color: #FFD700; font-weight: bold; font-size: 20px; }
.stat-placement { color: #FFD700; font-weight: bold; font-size: 18px; }

/* ===================================================================
   GAME OVER OVERLAY
   =================================================================== */

#game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#game-over-overlay.visible { display: flex; }

.game-over-content {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.98), rgba(50, 50, 70, 0.98));
    border: 3px solid #FFD700;
    border-radius: 15px;
    padding: 50px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.3);
    text-align: center;
}

.game-over-title {
    color: #FFD700;
    font-size: 48px;
    margin: 0 0 20px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: score-pulse 2s ease-in-out infinite;
}

.game-over-message {
    color: #fff;
    font-size: 24px;
    margin: 20px 0 40px;
    font-weight: bold;
}

.game-over-vc-info {
    color: #aaa;
    font-size: 16px;
    margin: 0 0 30px;
}

.final-scores-title {
    color: #FFD700;
    font-size: 28px;
    margin: 30px 0 20px;
}

.final-scores-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.final-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid transparent; /* color set inline (rank colour) */
}

.final-score-row.rank-1      { background: rgba(255, 215, 0, 0.15); }

.final-score-row.local-player {
    background: rgba(255, 215, 0, 0.25) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.7) !important;
}

.final-score-name-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.rank-badge { font-size: 24px; min-width: 40px; }

.final-score-name {
    font-size: 20px;
    font-weight: bold;
    /* color set inline */
}

.final-score-stats {
    display: flex;
    gap: 25px;
    color: #ccc;
    font-size: 16px;
}

.lobby-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 30px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.lobby-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 768px) {
    /* Lobby */
    #lobby-wrapper { padding: 20px 15px; }
    h1 { font-size: 2.2em; }
    #stats-bar { flex-direction: column; gap: 15px; }
    .game-header { flex-direction: column; gap: 10px; }
    .game-info { grid-template-columns: 1fr; }
    .game-actions { justify-content: stretch; }
    .join-button, .spectate-button { flex: 1; }

    /* Game info overlay */
    .controls-grid { grid-template-columns: 1fr; gap: 15px; }
}

@media (max-width: 480px) {
    #scoreboard { min-width: unset; width: 95vw; }
}

/* ===================================================================
   GAME START COUNTDOWN BANNER
   =================================================================== */

#game-start-banner {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 450;
    pointer-events: none;
    background: rgba(12, 18, 32, 0.92);
    border: 2px solid #ffaa00;
    box-shadow: 0 0 25px rgba(255, 170, 0, 0.4);
    border-radius: 12px;
    padding: 12px 30px;
    text-align: center;
    backdrop-filter: blur(8px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#game-start-banner .game-start-label {
    color: #ffcc00;
    font-size: 0.95em;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#game-start-banner .game-start-countdown {
    color: #ffffff;
    font-size: 2.8em;
    font-weight: 900;
    margin: 2px 0;
    text-shadow: 0 0 12px rgba(255, 200, 0, 0.8);
    font-family: monospace, sans-serif;
}

#game-start-banner .game-start-sub {
    color: #cccccc;
    font-size: 0.85em;
}
