:root {
    --accent: #00f3ff;
    --bg: #050505;
    --panel: #111;
    --border: #333;
    --neon-bg-color: rgba(0, 243, 255, 0.15);
    --bg-dark-color: #0a0a14;
}

body {
    margin: 0;
    background: var(--bg-dark-color); /* Promijenjeno na jako tamnu bazu */
    color: #e0e0e0;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    position: relative; /* Bitno za 3D efekte pozadine */
}

    /* --- POČETAK: ANIMIRANA NEONSKA POZADINA --- */
    body::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        background: radial-gradient(circle at center, var(--neon-bg-color) 0%, transparent 60%), radial-gradient(ellipse at bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
        z-index: -1;
        opacity: 0.6;
    }

    body::before {
        content: "";
        position: fixed;
        bottom: -30%;
        left: -50%;
        width: 200%;
        height: 100%;
        background-image: linear-gradient(0deg, transparent 24%, var(--neon-bg-color) 25%, var(--neon-bg-color) 26%, transparent 27%, transparent 74%, var(--neon-bg-color) 75%, var(--neon-bg-color) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, var(--neon-bg-color) 25%, var(--neon-bg-color) 26%, transparent 27%, transparent 74%, var(--neon-bg-color) 75%, var(--neon-bg-color) 76%, transparent 77%, transparent);
        background-size: 100px 100px;
        transform-origin: bottom center;
        transform: perspective(500px) rotateX(60deg);
        pointer-events: none;
        z-index: -2;
        animation: moveGrid 5s linear infinite;
    }

@keyframes moveGrid {
    0% {
        background-position: 0px 0px;
    }

    100% {
        background-position: 0px 100px;
    }
}
/* --- KRAJ: ANIMIRANA NEONSKA POZADINA --- */


.main-nav {
    width: 100%;
    background: #000;
    border-bottom: 2px solid var(--accent);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 100;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-size: 24px;
    font-weight: 900;
}

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

.nav-links a {
    color: #aaa;
    text-decoration: none;
    margin-left: 20px;
    font-weight: bold;
    transition: 0.3s;
}

    .nav-links a:hover {
        color: var(--accent);
    }

#mainLayout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.side-ad {
    flex: 0 0 160px;
    width: 160px;
    height: 100%;
    background: var(--panel);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

@media (max-width: 1350px) {
    .side-ad {
        display: none !important;
    }
}

#centerColumn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    position: relative;
    overflow-y: auto;
}

/* Landing Page */
#landingPage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    padding: 40px;
    box-sizing: border-box;
    text-align: center;
    animation: fadeIn 1s;
}

    #landingPage h1 {
        font-size: 48px;
        color: var(--accent);
        text-shadow: 0 0 20px var(--accent);
        margin-bottom: 20px;
    }

.seo-text {
    font-family: sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #aaa;
    background: rgba(17, 17, 17, 0.8);
    padding: 20px;
    border: 1px solid var(--border);
    margin-top: 30px;
    border-radius: 10px;
    text-align: left;
}

    .seo-text p {
        margin: 8px 0;
    }

    .seo-text strong {
        color: var(--accent);
    }

.diff-btn {
    background: #222;
    color: #aaa;
    border: 1px solid #555;
    padding: 10px 20px;
    font-family: 'Orbitron';
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    transition: 0.3s;
}

    .diff-btn.active {
        background: var(--accent);
        color: #000;
        border-color: var(--accent);
        box-shadow: 0 0 15px var(--accent);
    }

#bigStartBtn {
    padding: 20px 60px;
    font-size: 32px;
    font-family: 'Orbitron';
    font-weight: 900;
    color: #000;
    background: var(--accent);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 30px var(--accent);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: pulse 2s infinite;
    margin-top: 20px;
}

    #bigStartBtn:hover {
        transform: scale(1.05);
        box-shadow: 0 0 50px var(--accent);
        background: #fff;
    }

