/* Reset and base styles */
body {
    margin: 0;
    font-family: 'Exo 2', sans-serif; /* CHANGE: Main font */
    color: #ecf0f1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;

    /* Space background created with CSS */
    background-color: #000000;
    background-image:
        radial-gradient(ellipse at center, rgba(30, 40, 60, 0.7) 0%, rgba(0, 0, 0, 0) 70%),
        radial-gradient(ellipse at bottom, rgba(50, 60, 80, 0.6) 0%, rgba(0, 0, 0, 0) 70%),
        radial-gradient(ellipse at top left, rgba(70, 80, 100, 0.5) 0%, rgba(0, 0, 0, 0) 70%);
}

/* --- MAIN MENU STYLES --- */
#main-menu-screen {
    display: flex;
    width: 900px;
    height: 660px; 
    background-color: #2c3e50;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.menu-left-panel {
    width: 300px;
    padding: 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background-color: #34495e;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    margin: 0 0 20px 0;
    font-size: 2.2em;
    color: #ecf0f1;
    text-shadow:
        0 0 5px #fff,       /* White central glow */
        0 0 10px #3498db,   /* Bluish glow */
        0 0 10px #3498db,   /* Increased bluish glow */
        0 0 10px #3498db;   /* Expanded bluish glow */
    line-height: 1.2;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-nav button {
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    font-size: 1.1em;
    background-color: transparent; /* Background remains transparent */
    border: 2px solid #7f8c8d; /* Initial border */
    color: #ecf0f1; /* Default text color */
    text-shadow: none; /* Remove default shadow if it exists */
    box-shadow: none; /* Remove default shadow if it exists */
    min-width: 0;
    transition: all 0.2s ease-in-out;
    font-family: 'Rajdhani', sans-serif; /* For consistency with other buttons */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-nav button:not(:disabled):hover {
    background-color: transparent; /* Remove blue background on hover */
    border-color: #3498db; /* Blue border on hover */
    transform: translateX(5px);
    
    /* Neon glow for the button on hover */
    box-shadow:
        0 0 5px #3498db,    /* Inner glow */
        0 0 10px #3498db,   /* Medium glow */
        0 0 15px #3498db;   /* Outer glow */
    
    /* Neon glow for the button text on hover */
    text-shadow:
        0 0 2px #ecf0f1,    /* White for clarity */
        0 0 5px #3498db,    /* Blue glow */
        0 0 10px #3498db;   /* Stronger blue glow */
    
}

.menu-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: transparent;
}
/* 1. Continue (Cyan) */
#menu-continue-btn:not(:disabled):hover {
    border-color: #0090d3;
    box-shadow: 0 0 5px #00d2d3, 0 0 10px #00d2d3, 0 0 15px #00d2d3;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #00d2d3;
}

/* 2. New Game (Blue) */
#menu-new-game-btn:not(:disabled):hover {
    border-color: #3498db;
    box-shadow: 0 0 5px #3498db, 0 0 10px #3498db, 0 0 15px #3498db;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #3498db;
}

/* 3. Stats (Purple) */
#menu-stats-btn:not(:disabled):hover {
    border-color: #9b59b6;
    box-shadow: 0 0 5px #9b59b6, 0 0 10px #9b59b6, 0 0 15px #9b59b6;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #9b59b6;
}

/* 4. Settings (Magenta) */
#menu-settings-btn:not(:disabled):hover {
    border-color: #be2edd;
    box-shadow: 0 0 5px #be2edd, 0 0 10px #be2edd, 0 0 15px #be2edd;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #be2edd;
}

/* 5. About (Orange) */
#menu-about-btn:not(:disabled):hover {
    border-color: #e67e22;
    box-shadow: 0 0 5px #e67e22, 0 0 10px #e67e22, 0 0 15px #e67e22;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #e67e22;
}

/* 6. Credits (Orange-Red) */
#menu-credits-btn:not(:disabled):hover {
    border-color: #e7613c;
    box-shadow: 0 0 5px #e7613c, 0 0 10px #e7613c, 0 0 15px #e7613c;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #e7613c;
}

