/* Retro Pixel Art Stylesheet - Legendary Wizard */
@font-face {
    font-family: 'RetroFont';
    src: url('../assets/fonts/FVF Fernando 08.ttf') format('truetype');
}

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

:root {
    --bg-dark: #07090e;
    --panel-bg: rgba(13, 18, 30, 0.94);
    --border-color: #3b82f6;
    --gold: #fbbf24;
    --p1-color: #38bdf8;
    --p2-color: #c084fc;
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: 'RetroFont', monospace, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
    overflow: hidden;
}

/* Pixel Canvas Container strictly maintaining 16:9 ratio with zero distortion */
#canvas-wrapper {
    position: relative;
    width: min(98vw, calc(98dvh * 16 / 9), calc(98vh * 16 / 9));
    height: min(calc(98vw * 9 / 16), 98dvh, 98vh);
    aspect-ratio: 16 / 9;
    background-color: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 20px rgba(59, 130, 246, 0.35);
    border: 2px solid #1e293b;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    display: block;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
}



/* HUD Overlay */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 10px;
    z-index: 20;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.player-hud-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 6px 8px;
    min-width: 160px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.p1-card { border-left: 3px solid var(--p1-color); }
.p2-card { border-left: 3px solid var(--p2-color); }

.timer-card {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 3px 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 30;
}

#wave-timer {
    font-size: 10px;
    font-weight: bold;
    color: #fde047;
    text-shadow: 0 0 6px rgba(253, 224, 71, 0.5);
    letter-spacing: 0.5px;
}

.boss-timer-badge {
    font-size: 7px;
    color: #cbd5e1;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8px;
    margin-bottom: 4px;
}

.hud-title {
    font-weight: bold;
    font-size: 8px;
}
.p1-card .hud-title { color: #60a5fa; }
.p2-card .hud-title { color: #34d399; }

/* Pixel Art UI Health Bar using assets/ui/hp_frame.png & hp_fill.png */
.bar-container {
    position: relative;
    width: 112px;
    height: 16px;
    margin-bottom: 4px;
}

.bar-fill-hp {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: url('../assets/ui/hp_fill.png') no-repeat left center;
    background-size: 112px 16px;
    image-rendering: pixelated;
    transition: width 0.15s ease-out;
    z-index: 1;
}

.bar-frame-hp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../assets/ui/hp_frame.png') no-repeat center center;
    background-size: 100% 100%;
    image-rendering: pixelated;
    pointer-events: none;
    z-index: 2; /* Frame sits on top of fill! */
}

/* Pixel Art UI Stamina / EXP Bar using assets/ui/stamina_frame.png & stamina_fill.png */
.bar-fill-exp {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: url('../assets/ui/stamina_fill.png') no-repeat left center;
    background-size: 112px 16px;
    image-rendering: pixelated;
    transition: width 0.15s ease-out;
    z-index: 1;
}

.bar-frame-exp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../assets/ui/stamina_frame.png') no-repeat center center;
    background-size: 100% 100%;
    image-rendering: pixelated;
    pointer-events: none;
    z-index: 2; /* Frame sits on top of fill! */
}

/* Boss Multi-Health Bar List HUD */
.boss-hud-list {
    align-self: center;
    width: 65%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    z-index: 100;
}

.boss-hud-card {
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid #ef4444;
    border-radius: 6px;
    padding: 5px 10px;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5), inset 0 0 8px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.boss-hud-card.boss-enraged {
    animation: bossEnragePulse 1.2s infinite alternate;
}

@keyframes bossEnragePulse {
    from { transform: scale(1.0); box-shadow: 0 0 12px rgba(239, 68, 68, 0.7); }
    to { transform: scale(1.02); box-shadow: 0 0 24px rgba(255, 0, 0, 1.0); }
}

.boss-enrage-badge {
    display: inline-block;
    font-size: 7px;
    background: #ef4444;
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    animation: blinkBadge 0.6s infinite alternate;
}

@keyframes blinkBadge {
    from { opacity: 0.7; }
    to { opacity: 1.0; }
}

.boss-hud-container {
    align-self: center;
    width: 65%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #ef4444;
    border-radius: 6px;
    padding: 6px 12px;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6), inset 0 0 10px rgba(239, 68, 68, 0.3);
    margin-top: 6px;
    backdrop-filter: blur(4px);
    animation: bossPulse 2s infinite alternate;
}

@keyframes bossPulse {
    from { box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
    to { box-shadow: 0 0 22px rgba(239, 68, 68, 0.9); }
}

.boss-hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.boss-name {
    font-size: 9px;
    font-weight: bold;
    color: #fca5a5;
    letter-spacing: 0.5px;
    text-shadow: 0 0 6px #dc2626;
}

.boss-hp-text {
    font-size: 8px;
    font-weight: bold;
    color: #ffffff;
}

.boss-bar-container {
    position: relative;
    width: 100%;
    height: 10px;
    background: #450a0a;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #7f1d1d;
}

.boss-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px #ef4444;
}