@keyframes pulse {
    0% {
        box-shadow: 0 0 20px var(--accent);
    }

    50% {
        box-shadow: 0 0 40px var(--accent);
    }

    100% {
        box-shadow: 0 0 20px var(--accent);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Game Area */
#gameContainer {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    position: relative;
    padding-top: 20px;
}

#controlBar {
    width: 900px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 5px;
}

.ctrl-btn {
    background: #111;
    color: #aaa;
    border: 1px solid #444;
    padding: 8px 15px;
    font-family: 'Orbitron';
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 4px;
}

    .ctrl-btn:hover {
        background: #222;
        color: #fff;
        border-color: var(--accent);
    }

    .ctrl-btn.active-state {
        color: #0f0;
        border-color: #0f0;
    }

#scaler {
    transform-origin: top center;
    display: flex;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.1);
    flex-direction: column;
    align-items: center;
}

#gameWrapper {
    position: relative;
    width: 900px;
    height: 600px;
    border: 2px solid var(--border);
    overflow: hidden;
    cursor: crosshair;
    background: #000;
    touch-action: none;
}
    #gameWrapper::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none; /* Ensure clicks go through to the game */
        z-index: 10; /* Sits above canvas (z-index:5) but below UI buttons */
        /* Effect 1: Subtle Scanlines */
        background-image: linear-gradient( rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.25) 50% ), radial-gradient(circle at center, transparent 0%, rgba(0,243,255,0.1) 100%);
        background-size: 100% 4px, 100% 100%; /* Size of scanlines */

        opacity: 0.7;
        mix-blend-mode: overlay; /* Blends nicely with game colors */
        /* Effect 2: Slow pulsing glow */
        animation: screenPulse 4s ease-in-out infinite alternate;
    }

@keyframes screenPulse {
    0% {
        box-shadow: inset 0 0 50px rgba(0, 243, 255, 0.1);
        opacity: 0.6;
    }

    100% {
        box-shadow: inset 0 0 150px rgba(0, 243, 255, 0.3);
        opacity: 0.8;
    }
}

canvas {
    display: block;
    position: relative;
    z-index: 5;
}

/* Leaderboard */
#sidebar {
    width: 200px;
    height: 600px;
    background: var(--panel);
    border: 2px solid var(--border);
    border-left: none;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
}

#leaderboardTitle span {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
    text-align: center;
}

#leaderboardTitle div {
    text-align: center;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 10px;
}

#leaderboardList {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
}

    #leaderboardList li {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #333;
    }

#topUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Changed padding to be slightly smaller */
    padding: 10px 0;
    display: flex;
    justify-content: space-around;
    pointer-events: none;
    /* text-shadow: 0 2px 4px #000;  <- REMOVED text shadow, not needed with dark bg */
    font-size: 18px;
    z-index: 50;
    /* --- NEW STYLES FOR READABILITY --- */
    background: rgba(5, 10, 20, 0.9); /* Dark semi-transparent background */
    border-bottom: 2px solid var(--accent); /* Neon line at the bottom */
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); /* Shadow to separate it from game */
    backdrop-filter: blur(5px); /* Glassy effect */
}

.stat span {
    color: #fff;
    font-weight: bold;
}

/* Abilities & Rage */
#abilitiesUI {
    position: absolute;
    bottom: 85px;
    left: 20px;
    width: 860px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    z-index: 30;
    pointer-events: none;
}

.ability-btn {
    padding: 12px;
    font-family: 'Orbitron';
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    border: 1px solid #444;
    background: rgba(0,0,0,0.9);
    color: #fff;
    transition: 0.2s;
    width: 180px;
    pointer-events: auto;
}

#btnEMP {
    border-color: #00f3ff;
    color: #00f3ff;
}

#btnOrbital {
    border-color: #ff4400;
    color: #ff4400;
}

.ability-btn.active-mode {
    box-shadow: 0 0 20px #ff0055;
    color: #ff0055;
    border-color: #ff0055;
}

.ability-btn.cooldown {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

#rageWrapper {
    position: absolute;
    right: 20px;
    top: 150px;
    width: 15px;
    height: 200px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    overflow: hidden;
    z-index: 20;
    pointer-events: none;
}

