/* Global CSS Variables & Theme Setup */
:root {
    --bg-dark: #070714;
    --panel-bg: rgba(13, 13, 35, 0.55);
    --card-bg: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    
    --blue-neon: #00a2ff;
    --blue-neon-glow: rgba(0, 162, 255, 0.4);
    --blue-neon-dark: #005a96;
    
    --red-neon: #ff3b30;
    --red-neon-glow: rgba(255, 59, 48, 0.4);
    --red-neon-dark: #99140e;
    
    --yellow-neon: #ffea00;
    --yellow-glow: rgba(255, 234, 0, 0.4);
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-ui: 'Outfit', sans-serif;
    --font-digit: 'Orbitron', sans-serif;
    --font-retro: 'Press Start 2P', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevents text selection dragging in games */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden; /* Desktop app layout */
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background Animations */
#stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
                radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px);
    background-size: 550px 550px, 350px 350px;
    background-position: 0 0, 40px 60px;
    opacity: 0.25;
    z-index: -2;
    animation: starsRotate 240s linear infinite;
}

#nebula {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, rgba(0, 162, 255, 0.15) 0%, transparent 60%),
                radial-gradient(circle at 80% 70%, rgba(255, 59, 48, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    z-index: -1;
    filter: blur(40px);
}

@keyframes starsRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* General Layout Components */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.02);
}

.glass-card:hover {
    border-color: var(--border-hover);
}

/* Custom Buttons */
.btn {
    font-family: var(--font-ui);
    font-weight: 600;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.5);
    filter: brightness(1.1);
}
.primary-btn:active {
    transform: translateY(1px);
}
.primary-btn:disabled {
    background: var(--text-muted);
    color: rgba(255,255,255,0.4);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    filter: none;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}
.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Colors and Text Highlights */
.blue-text { color: var(--blue-neon); text-shadow: 0 0 8px var(--blue-neon-glow); }
.red-text { color: var(--red-neon); text-shadow: 0 0 8px var(--red-neon-glow); }
.glow-yellow { color: var(--yellow-neon); text-shadow: 0 0 8px var(--yellow-glow); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-glow { text-shadow: 0 0 15px currentColor; }

/* Lobby Screen Styling */
#lobby-screen {
    width: 90%;
    max-width: 1100px;
    margin: 4vh auto;
    padding: 20px;
    display: none;
    flex-direction: column;
    height: 92vh;
    overflow: hidden;
}
#lobby-screen.active {
    display: flex;
}

.lobby-header {
    text-align: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.game-title {
    font-family: var(--font-digit);
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(to right, var(--blue-neon), #bf5af2, var(--red-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4));
}
.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 6px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.lobby-setup {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    flex-shrink: 0;
}
.lobby-team-score {
    font-family: var(--font-digit);
    font-size: 1.2rem;
}
.lobby-team-record {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-left: 6px;
    white-space: nowrap;
}
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 65%;
}
.input-group label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}
.input-group input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    color: white;
    font-size: 1.1rem;
    font-family: var(--font-ui);
    letter-spacing: 1px;
    transition: all 0.2s ease;
}
.input-group input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 8px rgba(124,58,237,0.3);
}

.lobby-room-selector {
    margin: 0 16px 14px 16px;
    padding: 10px 12px;
    flex-shrink: 0;
}
.room-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.room-selector-title {
    font-family: var(--font-digit);
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.game-room-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.game-room-tab {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    align-items: center;
    min-height: 54px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-ui);
    text-align: left;
}
.game-room-tab:hover {
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.05);
}
.game-room-tab.active {
    border-color: #7c3aed;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
}
.room-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room-count {
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.room-score {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-family: var(--font-digit);
    font-size: 0.75rem;
}

.lobby-columns {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 16px;
    flex: 1;
    min-height: 0; /* Critical for scrollable chat child */
    overflow: hidden;
}

.team-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.team-title {
    font-family: var(--font-digit);
    font-size: 1.3rem;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.slot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.slot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    transition: all 0.15s ease;
}
.slot-item.occupied {
    background: rgba(255,255,255,0.02);
}
.slot-item.my-slot {
    border-color: #7c3aed;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
}
.slot-num {
    font-family: var(--font-digit);
    font-weight: 700;
    color: var(--text-secondary);
}
.slot-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}
.claim-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Chat Styling */
.lobby-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chat-title {
    font-family: var(--font-digit);
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}
.chat-msg {
    line-height: 1.4;
    word-break: break-word;
}
.chat-msg-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 6px;
}
.chat-msg-sender {
    font-weight: 700;
}

