:root {
    --bg-color: #050505;
    --accent-neon: #00ff41;
    --accent-dash: #00e5ff;
    --enemy-color: #ff0055;
    --hp-color: #ff3333;
    --text-color: #ffffff;
}

* {
    touch-action: manipulation;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    background-color: var(--bg-color);
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    /* Prevents accidental zooming while allowing normal taps */
    touch-action: manipulation;
    position: fixed;
    top: 0;
    left: 0;
    overscroll-behavior-x: none;
    /* Disable back/forward swipe navigation */
}



.hidden {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    /* FORCE ABOVE MOST OVERLAYS */
    background: transparent !important;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    pointer-events: none;
    /* Game logic handles inputs via window listeners */
}

#glitch-overlay {
    display: none !important;
}

#blood-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, transparent 40%, rgba(255, 0, 0, 0.45) 100%);
    pointer-events: none;
    z-index: 5000;
    display: none;
    opacity: 0;
    transition: opacity 0.1s;
}

.shake {
    animation: shake-anim 0.2s double;
}

@keyframes shake-anim {
    0% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-5px, 5px);
    }

    40% {
        transform: translate(5px, -5px);
    }

    60% {
        transform: translate(-5px, -5px);
    }

    80% {
        transform: translate(5px, 5px);
    }

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

#ui-layer {
    position: absolute;
    top: calc(15px + env(safe-area-inset-top));
    left: calc(15px + env(safe-area-inset-left));
    pointer-events: none;
    width: calc(100% - 30px);
    z-index: 2000;
    /* ABOVE CANVAS */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 0 10px var(--accent-neon);
    margin-bottom: 5px;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a0033;
    background-image: radial-gradient(circle at center, rgba(255, 0, 255, 0.1) 0%, #050505 85%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Edge-to-edge distribution */
    gap: 5px;
    z-index: 2100;
    padding: calc(env(safe-area-inset-top) + 60px) 15px calc(env(safe-area-inset-bottom) + 15px);
    box-sizing: border-box;
    transition: transform 0.6s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.5s;
    overflow: hidden;
    touch-action: none;
}

#start-screen.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.logo-area {
    text-align: center;
    flex: 0;
    /* Don't grow */
}

.game-title {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    /* Reduced scale */
    font-weight: 900;
    line-height: 0.85;
    margin: 0;
    text-shadow: 0 0 30px var(--accent-dash);
    animation: titleFloat 3s ease-in-out infinite;
}

.game-title span {
    color: var(--accent-dash);
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    /* Reduced scale */
    letter-spacing: 1px;
}

.character-preview {
    margin-top: 15px;
    /* Tighter spacing */
    position: relative;
    width: 80px;
    /* Smaller preview */
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

#player-crown {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    z-index: 10;
    filter: drop-shadow(0 0 10px currentColor);
    animation: crownFloat 2s ease-in-out infinite;
}

#player-crown.gold {
    color: #ffd700;
}

#player-crown.silver {
    color: #e0e0e0;
}

#player-crown.bronze {
    color: #cd7f32;
}

@keyframes crownFloat {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }
}

/* === NEOMODAL (CUSTOM DIALOG) === */
#neo-modal-overlay {
    position: fixed;
    inset: 0;
    /* Shorthand for top/right/bottom/left: 0 */
    width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#neo-modal-overlay.active {
    display: flex;
}

.neo-modal-box {
    background: rgba(15, 20, 25, 0.98);
    border: 1px solid var(--accent-dash);
    border-radius: 28px;
    width: 100%;
    max-width: 320px;
    padding: 35px 25px;
    margin: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
    /* Remove any default margins, but respect iOS safre area */
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 0 60px rgba(0, 229, 255, 0.2);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.neo-modal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px var(--accent-dash));
}

.neo-modal-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    word-break: keep-all;
    /* Prevent awkward word breaks */
}

.neo-modal-msg {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 30px;
    word-break: keep-all;
    /* Korean text fix */
    display: flex;
    justify-content: center;
    width: 100%;
}

.neo-modal-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.neo-modal-btn {
    flex: 1;
    padding: 15px;
    border-radius: 15px;
    border: none;
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.neo-modal-btn.primary {
    background: var(--accent-dash);
    color: #000;
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.3);
}

.neo-modal-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.neo-modal-btn:active {
    transform: scale(0.94);
}

.player-orb {
    position: relative;
    width: 55px;
    /* Smaller orb */
    height: 55px;
    background: radial-gradient(circle, var(--accent-dash) 0%, #000 70%);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--accent-dash);
    animation: orbPulse 3s ease-in-out infinite;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
}

#preview-pet {
    position: absolute;
    top: 0;
    right: -10px;
    font-size: 1.5rem;
    z-index: 15;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
    animation: petFloat 2.5s ease-in-out infinite;
}

