* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 1400px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.game-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.status-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-label {
    font-weight: bold;
    color: #666;
    font-size: 0.9em;
}

.status-value {
    color: #333;
    font-size: 1.2em;
    font-weight: bold;
    min-width: 50px;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tower-shop {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    min-width: 250px;
    max-width: 300px;
}

.tower-shop h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.tower-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tower-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tower-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.tower-item.selected {
    border-color: #667eea;
    background: #e8f0fe;
}

.tower-icon {
    font-size: 2em;
    text-align: center;
    margin-bottom: 5px;
}

.tower-name {
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 5px;
}

.tower-cost {
    color: #27ae60;
    font-weight: bold;
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.tower-desc {
    color: #666;
    font-size: 0.85em;
    text-align: center;
}

.game-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 600px;
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

#game-canvas {
    border: 3px solid #333;
    border-radius: 10px;
    background: #2d5016;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: crosshair;
    touch-action: none;
    position: relative;
}

.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    z-index: 200;
}

.canvas-controls.hidden {
    display: none;
}

.upgrade-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 250px;
}

.upgrade-panel.hidden {
    display: none;
}

.upgrade-panel h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

#tower-info {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.upgrade-btn, .sell-btn, .close-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upgrade-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.sell-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.close-btn {
    background: #95a5a6;
    color: white;
}

.upgrade-btn:hover, .sell-btn:hover, .close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.instructions {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.instructions p {
    margin-bottom: 5px;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .tower-shop {
        max-width: 100%;
    }
    
    .tower-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tower-item {
        min-width: 150px;
    }
    
    .game-area {
        min-width: auto;
        width: 100%;
    }
    
    #game-canvas {
        width: 100%;
        height: auto;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-item {
        justify-content: space-between;
    }
}