/* 7. Exit (Red) */
#menu-exit-btn:not(:disabled):hover {
    border-color: #e74c3c;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c, 0 0 15px #e74c3c;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #e74c3c;
}


/* --- Dim glow for DISABLED buttons --- */

/* 1. Continue (Cyan) */
#menu-continue-btn:disabled:hover {
    border-color: #00d2d3;
    box-shadow: 0 0 5px #00d2d3, 0 0 10px #00d2d3;
}

/* 2. New Game (Blue) */
#menu-new-game-btn:disabled:hover {
    border-color: #3498db;
    box-shadow: 0 0 5px #3498db, 0 0 10px #3498db;
}

/* 3. Achievements (Purple) */
#menu-achievements-btn:disabled:hover {
    border-color: #9b59b6;
    box-shadow: 0 0 5px #9b59b6, 0 0 10px #9b59b6;
}

/* 4. Settings (Magenta) */
#menu-settings-btn:disabled:hover {
    border-color: #be2edd;
    box-shadow: 0 0 5px #be2edd, 0 0 10px #be2edd;
}

/* 5. About (Orange) */
#menu-about-btn:disabled:hover {
    border-color: #e67e22;
    box-shadow: 0 0 5px #e67e22, 0 0 10px #e67e22;
}

/* 6. Credits (Orange-Red) */
#menu-credits-btn:disabled:hover {
    border-color: #e7613c;
    box-shadow: 0 0 5px #e7613c, 0 0 10px #e7613c;
}

/* 7. Exit (Red) */
#menu-exit-btn:disabled:hover {
    border-color: #e74c3c;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c;
}

.menu-right-panel {
    flex-grow: 1;
    position: relative;
    background-color: #1a2430;
}

#menu-battle-canvas {
    width: 100%;
    height: 100%;
}

.menu-right-panel {
    flex-grow: 1;
    position: relative;
    background-color: #1a2430;
}

#menu-battle-canvas {
    width: 100%;
    height: 100%;
}

/* --- END OF MAIN MENU STYLES --- */

#game-container {
    display: flex;
    flex-direction: column;
    width: 560px;
    gap: 10px;
    background-color: #34495e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    min-height: 910px; 
}

/* CHANGE: Font for in-game headers */
#game-container h1, #game-container h2 {
    font-family: 'Orbitron', sans-serif;
}

#hud,
#battlefield,
#base-health,
#dock {
    width: 100%;
    box-sizing: border-box;
}

#battle-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#meta-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    gap: 15px;
    text-align: center;
    flex-grow: 1;
}


/* MENU Button (#menu-return-btn) */
#menu-return-btn {
    background-color: transparent !important;
    border: 2px solid #3498db !important; /* Blue border */
    color: #ecf0f1 !important;
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease-in-out;
    min-width: auto; /* Automatic width */
    font-size: 16px;
    padding: 6px 15px; /* Slightly smaller padding */
    border-radius: 5px;
    cursor: pointer;
    position: absolute; /* Keep positioning */
    top: 0px;
    left: 0px;
}

#menu-return-btn:hover {
    background-color: transparent !important;
    border-color: #3498db !important;
    box-shadow: 0 0 5px #3498db, 0 0 10px #3498db, 0 0 15px #3498db;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #3498db;
    color: #a7d9ff !important;
}

/* Question Mark Button (#faq-btn) */
#faq-btn {
    background-color: transparent !important;
    border: 2px solid #00d2d3 !important; /* Cyan border */
    color: #ecf0f1 !important;
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    padding: 0;
    min-width: 0;
    position: absolute;
    top: 0px;
    right: 0px;
}

#faq-btn:hover {
    background-color: transparent !important;
    border-color: #00d2d3 !important;
    box-shadow: 0 0 5px #00d2d3, 0 0 10px #00d2d3, 0 0 15px #00d2d3;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #00d2d3;
    color: #a7d9ff !important;
}