@keyframes petFloat {

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

    50% {
        transform: translateY(-8px) rotate(-5deg);
    }
}

.player-orb.jump-spin {
    animation: none;
    /* Reset base animation */
    animation: jumpSpin 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes jumpSpin {
    0% {
        transform: scale(1) translateY(0) rotate(0deg);
    }

    40% {
        transform: scale(1.3) translateY(-40px) rotate(180deg);
    }

    80% {
        transform: scale(1.1) translateY(0) rotate(360deg);
    }

    100% {
        transform: scale(1) translateY(0) rotate(360deg);
    }
}

.orbit-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--enemy-color);
    border-radius: 50%;
    animation: orbitRotate 4s linear infinite;
    transform-origin: 35px 35px;
}

.orbit-particle.p2 {
    background: var(--accent-neon);
    animation-duration: 2.5s;
    transform-origin: 30px 30px;
    top: 5px;
    left: 5px;
}

@keyframes titleFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

@keyframes orbPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--accent-dash);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 50px var(--accent-dash);
    }
}

@keyframes orbitRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.main-action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* Increased from 12px */
    width: 100%;
    z-index: 2150;
    position: relative;
    pointer-events: none;
    margin-top: 20px;
    /* Added margin to push down */
}

.main-action-area>* {
    pointer-events: auto;
    /* Re-enable clicks for children */
}

.best-score-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 18px;
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(5px);
}

.best-score-badge .label {
    font-size: 0.65rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
}

.best-score-badge #high-score {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

#start-btn {
    background: linear-gradient(135deg, var(--accent-dash), #0088ff);
    border: none;
    color: #fff;
    padding: 12px 40px;
    /* Slimmer button */
    font-size: 1.1rem;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 229, 255, 0.3), inset 0 2px 8px rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulseButton 1.5s ease-in-out infinite;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 2200;
    pointer-events: auto !important;
}

#start-btn:active {
    transform: scale(0.92);
}

/* PREMIUM NAVIGATION ROW */
.premium-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    /* Reduced gap */
    width: 100%;
    max-width: 380px;
    /* Constrain for small screens */
    margin: 15px auto 0;
    /* Added top margin */
}

.nav-btn {
    flex: 1;
    min-width: 0;
    /* Important for flex shrinking */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 10px 4px;
    /* Reduced padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.nav-btn .icon {
    font-size: 1.2rem;
    /* Smaller icon */
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
    transition: transform 0.3s;
}

.nav-btn .btn-text {
    font-size: clamp(0.55rem, 2vw, 0.65rem);
    /* Responsive font size */
    font-weight: 900;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
    text-align: center;
}

.nav-btn:active {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.1);
}

.nav-btn:active .icon {
    transform: scale(1.1) translateY(-2px);
}

.nav-btn.plaza:active {
    border-color: rgba(170, 0, 255, 0.6);
    box-shadow: 0 5px 25px rgba(170, 0, 255, 0.3);
}

.nav-btn.shop:active {
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 5px 25px rgba(0, 229, 255, 0.3);
}

/* FOOTER AREA */
.start-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    /* Extra tight footer */
    width: 100%;
    margin-top: 10px;
    /* Added top margin */
}

.footer-meta {
    display: flex;
    flex-direction: row;
    /* Keep horizontal */
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.6rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px;
    width: 100%;
}

.ver-tag {
    color: #00ffff !important;
    background: #000;
    padding: 3px 8px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.update-link {
    color: var(--accent-dash);
    cursor: pointer;
    transition: opacity 0.2s;
}

.update-link:active {
    opacity: 0.5;
}

.hp-bar-container {
    width: 50vw;
    max-width: 250px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 5px;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    position: relative;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.2);
}

#hp-fill {
    width: 100%;
    height: 100%;
    background: var(--hp-color);
    box-shadow: 0 0 10px var(--hp-color);
    transition: width 0.3s ease;
    border-radius: 6px;
}

.hp-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 900;
    line-height: 16px;
    color: #fff;
    pointer-events: none;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 1px;
}

.revive-indicator {
    position: absolute;
    right: 0px;
    top: -20px;
    font-size: 0.7rem;
    font-weight: 900;
    color: #ff00ff;
    text-shadow: 0 0 5px #ff00ff;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 6px;
    z-index: 10;
}


/* Attack Speed Indicator (Hidden) */
.stamina-container {
    display: none;
    width: 150px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 5px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 0, 0.2);
    /* Yellow for attack */
}

#attack-fill {
    width: 100%;
    height: 100%;
    background: #ffff00;
    box-shadow: 0 0 10px #ffff00;
    transition: width 0.05s linear;
}

/* Skill Selection Modal (Mobile Optimized) */
#skill-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Green Flash Burst on Open */
@keyframes modalFlashIn {
    0% {
        background: rgba(0, 255, 65, 0.6);
        backdrop-filter: blur(0px);
    }

    30% {
        background: rgba(0, 255, 65, 0.15);
    }

    100% {
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(15px);
    }
}