#rageFill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #ff0055, #ff00ff);
    transition: height 0.3s ease;
}

#rageText {
    position: absolute;
    right: 45px;
    top: 260px;
    font-size: 12px;
    color: #ff00ff;
    text-shadow: 0 0 5px #ff00ff;
    font-weight: bold;
    transform: rotate(-90deg);
    transform-origin: right center;
    z-index: 20;
    pointer-events: none;
}

/* Towers Shop */
#shopContainer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background: rgba(0,0,0,0.95);
    padding: 8px;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    z-index: 20;
    border: 1px solid #444;
}

.tower-btn {
    min-width: 55px;
    height: 55px;
    background: #222;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

    .tower-btn.selected {
        border-color: var(--accent);
        box-shadow: 0 0 10px var(--accent);
        background: #112;
    }

    .tower-btn.disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.t-name {
    font-size: 8px;
    color: #aaa;
    margin-top: 3px;
}

.t-cost {
    font-size: 10px;
    color: #ffd700;
    font-weight: bold;
}

.t-preview-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-bottom: 2px;
    box-shadow: 0 0 5px currentColor;
}

#upgradeMenu {
    position: fixed;
    display: none;
    background: rgba(0,0,0,0.95);
    border: 1px solid var(--accent);
    padding: 8px;
    z-index: 9999;
    flex-direction: column;
    gap: 5px;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    min-width: 120px;
}

#upTitle {
    font-size: 10px;
    color: var(--accent);
    text-align: center;
    margin-bottom: 3px;
}

.up-btn {
    background: #222;
    color: white;
    border: 1px solid #555;
    padding: 8px;
    cursor: pointer;
    font-family: 'Orbitron';
    font-size: 11px;
    white-space: nowrap;
    transition: 0.2s;
}

    .up-btn:hover {
        background: #444;
    }

.branch-btn {
    display: none;
}

/* Centered In-game Buttons */
.action-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 40px;
    border: none;
    font-family: 'Orbitron';
    font-weight: bold;
    cursor: pointer;
    z-index: 40;
    font-size: 18px;
    transition: 0.3s;
}

#startBtn {
    bottom: 250px;
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px var(--accent);
    display: none;
}

#continueBtn {
    bottom: 320px;
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 15px #ffd700;
    display: none;
}

#newGameBtn {
    bottom: 250px;
    background: #ff0055;
    color: #fff;
    box-shadow: 0 0 15px #ff0055;
    display: none;
}

/* Overlays and Modals */
#overlay, #adModal, #perkOverlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.96);
    z-index: 50;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#adModal {
    z-index: 200;
    background: rgba(0,0,0,0.98);
}

.ad-box {
    width: 300px;
    height: 250px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
}

#adCloseBtn {
    padding: 12px 25px;
    background: #555;
    color: #aaa;
    border: none;
    font-family: 'Orbitron';
    cursor: not-allowed;
}

    #adCloseBtn.active {
        background: #ff0055;
        color: white;
        cursor: pointer;
    }

#perkOverlay {
    z-index: 200;
    background: rgba(0,0,0,0.95);
    text-align: center;
}

    #perkOverlay h1 {
        color: var(--accent);
        text-shadow: 0 0 15px var(--accent);
        margin-bottom: 10px;
        font-family: 'Orbitron';
    }

#perkList {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    max-width: 800px;
}

.perk-card {
    background: #111;
    border: 2px solid var(--accent);
    padding: 20px;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 10px;
}

    .perk-card:hover {
        background: #222;
        transform: translateY(-10px);
        box-shadow: 0 10px 20px rgba(0,243,255,0.3);
    }

/* Hacker Boss Overlay */
#hackOverlay {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff0000;
    font-size: 60px;
    font-weight: 900;
    text-shadow: 0 0 30px #ff0000;
    z-index: 40;
    pointer-events: none;
    animation: glitch 0.5s infinite;
}