.chat-input-bar {
    display: flex;
    gap: 8px;
}
.chat-input-bar input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    color: white;
    font-family: var(--font-ui);
}
.chat-input-bar input:focus {
    outline: none;
    border-color: #7c3aed;
}

.lobby-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
    padding-top: 16px;
    flex-shrink: 0;
}
.lobby-footer p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.large-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-family: var(--font-digit);
}

/* Game Screen Grid Layout */
#game-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}
#game-screen.active {
    display: flex;
}

/* HUD Bar */
.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 9999;
    padding: 0 24px;
    border-radius: 0 0 12px 12px;
    margin-bottom: 8px;
    border-top: none;
}
.hud-section {
    display: flex;
    align-items: center;
    gap: 12px;
}
.team-score {
    width: 180px;
}
.blue-hud-score { justify-content: flex-start; }
.red-hud-score { justify-content: flex-end; }

.hud-label {
    font-family: var(--font-digit);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px;
}
.hud-value {
    font-family: var(--font-digit);
    font-weight: 900;
    font-size: 2rem;
}

.digital-clock {
    font-family: var(--font-digit);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.orb-indicators-container {
    display: flex;
    gap: 8px;
}
.orb-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4a4a5a;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-digit);
    font-size: 0.7rem;
    font-weight: 900;
    color: white;
    cursor: default;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1);
}
.orb-indicator.blue {
    background: var(--blue-neon);
    box-shadow: 0 0 10px var(--blue-neon);
    border-color: #9cd4ff;
}
.orb-indicator.red {
    background: var(--red-neon);
    box-shadow: 0 0 10px var(--red-neon);
    border-color: #ff9d99;
}

/* Main Area Layout */
.game-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 280px;
    gap: 8px;
    padding: 0 8px;
    min-height: 0;
    width: 100%;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px;
}

.panel-header {
    font-family: var(--font-digit);
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.panel-header-small {
    font-family: var(--font-digit);
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

/* Left Sidebar - Player list */
.left-sidebar {
    align-self: center;
}
.player-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.player-card.blue-card { border-left: 3px solid var(--blue-neon); }
.player-card.red-card { border-left: 3px solid var(--red-neon); }
.player-card.dead { opacity: 0.4; }

.player-card-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
}
.player-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.player-card-stats {
    font-family: var(--font-digit);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.player-card-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.player-bar-mini {
    height: 4px;
    width: 100%;
    background: rgba(0,0,0,0.5);
    border-radius: 2px;
    overflow: hidden;
}
.player-bar-fill-mini {
    height: 100%;
}
.hp-fill-mini { background: #10b981; }
.mana-fill-mini { background: #3b82f6; }
.xp-fill-mini { background: #ca8a04; }

/* Center Viewport */
.viewport-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
    width: 100%;
    height: 100%;
}
#canvas-wrapper {
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    width: 100%;
    height: 100%;
}
#gameCanvas {
    display: block;
    image-rendering: pixelated; /* Sharp pixel art scaled */
    width: 100%;
    height: 100%;
}

/* Canvas Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.overlay-screen.active {
    display: flex;
}
#spectator-overlay {
    background: transparent;
    pointer-events: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 16px;
}
#spectator-overlay .overlay-content {
    pointer-events: auto;
    background: rgba(10, 10, 25, 0.72);
    padding: 10px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.overlay-content {
    background: rgba(10, 10, 25, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.flex-row {
    flex-direction: row !important;
    gap: 24px;
    align-items: center;
}

.death-title {
    font-family: var(--font-digit);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 2px;
}
.tip-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

/* Right Sidebar panels */
.sub-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 8px;
}
.sub-panel:last-child {
    margin-bottom: 0;
}

.minimap-panel {
    flex: 0 0 auto;
    align-items: center;
}
.minimap-wrapper {
    width: 150px;
    height: 150px;
    flex: 0 0 150px;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
#minimapCanvas {
    display: block;
}

.combat-log-panel {
    flex: 1;
}
.combat-feed {
    flex: 1;
    overflow-y: auto;
    font-size: 0.78rem;
    padding: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: var(--font-ui);
    min-height: 100px;
}
.combat-event {
    line-height: 1.3;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    padding-bottom: 4px;
    word-break: break-word;
}
.combat-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-right: 4px;
}