#meta-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: bold;
}

#meta-stats p {
    margin: 0;
}

/* TAB STYLES */
.tabs-nav {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
    margin-bottom: 15px;
}

.tab-btn {
    flex-grow: 1;
    background-color: #556070;
    border-bottom: 3px solid transparent;
    border-radius: 5px 5px 0 0;
}

.tab-btn.active {
    background-color: #2980b9;
    border-bottom: 3px solid #3498db;
}

.tab-content {
    display: none;
    width: 100%;
}

.tab-content.active {
    display: block;
}

/* Sub-tabs for Upgrades */
.sub-tabs-nav {
    display: flex;
    gap: 5px;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
    border-bottom: 2px solid #2c3e50;
}

.sub-tab-btn {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px;
    font-size: 16px;
    min-width: 0; /* Override default button min-width */
}

.sub-tab-btn.active {
    background-color: transparent; /* Ensure no background on active */
    color: #3498db;
    border-bottom-color: #3498db;
}

.sub-tab-btn:hover {
    background-color: #ffffff1a; /* Slight hover effect */
}

.sub-tab-content {
    display: none;
    width: 100%;
    min-height: 200px; /* To prevent layout shift when tabbing */
}

.sub-tab-content.active {
    display: block;
}

.upgrades-grid, #evolutions-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

#evolutions-container {
    min-height: 200px;
}

.evolution-item {
    background-color: #1a2430;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #fff;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.evolution-item:hover {
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);
}

.evolution-item.chosen {
    border-color: #f1c40f;
    box-shadow: 0 0 15px 3px #f1c40f;
    cursor: default;
}

.evolution-choices {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.evolution-choice-btn {
    width: 60px;
    height: 60px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid rgb(194, 255, 255);
    border-radius: 8px;
    cursor: pointer;
    min-width: 0;
    padding: 0;
    line-height: 1.2;
    color: #000;
}
.evolution-choice-btn.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.evo-cost {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #fff9e2;
}

.bastion-upgrade-item {
    grid-column: 1 / -1;
}

.upgrade-item {
    background-color: #1a2430;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #fff;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    display: flex; 
    flex-direction: column; 
    min-height: 150px; 
}

.upgrade-item h3 {
    margin-top: 2px;
    margin-bottom: 8px;
}

.upgrade-item p {
    margin-bottom: 12px;
}

.upgrade-item button {
    margin-top: auto; 
}

.upgrade-item:hover {
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);
}

.upgrade-item.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

#battlefield {
    height: 640px;
    background-color: rgba(26, 36, 48, 0.7);
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

#svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

@keyframes lightning-fade {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.lightning-fade-out {
    animation: lightning-fade 0.4s forwards;
}

#lanes-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: repeating-linear-gradient(to right, #ffffff1a, #ffffff1a 1px, transparent 1px, transparent 70px);
}

#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #1a2430;
    border-bottom: 2px solid #2c3e50;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.hud-item {
    font-size: 18px;
    font-weight: bold;
    font-family: 'Rajdhani', sans-serif; /* CHANGE: Font for HUD */
}

button {
    background-color: transparent; /* Remove background */
    color: #ecf0f1; /* Default text color */
    border: 2px solid #06f7ff; /* Sky-blue border by default */
    box-shadow: none; /* Remove default shadow if it exists */
    text-shadow: none; /* Remove default text shadow if it exists */

    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    /* Increase transition time for a smoother glow appearance */
    transition: all 0.2s ease-in-out, transform 0.1s ease; 

    min-width: 120px;
    font-size: 14px;
    padding: 8px;
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px; /* Add for consistency */
}

button:hover {
    background-color: transparent; /* Background remains transparent */
    border-color: #06f7ff; /* Blue border on hover */
    transform: translateX(0); /* Remove shift if it was there */

    /* Neon glow for the button on hover (like New Game) */
    box-shadow:
        0 0 5px #02e1ff,    
        0 0 10px #02e1ff,   
        0 0 15px #02e1ff;   
    
    /* Subtle neon glow for the button text on hover */
    text-shadow:
        0 0 1px #ecf0f1,
        0 0 2px #3498db;
    
    color: #a7d9ff; /* Slightly lighter text on hover */
}