@keyframes glitch {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) skewX(0deg);
    }

    20% {
        opacity: 0.8;
        transform: translate(-52%, -50%) skewX(-10deg);
    }

    40% {
        opacity: 0.4;
        transform: translate(-48%, -50%) skewX(10deg);
    }

    60% {
        opacity: 1;
        transform: translate(-50%, -50%) skewX(0deg);
    }
}

/* --- AŽURIRANI HOW TO PLAY MODAL (Cyberpunk / Neon stil) --- */
#howToModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.90);
    backdrop-filter: blur(5px); /* Moderni mutni efekt pozadine */
    z-index: 10000;
    overflow-y: auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

.modal-content {
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--accent);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 243, 255, 0.1);
    padding: 30px;
    background: #050505;
    position: relative;
    font-family: 'Orbitron', sans-serif; /* Koristimo primarni font za naslove */
}

    .modal-content h2 {
        color: var(--accent);
        text-shadow: 0 0 10px var(--accent);
        border-bottom: 2px solid var(--border);
        padding-bottom: 10px;
        margin-top: 0;
    }

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    color: #ff0055;
    cursor: pointer;
    transition: 0.2s;
    text-shadow: 0 0 5px #ff0055;
}

    .close-btn:hover {
        color: #ff4444;
        transform: scale(1.1);
    }

.modal-text {
    font-family: sans-serif; /* Zadržavamo sans-serif za lakšu čitljivost dugog tekste */
    line-height: 1.6;
    color: #ccc;
    font-size: 15px;
}

    .modal-text h3 {
        color: #fff;
        border-left: 4px solid var(--accent);
        padding-left: 10px;
        margin-top: 30px;
        font-family: 'Orbitron', sans-serif;
        letter-spacing: 1px;
    }

    .modal-text ul {
        background: rgba(255, 255, 255, 0.03);
        padding: 15px 15px 15px 40px;
        border-radius: 5px;
        border: 1px solid #222;
    }

    .modal-text li {
        margin-bottom: 10px;
    }

    .modal-text strong {
        color: var(--accent);
    }

.ready-btn {
    display: block;
    margin: 40px auto 0;
    padding: 15px 50px;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-family: 'Orbitron';
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

    .ready-btn:hover {
        background: var(--accent);
        color: #000;
        box-shadow: 0 0 30px var(--accent);
        transform: scale(1.05);
    }

#ovTitle {
    color: white;
}

#ovSub {
    color: #aaa;
    margin-bottom: 15px;
}

#inputContainer {
    display: none;
    text-align: center;
}

#nameInput {
    padding: 10px;
    font-family: 'Orbitron';
    text-align: center;
    background: #222;
    color: #fff;
    border: 1px solid var(--accent);
}

#zoneTitle {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    font-weight: 900;
    pointer-events: none;
    opacity: 0;
    transition: 2s;
    width: 100%;
    text-align: center;
    text-shadow: 0 0 30px currentColor;
    z-index: 100;
}
/* --- MOBILNE KONTROLE I ROTACIJA --- */


/* Kada body ima ovu klasu, sakrij glavni meni i bočne reklame */
body.in-game .main-nav,
body.in-game .side-ad {
    display: none !important;
}

body.in-game #mainLayout {
    height: 100vh;
}

/* Stil za ekran upozorenja o rotaciji */
#rotateMessage {
    display: none; /* Skriveno po defaultu */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #050505;
    z-index: 20000;
    color: var(--accent);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

    /* Animacija ikone mobitela */
    #rotateMessage .rotate-icon {
        font-size: 70px;
        margin-bottom: 20px;
        animation: rotatePhone 2s infinite ease-in-out;
    }

@keyframes rotatePhone {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-90deg);
    }

    100% {
        transform: rotate(-90deg);
    }
}

/* Prikaz upozorenja SAMO na mobitelima kada su okomito (Portrait) i u igri */
@media screen and (max-width: 900px) and (orientation: portrait) {
    body.in-game #rotateMessage {
        display: flex;
    }

    body.in-game #gameContainer {
        display: none !important; /* Sakrij igru dok korisnik ne okrene mobitel */
    }
}