.game-chat-panel {
    height: 160px;
}
#game-chat-messages {
    font-size: 0.8rem;
    padding: 8px;
}
#game-chat-input {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    color: white;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    width: 100%;
}
#game-chat-input:focus {
    outline: none;
    border-color: #7c3aed;
}

/* In-game footer status bar */
.game-footer {
    min-height: 60px;
    max-height: 26vh;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
    margin-top: 8px;
    border-bottom: none;
    flex: 0 0 auto;
    overflow-y: auto;
    scrollbar-width: thin;
}

.controls-guide {
    display: flex;
    flex: 1 1 420px;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    align-items: center;
    min-width: 0;
    line-height: 1.3;
}
.controls-guide span {
    white-space: nowrap;
}
.controls-guide strong {
    color: var(--text-primary);
}
.controls-guide kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 1px 5px;
    margin: 0 2px;
    font-family: inherit;
    font-size: 0.75rem;
    color: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
    display: inline-block;
}

.player-status-hub {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 460px;
    min-width: 0;
}

.status-bar-group {
    display: flex;
    gap: 10px;
    flex: 1 1 360px;
    max-width: 540px;
    min-width: 260px;
}
.level-container {
    flex: 0 0 55px;
}
.hud-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hud-bar-label {
    font-family: var(--font-digit);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}
.hud-bar-bg {
    height: 12px;
    background: rgba(0,0,0,0.6);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.hud-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.15s ease-out;
}
.hp-fill {
    background: linear-gradient(to right, #059669, #10b981);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}
.mana-fill {
    background: linear-gradient(to right, #2563eb, #3b82f6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}
.xp-fill {
    background: linear-gradient(to right, #ca8a04, #eab308);
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.4);
}

@media (max-width: 900px) {
    .game-footer {
        align-items: stretch;
        max-height: 34vh;
    }
    .controls-guide,
    .player-status-hub {
        flex-basis: 100%;
    }
    .player-status-hub {
        justify-content: space-between;
    }
    .status-bar-group {
        max-width: none;
    }
}

/* Hold-Tab In-Game Scoreboard */
.tab-scoreboard {
    position: absolute;
    inset: 0;
    z-index: 35;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.38);
    pointer-events: none;
}
.tab-scoreboard.active {
    display: flex;
}
.tab-scoreboard-panel {
    width: min(720px, 92%);
    max-height: min(560px, 88%);
    padding: 14px;
    background: rgba(8, 8, 18, 0.92);
    border: 1px solid var(--border-color);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.75);
    pointer-events: auto;
}
.tab-scoreboard-header {
    display: grid;
    grid-template-columns: 1fr auto auto 1fr;
    align-items: center;
    gap: 14px;
    padding: 0 4px 10px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font-digit);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.tab-scoreboard-header .red-text {
    text-align: right;
}
.tab-scoreboard-title {
    font-size: 0.9rem;
    letter-spacing: 1.5px;
}
.tab-scoreboard-time {
    color: var(--text-primary);
}
.tab-scoreboard-list {
    max-height: 430px;
    overflow-y: auto;
    padding-top: 6px;
}
.tab-scoreboard .leaderboard-item {
    font-size: 0.76rem;
    padding: 6px 4px;
}
.tab-scoreboard .leaderboard-kills {
    font-size: 0.58rem;
    gap: 5px;
}

/* Match Results Screen Overlays */
#results-screen {
    z-index: 100;
}
.results-box {
    width: 90%;
    max-width: 550px;
    padding: 32px;
    background: rgba(10, 10, 25, 0.95);
    border: 2px solid var(--border-color);
    box-shadow: 0 10px 50px rgba(0,0,0,0.9);
}
#results-winner {
    font-family: var(--font-digit);
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.results-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.scores-comparison {
    display: flex;
    justify-content: space-around;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}
.score-block h3 {
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.score-block h2 {
    font-family: var(--font-digit);
    font-size: 2.5rem;
    font-weight: 900;
}

.next-match-timer {
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Simple Keyframe Pulse for Titles */
.animate-pulse {
    animation: pulseGlow 2s ease-in-out infinite alternate;
}
@keyframes pulseGlow {
    from {
        filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.3));
    }
    to {
        filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.7));
    }
}