/* Slots for Skills & Passives */
.slots-container {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.slot-icon {
    width: 18px;
    height: 18px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 9px;
    position: relative;
}

.slot-icon span {
    position: absolute;
    bottom: -1px;
    right: 1px;
    font-size: 6px;
    color: #fbbf24;
}

.slot-empty {
    color: #334155;
}

/* Elemental Slot Border Accents */
.elem-border-fire { border-color: #ff4d00; }
.elem-border-water { border-color: #00b4d8; }
.elem-border-earth { border-color: #b07d62; }
.elem-border-plant { border-color: #55a630; }
.elem-border-lightning { border-color: #00f5d4; }
.elem-border-wind { border-color: #70e000; }
.elem-border-poison { border-color: #9d4edd; }
.elem-border-light { border-color: #ffe600; }
.elem-border-dark { border-color: #7209b7; }
.elem-border-blood { border-color: #ef4444; }
.elem-border-psychic { border-color: #d946ef; }
.elem-border-fairy { border-color: #f472b6; }
.elem-border-fusion { border-color: #f59e0b; }

/* Timer in Center Top */
.timer-card {
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 10px;
    color: #f8fafc;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* Level Up Modal */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    backdrop-filter: blur(4px);
}

#levelup-modal.modal-overlay,
#relic-modal.modal-overlay {
    background: rgba(3, 7, 18, 0.6);
    pointer-events: none;
}

#levelup-modal .modal-content,
#relic-modal .modal-content {
    pointer-events: auto;
}

.modal-content {
    text-align: center;
    max-width: 90%;
}

.modal-header {
    font-size: 11px;
    color: #fde047;
    margin-bottom: 16px;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.6);
}

.cards-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: nowrap;
    width: 100%;
}

.upgrade-card {
    width: 130px;
    height: 180px;
    background: #0f172a;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    position: relative;
    pointer-events: auto;
    box-sizing: border-box;
}

.upgrade-card:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    border-color: #60a5fa;
}

.card-element-tag {
    font-size: 7px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #1e293b;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.card-icon {
    font-size: 26px;
    margin: 6px 0;
}

.card-title {
    font-size: 8px;
    color: #f8fafc;
    margin-bottom: 4px;
    line-height: 1.3;
    text-align: center;
}

.card-level {
    font-size: 7px;
    color: #fbbf24;
    margin-bottom: 6px;
}

.card-desc {
    font-size: 7px;
    color: #94a3b8;
    line-height: 1.4;
    text-align: center;
    flex-grow: 1;
}

.card-key-hint {
    font-size: 7px;
    color: #64748b;
    margin-top: 6px;
    background: #020617;
    padding: 3px 6px;
    border-radius: 2px;
}

/* Elemental Themes for Upgrade Cards */
.elem-fire { border-color: #ea580c; background: linear-gradient(180deg, #1c1917 0%, #451a03 100%); }
.elem-fire:hover { box-shadow: 0 8px 24px rgba(234, 88, 12, 0.5); }
.elem-water { border-color: #0284c7; background: linear-gradient(180deg, #082f49 0%, #0c4a6e 100%); }
.elem-water:hover { box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5); }
.elem-earth { border-color: #b45309; background: linear-gradient(180deg, #1c1917 0%, #451a03 100%); }
.elem-plant { border-color: #16a34a; background: linear-gradient(180deg, #052e16 0%, #14532d 100%); }
.elem-lightning { border-color: #06b6d4; background: linear-gradient(180deg, #083344 0%, #164e63 100%); }
.elem-wind { border-color: #84cc16; background: linear-gradient(180deg, #14532d 0%, #365314 100%); }
.elem-poison { border-color: #9333ea; background: linear-gradient(180deg, #3b0764 0%, #581c87 100%); }
.elem-light { border-color: #eab308; background: linear-gradient(180deg, #422006 0%, #713f12 100%); }
.elem-dark { border-color: #c026d3; background: linear-gradient(180deg, #2e1065 0%, #4a044e 100%); }
.elem-blood { border-color: #dc2626; background: linear-gradient(180deg, #450a0a 0%, #7f1d1d 100%); }
.elem-blood:hover { box-shadow: 0 8px 24px rgba(220, 38, 38, 0.5); }
.elem-psychic { border-color: #c026d3; background: linear-gradient(180deg, #3b0764 0%, #701a75 100%); }
.elem-psychic:hover { box-shadow: 0 8px 24px rgba(217, 70, 239, 0.5); }
.elem-fairy { border-color: #ec4899; background: linear-gradient(180deg, #500724 0%, #831843 100%); }
.elem-fairy:hover { box-shadow: 0 8px 24px rgba(244, 114, 182, 0.5); }
.elem-fusion { border-color: #f59e0b; background: linear-gradient(180deg, #451a03 0%, #78350f 100%); }
.elem-fusion:hover { box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6); }

/* ─── Relic Modal & Cards (Fitted for 480x270 Canvas) ──────────────── */
.relic-modal-content {
    background: radial-gradient(circle at center, #1e1b4b 0%, #09090b 100%);
    border: 2px solid #818cf8;
    box-shadow: 0 0 25px rgba(129, 140, 248, 0.45);
    border-radius: 6px;
    padding: 8px 10px;
    width: min(450px, 95vw);
    max-height: min(255px, 94vh);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.relic-header {
    font-size: 8.5px;
    color: #fde047;
    text-shadow: 0 0 8px rgba(253, 224, 71, 0.7);
    margin-bottom: 2px;
}

.relic-subtitle {
    font-size: 6px;
    color: #c7d2fe;
    margin-bottom: 6px;
}

.relic-cards-container {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: nowrap;
    width: 100%;
}

.relic-card {
    flex: 1;
    max-width: 102px;
    min-width: 86px;
    height: 180px;
    background: #0f172a;
    border: 1.5px solid #6366f1;
    border-radius: 5px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    position: relative;
    pointer-events: auto;
    box-sizing: border-box;
}

.relic-card:hover {
    transform: translateY(-3px) scale(1.03);
}

.relic-rarity-badge {
    font-size: 5px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 2px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.relic-icon {
    font-size: 22px;
    margin: 2px 0;
}

.relic-title {
    font-size: 6.5px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 2px;
    line-height: 1.2;
    text-align: center;
}

.relic-desc {
    font-size: 5.5px;
    color: #94a3b8;
    line-height: 1.25;
    text-align: center;
    flex-grow: 1;
}

.relic-card .card-key-hint {
    font-size: 5.5px;
    color: #64748b;
    margin-top: 2px;
}

/* Rarity Color Themes */
.rarity-rare {
    border-color: #38bdf8;
    background: linear-gradient(180deg, #0c4a6e 0%, #032030 100%);
}
.rarity-rare:hover {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
    border-color: #7dd3fc;
}
.rarity-rare .relic-rarity-badge {
    background: #0284c7;
    color: #e0f2fe;
}

.rarity-epic {
    border-color: #c084fc;
    background: linear-gradient(180deg, #581c87 0%, #2e1065 100%);
}
.rarity-epic:hover {
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.6);
    border-color: #e9d5ff;
}
.rarity-epic .relic-rarity-badge {
    background: #9333ea;
    color: #fae8ff;
}

.rarity-legendary {
    border-color: #fde047;
    background: linear-gradient(180deg, #713f12 0%, #3a1d04 100%);
    animation: pulse-legendary 2s infinite alternate;
}
.rarity-legendary:hover {
    box-shadow: 0 0 25px rgba(253, 224, 71, 0.8);
    border-color: #fef08a;
}
.rarity-legendary .relic-rarity-badge {
    background: #ca8a04;
    color: #fef9c3;
}

@keyframes pulse-legendary {
    0% { box-shadow: 0 0 10px rgba(253, 224, 71, 0.3); }
    100% { box-shadow: 0 0 20px rgba(253, 224, 71, 0.7); }
}

/* Main Menu Screen */
#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 150;
    padding: 16px;
}

.game-logo {
    font-size: 13px;
    color: #fde047;
    text-align: center;
    text-shadow: 0 0 14px rgba(253, 224, 71, 0.6), 2px 2px #b45309;
    margin-bottom: 4px;
}

.game-sub {
    font-size: 8px;
    color: #94a3b8;
    margin-bottom: 10px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 260px;
    align-items: stretch;
    margin-bottom: 8px;
}

.pixel-btn {
    font-family: inherit;
    font-size: 8px;
    background: #2563eb;
    color: #ffffff;
    border: 2px solid #60a5fa;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, background-color 0.1s ease, box-shadow 0.1s ease;
    box-sizing: border-box;
}

.pixel-btn:hover {
    background: #1d4ed8;
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.pixel-btn-coop {
    background: #059669;
    border-color: #34d399;
}
.pixel-btn-coop:hover {
    background: #047857;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

.controls-hint {
    font-size: 6.5px;
    color: #64748b;
    margin-top: 6px;
    text-align: center;
    line-height: 1.5;
}

.boss-timer-badge {
    display: block;
    font-size: 7px;
    color: #f59e0b;
    margin-top: 2px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.hud-stat-badge {
    font-size: 7px;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #334155;
}
.hud-stat-badge span {
    font-weight: bold;
}
#p1-kills, #p2-kills { color: #f87171; }
#p1-dmg, #p2-dmg { color: #38bdf8; }

.modal-footer {
    margin-top: 14px;
}

.btn-reroll {
    font-family: inherit;
    font-size: 8px;
    background: #7c3aed;
    color: #ffffff;
    border: 2px solid #a78bfa;
    border-radius: 4px;
    padding: 6px 14px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
    transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
    pointer-events: auto;
}
.btn-reroll:hover {
    background: #6d28d9;
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.8);
}
.btn-reroll:disabled {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Game Over & Damage Report */
.game-over-content {
    background: rgba(15, 23, 42, 0.96);
    border: 2px solid #ef4444;
    border-radius: 8px;
    padding: 16px 20px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
}

.game-over-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.pixel-btn-secondary {
    background: #475569;
    border-color: #94a3b8;
    color: #f8fafc;
}
.pixel-btn-secondary:hover {
    background: #334155;
    transform: scale(1.05);
}

.damage-report-container {
    width: 100%;
    margin-bottom: 14px;
}

.report-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.report-player-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 8px 12px;
    min-width: 180px;
    text-align: left;
}
.report-p1 { border-top: 3px solid #3b82f6; }
.report-p2 { border-top: 3px solid #10b981; }

.report-player-header {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    font-weight: bold;
    margin-bottom: 6px;
}

.report-stat-line {
    font-size: 7px;
    color: #cbd5e1;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.report-skill-list {
    margin-top: 6px;
    border-top: 1px dashed #334155;
    padding-top: 4px;
}

.report-skill-item {
    font-size: 6.5px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.dps-bar-bg {
    width: 100%;
    height: 4px;
    background: #1e293b;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}
.dps-bar-fill {
    height: 100%;
    background: #38bdf8;
}

/* Skill Lab Button */
.pixel-btn-lab {
    background: linear-gradient(180deg, #7c3aed 0%, #4c1d95 100%);
    border-color: #a855f7;
    box-shadow: 0 4px 0 #3b0764, 0 0 12px rgba(168, 85, 247, 0.4);
    color: #f5d0fe;
}
.pixel-btn-lab:hover {
    background: linear-gradient(180deg, #9333ea 0%, #581c87 100%);
    box-shadow: 0 2px 0 #3b0764, 0 0 16px rgba(168, 85, 247, 0.7);
    color: #ffffff;
}

/* Skill Lab Modal & Container (Transparent Floating HUD) */
.lab-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    pointer-events: none;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.lab-container {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #ffffff;
    font-family: 'RetroFont', monospace, sans-serif;
    pointer-events: none;
}

/* Lab Header */
.lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid #4338ca;
    border-radius: 6px;
    margin: 4px 6px;
    pointer-events: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.lab-title {
    font-size: 8px;
    color: #a5b4fc;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(165, 180, 252, 0.5);
}

.lab-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lab-badge-stat {
    background: #1e1b4b;
    border: 1px solid #4f46e5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 6.5px;
    color: #38bdf8;
}

.pixel-btn-sm {
    padding: 3px 8px;
    font-size: 6.5px;
}
.pixel-btn-xs {
    padding: 2px 5px;
    font-size: 5.5px;
}

/* Lab Body Split */
.lab-body {
    display: flex;
    justify-content: space-between;
    flex: 1;
    overflow: hidden;
    padding: 0 6px 6px 6px;
    pointer-events: none;
}

/* Left Catalog Panel */
.lab-catalog-panel {
    width: 32%;
    max-width: 290px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: rgba(13, 17, 28, 0.92);
    border: 1px solid #334155;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.lab-search-box input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    color: #ffffff;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 7px;
    border-radius: 4px;
    outline: none;
    margin-bottom: 6px;
}
.lab-search-box input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.4);
}

.lab-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 6px;
}

.lab-filter-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    font-family: inherit;
    font-size: 6px;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lab-filter-btn:hover {
    color: #ffffff;
    border-color: #64748b;
}
.lab-filter-btn.active {
    background: #4338ca;
    color: #ffffff;
    border-color: #818cf8;
    box-shadow: 0 0 6px rgba(129, 140, 248, 0.5);
}

.lab-count-hint {
    font-size: 6px;
    color: #64748b;
    margin-bottom: 4px;
}

.lab-grid-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.lab-skill-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #334155;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lab-skill-card:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: #64748b;
    transform: translateX(2px);
}
.lab-skill-card.equipped {
    background: rgba(67, 56, 202, 0.4);
    border-color: #818cf8;
}

.lab-card-icon {
    font-size: 11px;
    width: 18px;
    text-align: center;
}

.lab-card-info {
    flex: 1;
    margin-left: 6px;
    display: flex;
    flex-direction: column;
}

.lab-card-name {
    font-size: 6.8px;
    color: #f1f5f9;
    font-weight: bold;
}

.lab-card-elem {
    font-size: 5.5px;
    color: #94a3b8;
    margin-top: 1px;
}

.lab-card-btn {
    background: #334155;
    border: 1px solid #475569;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 5.5px;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
}
.lab-skill-card.equipped .lab-card-btn {
    background: #dc2626;
    border-color: #f87171;
    color: #ffffff;
}

/* Right Control Panel */
.lab-controls-panel {
    width: 32%;
    max-width: 290px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 6px;
    overflow-y: auto;
    background: rgba(13, 17, 28, 0.92);
    border: 1px solid #334155;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.lab-section {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 5px 7px;
}

.lab-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 7.5px;
    color: #e2e8f0;
    font-weight: bold;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 3px;
}

.lab-btn-text {
    background: none;
    border: none;
    color: #f87171;
    font-family: inherit;
    font-size: 6px;
    cursor: pointer;
    text-decoration: underline;
}
.lab-btn-text:hover {
    color: #ef4444;
}

.lab-slots-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 40px;
}

.lab-empty-hint {
    font-size: 6px;
    color: #64748b;
    font-style: italic;
    padding: 8px 4px;
}

.lab-equipped-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
    border: 1px solid #3b82f6;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 6.5px;
}

.slot-icon { font-size: 9px; margin-right: 4px; }
.slot-name { flex: 1; color: #f8fafc; }
.slot-remove {
    color: #ef4444;
    cursor: pointer;
    font-size: 8px;
    padding: 0 3px;
}
.slot-remove:hover { color: #fca5a5; }

.lab-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 6.5px;
    color: #cbd5e1;
    margin-bottom: 5px;
}

.lab-subhint {
    font-size: 5.5px;
    color: #94a3b8;
}

.lab-slider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 6.5px;
    color: #cbd5e1;
    margin-bottom: 5px;
    gap: 6px;
}

.lab-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: #6366f1;
    cursor: pointer;
}

.slider-val {
    font-size: 6.5px;
    color: #38bdf8;
    width: 25px;
    text-align: right;
}

.lab-select {
    background: #0f172a;
    border: 1px solid #334155;
    color: #ffffff;
    font-family: inherit;
    font-size: 6px;
    padding: 2px 4px;
    border-radius: 3px;
    outline: none;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   MOBILE VIRTUAL JOYSTICKS & RESPONSIVE CONTROLLER
   ========================================================================== */
#mobile-controls-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    display: none; /* Hidden on PC / Mouse by default */
}

/* Display only on touch screens / mobile devices */
@media (hover: none) and (pointer: coarse), (max-width: 1024px) {
    #mobile-controls-layer {
        display: block !important;
    }
}
body.is-touch-device #mobile-controls-layer {
    display: block !important;
}

.touch-zone {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    pointer-events: auto;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#touch-zone-p1 {
    left: 0;
}

#touch-zone-p2 {
    right: 0;
}

/* Virtual Joystick Base */
.joystick-base {
    position: absolute;
    bottom: 45px;
    left: 45px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.45) 70%, rgba(59, 130, 246, 0.2) 100%);
    border: 2px dashed rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: opacity 0.2s, border-color 0.2s;
    opacity: 0.65;
}

/* P2 Green Joystick Base (Co-op) */
.joystick-p2-base {
    left: auto;
    right: 45px;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.65) 0%, rgba(30, 41, 59, 0.45) 70%, rgba(16, 185, 129, 0.2) 100%);
    border: 2px dashed rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.6);
}

.joystick-base.active {
    opacity: 0.95;
    border-style: solid;
}

.joystick-base.active.joystick-p1-base {
    border-color: #60a5fa;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.6);
}

.joystick-base.active.joystick-p2-base {
    border-color: #34d399;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
}

/* Virtual Joystick Knob */
.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.8), inset 0 0 6px rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.joystick-p2-knob {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8), inset 0 0 6px rgba(255, 255, 255, 0.6);
}

.joy-label {
    font-size: 11px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* ==========================================================================
   MOBILE RESPONSIVE ADAPTATIONS
   ========================================================================== */
@media (max-width: 900px), (max-height: 500px) {
    #app-container {
        padding: 0;
        width: 100vw;
        height: 100vh;
    }

    #canvas-wrapper {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    /* Compact Mobile HUD */
    #game-hud {
        padding: 4px 6px;
    }

    .player-hud-card {
        padding: 4px 6px;
        min-width: 110px;
    }

    .hud-title {
        font-size: 7px;
    }

    .bar-container {
        height: 5px;
    }

    .timer-card {
        padding: 3px 8px;
        font-size: 11px;
    }

    .boss-timer-badge {
        font-size: 6px;
    }

    /* Touch Friendly Level Up Modal */
    .modal-content {
        padding: 10px;
        max-width: 95vw;
    }

    .cards-container {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .level-card {
        width: 100px;
        padding: 8px 6px;
        touch-action: manipulation;
    }

    .btn-reroll {
        padding: 8px 14px;
        font-size: 8px;
        width: 100%;
    }

    /* Responsive Skill Lab Screen */
    .lab-container {
        width: 96vw;
        height: 94vh;
        padding: 8px;
    }

    .lab-body {
        flex-direction: column;
        overflow-y: auto;
        gap: 8px;
    }

    .lab-catalog-panel {
        max-height: 55vh;
    }

    .lab-controls-panel {
        width: 100%;
        max-width: 100%;
    }

    .lab-grid-container {
        max-height: 35vh;
    }

    .lab-filter-btn {
        padding: 4px 6px;
        font-size: 7px;
    }

    /* Main Menu Mobile */
    .game-logo {
        font-size: 16px;
    }

    .pixel-btn {
        padding: 10px 16px;
        font-size: 9px;
    }

    .controls-hint {
        font-size: 6px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   META PROGRESSION (TALENT SHOP) & RELIC BOONS STYLES
═══════════════════════════════════════════════════════════════════════ */

/* Meta Shop Button in Main Menu */
.pixel-btn-meta {
    background: #d97706;
    border-color: #fde047;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(253, 224, 71, 0.4);
}
.pixel-btn-meta:hover {
    background: #b45309;
    box-shadow: 0 0 16px rgba(253, 224, 71, 0.7);
}

/* Meta Progression Modal */
.meta-modal-content {
    width: 96%;
    max-width: 1040px;
    max-height: 94vh;
    background: radial-gradient(circle at top, #1e293b 0%, #090d16 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.45);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.meta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
    padding-bottom: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.meta-title {
    font-size: 13.5px;
    color: #fde047;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.5);
    font-family: inherit;
}

.meta-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-gold-badge {
    background: #1e1b4b;
    border: 1px solid #f59e0b;
    color: #fde047;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
    font-family: inherit;
}

.meta-mult-group {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(15, 23, 42, 0.85);
    padding: 3px 4px;
    border-radius: 6px;
    border: 1px solid #334155;
}

.meta-mult-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.meta-mult-btn:hover {
    color: #ffffff;
    background: rgba(51, 65, 85, 0.8);
}

.meta-mult-btn.active {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 800;
    border-color: #7dd3fc;
}

.meta-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.meta-upgrade-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.meta-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 8px;
    min-height: 138px;
    box-sizing: border-box;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.meta-card:hover {
    background: linear-gradient(180deg, rgba(51, 65, 85, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-color: #64748b;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.meta-card.maxed {
    border-color: #f59e0b;
    background: linear-gradient(180deg, rgba(60, 45, 15, 0.8) 0%, rgba(30, 20, 5, 0.9) 100%);
    box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.25);
}

.meta-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.meta-icon {
    font-size: 20px;
    width: 34px;
    height: 34px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.meta-lvl {
    font-size: 10.5px;
    color: #38bdf8;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.85);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #334155;
    font-family: inherit;
}

.meta-lvl.lvl-max {
    color: #fde047;
    border-color: #f59e0b;
    background: rgba(45, 30, 10, 0.9);
}

.meta-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 4px 0 8px 0;
}

.meta-name {
    font-size: 11.5px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 3px;
    line-height: 1.25;
    font-family: inherit;
}

.meta-desc {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    line-height: 1.35;
    font-family: inherit;
}

.meta-buy-btn {
    font-family: inherit;
    font-size: 11px;
    padding: 7px 4px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid;
    width: 100%;
    text-align: center;
    font-weight: 700;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.meta-buy-btn.btn-can-buy {
    background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
    border-color: #fde047;
    color: #ffffff;
    box-shadow: 0 2px 0 #78350f;
}

.meta-buy-btn.btn-can-buy:hover {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 0 10px rgba(253, 224, 71, 0.6);
}

.meta-buy-btn.btn-disabled {
    background: #1e293b;
    border-color: #334155;
    color: #64748b;
    cursor: not-allowed;
}

.meta-buy-btn.btn-max {
    background: #1e293b;
    border-color: #f59e0b;
    color: #fde047;
    cursor: default;
}

@media (max-width: 900px) {
    .meta-upgrade-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 500px) {
    .meta-upgrade-list {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* Online Battle Royale Button */
.pixel-btn-online {
    background: linear-gradient(180deg, #ef4444 0%, #991b1b 100%);
    border-color: #f87171;
    color: #ffffff;
    box-shadow: 0 4px 0 #7f1d1d, 0 0 16px rgba(239, 68, 68, 0.5);
}
.pixel-btn-online:hover {
    background: linear-gradient(180deg, #dc2626 0%, #7f1d1d 100%);
    box-shadow: 0 2px 0 #450a0a, 0 0 22px rgba(239, 68, 68, 0.8);
}

/* Multiplayer Room Modal */
.mp-modal-content {
    background: #090d16;
    border: 2px solid #ef4444;
    border-radius: 8px;
    padding: 16px 20px;
    max-width: 540px;
    text-align: center;
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.45);
}

.mp-header {
    font-size: 10px;
    font-weight: bold;
    color: #fca5a5;
    margin-bottom: 6px;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

.mp-subtext {
    font-size: 6.5px;
    color: #94a3b8;
    margin-bottom: 14px;
    line-height: 1.4;
}

.mp-grid {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.mp-card {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.mp-card-host { border-top: 3px solid #38bdf8; }
.mp-card-join { border-top: 3px solid #10b981; }

.mp-card h3 {
    font-size: 7.5px;
    color: #f8fafc;
    margin-bottom: 6px;
}

.mp-card p {
    font-size: 6px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.3;
}

.room-info-box {
    margin-top: 10px;
    width: 100%;
}
.room-hint {
    font-size: 6px;
    color: #cbd5e1;
    display: block;
    margin-bottom: 4px;
}
.room-code-display {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    background: #1e293b;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px dashed #38bdf8;
    margin-bottom: 6px;
}
#display-room-code {
    font-size: 11px;
    font-weight: bold;
    color: #38bdf8;
    letter-spacing: 2px;
}

.waiting-spinner {
    font-size: 6px;
    color: #fde047;
    animation: pulse 1.5s infinite;
}

/* Lobby Room View Styles */
.lobby-code-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0f172a;
    border: 1px dashed #38bdf8;
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 12px;
}
.lobby-label {
    font-size: 7px;
    color: #94a3b8;
}
.lobby-code {
    font-size: 11px;
    font-weight: bold;
    color: #38bdf8;
    letter-spacing: 2px;
}

.lobby-players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 7.5px;
    font-weight: bold;
    color: #f8fafc;
    margin-bottom: 8px;
    padding: 0 4px;
}
.role-badge {
    font-size: 6px;
    padding: 2px 6px;
    border-radius: 3px;
}
.role-host { background: #b45309; color: #fde047; }
.role-client { background: #0369a1; color: #bae6fd; }

.lobby-player-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 2px;
}

.lobby-player-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    border: 1.5px solid #334155;
    border-radius: 6px;
    padding: 6px 8px;
    text-align: left;
    transition: all 0.2s;
}
.lobby-player-slot.occupied {
    background: rgba(15, 23, 42, 0.9);
}
.lobby-player-slot.is-me {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.slot-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    background: #020617;
}
.empty-avatar {
    border-color: #475569 !important;
    color: #475569;
}

.slot-info {
    flex: 1;
    overflow: hidden;
}
.slot-name {
    font-size: 7px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.slot-status {
    font-size: 5.5px;
    color: #22c55e;
}
.empty-name { color: #64748b; }
.empty-status { color: #475569; }

.lobby-action-area {
    margin: 10px 0;
}
.pixel-btn-lg {
    font-size: 9px !important;
    padding: 8px 18px !important;
    letter-spacing: 1px;
}
.host-tip {
    font-size: 6px;
    color: #94a3b8;
    margin-top: 5px;
}
.waiting-host-spinner {
    font-size: 7.5px;
    color: #fde047;
    padding: 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 4px;
    animation: pulse 1.5s infinite;
}

/* Victory Royale Screen */
.victory-modal-content {
    background: radial-gradient(circle at center, #1e1b4b 0%, #090618 100%);
    border: 3px solid #f59e0b;
    border-radius: 12px;
    padding: 24px 30px;
    text-align: center;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.7);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.victory-title {
    font-size: 16px;
    font-weight: bold;
    color: #fde047;
    text-shadow: 0 0 16px rgba(253, 224, 71, 0.9), 0 4px 0 #b45309;
    margin-bottom: 8px;
}
.victory-crown {
    font-size: 28px;
    margin: 10px 0;
}
.victory-subtext {
    font-size: 8px;
    color: #e2e8f0;
    margin-bottom: 12px;
}
.victory-gold-reward {
    font-size: 10px;
    font-weight: bold;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 6px 12px;
    display: inline-block;
    margin-bottom: 16px;
}

/* In-Game Floating Top Banner Alert */
.game-banner-alert {
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #ef4444;
    border-radius: 6px;
    padding: 8px 18px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    color: #ef4444;
    text-shadow: 1px 1px 0 #000000, 0 0 8px currentColor;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease-out;
    z-index: 90;
    white-space: nowrap;
}
.game-banner-alert.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========================================================
   CHAT & PARTY MULTIPLAYER SYSTEM STYLES
   ======================================================== */



/* Menu Player Name Customization Box */
.menu-name-input-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 280px;
}
.menu-name-label {
    font-size: 7.5px;
    font-weight: bold;
    color: #fde047;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 0 #000;
}
#input-player-name {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid #38bdf8;
    border-radius: 4px;
    color: #ffffff;
    font-family: 'RetroFont', monospace, sans-serif;
    font-size: 9px;
    padding: 6px 10px;
    text-align: center;
    outline: none;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    transition: all 0.15s ease;
}
#input-player-name:focus {
    border-color: #fde047;
    box-shadow: 0 0 14px rgba(253, 224, 71, 0.5);
    transform: scale(1.02);
}

/* Floating Team Members HUD Status Panel */
.team-hud-panel {
    position: absolute;
    top: 114px;
    left: 10px;
    background: rgba(15, 23, 42, 0.88);
    border: 1.5px solid rgba(56, 189, 248, 0.6);
    border-radius: 4px;
    padding: 5px 8px;
    width: 140px;
    pointer-events: auto;
    z-index: 35;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}
.team-hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 3px;
}
.team-hud-title {
    font-size: 7px;
    font-weight: bold;
    color: #38bdf8;
}
.team-hud-leave-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 6px;
    padding: 1px 4px;
    border-radius: 2px;
    cursor: pointer;
}
.team-hud-leave-btn:hover {
    background: #ef4444;
    color: #fff;
}
.team-hud-members {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.team-hud-member-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.team-hud-member-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 6.5px;
}
.team-hud-member-hp-bar {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}
.team-hud-member-hp-fill {
    height: 100%;
    background: #22c55e;
    transition: width 0.2s ease;
}

/* Party Toast Alert */
.party-invite-toast {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #38bdf8;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 95;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(56, 189, 248, 0.3);
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.invite-toast-icon {
    font-size: 20px;
}
.invite-toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.invite-toast-title {
    font-size: 8px;
    font-weight: bold;
    color: #38bdf8;
}
.invite-toast-msg {
    font-size: 7.5px;
    color: #e2e8f0;
}
.invite-toast-timer-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 3px;
    border-radius: 1px;
    overflow: hidden;
}
.invite-toast-progress {
    height: 100%;
    background: #fde047;
    width: 100%;
}
.invite-toast-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Chat & Party Modal */
.chat-modal-content {
    width: min(580px, 95vw);
    max-height: min(440px, 88vh);
    background: rgba(11, 17, 32, 0.96);
    border: 2px solid #38bdf8;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(56, 189, 248, 0.2);
}
.chat-modal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.chat-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #94a3b8;
    font-family: 'RetroFont', monospace, sans-serif;
    font-size: 8px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.chat-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.chat-tab-btn.active {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    font-weight: bold;
}
.chat-close-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    font-family: 'RetroFont', monospace, sans-serif;
    cursor: pointer;
    padding: 2px 6px;
}
.chat-close-btn:hover {
    color: #ef4444;
}

/* Chat Tab View */
.chat-tab-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 6px;
}
.chat-messages-container {
    flex: 1;
    min-height: 100px;
    max-height: 120px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 6px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.chat-messages-container::-webkit-scrollbar {
    width: 4px;
}
.chat-messages-container::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}
.chat-msg-row {
    font-size: 7.5px;
    line-height: 1.3;
    word-break: break-word;
}
.chat-author {
    font-weight: bold;
    margin-right: 4px;
}
.chat-text {
    color: #f1f5f9;
}
.chat-system-msg {
    font-size: 6.5px;
    color: #fbbf24;
    font-style: italic;
    background: rgba(251, 191, 36, 0.1);
    padding: 3px 5px;
    border-radius: 2px;
    border-left: 2px solid #fbbf24;
}

/* Quick Chat Bar */
.quick-chat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.quick-chat-chip {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: #cbd5e1;
    font-family: 'RetroFont', monospace, sans-serif;
    font-size: 6.5px;
    padding: 3px 6px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.quick-chat-chip:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #fff;
    transform: translateY(-1px);
}

/* Chat Input Row */
.chat-input-row {
    display: flex;
    gap: 6px;
}
#chat-input-field {
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #334155;
    border-radius: 3px;
    color: #fff;
    font-family: 'RetroFont', monospace, sans-serif;
    font-size: 8px;
    padding: 5px 8px;
    outline: none;
}
#chat-input-field:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
#btn-send-chat {
    font-size: 8px;
    padding: 5px 10px;
}

/* Party Tab View */
.party-tab-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 190px;
    overflow-y: auto;
}
.my-party-box {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid #3b82f6;
    border-radius: 4px;
    padding: 6px 10px;
}
.party-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 7.5px;
    font-weight: bold;
    color: #60a5fa;
}
.my-party-members-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.party-empty-hint {
    font-size: 6.5px;
    color: #94a3b8;
    font-style: italic;
}
.party-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 7px;
}
.party-roster-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 7px;
    font-weight: bold;
    color: #e2e8f0;
}
.party-tip-badge {
    font-size: 6px;
    color: #34d399;
    font-weight: normal;
}
.party-player-roster {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
}
.party-roster-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 7px;
}
.party-roster-info {
    display: flex;
    align-items: center;
    gap: 6px;
}
.party-roster-avatar {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}
.party-roster-btn {
    font-size: 6.5px;
    padding: 3px 6px;
}

/* Floating Action Bar (Chat & Leaderboard Buttons) - Positioned on Bottom-Right */
.floating-hud-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    z-index: 50;
    pointer-events: auto;
}

.btn-chat-toggle, .btn-lb-toggle {
    position: relative;
    background: rgba(15, 23, 42, 0.92);
    border: 1.5px solid #38bdf8;
    border-radius: 4px;
    color: #ffffff;
    font-family: 'RetroFont', monospace, sans-serif;
    font-size: 7px;
    padding: 4px 8px;
    height: 24px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(56, 189, 248, 0.25);
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}

.btn-lb-toggle {
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(245, 158, 11, 0.25);
}

.btn-chat-toggle:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #7dd3fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.btn-lb-toggle:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: #fde047;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.chat-btn-icon {
    font-size: 9px;
    line-height: 1;
    display: inline-block;
}

.chat-btn-text {
    font-weight: bold;
    letter-spacing: 0.3px;
    line-height: 1;
}

.chat-btn-key {
    font-size: 5.5px;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 3px;
    border-radius: 2px;
    line-height: 1;
}

.chat-unread-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #ef4444;
    border: 1px solid #ffffff;
    box-shadow: 0 0 8px #ef4444;
    animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 1; }
}

/* Leaderboard Tab View */
.leaderboard-tab-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 280px;
    max-height: 360px;
}

.leaderboard-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    padding: 6px 10px;
}

.lb-title {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: #fde047;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(253, 224, 71, 0.4);
}

.lb-online-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
    color: #38bdf8;
    font-weight: 700;
}

.leaderboard-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.45);
    min-height: 240px;
    max-height: 310px;
}

.leaderboard-table-wrapper::-webkit-scrollbar {
    width: 5px;
}
.leaderboard-table-wrapper::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
}

.leaderboard-table thead th {
    position: sticky;
    top: 0;
    background: #0f172a;
    color: #94a3b8;
    font-size: 8px;
    font-weight: 800;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.leaderboard-table tbody tr.lb-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.12s ease;
}

.leaderboard-table tbody tr.lb-row:hover {
    background: rgba(56, 189, 248, 0.12);
}

.leaderboard-table tbody tr.lb-row-local {
    background: rgba(245, 158, 11, 0.18) !important;
    border-left: 3px solid #fde047;
}

.leaderboard-table tbody td {
    padding: 6px 8px;
    vertical-align: middle;
}

.lb-rank {
    display: inline-block;
    font-weight: 800;
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 3px;
}
.lb-rank.rank-1 {
    color: #fde047;
    background: rgba(253, 224, 71, 0.15);
    border: 1px solid rgba(253, 224, 71, 0.4);
    text-shadow: 0 0 6px rgba(253, 224, 71, 0.6);
}
.lb-rank.rank-2 {
    color: #e2e8f0;
    background: rgba(226, 232, 240, 0.15);
    border: 1px solid rgba(226, 232, 240, 0.4);
    text-shadow: 0 0 6px rgba(226, 232, 240, 0.6);
}
.lb-rank.rank-3 {
    color: #fdba74;
    background: rgba(253, 186, 116, 0.15);
    border: 1px solid rgba(253, 186, 116, 0.4);
    text-shadow: 0 0 6px rgba(253, 186, 116, 0.6);
}
.lb-rank.rank-n {
    color: #94a3b8;
}

.lb-player-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lb-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.4);
}

.lb-player-name {
    font-weight: 700;
    font-size: 10px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-you-tag {
    color: #fde047;
    font-size: 7.5px;
    font-weight: 800;
    background: rgba(253, 224, 71, 0.15);
    padding: 1px 4px;
    border-radius: 2px;
}

.lb-team-tag {
    color: #34d399;
    font-size: 7.5px;
    background: rgba(52, 211, 153, 0.18);
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 700;
}

.lb-level-badge {
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid #38bdf8;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 8.5px;
}

.lb-stat-kills {
    color: #fb923c;
    font-weight: 800;
    font-size: 9.5px;
}

.lb-score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.lb-stat-score {
    color: #fde047;
    font-weight: 800;
    font-size: 9.5px;
}

.lb-sub-pts {
    font-size: 7px;
    color: #94a3b8;
    font-weight: normal;
}

.lb-stat-dmg-sub {
    color: #c084fc;
    font-size: 8px;
    font-weight: 600;
}

.lb-status-alive {
    color: #4ade80;
    font-size: 8.5px;
    font-weight: 700;
}

.lb-status-dead {
    color: #ef4444;
    font-size: 8.5px;
    font-style: italic;
    font-weight: 700;
}

.lb-empty-cell {
    text-align: center;
    padding: 30px 0;
    color: #64748b;
    font-style: italic;
    font-size: 10px;
}

/* ========================================================
   Retro Pixel Art Loading Screen Overlay
   ======================================================== */
.loading-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #030712 90%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 120;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.35s ease-out;
}

.loading-screen-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(380px, 90vw);
    background: rgba(15, 23, 42, 0.94);
    border: 2px solid #38bdf8;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.95), 0 0 20px rgba(56, 189, 248, 0.35);
    border-radius: 8px;
    padding: 16px 20px;
    text-align: center;
    gap: 8px;
    animation: zoomInLoad 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomInLoad {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.loading-magic-symbol {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

.loading-ring-outer {
    position: absolute;
    inset: 0;
    border: 2px dashed #fde047;
    border-radius: 50%;
    animation: spinClockwise 6s linear infinite;
}

.loading-ring-inner {
    position: absolute;
    inset: 5px;
    border: 1.5px dotted #38bdf8;
    border-radius: 50%;
    animation: spinCounter 4s linear infinite;
}

.loading-icon-center {
    font-size: 18px;
    animation: pulseOrb 1.5s ease-in-out infinite alternate;
}

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

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

@keyframes pulseOrb {
    0% { transform: scale(0.88); filter: drop-shadow(0 0 4px #38bdf8); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 12px #fde047); }
}

.loading-title {
    font-size: 9px;
    color: #fde047;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(253, 224, 71, 0.5);
}

.loading-subtitle {
    font-size: 6.5px;
    color: #94a3b8;
    letter-spacing: 0.2px;
}

.loading-progress-frame {
    position: relative;
    width: 100%;
    height: 10px;
    background: #020617;
    border: 1.5px solid #334155;
    border-radius: 5px;
    overflow: hidden;
    margin: 6px 0 2px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #fde047 100%);
    border-radius: 3px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

.loading-status-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 6.5px;
}

.loading-status-msg {
    color: #38bdf8;
    font-weight: bold;
}

.loading-percent-val {
    color: #fde047;
    font-weight: bold;
}

.loading-tip-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 10px;
    margin-top: 4px;
    text-align: left;
}

.loading-tip-bulb {
    font-size: 11px;
    flex-shrink: 0;
}

.loading-tip-text {
    font-size: 6px;
    color: #cbd5e1;
    line-height: 1.35;
}

/* =========================================================
   OVERHEAD PLAYER NAMETAG SYSTEM (CRISP NATIVE HIGH-DPI)
   ========================================================= */
.player-nametags-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 55;
}

.player-nametag-item {
    position: absolute;
    transform: translate(-50%, -100%);
    font-family: 'Press Start 2P', 'Segoe UI', -apple-system, sans-serif;
    font-size: clamp(8px, 1.1vw, 11px);
    font-weight: 800;
    color: #fde047;
    white-space: nowrap;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 
        -1.5px -1.5px 0 #0b1120,
         1.5px -1.5px 0 #0b1120,
        -1.5px  1.5px 0 #0b1120,
         1.5px  1.5px 0 #0b1120,
         0px 2px 4px rgba(0, 0, 0, 0.95);
    will-change: left, top;
}

.player-nametag-item.is-remote {
    color: #f8fafc;
}

.player-nametag-item.is-party {
    color: #4ade80;
    text-shadow: 
        -1.5px -1.5px 0 #052e16,
         1.5px -1.5px 0 #052e16,
        -1.5px  1.5px 0 #052e16,
         1.5px  1.5px 0 #052e16,
         0px 2px 4px rgba(0, 0, 0, 0.95);
}

.player-nametag-item.is-enemy {
    color: #f87171;
    text-shadow: 
        -1.5px -1.5px 0 #450a0a,
         1.5px -1.5px 0 #450a0a,
        -1.5px  1.5px 0 #450a0a,
         1.5px  1.5px 0 #450a0a,
         0px 2px 4px rgba(239, 68, 68, 0.6);
}

/* =========================================================
   OVERHEAD SPEECH BUBBLE SYSTEM (CRISP NATIVE RESOLUTION)
   ========================================================= */
.speech-bubbles-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 65;
}

.speech-bubble-item {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(11, 17, 32, 0.94);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1.5px solid var(--bubble-color, #38bdf8);
    border-radius: 6px;
    padding: clamp(2px, 0.4vw, 4px) clamp(6px, 0.8vw, 10px);
    color: #f8fafc;
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: clamp(10px, 1.3vw, 13px);
    font-weight: 700;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.75), 0 0 10px rgba(56, 189, 248, 0.3);
    white-space: nowrap;
    max-width: 260px;
    text-overflow: ellipsis;
    overflow: hidden;
    pointer-events: none;
    line-height: 1.25;
    animation: bubblePop 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.2s ease-out;
}

.speech-bubble-item::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--bubble-color, #38bdf8);
}

@keyframes bubblePop {
    0% { transform: translate(-50%, -85%) scale(0.85); opacity: 0; }
    100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────
   Crisp High-DPI Vector Movement Guide HUD
   ───────────────────────────────────────────────────────────── */
.movement-guide-hud {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(11, 17, 32, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid #38bdf8;
    border-radius: 8px;
    padding: 8px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.35);
    z-index: 55;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.movement-guide-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.guide-key-row {
    display: flex;
    gap: 3px;
}

.guide-key {
    width: 22px;
    height: 22px;
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid #38bdf8;
    border-radius: 4px;
    color: #f8fafc;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.08s ease;
}

.guide-key.active {
    background: #38bdf8;
    color: #070c18;
    box-shadow: 0 0 12px #38bdf8, 0 0 20px rgba(56, 189, 248, 0.6);
    transform: translateY(1px) scale(0.95);
}

.movement-guide-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.guide-title {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
    text-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}

.guide-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 9px;
    color: #94a3b8;
    font-weight: 600;
}