#skill-modal h2 {
    color: var(--accent-neon);
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--accent-neon), 0 0 60px var(--accent-neon);
    text-align: center;
    animation: titleZoom 0.6s ease-out;
}

/* Title Zoom-In Effect */
@keyframes titleZoom {
    0% {
        transform: scale(3);
        opacity: 0;
        filter: blur(10px);
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
        filter: blur(0);
    }

    100% {
        transform: scale(1);
    }
}

.skill-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    max-height: 70vh;
    box-sizing: border-box;
    padding: 10px;
}

.skill-card {
    flex: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    min-height: 80px;
    animation: cardSlideIn 0.4s ease-out backwards;
}

/* Cards Slide Up One by One */
.skill-card:nth-child(1) {
    animation-delay: 0.15s;
}

.skill-card:nth-child(2) {
    animation-delay: 0.3s;
}

.skill-card:nth-child(3) {
    animation-delay: 0.45s;
}

@keyframes cardSlideIn {
    0% {
        transform: translateY(80px) scale(0.8);
        opacity: 0;
        box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        box-shadow: none;
    }
}

/* Card Press Effect */
.skill-card:active {
    transform: scale(0.95);
    background: rgba(0, 255, 65, 0.2);
    border-color: var(--accent-neon);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
}

/* Mastered (Ultimate) Card Styles */
.skill-card.mastered-card {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.15), rgba(255, 255, 255, 0.05));
    border: 2px solid #ffaa00;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.3), inset 0 0 10px rgba(255, 170, 0, 0.1);
    animation: masterPulse 2s infinite alternate;
}

.skill-card.mastered-card .skill-title {
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.6);
}

.skill-card.mastered-card .skill-desc {
    color: #fff;
}

@keyframes masterPulse {
    from {
        border-color: #ffaa00;
        box-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
    }

    to {
        border-color: #fff;
        box-shadow: 0 0 30px rgba(255, 170, 0, 0.6);
    }
}

.pulse-icon {
    animation: iconZoom 1s infinite alternate;
}

@keyframes iconZoom {
    from {
        transform: scale(1);
        filter: brightness(1);
    }

    to {
        transform: scale(1.15);
        filter: brightness(1.5) drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
    }
}

.skill-icon {
    font-size: 2.5rem;
    /* Slightly smaller */
    width: 60px;
    text-align: center;
}

.skill-info {
    /* Wrapper for title/desc */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skill-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.skill-desc {
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.3;
}

/* Settings/Pause Button */
#settings-btn {
    position: absolute;
    top: calc(85px + env(safe-area-inset-top));
    right: calc(25px + env(safe-area-inset-right));
    width: 52px;
    height: 52px;
    background: rgba(15, 20, 25, 0.85);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(0, 229, 255, 0.4);
    border-radius: 16px;
    color: var(--accent-dash);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    z-index: 3500;
    /* Above all UI and Canvas */
    font-size: 1.6rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 229, 255, 0.2);
}

#settings-btn:active {
    transform: scale(0.9) rotate(15deg);
}

@media (hover: hover) {
    #settings-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: rotate(45deg);
    }

    .skill-card:hover {
        background: rgba(0, 255, 65, 0.1);
        border-color: var(--accent-neon);
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 8px 20px rgba(0, 255, 65, 0.2);
    }
}

/* Pause Overlay */
#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Ensure it's on top of everything */
}

.pause-title {
    color: var(--accent-dash);
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    font-weight: 900;
    text-shadow: 0 0 20px var(--accent-dash);
    margin-bottom: 40px;
    letter-spacing: 4px;
}

.pause-btn-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    padding: 0 20px;
}

.pause-menu-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 900;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px currentColor);
}

.pause-menu-btn:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.pause-menu-btn.quit {
    border-color: rgba(255, 0, 85, 0.4);
    color: #ff3366;
    margin-top: 15px;
    background: rgba(255, 0, 85, 0.05);
}

.pause-menu-btn.quit:active {
    background: rgba(255, 0, 85, 0.15);
    border-color: #ff0055;
}

/* Floating Text Engine */
.damage-text {
    position: absolute;
    pointer-events: none;
    font-weight: 900;
    color: #fff;
    font-size: 1.2rem;
    text-shadow: 0 0 5px #000;
    animation: float-up 0.6s ease-out forwards;
    z-index: 1000;
}

@keyframes float-up {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

.skill-icon {
    font-size: 3rem;
}

.skill-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
}

/* Specific override for pause menu buttons to be smaller */
#pause-overlay .pause-menu-btn {
    min-width: 200px;
    padding: 18px 25px;
}

.skill-desc {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.4;
}