button:active {
    transform: scale(0.96); /* Slightly more compression on click */
    box-shadow: 0 0 10px #3498db; /* Smaller glow when active */
}

button:disabled {
    background-color: transparent; /* Background remains transparent */
    border-color: #7f8c8d; /* Slightly darker gray border for disabled */
    color: #bdc3c7; /* Dimmer text for disabled */
    cursor: not-allowed;
    opacity: 0.5; /* Slightly more transparent */
    transform: none;
    box-shadow: none; /* Remove glow if it was there */
    text-shadow: none; /* Remove text glow */
}

button:disabled:hover {
    background-color: transparent;
    border-color: #7f8c8d; /* Border remains dim */
    box-shadow: none; /* No glow on hover for disabled */
    text-shadow: none;
}

#start-game-btn {
    width: 100%;
    margin-top: auto;
    padding: 12px;
    font-size: 18px;
}

#slots-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    z-index: 5;
}

.slot {
    width: 70px;
    height: 64px;
    border: 1px dashed #ffffff44;
    box-sizing: border-box;
    position: relative;
}

.slot.occupied {
    border-style: solid;
    border-color: transparent;
}

.slot.coil-slot {
    background-color: rgba(189, 195, 199, 0.1);
}

.slot.synergy-highlight {
    box-shadow: 0 0 10px 2px #f1c40f;
    border-color: #f1c40f;
}

#base-health-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 5px 10px;
    box-sizing: border-box;
    background-color: #1a2430;
    border-radius: 8px;
}

#base-shield-text {
    color: #00d2d3;
    font-weight: bold;
    margin-left: 5px;
}

#bastion-shield-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 210, 211, 0.3);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: inset 0 0 15px rgba(0, 210, 211, 0.7);
    animation: shieldPulse 2.5s infinite ease-in-out;
}

@keyframes shieldPulse {
    0% { opacity: 0.8; }
    50% { opacity: 1.0; }
    100% { opacity: 0.8; }
}

#base-health {
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    width: 80%;
    box-sizing: border-box;
}

#base-hp-bar {
    width: 100%;
    height: 15px;
    background-color: #e74c3c;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}

#base-hp-fill {
    height: 100%;
    width: 100%;
    background-color: #2ecc71;
    border-radius: 5px; /* Add if you don't have rounding */
    /* Add background-color and box-shadow to transition for smooth animation */
    transition: width 0.3s ease-out, background-color 0.3s ease-out, box-shadow 0.3s ease-out;
}
#dock {
    background-color: #1a2430;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    position: relative; /* <-- ADD THIS LINE */
}

/* Styles for DOCK label */
.dock-label,
.bastion-label {
    position: absolute;
    top: -8px;
    left: 50%; /* Move the element's start to the center */
    transform: translateX(-50%); /* Center the element itself */
    color: #a2e9ee;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    pointer-events: none;
    opacity: 0.7;
    z-index: 10;
}

#money-display {
    font-weight: bold;
    font-size: 18px;
}

#dock-items {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.dock-item, .tower {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid #fff;
    cursor: grab;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.2s ease;
    padding: 0;
    position: relative;
    font-family: 'Rajdhani', sans-serif; /* CHANGE: Font for towers */
}
.dock-item .tower-name {
    font-size: 18px;
    margin-bottom: 2px;
}
.tower .tower-name {
    font-size: 18px;
}
.dock-item .tower-cost {
    font-size: 10px;
}
.dock-item.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.dock-item:hover, .tower:hover {
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);
}
.dock-item.disabled:hover {
    box-shadow: none;
}