.results-leaderboard-container {
    margin: 20px 0 24px 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: left;
    max-height: 250px;
    overflow-y: auto;
}
.leaderboard-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
}
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
}
.leaderboard-item:last-child {
    border-bottom: none;
}
.leaderboard-rank {
    font-weight: bold;
    width: 24px;
    flex: 0 0 24px;
    color: var(--text-secondary);
}
.leaderboard-name {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 2px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.leaderboard-kills {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 5px;
    font-family: var(--font-digit);
    font-size: 0.58rem;
    font-weight: bold;
    color: #00ff66;
    margin-left: 4px;
    white-space: nowrap;
}
.leaderboard-kills span {
    display: inline-block;
}

#top-ten-screen {
    z-index: 95;
}
#help-screen { z-index: 96; }
.help-box {
    width: min(820px, 92vw);
    max-height: min(760px, 88vh);
    overflow-y: auto;
    padding: 26px 28px;
    background: #101e26f5;
    border: 1px solid #bba57566;
    box-shadow: 0 10px 50px #000b;
}
.help-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.help-header .eyebrow { margin: 0 0 8px; font-size: 9px; }
.help-header .leaderboard-title { margin: 0; padding: 0; border: 0; text-align: left; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.help-section { padding: 16px; border: 1px solid #9a9b752b; background: #0b171c99; }
.help-section h3 { margin: 0 0 9px; color: #d7c395; font: 15px Georgia, serif; letter-spacing: 1px; }
.help-section p, .help-section li, .help-list { margin: 0; color: #b8c4c2; font-size: 11px; line-height: 1.65; }
.help-section ul { margin: 0; padding-left: 18px; }
.help-section kbd { font-size: 9px; }
.help-list { display: grid; gap: 6px; }
.help-list > div { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: center; }
.help-list dt, .help-list dd { margin: 0; }
.help-list dd { color: #d0d7d2; }
@media (max-width: 600px) {
    .help-box { padding: 20px 16px; }
    .help-grid { grid-template-columns: 1fr; }
    .help-section { padding: 13px; }
}
.top-ten-box {
    width: min(560px, 92vw);
    max-height: min(680px, 86vh);
    padding: 22px;
    background: rgba(10, 10, 25, 0.96);
    border: 2px solid var(--border-color);
    box-shadow: 0 10px 50px rgba(0,0,0,0.9);
    overflow: hidden;
}
.top-ten-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.top-ten-header .leaderboard-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
    text-align: left;
}
.top-ten-list {
    max-height: 56vh;
    overflow-y: auto;
}
.top-ten-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-body);
    letter-spacing: 0.5px;
}
.top-ten-score {
    color: #facc15;
    font-family: var(--font-digit);
    font-size: 0.7rem;
    font-weight: 700;
    flex: 0 0 70px;
    text-align: right;
}