.xp-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    position: absolute;
    top: env(safe-area-inset-top);
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#xp-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-dash);
    box-shadow: 0 0 15px var(--accent-dash);
    transition: width 0.3s ease;
}

#xp-text {
    position: absolute;
    right: calc(15px + env(safe-area-inset-right));
    top: calc(18px + env(safe-area-inset-top));
    font-size: 0.95rem;
    color: var(--accent-dash);
    font-weight: 900;
    text-shadow: 0 0 10px var(--accent-dash);
    pointer-events: none;
    opacity: 0.9;
    z-index: 1001;
    /* Above progress bar */
}

.hint {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: 100%;
    text-align: center;
    opacity: 0.6;
    font-size: 0.9rem;
    letter-spacing: 2px;
    pointer-events: none;
}

.level-up-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-neon);
    opacity: 0;
    pointer-events: none;
}

@keyframes flash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.active-flash {
    animation: flash 0.8s ease-out forwards;
}

/* Joystick (Mobile Control) */
#joystick-zone {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 2000;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s;
    opacity: 0.6;
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    background: rgba(0, 229, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    transition: transform 0.05s linear;
}

/* === LEVEL UP ANNOUNCEMENT ANIMATIONS === */
@keyframes lvlAnnounceIn {
    0% {
        background: radial-gradient(circle, rgba(0, 255, 65, 0.6) 0%, transparent 70%);
    }

    50% {
        background: radial-gradient(circle, rgba(0, 255, 65, 0.2) 0%, transparent 70%);
    }

    100% {
        background: radial-gradient(circle, rgba(0, 255, 65, 0) 0%, transparent 70%);
        opacity: 0;
    }
}

@keyframes lvlTextPop {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    20% {
        transform: scale(1.5);
        opacity: 1;
    }

    50% {
        transform: scale(1.0);
        opacity: 1;
    }

    80% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.0);
        opacity: 0;
    }
}

/* === LOADING SCREEN (SPLASH) === */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    z-index: 99999;
    /* Absolute top */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    width: 80%;
}

.splash-logo {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 30px;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
}

.splash-logo span {
    color: var(--accent-dash);
}

.loader-box {
    width: 100%;
    max-width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 auto 15px;
    border-radius: 2px;
    overflow: hidden;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-dash);
    box-shadow: 0 0 15px var(--accent-dash);
    animation: loadingAnim 2.2s cubic-bezier(0.65, 0.05, 0.36, 1) forwards;
}

.loading-text {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes loadingAnim {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

/* Game Over Screen */
#gameover-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 4000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-box {
    margin-top: 15px;
}

.google-login-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

#start-leaderboard {
    margin-top: 20px;
    width: 300px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 15px;
}

#start-leaderboard h3 {
    font-size: 0.8rem;
    color: var(--accent-dash);
    letter-spacing: 2px;
    margin-bottom: 15px;
}

#start-leaderboard-list .rank-item {
    font-size: 0.8rem;
}

#gameover-screen.hidden {
    display: none;
}

#gameover-screen:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.gameover-content {
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#gameover-screen:not(.hidden) .gameover-content {
    transform: scale(1) translateY(0);
}

#gameover-screen {
    display: flex;
    /* Ensure centering */
    align-items: center;
    justify-content: center;
}

.gameover-content {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gameover-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--enemy-color);
    margin-bottom: 40px;
    letter-spacing: -2px;
    text-shadow: 0 0 40px rgba(255, 0, 85, 0.4);
}

.gameover-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 320px;
    /* Constrain width */
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-item.best {
    grid-column: span 2;
    background: rgba(0, 229, 255, 0.05);
}

.stat-item .label {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

.stat-item .value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
}

#restart-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 16px 36px;
    font-size: 1rem;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

@media (hover: hover) {
    #restart-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 15px 40px rgba(255, 255, 255, 0.3);
    }
}

#restart-btn:active {
    transform: scale(0.95);
}

@media (max-width: 400px) {
    .gameover-title {
        font-size: 2.2rem;
        margin-bottom: 25px;
        /* Reduced margin for mobile */
    }

    .gameover-stats {
        gap: 10px;
        margin-bottom: 25px;
    }

    .stat-item .value {
        font-size: 1.5rem;
        /* Smaller text for stats */
    }
}

/* Auth & Leaderboard */
#auth-section {
    margin-bottom: 20px;
}

#login-btn {
    background: rgba(66, 133, 244, 0.2);
    color: #4285f4;
    border: 1px solid #4285f4;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    font-size: 0.9rem;
}

#user-info,
#start-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

#user-pic,
#start-user-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-dash);
    box-shadow: 0 0 10px var(--accent-dash);
}

#user-name,
#start-user-name {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
}

#leaderboard {
    width: 320px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 15px;
    margin-bottom: 30px;
    max-height: 200px;
    overflow-y: auto;
}

