* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a12;
    font-family: 'Chakra Petch', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    position: relative;
    width: 1000px;
    height: 700px;
    border: 4px solid #2a1f4e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 
        0 0 40px rgba(138, 43, 226, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
}

#gameCanvas {
    display: block;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0f0f1a 100%);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
}

.hud-left, .hud-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.hud-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 25px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 1.4rem;
}

.home-health .bar-container {
    width: 120px;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
}

.home-health .bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff4757, #ff6b81);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

#homeHealthText, #coinCount, #killCount {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    min-width: 40px;
}

.coins {
    border-color: rgba(255, 215, 0, 0.3);
}

.kills {
    border-color: rgba(255, 71, 87, 0.3);
}

.wave-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 10px 25px;
    border-radius: 15px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wave-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
}

#waveNumber {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

/* Shop Panel */
#shopPanel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #fbbf24;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.4);
    z-index: 80;
    min-width: 320px;
}

#shopPanel.hidden {
    display: none;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(251, 191, 36, 0.3);
}

.shop-header h3 {
    color: #fbbf24;
    font-size: 1.2rem;
    margin: 0;
}

.close-btn {
    background: rgba(255, 71, 87, 0.3);
    border: 2px solid #ff4757;
    color: #ff4757;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #ff4757;
    color: #fff;
}

#shopItems {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.2s;
}

.shop-item:hover {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.1);
}

.shop-item.equipped {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.shop-item.owned {
    border-color: rgba(74, 222, 128, 0.3);
}

.item-emoji {
    font-size: 1.8rem;
}

.item-name {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    min-width: 70px;
}

.item-stats {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    flex: 1;
}

.buy-btn, .equip-btn {
    padding: 6px 15px;
    border-radius: 6px;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.buy-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    color: #000;
}

.buy-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.buy-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.equip-btn {
    background: rgba(74, 222, 128, 0.2);
    border: 2px solid #4ade80;
    color: #4ade80;
}

.equip-btn:hover {
    background: #4ade80;
    color: #000;
}

.equip-btn.equipped {
    background: #4ade80;
    color: #000;
}

/* Upgrade Panel */
#upgradePanel {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid rgba(138, 43, 226, 0.5);
    box-shadow: 0 -5px 30px rgba(138, 43, 226, 0.3);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 15px;
}

.panel-header h3 {
    color: #fff;
    font-size: 0.9rem;
    margin: 0;
    letter-spacing: 2px;
}

.shop-toggle-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    color: #000;
    padding: 8px 15px;
    border-radius: 8px;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.current-weapon {
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid #3b82f6;
    color: #3b82f6;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.upgrade-buttons {
    display: flex;
    gap: 12px;
}

.upgrade-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.upgrade-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: #8a2be2;
    box-shadow: 0 5px 20px rgba(138, 43, 226, 0.4);
}

.upgrade-btn:active:not(:disabled) {
    transform: translateY(0);
}

.upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-icon {
    font-size: 1.5rem;
}

.upgrade-name {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.upgrade-level {
    color: #8a2be2;
    font-size: 0.7rem;
}

.upgrade-cost {
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px 60px;
    border-radius: 20px;
    border: 3px solid #8a2be2;
    text-align: center;
    box-shadow: 
        0 0 50px rgba(138, 43, 226, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    max-width: 500px;
}

.modal-content h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.instructions {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.instructions p {
    color: rgba(255, 255, 255, 0.8);
    margin: 10px 0;
    font-size: 1rem;
}

.btn {
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Chakra Petch', sans-serif;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 5px 25px rgba(102, 126, 234, 0.5);
}

.btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(102, 126, 234, 0.7);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Game Over Modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.stat-box {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

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

.modal-buttons .btn {
    padding: 12px 35px;
    font-size: 1rem;
}

/* Wave Announcement */
#waveAnnouncement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    pointer-events: none;
}

#waveAnnouncement.hidden {
    display: none;
}

#waveText {
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 
        0 0 20px rgba(138, 43, 226, 1),
        0 0 40px rgba(138, 43, 226, 0.8),
        0 0 60px rgba(138, 43, 226, 0.6);
    animation: waveAnnounce 2s ease-out forwards;
}

@keyframes waveAnnounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    20% {
        opacity: 1;
        transform: scale(1.2);
    }
    40% {
        transform: scale(1);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Click Effect */
.click-effect {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #ff4757;
    border-radius: 50%;
    pointer-events: none;
    animation: clickRipple 0.4s ease-out forwards;
}

@keyframes clickRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Damage numbers */
.damage-number {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff4757;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: damageFloat 0.8s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
}

