@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Cinzel:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background: #000;
    overflow: hidden;
    font-family: 'Cinzel', serif;
    cursor: default;
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* ========== HUD OVERLAY ========== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

#topBar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 8px 20px;
    background: linear-gradient(180deg, rgba(30, 20, 10, 0.95) 0%, rgba(30, 20, 10, 0.7) 80%, transparent 100%);
    pointer-events: auto;
}

.resource-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0d060;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(240, 200, 60, 0.5);
}

.resource-display .icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.resource-display .value {
    min-width: 60px;
    text-align: right;
}

.pop-display {
    color: #c0c0c0;
    font-size: 14px;
}

/* ========== BOTTOM PANEL ========== */
#bottomPanel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 20px 15px;
    background: linear-gradient(0deg, rgba(20, 15, 8, 0.95) 0%, rgba(20, 15, 8, 0.7) 80%, transparent 100%);
    pointer-events: auto;
    z-index: 10;
}

/* ========== UNIT BUTTONS ========== */
.unit-btn {
    position: relative;
    width: 70px;
    height: 80px;
    background: linear-gradient(145deg, #3a2a15, #2a1a08);
    border: 2px solid #6b4c2a;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
    overflow: hidden;
}

.unit-btn:hover {
    border-color: #f0d060;
    background: linear-gradient(145deg, #4a3a25, #3a2a18);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(240, 200, 60, 0.3);
}

.unit-btn:active {
    transform: translateY(0px);
}

.unit-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.unit-btn .unit-icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.unit-btn .unit-name {
    font-size: 8px;
    color: #c0a060;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unit-btn .unit-cost {
    font-size: 10px;
    color: #f0d060;
    font-weight: 700;
}

.unit-btn .hotkey {
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 9px;
    color: #888;
    font-family: monospace;
}

.unit-btn .train-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #4caf50;
    transition: width 0.1s linear;
}

/* ========== ARMY CONTROLS ========== */
#armyControls {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    pointer-events: auto;
    z-index: 10;
}

.army-btn {
    padding: 8px 20px;
    background: linear-gradient(145deg, #2a3a15, #1a2a08);
    border: 2px solid #4b6c2a;
    border-radius: 6px;
    color: #a0d060;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
}

.army-btn:hover {
    border-color: #80e040;
    background: linear-gradient(145deg, #3a4a25, #2a3a18);
    box-shadow: 0 0 15px rgba(80, 200, 40, 0.3);
}

.army-btn.active {
    border-color: #f0d060;
    background: linear-gradient(145deg, #4a3a15, #3a2a08);
    color: #f0d060;
    box-shadow: 0 0 15px rgba(240, 200, 60, 0.4);
}

.army-btn .hotkey-hint {
    font-size: 9px;
    color: #688;
    display: block;
    font-family: monospace;
}

/* ========== MINIMAP ========== */
#minimapContainer {
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 200px;
    height: 50px;
    background: rgba(10, 8, 5, 0.9);
    border: 2px solid #4b3c2a;
    border-radius: 6px;
    pointer-events: auto;
    z-index: 11;
    overflow: hidden;
}

#minimapCanvas {
    width: 100%;
    height: 100%;
}

/* ========== START SCREEN ========== */
#startScreen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a0705 0%, #1a1208 50%, #0a0705 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#startScreen h1 {
    font-family: 'MedievalSharp', cursive;
    font-size: 64px;
    color: #f0d060;
    text-shadow:
        0 0 20px rgba(240, 200, 60, 0.6),
        0 0 60px rgba(240, 200, 60, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 10px;
    animation: titleGlow 3s ease-in-out infinite;
}

#startScreen .subtitle {
    font-size: 16px;
    color: #8a7a5a;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 50px;
}

@keyframes titleGlow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(240, 200, 60, 0.6), 0 0 60px rgba(240, 200, 60, 0.3), 0 4px 8px rgba(0, 0, 0, 0.8);
    }

    50% {
        text-shadow: 0 0 30px rgba(240, 200, 60, 0.8), 0 0 80px rgba(240, 200, 60, 0.5), 0 4px 8px rgba(0, 0, 0, 0.8);
    }
}

.start-btn {
    padding: 15px 50px;
    font-family: 'MedievalSharp', cursive;
    font-size: 24px;
    background: linear-gradient(145deg, #4a3a15, #2a1a08);
    border: 2px solid #8b6c3a;
    border-radius: 8px;
    color: #f0d060;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.start-btn:hover {
    border-color: #f0d060;
    box-shadow: 0 0 30px rgba(240, 200, 60, 0.4);
    transform: scale(1.05);
}

/* ========== GAME OVER SCREEN ========== */
#gameOverScreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#gameOverScreen.show {
    display: flex;
}

#gameOverScreen h1 {
    font-family: 'MedievalSharp', cursive;
    font-size: 72px;
    margin-bottom: 20px;
}

#gameOverScreen.victory h1 {
    color: #f0d060;
    text-shadow: 0 0 40px rgba(240, 200, 60, 0.6);
}

#gameOverScreen.defeat h1 {
    color: #d04040;
    text-shadow: 0 0 40px rgba(200, 40, 40, 0.6);
}

#gameOverScreen .restart-btn {
    margin-top: 30px;
    padding: 12px 40px;
    font-family: 'MedievalSharp', cursive;
    font-size: 20px;
    background: linear-gradient(145deg, #3a2a15, #2a1a08);
    border: 2px solid #6b4c2a;
    border-radius: 8px;
    color: #f0d060;
    cursor: pointer;
    transition: all 0.3s ease;
}

#gameOverScreen .restart-btn:hover {
    border-color: #f0d060;
    box-shadow: 0 0 20px rgba(240, 200, 60, 0.4);
}

/* ========== HEALTH BARS ========== */
.statue-health-container {
    position: fixed;
    top: 45px;
    width: 200px;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 6px;
    overflow: hidden;
    z-index: 10;
}

#playerStatueHealth {
    left: 20px;
}

#enemyStatueHealth {
    right: 20px;
}

.statue-health-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

#playerStatueHealth .statue-health-fill {
    background: linear-gradient(90deg, #2196f3, #42a5f5);
}

#enemyStatueHealth .statue-health-fill {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

.statue-label {
    position: absolute;
    top: -16px;
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 100%;
    text-align: center;
}

/* ========== SHOP & GEMS ========== */
.resource-display.gems-display {
    color: #a855f7;
    margin-right: 20px;
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.shop-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #9333ea, #7e22ce);
    border: 2px solid #581c87;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
    z-index: 90;
    pointer-events: auto;
}

.shop-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
    border-color: #d8b4fe;
}

.shop-btn:active {
    transform: scale(0.95);
}

.shop-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 25px;
    display: none;
    flex-direction: column;
    gap: 15px;
    z-index: 200;
    width: 400px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.shop-overlay.active {
    display: flex;
}

.shop-header {
    text-align: center;
    color: #d4af37;
    font-size: 28px;
    font-family: 'MedievalSharp', cursive;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 10px;
}

.boost-item {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.boost-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #a855f7;
    transform: translateX(5px);
}

.boost-item:active {
    transform: translateX(2px);
}

.boost-icon {
    font-size: 32px;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}

.boost-info {
    flex: 1;
}

.boost-name {
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    display: block;
    font-family: 'Cinzel', serif;
}

.boost-desc {
    color: #aaa;
    font-size: 12px;
    margin-top: 2px;
}

.boost-cost {
    color: #a855f7;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(168, 85, 247, 0.4);
}

.close-shop {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-shop:hover {
    color: #fff;
}