#leaderboard h3 {
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: var(--accent-dash);
}

.champion-banner {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: bannerPulse 2s infinite alternate;
}

.champion-banner.hidden {
    display: none;
}

.champ-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.champ-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.champ-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: rgba(255, 215, 0, 0.8);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.champ-name {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

@keyframes bannerPulse {
    from {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
        border-color: rgba(255, 215, 0, 0.3);
    }

    to {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
        border-color: rgba(255, 215, 0, 0.6);
    }
}

.rank-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.rank-item:last-child {
    border: none;
}

.rank-name {
    color: #fff;
    font-weight: 600;
}

.rank-score {
    color: var(--accent-neon);
    font-weight: 800;
}

.rank-pos {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 900;
    margin-right: 10px;
}

/* Start Screen Specific Auth/Leaderboard */
.auth-box {
    margin-top: 20px;
    z-index: 100;
}

.google-login-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.google-login-btn:active {
    transform: scale(0.95);
}

#start-leaderboard {
    margin-top: 20px;
    width: 320px;
    max-width: 90%;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

#start-leaderboard h3 {
    font-size: 0.8rem;
    color: var(--accent-dash);
    letter-spacing: 2px;
    margin-bottom: 20px;
    font-weight: 900;
}

#start-leaderboard-list {
    max-height: 200px;
    overflow-y: auto;
}

/* SKIN COLLECTION SYSTEM */
.skins-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 14px 0;
    width: 140px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.skins-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.05);
}

/* Collection Modal (Skins & Pets) */
#skins-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skins-content {
    width: 95%;
    max-width: 500px;
    height: 80vh;
    /* Fixed height for consistent 'frame' ratio */
    min-height: 500px;
    /* Minimum frame for Tablet/PC */
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skins-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.close-skins {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 100;
}

.close-skins:active {
    transform: scale(0.9);
    background: rgba(255, 0, 85, 0.2);
    color: #ff3366;
    border-color: #ff3366;
}

.collection-tabs {
    display: flex;
    gap: 15px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.1rem;
    /* Reduced from 1.4rem to prevent pushing other elements */
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.tab-btn.active {
    color: var(--accent-dash);
    text-shadow: 0 0 10px var(--accent-dash);
}

#item-info-banner {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #ccc;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    min-height: 80px;
    /* Unified banner height for both tabs */
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: keep-all;
    overflow-y: auto;
    /* Just in case descriptions are very long */
}

#skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding-bottom: 20px;
    padding-right: 10px;
    flex: 1;
    /* Custom Scrollbar for list-like feel */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-dash) rgba(255, 255, 255, 0.05);
}

#skins-grid::-webkit-scrollbar {
    width: 6px;
}

#skins-grid::-webkit-scrollbar-thumb {
    background: var(--accent-dash);
    border-radius: 3px;
}

/* Item Card Enhancement */
.skin-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.pet-card {
    background: rgba(40, 40, 50, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pet-rarity {
    font-size: 0.6rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.pet-rarity.common {
    background: rgba(200, 200, 200, 0.2);
    color: #ccc;
}

.pet-rarity.rare {
    background: rgba(0, 229, 255, 0.2);
    color: #00e5ff;
}

.pet-rarity.epic {
    background: rgba(170, 0, 255, 0.2);
    color: #aa00ff;
}

.pet-rarity.legendary {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid #ffd700;
}

.skin-card.locked {
    filter: grayscale(1);
    opacity: 0.8;
    /* Increased from 0.6 for better visibility */
    background: repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.1),
            rgba(0, 0, 0, 0.1) 10px,
            rgba(255, 255, 255, 0.01) 10px,
            rgba(255, 255, 255, 0.01) 20px);
}

.skin-card.locked .skin-preview {
    opacity: 0.5;
}

.skin-card.selected {
    border: 2px solid var(--accent-dash);
    background: rgba(255, 0, 85, 0.05);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.2);
}

.skin-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    /* Changed from 50% for a modern tile feel */
    margin-bottom: 8px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.skin-lock-icon {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.5);
}

.skin-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 5px;
}

.skin-desc {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.equipped-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--accent-neon);
    color: #000;
    font-size: 0.5rem;
    font-weight: 900;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
}

.skin-card.selected .equipped-badge {
    opacity: 1;
}

/* === SHOP (ARMORY) SYSTEM === */
.menu-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    width: 100%;
}

.shop-btn {
    background: rgba(0, 229, 255, 0.08);
    /* Transparent Cyan */
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--accent-dash);
    padding: 14px 0;
    width: 140px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    backdrop-filter: blur(5px);
}

.shop-btn:hover {
    background: rgba(0, 229, 255, 0.2);
    color: #fff;
    border-color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.3);
}