.laser, .cntm, .chan { background-color: #2ecc71; }
.gun, .gtlg, .snpr { background-color: #f1c40f; }
.flame, .fbal, .fstm { background-color: #e67e22; }
.shock, .shok_orb, .shok_chn { background-color: #9b59b6; }
.cryo, .cryo_frz, .cryo_blz { background-color: #3498db; }
.rocket, .havy, .swrm { background-color: #e74c3c; }
.coil { background-color: #bdc3c7; }
.shield { background-color: #00d2d3; }
.radar { background-color: #707C67; }

.enemy {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #7f8c8d;
    border: 2px solid #bdc3c7;
    border-radius: 50%;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
}

.enemy.burning {
    box-shadow: 0 0 15px 4px #e67e22, inset 0 0 10px #ffdd00;
    animation: burning-pulse 0.5s infinite ease-in-out;
}

@keyframes burning-pulse {
    0% { transform: translate(-50%, -50%) scale(1.0); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
    100% { transform: translate(-50%, -50%) scale(1.0); }
}

.enemy.slowed {
    box-shadow: inset 0 0 10px 3px #3498db, 0 0 15px 4px #a7d9ff;
}

/* ИЗМЕНЕНО: Улучшенный эффект заморозки */
.enemy.frozen {
    background-color: #c0ecff;
    border: 2px solid #ffffff;
    box-shadow: inset 0 0 10px 3px #3498db, 0 0 15px 4px #a7d9ff, 0 0 25px 8px #ffffff;
    animation: frozen-pulse 1.5s infinite ease-in-out;
}

/* ИЗМЕНЕНО: Улучшенная анимация заморозки */
@keyframes frozen-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1.0);
        filter: brightness(1.0);
        border-radius: 45% 55% 60% 40% / 55% 45% 55% 45%;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        filter: brightness(1.2);
        border-radius: 60% 40% 45% 55% / 45% 55% 45% 55%;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.0);
        filter: brightness(1.0);
        border-radius: 45% 55% 60% 40% / 55% 45% 55% 45%;
    }
}

.invisible-enemy {
    background-color: #9b59b6aa;
    border-color: #d3adf7;
    opacity: 0.1;
    animation: shimmer 2s infinite ease-in-out;
}

.invisible-enemy.revealed {
    opacity: 1;
    animation: none;
    box-shadow: 0 0 10px 3px #f39c12;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-50%, -50%) scale(1.0); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

.boss-enemy {
    width: 60px;
    height: 60px;
    background-color: #4b0082;
    border: 3px solid #ff00ff;
    border-radius: 15px;
    box-shadow: 0 0 20px #ff00ff;
}

@keyframes boss-flashing-border {
    0%, 100% { border-color: #ff00ff; }
    50% { border-color: #ffffff; }
}

.boss-enemy.charging-special {
    animation: boss-flashing-border 0.25s infinite;
}

.boss-hp-bar {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 8px;
    background-color: #555;
    border-radius: 4px;
    border: 1px solid #fff;
    overflow: hidden;
}

.boss-hp-fill {
    height: 100%;
    width: 100%;
    background-color: #e74c3c;
    border-radius: 3px;
    transition: width 0.2s ease-out;
}

.meteor-enemy {
    background-color: #4B4B4B;
    border: 2px solid #2C2C2C;
    border-radius: 50%;
    box-shadow: 0 0 15px #e74c3c, 0 0 20px #e67e22;
    animation: meteor-pulse 1.5s infinite ease-in-out;
}

@keyframes meteor-pulse {
    0% {
        box-shadow: 0 0 15px #e74c3c, 0 0 20px #e67e22;
        transform: translate(-50%, -50%); /* <-- ADDED */
    }
    50% {
        box-shadow: 0 0 25px #e74c3c, 0 0 30px #e67e22;
        transform: translate(-50%, -50%); /* <-- ADDED */
    }
    100% {
        box-shadow: 0 0 15px #e74c3c, 0 0 20px #e67e22;
        transform: translate(-50%, -50%); /* <-- ADDED */
    }
}
.enemy.attacking {
    animation: attackGlow 1.2s infinite;
}

.projectile {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 15px #00ffff;
}

.enemy-projectile {
    background-color: #e74c3c;
    width: 8px;
    height: 8px;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c, 0 0 15px #e74c3c;
}

.boss-rocket-projectile {
    width: 14px;
    height: 14px;
    background-color: #ff00ff;
    border-radius: 4px;
    box-shadow: 0 0 8px #e74c3c, 0 0 15px #ff00ff;
    border: 1px solid #ffffff;
}

.beam {
    position: absolute;
    transform-origin: top left;
}

.sustained-beam, .fire-stream {
    position: absolute;
    transform-origin: left center;
    pointer-events: none;
    z-index: 6;
}

.fire-stream {
    position: absolute;
    height: 15px; 
    background: linear-gradient(to right, #ffcc00, #ff6600, #ff0000);
    pointer-events: none;
    z-index: 10;
    transform-origin: left center; 
    animation: fire-flicker 0.1s infinite alternate; 
    
    box-shadow: 0 0 5px 2px rgba(255, 102, 0, 0.8), 
                0 0 15px 5px rgba(255, 153, 0, 0.5) inset; 

    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%); 
}

@keyframes fire-flicker {
    0% { opacity: 0.9; }
    50% { opacity: 1.0; }
    100% { opacity: 0.9; }
}

.radar-ping {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid #f39c12;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.8;
    animation: radar-pulse 1s forwards;
}

@keyframes radar-pulse {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.rocket-projectile, .fbal-projectile {
    width: 12px;
    height: 12px;
    background-color: #e74c3c;
    border-radius: 50%;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c, 0 0 15px #e74c3c;
}

.cryo_blz-projectile {
    width: 14px;
    height: 14px;
    background-color: #a7d9ff;
    border-radius: 50%;
    box-shadow: 0 0 8px #3498db, 0 0 15px #3498db;
    animation: fireball-pulse 0.5s infinite;
}

.shok_orb-projectile {
    width: 18px;
    height: 18px;
    background-color: #d3adf7;
    border-radius: 50%;
    box-shadow: 0 0 10px #9b59b6, 0 0 20px #9b59b6;
    animation: shock-orb-pulse 0.4s infinite ease-in-out;
}

@keyframes shock-orb-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1.0); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

.fbal-projectile {
    background-color: #e67e22;
    box-shadow: 0 0 8px #e67e22, 0 0 15px #e67e22;
    animation: fireball-pulse 0.3s infinite;
}

@keyframes fireball-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1.0); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.flame-projectile {
    width: 4px;
    height: 4px;
    background-color: #e67e22;
    border-radius: 50%;
    box-shadow: 0 0 5px #e67e22, 0 0 10px #e67e22, 0 0 15px #e67e22;
}

.explosion-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    pointer-events: none; /* Particles should not interfere with clicks */
    z-index: 50; /* So they are on top of enemies */
    animation: particle-explode 0.5s ease-out forwards;
}

@keyframes particle-explode {
    0% {
        /* Start at the center, opaque, and normal size */
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        /* Move to the random position we set in JS,
           shrink to zero, and disappear */
        transform: translate(calc(var(--tx) - 50%), calc(var(--ty) - 50%)) scale(0);
        opacity: 0;
    }
}

/* НОВОЕ: Стили для ледяных частиц */
.ice-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px 2px #a7d9ff;
    pointer-events: none;
    z-index: 51;
    animation: ice-particle-animation 0.8s ease-out forwards;
}

@keyframes ice-particle-animation {
    0% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--tx) - 50%), calc(var(--ty) - 50%)) scale(0);
    }
}

.enemy.hit {
    box-shadow: 0 0 8px 2px #e74c3c;
}



@keyframes attackGlow {
    0% { box-shadow: 0 0 5px #e74c3c; }
    50% { box-shadow: 0 0 15px #e74c3c; }
    100% { box-shadow: 0 0 5px #e74c3c; }
}

.hidden {
    display: none !important;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 100;
}

#game-over-text {
    color: #fff;
    font-size: 2em;
    text-shadow: 2px 2px 4px #000;
}

#message-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    z-index: 200;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.popup-content {
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
}

#faq-popup .popup-content {
    text-align: left;
}

#tutorial-popup .popup-content {
    text-align: left;
}

.popup-content h2 {
    margin-top: 0;
}

.popup-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

#evolution-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
}

