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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#game-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

#header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 25px 30px;
    margin-bottom: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#header:hover {
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transform: translateY(-2px);
}

#header h1 {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 2.5em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.5px;
}

#stats-btn, #settings-btn, #help-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea, #764ba2) border-box;
    color: #667eea;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

#stats-btn::before, #settings-btn::before, #help-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(-50%, -50%);
    z-index: -1;
}

#stats-btn:hover::before, #settings-btn:hover::before, #help-btn:hover::before {
    width: 100%;
    height: 100%;
}

#stats-btn:hover, #settings-btn:hover, #help-btn:hover {
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 0 0 4px rgba(102, 126, 234, 0.1);
}

#stats-btn:active, #settings-btn:active, #help-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.8),
        0 0 0 5px rgba(102, 126, 234, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 
        0 12px 32px rgba(102, 126, 234, 0.5),
        0 0 0 3px rgba(255, 255, 255, 1),
        0 0 0 6px rgba(102, 126, 234, 0.3);
}

#game-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    font-size: 1.2em;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: help;
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.stat:hover::before {
    left: 100%;
}

.stat:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.stat-label {
    color: #666;
    margin-right: 5px;
}

#main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

#sidebar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 25px;
    width: 320px;
    flex-shrink: 0;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    max-height: 850px;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar:hover {
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

#sidebar h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 800;
    letter-spacing: -0.3px;
}

#tower-shop-container {
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.98) 0%, rgba(42, 82, 152, 0.98) 100%);
    border-radius: 20px;
    padding: 25px 30px;
    box-shadow: 
        0 -20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

#tower-shop-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

#tower-shop {
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

#tower-shop::-webkit-scrollbar {
    height: 8px;
}

#tower-shop::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#tower-shop::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#tower-shop::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.tower-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(102, 126, 234, 0.2);
    min-width: 180px;
    flex-shrink: 0;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    position: relative;
    overflow: hidden;
}

.tower-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s ease;
}

.tower-card:hover::before {
    left: 100%;
}

.tower-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(102, 126, 234, 0.3),
        0 0 0 2px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset;
    border-color: #667eea;
}

.tower-card:active {
    transform: translateY(-4px) scale(1.01);
}

.tower-card.selected {
    border-color: transparent;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 8px 32px rgba(102, 126, 234, 0.5),
        0 0 0 3px rgba(255, 255, 255, 0.3),
        0 0 40px rgba(102, 126, 234, 0.4) inset;
    animation: selectedPulse 2s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 
            0 8px 32px rgba(102, 126, 234, 0.5),
            0 0 0 3px rgba(255, 255, 255, 0.3),
            0 0 40px rgba(102, 126, 234, 0.4) inset;
    }
    50% {
        box-shadow: 
            0 12px 40px rgba(102, 126, 234, 0.6),
            0 0 0 4px rgba(255, 255, 255, 0.5),
            0 0 50px rgba(102, 126, 234, 0.5) inset;
    }
}

.tower-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tower-card:hover img {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.tower-card.selected img {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.tower-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tower-card h3 {
    margin: 0;
    font-size: 1.1em;
    color: #2c3e50;
}

.tower-card.selected h3 {
    color: white;
}

.tower-card .cost {
    font-weight: bold;
    font-size: 1em;
    color: #f39c12;
    margin: 0;
}

.tower-card.selected .cost {
    color: #ffd700;
}

.tower-description {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
}

.tower-card.selected .tower-description {
    color: rgba(255, 255, 255, 0.9);
}

.selected-indicator {
    display: none;
    text-align: center;
    font-size: 0.85em;
    font-weight: bold;
    color: white;
    background: #2ecc71;
    padding: 8px;
    border-radius: 6px;
    margin-top: 8px;
    animation: pulse 1.5s infinite;
}

.tower-card.selected .selected-indicator {
    display: block;
}

.tower-card.selected button {
    display: none;
}

.tower-card button {
    width: 100%;
    padding: 11px;
    margin-top: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.tower-card button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.tower-card button:hover::before {
    width: 300px;
    height: 300px;
}

.tower-card button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.tower-card button:active {
    transform: translateY(0);
}

.tower-card.insufficient-funds {
    opacity: 0.6;
}

.tower-card.insufficient-funds button {
    background: #bdc3c7;
    cursor: not-allowed;
}

.tower-card.insufficient-funds:hover {
    transform: none;
    box-shadow: none;
    border-color: #e0e0e0;
}

.tower-card.selected button {
    background: white;
    color: #667eea;
}

.tower-card.selected button:hover {
    background: #f0f0f0;
}

/* Wave Preview Section */
#wave-preview-section {
    margin-bottom: 20px;
}

#wave-preview {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 14px;
    padding: 18px;
    margin-top: 10px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#wave-preview:hover {
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    transform: translateY(-2px);
}

#wave-number-display {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

#wave-difficulty {
    margin-bottom: 10px;
    font-size: 0.95em;
}