#plaza-btn {
    background: linear-gradient(135deg, rgba(170, 0, 255, 0.15), rgba(170, 0, 255, 0.05));
    border: 1px solid rgba(170, 0, 255, 0.6);
    color: #eebbff;
    position: relative;
    overflow: hidden;
    animation: plazaPulse 2s infinite ease-in-out;
}

@keyframes plazaPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(170, 0, 255, 0.3), inset 0 0 10px rgba(170, 0, 255, 0.1);
        border-color: rgba(170, 0, 255, 0.6);
        background: linear-gradient(135deg, rgba(170, 0, 255, 0.15), rgba(170, 0, 255, 0.05));
    }

    50% {
        box-shadow: 0 0 35px rgba(170, 0, 255, 0.6), inset 0 0 15px rgba(170, 0, 255, 0.2);
        border-color: rgba(200, 100, 255, 0.8);
        background: linear-gradient(135deg, rgba(170, 0, 255, 0.25), rgba(170, 0, 255, 0.1));
    }
}

#plaza-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#plaza-btn:hover {
    background: linear-gradient(135deg, rgba(170, 0, 255, 0.3), rgba(170, 0, 255, 0.1));
    color: #fff;
    border-color: #fff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(170, 0, 255, 0.5), inset 0 0 20px rgba(170, 0, 255, 0.3);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation-play-state: paused;
    /* Pause subtle pulse on hover, let hover state take over */
}

#plaza-btn:hover::before {
    opacity: 1;
    animation: rotateGlow 4s linear infinite;
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: shopFadeIn 0.3s ease-out;
    display: none;
    /* Default hidden */
}

/* Override .hidden utility */
#shop-modal.hidden {
    display: none !important;
}

#shop-modal:not(.hidden) {
    display: flex !important;
}


@keyframes shopFadeIn {
    from {
        opacity: 0;
        transform: scale(1.05);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.shop-content {
    width: 90%;
    max-width: 450px;
    background: rgba(10, 15, 20, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 30px;
    padding: 30px;
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.15);
    position: relative;
    overflow: hidden;
}

/* Cyber Grid Background for Shop */
.shop-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

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

.shop-header h2 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 3px;
    color: #fff;
    text-shadow: 0 0 20px var(--accent-dash);
}

.shop-credits {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent-neon);
    background: rgba(0, 255, 65, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 65, 0.3);
}

.close-shop {
    font-size: 2rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    position: relative;
    z-index: 100;
}

.close-shop:hover {
    color: #fff;
}

#shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    max-height: 55vh;
    overflow-y: auto;
    position: relative;
    z-index: 1;
    padding: 10px 5px;
}

.shop-item-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.shop-item-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-dash);
}

.shop-icon {
    font-size: 2rem;
    width: 65px;
    height: 65px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shop-title {
    font-weight: 900;
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.shop-desc {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.3;
    min-height: 2.6rem;
}

.shop-stock {
    font-size: 0.7rem;
    color: var(--accent-neon);
    margin-top: 2px;
    font-weight: bold;
}

.shop-buy-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-dash), #00bbd4);
    border: none;
    color: #000;
    font-weight: 900;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 229, 255, 0.3);
}

.shop-buy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-dash);
}

.shop-buy-btn:active {
    transform: scale(0.95);
}

.shop-buy-btn.disabled {
    background: #333;
    color: #666;
    pointer-events: none;
    box-shadow: none;
}

.shop-item-card.locked-exclusive {
    opacity: 0.4;
    filter: grayscale(1);
    border-color: rgba(255, 0, 0, 0.2);
    pointer-events: none;
}

/* === AMMO HUD === */
.ammo-hud {
    position: fixed;
    top: 140px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    pointer-events: none;
}

.ammo-slot {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 5px 12px;
    border-radius: 15px;
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
    transition: all 0.3s;
}

.ammo-slot span {
    color: #00e5ff;
    text-shadow: 0 0 5px #00e5ff;
}

.ammo-slot.hidden {
    display: none;
}

@keyframes pulseButton {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(0, 229, 255, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 50px rgba(0, 229, 255, 0.6);
    }
}

@keyframes crownFloat {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }
}

/* === ORIENTATION LOCK & RESPONSIVE SCALING (v4.4.1) === */
#orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #050505;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(20px);
}

/* Detect Landscape on Mobile/Tablets */
/* iPads are around 768-1024. Folds are around 700-900 unfolded. */
@media screen and (orientation: landscape) and (max-height: 600px),
screen and (orientation: landscape) and (max-width: 1100px) {
    #orientation-warning {
        display: flex;
    }
}

.warning-box {
    animation: warningPulse 2s infinite ease-in-out;
}

.warning-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px var(--accent-dash));
}