.evo-popup-warning {
    font-size: 12px;
    color: #f1c40f;
    margin-top: 15px;
}

#faq-popup, #tutorial-popup, #welcome-popup, #post-tutorial-popup, #settings-popup, #confirm-reset-popup, #about-popup, #credits-popup, #stats-popup, #confirm-new-game-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#confirm-new-game-popup .popup-content {
    text-align: left;
}


.close-popup-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    min-width: 0;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
}


#faq-content p {
    margin-bottom: 15px;
}
#close-tutorial-btn, #close-welcome-btn, #close-post-tutorial-btn, #reset-progress-btn {
    margin-top: 20px;
}

/* --- Styles for modal window buttons (FINAL VERSION) --- */

/* Common styles for buttons */
#confirm-reset-btn,
#cancel-reset-btn,
#evo-popup-confirm-btn,
#cancel-new-game-btn {  /* <-- Added */
    background-color: transparent !important;
    color: #ecf0f1 !important;
    transition: all 0.2s ease-in-out;
    border-width: 2px !important;
    border-style: solid !important;
}

/* Red buttons */
#confirm-reset-btn,
#evo-popup-cancel-btn,
#confirm-new-game-btn { /* <-- Added */
    border-color: #e74c3c !important; 
}

/* Blue buttons */
#cancel-reset-btn,
#cancel-new-game-btn { /* <-- Added */
    border-color: #3498db !important;
}