.difficulty-skulls {
    color: #e74c3c;
    font-size: 1.2em;
    margin-left: 5px;
}

#wave-composition {
    margin: 10px 0;
}

.enemy-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9em;
}

.enemy-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.enemy-count {
    font-weight: bold;
    color: #333;
}

#wave-reward {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1em;
    font-weight: bold;
}

.reward-amount {
    color: #f39c12;
    font-size: 1.1em;
}

#tower-info {
    margin-top: 20px;
}

#tower-details {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 14px;
    padding: 18px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tower-details:hover {
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    transform: translateY(-2px);
}

#tower-details img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.5) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tower-details img:hover {
    transform: scale(1.02);
    box-shadow: 
        0 8px 28px rgba(0, 0, 0, 0.25),
        0 0 0 2px rgba(255, 255, 255, 0.6) inset;
}

#tower-details h3 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-size: 1.3em;
    font-weight: 800;
    letter-spacing: -0.3px;
}

#tower-details p {
    margin-bottom: 8px;
    font-size: 0.95em;
}

.targeting-section {
    margin: 15px 0;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.targeting-section label {
    display: block;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.targeting-section select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.targeting-section select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.targeting-section select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

#tower-details button {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

#upgrade-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 
        0 4px 16px rgba(46, 204, 113, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

#upgrade-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

#upgrade-btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

#upgrade-btn:hover:not(:disabled) {
    box-shadow: 
        0 8px 24px rgba(46, 204, 113, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-3px);
}

#upgrade-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

#upgrade-btn:disabled {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.5;
}

#sell-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 
        0 4px 16px rgba(231, 76, 60, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

#sell-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

#sell-btn:hover::before {
    width: 300px;
    height: 300px;
}

#sell-btn:hover {
    box-shadow: 
        0 8px 24px rgba(231, 76, 60, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transform: translateY(-3px);
}

#sell-btn:active {
    transform: translateY(-1px);
}

#canvas-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#gameCanvas {
    background: #2c3e50;
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 100px rgba(102, 126, 234, 0.1);
    cursor: crosshair;
    display: block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#gameCanvas:hover {
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 0 120px rgba(102, 126, 234, 0.15);
}

#game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#game-controls button {
    padding: 16px 36px;
    font-size: 1.1em;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

#game-controls button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

#game-controls button:hover::before {
    width: 300px;
    height: 300px;
}

#start-wave-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

#start-wave-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 10px 30px rgba(46, 204, 113, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

#start-wave-btn:active:not(:disabled) {
    transform: translateY(-1px) scale(1.01);
}

#start-wave-btn:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

#pause-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

#pause-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 10px 30px rgba(231, 76, 60, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

#pause-btn:active {
    transform: translateY(-1px) scale(1.01);
}

#speed-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

#speed-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 10px 30px rgba(52, 152, 219, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

#speed-btn:active {
    transform: translateY(-1px) scale(1.01);
}

#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#game-over-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
}

#game-over-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

#game-over-title {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #2c3e50;
}

#game-over-message {
    font-size: 1.1em;
    margin-bottom: 30px;
    color: #666;
}

#game-over-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.final-stat-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.final-stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

#game-over-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#game-over-actions button {
    padding: 14px 32px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.primary-action {
    background: #667eea;
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.primary-action:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.primary-action:active {
    transform: translateY(0);
}

.secondary-action {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.secondary-action:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.secondary-action:active {
    transform: translateY(0);
}

/* Scrollbar styling */
#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Tutorial System */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tutorial-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    position: relative;
    z-index: 10001;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

#tutorial-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#tutorial-close:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#tutorial-title {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

#tutorial-text {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #333;
}

#tutorial-buttons {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

#tutorial-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tutorial-prev, #tutorial-next {
    background: #667eea;
    color: white;
}