@keyframes warningPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Tablet & Wide Device Scaling (Galaxy Fold Unfolded, iPads) */
@media screen and (min-width: 600px) {
    #ui-layer {
        left: 50% !important;
        transform: translateX(-50%);
        width: 100% !important;
        max-width: 500px;
        /* Keep HUD compact */
        padding: 0 20px;
        box-sizing: border-box;
    }

    .stats {
        text-align: center;
    }

    .hp-bar-container {
        margin: 5px auto 0 !important;
    }

    #start-screen {
        background-size: cover;
    }

    .main-action-area {
        max-width: 450px;
    }

    .premium-nav {
        max-width: 450px;
    }
}

/* Ultra Wide / PC Styling */
@media screen and (min-width: 1000px) {
    #ui-layer {
        max-width: 600px;
    }

    #start-screen {
        justify-content: center !important;
        gap: 60px;
    }
}

/* === AMMO HUD (Fixed Overlap) === */
.ammo-hud {
    position: absolute;
    top: calc(85px + env(safe-area-inset-top));
    /* Below HP bar */
    left: calc(15px + env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 90;
}

.ammo-slot {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent-dash);
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
}

/* === OVERLOAD GAUGE === */
.overload-container {
    position: fixed;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#overload-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff4d4d, #ffaa00);
    transition: width 0.2s ease-out;
}

#overload-text {
    position: relative;
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.9);
    z-index: 2;
    text-shadow: 0 1px 2px black;
    letter-spacing: 1px;
}

.overload-container.critical {
    border-color: #ff0000;
    box-shadow: 0 0 20px #ff0000, 0 0 40px rgba(255, 0, 0, 0.5);
    animation: gaugeShake 0.1s infinite;
}

.overload-container.critical #overload-fill {
    background: linear-gradient(90deg, #ff0000, #ffff00, #ff0000);
    background-size: 200% 100%;
    animation: rainbow 0.5s linear infinite;
}

@keyframes rainbow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

@keyframes gaugeShake {
    0% {
        transform: translate(-51%, 0);
    }

    25% {
        transform: translate(-49%, 1px);
    }

    50% {
        transform: translate(-51%, -1px);
    }

    75% {
        transform: translate(-49%, 0);
    }

    100% {
        transform: translate(-50%, 0);
    }
}

#super-nova-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: white;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease-out;
}

/* === MODE SELECTION & CAMPAIGN UI === */
#mode-select-overlay,
#chapter-select-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999 !important;
    display: flex !important;
    visibility: visible !important;
    justify-content: center;
    align-items: flex-end;
    opacity: 1 !important;
    transition: opacity 0.3s ease;
}

#mode-select-overlay.hidden,
#chapter-select-overlay.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#chapter-select-overlay {
    align-items: center;
}

.mode-panel {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, rgba(20, 20, 30, 0.98) 0%, rgba(10, 10, 15, 1) 100%);
    border-top: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 28px 28px 0 0;
    padding: 30px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.9);
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-sizing: border-box;
}

.mode-panel.slide-up {
    transform: translateY(0);
}

.mode-title {
    text-align: center;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    font-weight: 900;
}

.mode-options {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.mode-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.mode-card:active {
    transform: scale(0.96);
}

.mode-card.campaign {
    border-color: rgba(170, 0, 255, 0.3);
    background: linear-gradient(135deg, rgba(50, 0, 100, 0.4) 0%, rgba(0, 0, 0, 0) 100%);
}

.mode-card.arcade {
    border-color: rgba(0, 229, 255, 0.3);
    background: linear-gradient(135deg, rgba(0, 50, 100, 0.4) 0%, rgba(0, 0, 0, 0) 100%);
}

.mode-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    transition: transform 0.3s;
}

.mode-card:active .mode-icon {
    transform: scale(1.1);
}

.mode-info h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