/* Glow effect for red buttons on hover */
#confirm-reset-btn:hover,
#evo-popup-cancel-btn:hover,
#confirm-new-game-btn:hover { /* <-- Added */
    background-color: transparent !important;
    border-color: #e74c3c !important;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c, 0 0 15px #e74c3c;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #e74c3c;
}

/* Glow effect for blue button on hover */
#cancel-reset-btn:hover,
#cancel-new-game-btn:hover { /* <-- Added */
    background-color: transparent !important;
    border-color: #3498db !important;
    box-shadow: 0 0 5px #3498db, 0 0 10px #3498db, 0 0 15px #3498db;
    text-shadow: 0 0 1px #ecf0f1, 0 0 2px #3498db;
}


/* First, set a border in the normal state for a smooth transition */
#confirm-reset-btn,
#evo-popup-cancel-btn {
    border: 2px solid transparent;
}

/* Now, add the red glow on hover */
#confirm-reset-btn:hover,
#evo-popup-cancel-btn:hover {
    background-color: #c0392b; /* Keep the background darkening for emphasis */
    border-color: #e74c3c; /* Red border */
    
    /* Red glow for the button */
    box-shadow:
        0 0 5px #e74c3c,    
        0 0 10px #e74c3c,   
        0 0 15px #e74c3c;   
    
    /* Red glow for the text */
    text-shadow:
        0 0 1px #ecf0f1,
        0 0 2px #e74c3c;
}

.damage-popup {
    position: absolute;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: fade-and-move-up 1s forwards;
    z-index: 50;
}

.damage-popup.dot-damage {
    color: #e67e22;
    font-size: 13px;
    animation: fade-and-move-up 0.8s forwards;
}


@keyframes fade-and-move-up {
    from { opacity: 1; transform: translate(-50%, -50%); }
    to { opacity: 0; transform: translate(-50%, -100px); }
}

#choice-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 150;
    padding: 20px;
    box-sizing: border-box;
}

#choice-screen h2 {
    color: #fff;
    font-size: 2.5em;
    margin-bottom: 10px;
}

#choice-screen p {
    color: #bdc3c7;
    font-size: 1.2em;
    margin-bottom: 20px;
}

#choice-cards-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    width: 100%;
    max-width: 800px;
}

.choice-card {
    width: 160px;
    height: 250px;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    background-color: #2c3e50;
}

