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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.game-title {
    font-size: 3rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #8B4513, #DAA520, #FFD700, #B8860B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

.game-tagline {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #8B4513;
    font-style: italic;
    text-align: center;
    font-weight: 500;
}

.game-subtitle {
    font-size: 2rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #DAA520, #FFD700, #B8860B, #8B4513);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.title-image-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(218, 165, 32, 0.3);
}

.title-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.title-image:hover {
    transform: scale(1.05);
}

.title-description {
    flex: 1;
    max-width: 400px;
    text-align: left;
}

.title-description h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #DAA520, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.title-description p {
    font-size: 1rem;
    line-height: 1.6;
    color: #8B4513;
    font-weight: 500;
}

/* Drunkey Enemy Animation Styles */
.enemy-drunkey {
    width: 40px;
    height: 40px;
    object-fit: contain;
    animation: drunkey-waddle 0.6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes drunkey-waddle {
    0%, 100% { 
        transform: rotate(-5deg) scale(1); 
    }
    25% { 
        transform: rotate(2deg) scale(1.05); 
    }
    50% { 
        transform: rotate(5deg) scale(1); 
    }
    75% { 
        transform: rotate(-2deg) scale(1.1); 
    }
}

/* Direction-based rotation classes */
.enemy-facing-right {
    transform: rotate(90deg);
}

.enemy-facing-left {
    transform: rotate(-90deg);
}

.enemy-facing-up {
    transform: rotate(0deg);
}

.enemy-facing-down {
    transform: rotate(180deg);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.game-main {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.game-sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tower-selection h3,
.wave-info h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.tower-option {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tower-option:hover {
    border-color: #4ecdc4;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tower-option.selected {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.tower-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.tower-info {
    flex: 1;
}

.tower-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.tower-cost {
    color: #666;
    font-size: 0.9rem;
}

.game-controls {
    margin: 20px 0;
}

.control-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-wave {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

#start-wave:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

#pause-game {
    background: linear-gradient(45deg, #ffa726, #ff9800);
    color: white;
}

#pause-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 167, 38, 0.4);
}

#restart-game {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
}

#restart-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.game-board {
    flex: 1;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: crosshair;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.overlay-content h2 {
    margin-bottom: 15px;
    color: #ff6b6b;
}

.overlay-content p {
    margin-bottom: 20px;
    color: #666;
}

.game-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.instructions {
    text-align: center;
    color: #666;
}

.instructions p {
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-main {
        flex-direction: column;
    }
    
    .game-sidebar {
        width: 100%;
        order: 2;
    }
    
    .game-board {
        order: 1;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat {
        padding: 8px 15px;
    }
    
    #game-canvas {
        width: 100%;
        height: auto;
        max-width: 600px;
    }
    
    .title-image-section {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .title-image {
        width: 120px;
        height: 120px;
    }
    
    .title-description {
        text-align: center;
        max-width: 100%;
    }
}

/* Animation for tower placement */
@keyframes towerPlace {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tower-placed {
    animation: towerPlace 0.3s ease-out;
}

/* Enemy path visualization */
.path-cell {
    background: rgba(255, 193, 7, 0.3);
    border: 1px dashed #ffc107;
}

/* Tower range indicator */
.tower-range {
    background: rgba(78, 205, 196, 0.2);
    border: 2px solid rgba(78, 205, 196, 0.5);
    border-radius: 50%;
}

/* Title screen overlay */
.title-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(102,126,234,0.95) 0%, rgba(118,75,162,0.95) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.title-screen-content {
    width: min(900px, 92vw);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.play-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.4);
}