.mode-info p {
    margin: 5px 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.mode-close-btn,
.chapter-close-btn {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-weight: 800;
    border-radius: 12px;
    margin-top: 15px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.mode-close-btn:active,
.chapter-close-btn:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.chapter-content {
    background: #111;
    width: 85%;
    max-width: 380px;
    padding: 30px 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    max-height: 80vh;
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.chapter-header {
    text-align: center;
    color: #00e5ff;
    margin-top: 0;
    margin-bottom: 25px;
    letter-spacing: 2px;
    font-size: 1.4rem;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.chapter-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    text-align: left;
}

.chapter-card.unlocked {
    border-color: #00ff41;
    background: linear-gradient(90deg, rgba(0, 255, 65, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
    cursor: pointer;
}

.chapter-card.unlocked:active {
    transform: scale(0.98);
    background: rgba(0, 255, 65, 0.15);
}

.chapter-card.locked {
    opacity: 0.4;
    filter: grayscale(1);
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.3);
}

.chapter-num {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 900;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.chapter-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 6px;
    color: #fff;
    letter-spacing: 0.5px;
}

.chapter-desc {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 10px;
    line-height: 1.4;
}

.chapter-status {
    font-size: 0.7rem;
    font-weight: 900;
    color: #00ff41;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 255, 65, 0.3);
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 255, 65, 0.1);
}

.chapter-card.locked .chapter-status {
    color: #ff5555;
    border-color: rgba(255, 85, 85, 0.3);
    background: rgba(255, 85, 85, 0.1);
}

/* === UPGRADE BUTTON (Standalone) === */
.upgrade-btn {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.2), rgba(255, 100, 0, 0.15));
    border: 1.5px solid rgba(255, 170, 0, 0.5);
    color: #ffaa00;
    font-size: 0.85rem;
    /* Increased from 0.7rem */
    font-weight: 900;
    padding: 12px 30px;
    /* Increased from 8px 20px */
    border-radius: 25px;
    /* Increased from 20px */
    cursor: pointer;
    letter-spacing: 2px;
    margin-top: 25px;
    /* Increased from 10px */
    animation: upgradePulse 2s infinite;
    transition: all 0.2s;
    display: block;
}

.upgrade-btn:active {
    transform: scale(0.95);
    background: rgba(255, 170, 0, 0.3);
}

@keyframes upgradePulse {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 170, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
    }
}

/* === UPGRADE MODAL === */
#upgrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

#upgrade-modal.hidden {
    display: none !important;
}

.upgrade-content {
    width: 92%;
    max-width: 400px;
    max-height: 85vh;
    background: linear-gradient(180deg, rgba(20, 15, 30, 0.98) 0%, rgba(10, 8, 18, 1) 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 170, 0, 0.2);
    overflow: hidden;
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
}

.upgrade-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 170, 0, 0.03);
    gap: 10px;
}

.upgrade-header h2 {
    font-size: 0.95rem;
    font-weight: 900;
    color: #ffaa00;
    letter-spacing: 1px;
    margin: 0;
    flex-shrink: 0;
}

.upgrade-credits {
    font-size: 0.85rem;
    font-weight: 900;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    margin-left: auto;
    margin-right: 5px;
}

.upgrade-credits-icon {
    font-size: 1.1rem;
}

.close-upgrade {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    line-height: 1;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    transition: all 0.2s;
}

.close-upgrade:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(0.9);
}

#upgrade-grid {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    transition: all 0.2s;
}

.upgrade-card:active {
    background: rgba(255, 170, 0, 0.08);
    border-color: rgba(255, 170, 0, 0.3);
}

.upgrade-icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    flex-shrink: 0;
}

.upgrade-info {
    flex: 1;
    min-width: 0;
}

.upgrade-name {
    font-size: 0.8rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
}

.upgrade-desc {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.upgrade-level {
    display: flex;
    gap: 3px;
    margin-top: 5px;
}

.upgrade-level .pip {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.upgrade-level .pip.filled {
    background: #ffaa00;
    box-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
}

/* NEW: Requirement Chip for Upgrades */
.req-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 5px;
}

.req-chip.missing {
    background: rgba(255, 85, 85, 0.1);
    border-color: rgba(255, 85, 85, 0.3);
    color: #ff5555;
    animation: shake-error 0.4s ease-in-out;
}

@keyframes shake-error {

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

    25% {
        transform: translateX(-2px);
    }

    75% {
        transform: translateX(2px);
    }
}

.upgrade-buy {
    background: linear-gradient(135deg, #ffaa00, #ff8800);
    color: #000;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
}

.upgrade-buy:active {
    transform: scale(0.93);
}

.upgrade-buy.maxed {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.upgrade-buy.too-expensive {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

/* === WAVE HUD (Campaign) === */
#wave-hud {
    position: fixed;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    text-align: center;
    pointer-events: none;
}

#wave-hud.hidden {
    display: none;
}

.wave-label {
    font-size: 0.7rem;
    font-weight: 900;
    color: #00e5ff;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.wave-kills {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

/* === CAMPAIGN VICTORY SCREEN === */
#campaign-victory {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 8000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(15px);
}

#campaign-victory.hidden {
    display: none !important;
}

.victory-content {
    text-align: center;
    animation: victorySlide 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes victorySlide {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.victory-star {
    font-size: 4rem;
    animation: starPulse 1.5s ease-in-out infinite;
}

@keyframes starPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(15deg);
    }
}

.victory-title {
    font-size: 2rem;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin: 15px 0 5px;
}

.victory-chapter {
    font-size: 1.2rem;
    font-weight: 900;
    color: #00ff41;
    letter-spacing: 3px;
}

.victory-stats {
    margin: 25px 0;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 16px;
    display: inline-block;
}

.victory-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.v-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px;
}

.v-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #00e5ff;
}

.victory-btn {
    background: linear-gradient(135deg, #ffd700, #ff8800);
    color: #000;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.victory-btn:active {
    transform: scale(0.95);
}