.card-tower-visual {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 3px solid #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-tower-name {
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.card-stages {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.stage-dot {
    width: 12px;
    height: 12px;
    background-color: #7f8c8d;
    border-radius: 50%;
    border: 1px solid #ecf0f1;
}

.stage-dot.filled {
    background-color: #f1c40f;
    box-shadow: 0 0 5px #f1c40f;
}


.choice-card.rarity-common {
    background-color: #7f8c8d;
}
.choice-card.rarity-uncommon {
    background-color: #3498db;
}
.choice-card.rarity-rare {
    background-color: #8e44ad;
}
.choice-card.rarity-epic {
    background-color: #f39c12;
}

.choice-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.card-description {
    text-align: center;
    font-size: 1em;
    color: #ecf0f1 !important;
}

.card-description span {
    font-weight: bold;
}
.card-rarity {
    display: none;
}

#tutorial-animation {
    position: relative;
    height: 150px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.anim-slots-container {
    display: flex;
    gap: 10px;
}

.anim-slot {
    width: 50px;
    height: 50px;
    border: 2px dashed #ffffff44;
    border-radius: 8px;
}

.anim-slot.anim-target {
    border-style: solid;
    border-color: #f1c40f;
}

.anim-dock {
    width: 80%;
    height: 60px;
    background-color: #1a2430;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.anim-tower {
    position: absolute;
    bottom: 25px;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 2px solid #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.anim-hand {
    position: absolute;
    font-size: 32px;
    animation: drag-animation 3s infinite ease-in-out;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes drag-animation {
    0% {
        transform: translate(0px, 130px);
        opacity: 1;
    }
    20% {
        transform: translate(0px, 130px);
        opacity: 1;
    }
    30% {
        transform: translate(0px, 120px);
    }
    60% {
        transform: translate(0px, 40px);
        opacity: 1;
    }
    80% {
        transform: translate(0px, 40px);
        opacity: 0;
    }
    100% {
        transform: translate(0px, 130px);
        opacity: 0;
    }
}

#wave-announcement {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    background-color: rgba(231, 76, 60, 0.85);
    color: white;
    font-size: 2.5em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 10px;
    border: 3px solid #fff;
    z-index: 300;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: fade-in-out 1.2s ease-in-out;
}

@keyframes fade-in-out {
    0%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20%, 80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Styles for evolution icon (letter E) */
.tower.evolved::before,
.dock-item.evolved::before {
    content: 'E';
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 14px; 
    font-weight: bold;
    color: #ffd700;
    line-height: 1;
    
    text-shadow: 
        -1px -1px 0 #cccccc,  
         1px -1px 0 #cccccc,  
        -1px  1px 0 #cccccc,  
         1px  1px 0 #cccccc;

    z-index: 10;
}

/* Red "Cancel" button in the evolution modal by its ID */
#evo-popup-cancel-btn {
    background-color: #e74c3c; 
    border-color: #c0392b; 
}

#evo-popup-cancel-btn:hover {
    background-color: #c0392b; 
}


/* Styles for stats popup */
.stats-list {
    margin-top: 20px;
    text-align: left;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 1.1em;
    padding: 8px 0;
    border-bottom: 1px solid #2c3e50;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span {
    color: #bdc3c7;
}

.stat-item strong {
    color: #f1c40f;
}

/* Styles for the social media section in credits */
.socials-title {
    margin-top: 30px; /* Top margin from the main text */
    margin-bottom: 10px;
    color: #bdc3c7; /* Slightly muted color */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.2em;
}

.socials-links a {
    color: #3498db; /* Blue color, like other UI elements */
    text-decoration: none; /* Remove underline */
    font-weight: bold;
    transition: all 0.2s ease;
}

.socials-links a:hover {
    color: #5dade2; /* Lighter blue on hover */
    text-decoration: underline; /* Bring back underline on hover */
    text-shadow: 0 0 5px #3498db;
}

.socials-links span {
    color: #7f8c8d; /* Separator color */
}