* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    overflow: hidden;
    user-select: none;
}

#gameContainer {
    position: relative;
    width: 1200px;
    height: 800px;
    margin: 20px 0 20px 20px;
    border: 3px solid #2c3e50;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    float: left;
}

#gameCanvas {
    border: 3px solid #fff;
    border-radius: 10px;
    background: linear-gradient(45deg, #4a6741, #6b8e23);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#healthBar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 200px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #fff;
    border-radius: 15px;
    overflow: hidden;
}

#healthFill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff6666);
    width: 100%;
    transition: width 0.3s ease;
}

#healthText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#coinCounter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border: 2px solid #ffd700;
    border-radius: 25px;
    color: #ffd700;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#towerMenu {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: all;
}

.weapon-btn, .tower-btn {
    padding: 12px 24px;
    border: 2px solid #fff;
    border-radius: 25px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.weapon-btn:hover, .tower-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.weapon-btn.active {
    background: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.tower-btn {
    background: rgba(255, 165, 0, 0.8);
    border-color: #ffa500;
}

.tower-btn:hover {
    background: rgba(255, 165, 0, 1);
}

.shop-toggle-btn {
    background: rgba(52, 152, 219, 0.8);
    border: 2px solid #3498db;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    margin-right: 10px;
}

.shop-toggle-btn:hover {
    background: rgba(52, 152, 219, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#waveInfo {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border: 2px solid #fff;
    border-radius: 25px;
    color: white;
    font-weight: bold;
}

#waveText, #enemyCount {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Game entity styles for visual feedback */
.damage-text {
    position: absolute;
    color: #ff4444;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: damageFloat 1s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

.coin-pickup {
    position: absolute;
    color: #ffd700;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: coinFloat 0.8s ease-out forwards;
}

@keyframes coinFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(1.2);
    }
}

/* Shop Styles */
.shop-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    overflow-y: auto;
    z-index: 1000;
    border-left: 3px solid #3498db;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.shop-header {
    padding: 20px;
    border-bottom: 2px solid #3498db;
    background: rgba(52, 73, 94, 0.8);
}

.shop-header h2 {
    margin: 0;
    color: #3498db;
    font-size: 24px;
    text-align: center;
}

.shop-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #34495e;
}

.tab-btn {
    background: transparent;
    color: #bdc3c7;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.weapons-list, .upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.weapon-item, .upgrade-item {
    background: rgba(52, 73, 94, 0.5);
    border: 1px solid #34495e;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s;
}

.weapon-item:hover, .upgrade-item:hover {
    background: rgba(52, 73, 94, 0.7);
    border-color: #3498db;
}

.weapon-item.unaffordable {
    opacity: 0.5;
    background: rgba(52, 73, 94, 0.3);
}

.weapon-item.unaffordable .weapon-info h3 {
    color: #7f8c8d;
}

.weapon-item.unaffordable .weapon-stats span {
    color: #95a5a6;
}

.weapon-item.locked {
    opacity: 0.6;
}

.weapon-info, .upgrade-info {
    flex: 1;
}

.weapon-info h3, .upgrade-info h4 {
    margin: 0 0 5px 0;
    color: #3498db;
}

.weapon-info p, .upgrade-info p {
    margin: 0 0 10px 0;
    color: #bdc3c7;
    font-size: 14px;
}

.weapon-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #95a5a6;
}

.weapon-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.buy-btn, .upgrade-btn, .equip-btn, .upgrade-tower-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    white-space: nowrap;
}

.buy-btn {
    background: #27ae60;
    color: white;
}

.buy-btn:hover:not(:disabled) {
    background: #229954;
}

.upgrade-btn, .upgrade-tower-btn {
    background: #f39c12;
    color: white;
}

.upgrade-btn:hover:not(:disabled), .upgrade-tower-btn:hover:not(:disabled) {
    background: #e67e22;
}

.equip-btn {
    background: #3498db;
    color: white;
}

.equip-btn.active {
    background: #2980b9;
}

.equip-btn:hover:not(:disabled) {
    background: #2980b9;
}

.buy-btn:disabled, .upgrade-btn:disabled, .equip-btn:disabled, .upgrade-tower-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

/* Main Menu Styles */
.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.menu-content {
    text-align: center;
    color: white;
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.menu-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn.primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.menu-btn.primary:hover {
    background: linear-gradient(45deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.menu-btn.secondary {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.menu-btn.secondary:hover {
    background: linear-gradient(45deg, #1976D2, #2196F3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    color: white;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(45deg, #3498db, #2980b9);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scoreboard-item {
    background: rgba(52, 73, 94, 0.3);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.scoreboard-item:hover {
    background: rgba(52, 73, 94, 0.5);
}

.scoreboard-item.rank-1 {
    border-left-color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
}

.scoreboard-item.rank-2 {
    border-left-color: #95a5a6;
    background: rgba(149, 165, 166, 0.1);
}

.scoreboard-item.rank-3 {
    border-left-color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-rank {
    font-weight: bold;
    font-size: 1.1rem;
    color: #3498db;
}

.score-rank.rank-1 {
    color: #f1c40f;
}

.score-rank.rank-2 {
    color: #95a5a6;
}

.score-rank.rank-3 {
    color: #e67e22;
}

.score-details {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2ecc71;
}

.no-scores {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
}

/* Healing Tab Styles */
.healing-upgrades {
    padding: 20px;
}

.healing-info {
    background: rgba(52, 73, 94, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2ecc71;
}

.healing-info h3 {
    color: #2ecc71;
    margin-bottom: 10px;
}

.healing-info p {
    color: #bdc3c7;
    margin-bottom: 15px;
}

.healing-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.healing-stats span {
    color: #ecf0f1;
    font-weight: bold;
}

.upgrade-healing-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-weight: bold;
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upgrade-healing-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.upgrade-healing-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Name Input Modal Styles */
.name-input-container {
    text-align: center;
    padding: 20px;
}

.name-input-container h3 {
    color: #ecf0f1;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.name-input-container p {
    color: #bdc3c7;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

#finalScore {
    color: #f1c40f;
    font-weight: bold;
    font-size: 1.2rem;
}

#playerNameInput {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    background: rgba(52, 73, 94, 0.3);
    color: white;
    text-align: center;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s ease;
}

#playerNameInput:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
}

#playerNameInput::placeholder {
    color: #7f8c8d;
}

.name-input-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.save-score-btn, .skip-name-btn {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 120px;
}

.save-score-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.save-score-btn:hover {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.skip-name-btn {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
}

.skip-name-btn:hover {
    background: linear-gradient(45deg, #7f8c8d, #95a5a6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

/* Utility Classes */
.hidden {
    display: none !important;
}
