:root {
    --bg-color: #1a1a2e;
    --game-bg: #0f0f23;
    --text-color: #eee;
    --accent-color: #e94560;
    --accent-alt: #0f4c75;
    --success: #4caf50;
    --warning: #ff9800;
    --border: #333;
    --text: #eee;
    --muted: #888;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
}

.game-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    touch-action: none;
}

canvas {
    background-color: var(--game-bg);
    border: 4px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    image-rendering: pixelated;
}

/* HUD */
.hud {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 10px;
    box-sizing: border-box;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

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

.hud-left span, .hud-right span {
    color: #ffd700;
}

/* Controls Panel */
.controls-panel {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.defense-buttons {
    display: flex;
    gap: 10px;
}

.def-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}

.def-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-color);
}

.def-btn.selected {
    background: rgba(233, 69, 96, 0.3);
    border-color: var(--accent-color);
}

.def-btn .icon {
    font-size: 24px;
}

.def-btn .cost {
    font-size: 12px;
    color: #ffd700;
}

.status-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    font-size: 14px;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 42px;
    color: var(--accent-color);
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 18px;
    color: #888;
    margin-bottom: 20px;
}

/* Faction Selection */
.faction-select {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.faction-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    color: white;
    width: 160px;
    transition: all 0.3s;
}

.faction-btn:hover {
    background: rgba(233, 69, 96, 0.2);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

.faction-btn .flag {
    font-size: 48px;
    margin-bottom: 10px;
}

.faction-btn .name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

.faction-btn .desc {
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
}

/* Event Modal */
.event-content {
    background: var(--bg-color);
    border: 3px solid var(--accent-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
}

.event-content h2 {
    margin: 0 0 15px 0;
    color: var(--accent-color);
}

.event-content p {
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.event-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-option {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    color: white;
    text-align: left;
    transition: all 0.2s;
}

.event-option:hover {
    background: rgba(233, 69, 96, 0.2);
    border-color: var(--accent-color);
}

.event-option .opt-label {
    font-weight: bold;
    margin-bottom: 5px;
}

.event-option .opt-effect {
    font-size: 12px;
    color: #888;
}

/* Game Over */
.result-stats {
    margin: 20px 0;
    font-size: 16px;
}

.result-stats p {
    margin: 5px 0;
}

.btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px 30px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn:hover {
    background: #ff6b81;
    transform: scale(1.05);
}

/* Footer */
.site-footer {
    margin-top: auto;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: #666;
    text-align: center;
    padding: 10px;
    font-size: 12px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 28px;
    }

    .hud {
        font-size: 14px;
        gap: 10px;
    }

    .faction-select {
        flex-direction: column;
        align-items: center;
    }

    .faction-btn {
        width: 90%;
        max-width: 250px;
    }

    .defense-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .def-btn {
        padding: 6px 10px;
    }

    .def-btn .icon {
        font-size: 20px;
    }

    .event-content {
        padding: 20px;
    }
}