#tutorial-prev:hover, #tutorial-next:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

#tutorial-prev:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#tutorial-skip {
    background: #e0e0e0;
    color: #666;
}

#tutorial-skip:hover {
    background: #ccc;
}

#tutorial-highlight {
    position: fixed;
    border: 4px solid #667eea;
    border-radius: 10px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85), 0 0 20px #667eea;
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85), 0 0 40px #667eea;
    }
}

#tutorial-highlight {
    animation: pulse 2s infinite;
}

/* Settings Modal */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settings-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

#settings-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#settings-close:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#settings-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    color: #764ba2;
    font-size: 1.3em;
    margin-bottom: 15px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    background: #f5f7fa;
}

.setting-item label {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.setting-item input[type="range"] {
    width: 150px;
    margin: 0 10px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.setting-item select {
    padding: 5px 10px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 1em;
    cursor: pointer;
}

.setting-item span {
    min-width: 50px;
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

#reset-settings-btn {
    width: 100%;
    padding: 12px 24px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
}

#reset-settings-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* Statistics Modal */
#stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#stats-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

#stats-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#stats-close:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#stats-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.stats-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.stats-section:last-child {
    border-bottom: none;
}

.stats-section h3 {
    color: #764ba2;
    font-size: 1.3em;
    margin-bottom: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background: #f5f7fa;
    border-radius: 8px;
}

.stat-row .stat-label {
    font-weight: 600;
    color: #333;
}

.stat-row .stat-value {
    font-weight: bold;
    color: #667eea;
}

.tower-stat-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    border-left: 4px solid #667eea;
}

.tower-stat-item h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.tower-stat-item .mini-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9em;
}

.tower-stat-item .mini-stat span:first-child {
    color: #666;
}

.tower-stat-item .mini-stat span:last-child {
    font-weight: bold;
    color: #333;
}

/* Tower Comparison Modal */
#comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#comparison-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 95%;
    width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

#comparison-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#comparison-close:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#comparison-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

#comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.compare-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
}

.compare-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.compare-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.compare-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.3em;
    text-align: center;
}

.compare-card .cost-badge {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #f39c12;
    margin-bottom: 15px;
}

.compare-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

.compare-stat .label {
    color: #666;
    font-size: 0.9em;
}

.compare-stat .value {
    font-weight: bold;
    color: #333;
}

.compare-stat .value.best {
    color: #2ecc71;
}

.compare-recommendation {
    margin-top: 15px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.compare-recommendation strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.compare-recommendation p {
    font-size: 0.85em;
    color: #666;
    margin: 0;
}

/* Tooltip System */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    max-width: 300px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(102, 126, 234, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip h4 {
    margin: 0 0 8px 0;
    color: #667eea;
    font-size: 1.1em;
}

.tooltip p {
    margin: 4px 0;
    line-height: 1.4;
}

.tooltip .tooltip-stat {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tooltip .tooltip-label {
    color: #aaa;
}

.tooltip .tooltip-value {
    font-weight: bold;
    color: #fff;
}

.tooltip .tooltip-dps {
    color: #f39c12;
}

.tooltip .tooltip-efficiency {
    color: #2ecc71;
}

/* Animations */
@keyframes notificationSlideIn {
    0% {
        transform: translateX(-50%) translateY(-40px) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateX(-50%) translateY(5px) scale(1.02);
    }
    100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes notificationSlideOut {
    0% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(-40px) scale(0.9);
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.6);
    }
}

/* Responsive design */
@media (max-width: 1400px) {
    #main-content {
        flex-direction: column;
    }
    
    #sidebar {
        width: 100%;
        max-height: none;
        display: flex;
        gap: 20px;
    }
    
    #wave-preview-section,
    #tower-info {
        flex: 1;
        margin: 0;
    }
    
    #tower-shop {
        flex-wrap: wrap;
    }
    
    .tower-card {
        min-width: 160px;
    }
}

