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

body, html {
    width: 100%; height: 100%; overflow: hidden;
    background-color: #000;
    font-family: 'MedievalSharp', cursive;
}

#gameCanvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}

/* UI Layer */
#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; pointer-events: none;
}

/* Top Bar */
#top-bar {
    position: absolute; top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 20px;
}

.team-banner {
    background: radial-gradient(circle, #3a2211, #1a0a02);
    border: 4px solid #b8860b; /* Golden rod wood */
    padding: 15px 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.9), inset 0 0 20px rgba(0,0,0,0.8);
    pointer-events: auto;
    border-radius: 10px;
}
.team-banner.red { border-bottom: 6px solid #ff2222; background: radial-gradient(circle, #551111, #110000); }
.team-banner.blue { border-bottom: 6px solid #2255ff; background: radial-gradient(circle, #112255, #000011); }

.team-name { font-family: 'Cinzel', serif; font-size: 24px; color: #fff; text-shadow: 0 0 10px #fff, 2px 2px 5px #000; margin-bottom: 5px; }
.resource { font-size: 22px; color: #FFD700; text-shadow: 0 0 8px #FFD700, 2px 2px 5px #000; }

.center-hud {
    text-align: center;
    background: linear-gradient(to bottom, rgba(40,40,40,0.95), rgba(10,10,10,0.95));
    border: 4px solid #555;
    border-top: none;
    padding: 15px 40px;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9), inset 0 -5px 15px rgba(255,255,255,0.1);
}

#timer { font-family: 'Cinzel', serif; font-size: 40px; color: #fff; margin-bottom: 10px; text-shadow: 0 0 15px #fff; }
#gate-health-container { width: 300px; }
.label { font-size: 14px; color: #ccc; margin-bottom: 5px; letter-spacing: 2px; text-shadow: 1px 1px 0 #000; }
.bar-bg { width: 100%; height: 18px; background: #111; border: 2px solid #333; border-radius: 10px; overflow: hidden; box-shadow: inset 0 5px 10px rgba(0,0,0,0.8); }
#gate-health-bar { width: 100%; height: 100%; background: linear-gradient(90deg, #4a7a2a, #88cc44); box-shadow: 0 0 10px #88cc44; transition: width 0.3s; }

/* Bottom Panel */
#bottom-panel {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 120px;
    background: linear-gradient(to top, #1a1008, #2b1d12);
    border-top: 6px solid #5a3c22;
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 40px; pointer-events: auto;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
}

.action-menu h3 { font-family: 'Cinzel', serif; color: #FFD700; margin-bottom: 10px; text-shadow: 0 0 10px #aa6600; }
.spawn-btn {
    background: #3d2314; color: #FFD700; border: 2px solid #8b6914;
    padding: 12px 24px; margin-right: 10px; cursor: pointer;
    font-family: 'Cinzel', serif; font-size: 18px; font-weight: bold;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 4px 0 #1a1008;
    border-radius: 5px;
    transition: all 0.1s;
    text-shadow: 1px 1px 0 #000;
}
.spawn-btn:hover { background: #553311; }
.spawn-btn:active { transform: translateY(4px); box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 0 #1a1008; }

#minimap-container {
    width: 200px; height: 100px; background: #4a7a2a;
    border: 3px solid #8b6914; position: relative;
    overflow: hidden;
}

/* Menus */
#start-menu, #end-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center; z-index: 100;
}

.parchment-box {
    background: #e6d5a1; /* Parchment color */
    border: 8px solid #5a3c22;
    padding: 50px; text-align: center;
    box-shadow: inset 0 0 50px rgba(100,50,0,0.3), 0 10px 30px rgba(0,0,0,0.8);
    max-width: 600px; width: 90%;
}

.parchment-box h1 {
    font-family: 'Cinzel', serif; font-size: 48px; color: #3a2211; margin-bottom: 20px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}
.parchment-box p { font-size: 24px; color: #5a3c22; margin-bottom: 40px; }

.team-select { display: flex; gap: 20px; justify-content: center; }
.btn-main {
    background: #5a3c22; color: #FFD700; border: 4px solid #3a2211;
    padding: 15px 30px; font-family: 'Cinzel', serif; font-size: 20px;
    cursor: pointer; box-shadow: 0 5px 0 #2a1201; transition: transform 0.1s;
}
.btn-main:active { transform: translateY(5px); box-shadow: none; }
#play-attack { background: #8B0000; }
#play-defend { background: #00338B; }

/* Responsive */
@media (max-width: 800px) {
    #top-bar { padding: 5px; flex-wrap: wrap; }
    .team-banner { padding: 5px; flex: 1; text-align: center; }
    .team-name { font-size: 12px; margin-bottom: 2px; }
    .resource { font-size: 14px; }
    
    .center-hud { flex: 1 1 100%; order: -1; padding: 5px; border-radius: 0 0 10px 10px; margin-bottom: 5px; }
    #timer { font-size: 24px; margin-bottom: 2px; }
    #gate-health-container { width: 90%; margin: 0 auto; }
    .label { font-size: 10px; }
    
    #bottom-panel { 
        height: auto; 
        padding: 10px; 
        flex-direction: column; 
    }
    .action-menu { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; gap: 5px; }
    .action-menu h3 { width: 100%; text-align: center; margin-bottom: 5px; font-size: 14px; }
    .spawn-btn { 
        font-size: 12px; 
        padding: 10px 5px; 
        margin: 0; 
        flex: 1 1 30%; 
    }
    
    #minimap-container { display: none; }
    
    .parchment-box { padding: 20px; border-width: 4px; }
    .parchment-box h1 { font-size: 28px; }
    .parchment-box p { font-size: 16px; margin-bottom: 20px; }
    .btn-main { font-size: 16px; padding: 10px 15px; }
    .team-select { flex-direction: column; gap: 10px; }
}
