:root {
    --bg-color: #090914;
    --primary: #9b2cff;
    --secondary: #d924ff;
    --accent: #00ffff;
    --text-light: #ffffff;
    --text-dim: #a0a0b0;
    --red-team: #ff3366;
    --blue-team: #33aaff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100dvh;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass to canvas unless over an interactive element */
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: auto; /* Catch clicks for UI */
    background-color: var(--bg-color);
}

.screen.hidden {
    display: none;
}

#screen-hud, #screen-home {
    background-color: transparent; 
}

#screen-hud {
    pointer-events: none; /* Game handles most clicks */
}

/* Typography */
.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 4rem;
    text-align: center;
    margin-top: 2rem;
    color: var(--text-light);
    -webkit-text-stroke: 2px var(--primary);
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    text-align: center;
    margin: 1rem 0;
    color: var(--accent);
}

/* Buttons */
button {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s, filter 0.1s;
    pointer-events: auto;
}

button:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 3rem;
    font-size: 2rem;
    align-self: center;
    margin-top: auto;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px rgba(155, 44, 255, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--text-light);
    color: white;
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    align-self: center;
    margin-bottom: 2rem;
}

/* Home Screen */
.selected-character-display {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#home-character-img {
    max-height: 50vh;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(155, 44, 255, 0.3));
}

.nav-bottom {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.5);
}

/* HUD */
.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 900;
}

.blue-team { color: var(--blue-team); }
.red-team { color: var(--red-team); }
.timer { color: white; }

/* Placeholder Joysticks for mobile */
.joystick {
    position: absolute;
    bottom: 2rem;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    pointer-events: auto;
}

#joystick-move { left: 2rem; }
#joystick-aim { right: 2rem; }

.knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.btn-super {
    position: absolute;
    bottom: 2rem;
    right: 160px;
    width: 60px;
    height: 60px;
    background: var(--accent);
    color: black;
    border-radius: 50%;
    font-size: 0.8rem;
}

.bottom-hud {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ammo-slots {
    display: flex;
    gap: 10px;
}

.ammo {
    width: 30px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    transition: all 0.2s;
}

.ammo.full {
    background: var(--accent);
    border-color: white;
    box-shadow: 0 0 10px var(--accent);
}


/* Progression UI */
.progression-bar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.resource-badge {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}
.resource-badge.trophies { color: #ffaa00; }
.resource-badge.gold { color: #ffdd00; }
.resource-badge.gems { color: #00ffaa; }

.progression-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
.btn-trophy-road, .btn-brawl-box {
    background: #1a1a2e;
    color: white;
    border: 2px solid #365875;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-brawl-box { border-color: #ffaa00; }
.btn-trophy-road:hover, .btn-brawl-box:hover { transform: scale(1.05); }

/* End Screen Overlay */
#screen-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 5, 18, 0.9);
    z-index: 100;
}
#screen-end h1 { font-size: 5rem; margin-bottom: 1rem; text-shadow: 0 0 20px rgba(255,255,255,0.5); }
#screen-end .rewards { display: flex; gap: 2rem; margin: 2rem 0; font-size: 2rem; font-weight: bold; }
#screen-end.victory h1 { color: #00ffaa; }
#screen-end.defeat h1 { color: #ff4444; }


.trophy-road-container {
    width: 100vw;
    height: 100dvh;
    overflow-x: auto;
    overflow-y: hidden;
    background: radial-gradient(circle at 50% 50%, #29154a 0%, #0a0512 80%);
    display: flex;
    align-items: center;
    padding: 0 10vw;
    box-sizing: border-box;
    position: relative;
    scrollbar-width: none; 
}
.trophy-road-container::-webkit-scrollbar {
    display: none;
}
.trophy-track {
    display: flex;
    align-items: center;
    gap: 150px;
    height: 400px;
    position: relative;
    min-width: max-content;
}
.trophy-track::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -100px;
    right: -100px;
    height: 40px;
    background: #1a1a2e;
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 20px;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.8);
    border: 4px solid #333;
}
.trophy-track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -100px;
    width: calc(var(--progress, 0%) + 100px);
    height: 40px;
    background: linear-gradient(90deg, #ffcc00, #ff6600);
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(255, 100, 0, 0.6), inset 0 5px 10px rgba(255, 255, 255, 0.5);
    border: 4px solid #fff;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.trophy-node {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}
.trophy-node:hover {
    transform: scale(1.1);
}
.trophy-node.locked {
    opacity: 0.6;
    filter: grayscale(80%);
}
.trophy-node.locked .trophy-milestone {
    background: #333;
    border-color: #555;
    color: #aaa;
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.5);
}
.trophy-milestone {
    background: #ffcc00;
    color: #8B4513;
    font-weight: 900;
    padding: 12px 25px;
    border-radius: 40px;
    font-size: 1.5rem;
    box-shadow: 0 8px 15px rgba(255, 204, 0, 0.4), inset 0 -4px 0 rgba(200, 150, 0, 0.6);
    border: 3px solid #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.trophy-reward {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, #2a2a4a, #111122);
    border: 5px solid #39eaff;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(57, 234, 255, 0.3), inset 0 0 30px rgba(57, 234, 255, 0.2);
}
.trophy-reward img {
    width: 140%;
    height: 140%;
    object-fit: cover;
}
.trophy-reward-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 0 4px 8px rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 10px;
}


#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: rgba(255, 30, 60, 0.95);
    color: white;
    padding: 15px 40px;
    border-radius: 40px;
    font-family: "Outfit", sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(255, 30, 60, 0.5);
    animation: toastEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-align: center;
    border: 3px solid #ffaaaa;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
@keyframes toastEnter {
    from { transform: translateY(-50px) scale(0.8); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}


html, body { overscroll-behavior: none; }

.joystick {
    opacity: .7;
    transition: opacity 0.1s;
    pointer-events: none;
}
.joystick.active {
    opacity: 1;
}
#mobile-controls {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 50;
}
.btn-super {
    pointer-events: auto;
}


.btn-gadget{position:absolute;right:2rem;bottom:12rem;border:2px solid #95f6ad;background:#216b4cdd;color:white;border-radius:50%;width:64px;height:64px;font:bold 12px Arial;pointer-events:auto;touch-action:none;}
.btn-gadget:disabled{opacity:.45;}
#settings-form{display:grid;gap:18px;padding:12px 0;}#settings-form label{display:flex;align-items:center;justify-content:space-between;gap:16px;}#settings-form p{max-width:320px;font-size:12px;line-height:1.6;}#settings-form input[type=range]{max-width:160px;}
.joystick{width:var(--control-size,120px);height:var(--control-size,120px);}
@media(max-height:450px){.btn-gadget{right:6.8rem;bottom:5.8rem;width:52px;height:52px;}}

.ability-info{font-size:11px;line-height:1.6;color:#c9dfed;padding:8px 0;}
