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

body {
    font-family: 'Arial Black', Arial, sans-serif;
    background: linear-gradient(135deg, #2D5016, #4A7C59);
    color: #fff;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#ui-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 800px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px 10px 0 0;
}

.player-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.health-bar-container {
    width: 200px;
    height: 20px;
    background: #333;
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
}

.health-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00);
    width: 100%;
    transition: width 0.3s ease;
}

#game-info {
    text-align: center;
}

#timer {
    font-size: 36px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#round-info {
    font-size: 16px;
    margin-top: 5px;
}

#game-canvas {
    background: #000;
    border: 3px solid #8B4513;
    border-radius: 0 0 10px 10px;
    display: block;
}

#controls {
    margin-top: 20px;
    width: 800px;
}

#mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 120px;
    height: 120px;
}

#dpad .control-btn:nth-child(1) { grid-column: 2; grid-row: 1; }
#dpad .control-btn:nth-child(2) { grid-column: 1; grid-row: 2; }
#dpad .control-btn:nth-child(3) { grid-column: 2; grid-row: 3; }
#dpad .control-btn:nth-child(4) { grid-column: 3; grid-row: 2; }

.control-btn {
    background: #4A7C59;
    border: 2px solid #fff;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.control-btn:active {
    background: #2D5016;
    transform: scale(0.95);
}

#action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    width: 200px;
}

.action-btn {
    background: #FF6B35;
    border: 3px solid #fff;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.action-btn:active {
    background: #E55A2B;
    transform: scale(0.95);
}

.action-btn.special {
    background: #FFD700;
    color: #333;
    grid-column: span 2;
}

.action-btn.special:active {
    background: #E6C200;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.screen.hidden {
    display: none;
}

#character-select h2 {
    font-size: 32px;
    margin-bottom: 40px;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

#character-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.character-card {
    background: rgba(75, 124, 89, 0.8);
    border: 3px solid #fff;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    width: 180px;
}

.character-card:hover {
    background: rgba(75, 124, 89, 1);
    transform: translateY(-5px);
}

.character-card.selected {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.character-portrait {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    border: 2px solid #666;
}

.gorilla-portrait::before {
    content: "🦍";
}

.chimp-portrait::before {
    content: "🐵";
}

.orangutan-portrait::before {
    content: "🦧";
}

.character-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #FFD700;
}

.stats div {
    font-size: 12px;
    margin: 2px 0;
    text-align: left;
}

#start-fight {
    background: #FF6B35;
    border: 3px solid #fff;
    border-radius: 15px;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.3s;
    display: none;
}

#start-fight:hover {
    background: #E55A2B;
    transform: scale(1.05);
}

#game-over h2 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

#fight-stats {
    background: rgba(75, 124, 89, 0.8);
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

#fight-stats div {
    font-size: 16px;
    margin: 5px 0;
}

#rematch, #new-fight {
    background: #FF6B35;
    border: 3px solid #fff;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    padding: 12px 30px;
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.3s;
}

#rematch:hover, #new-fight:hover {
    background: #E55A2B;
    transform: scale(1.05);
}

/* Mobile responsiveness */
@media (max-width: 850px) {
    #ui-header, #controls {
        width: 95vw;
    }
    
    #game-canvas {
        width: 95vw;
        height: 50vh;
    }
    
    #character-grid {
        flex-direction: column;
        gap: 15px;
    }
    
    .character-card {
        width: 300px;
    }
    
    #mobile-controls {
        flex-direction: column;
        gap: 20px;
    }
    
    #action-buttons {
        width: 250px;
    }
}

/* Keyboard hint */
@media (min-width: 851px) {
    #controls::after {
        content: "Player 1: WASD + QERT | Player 2: Arrows + UIOP";
        display: block;
        text-align: center;
        color: #ccc;
        font-size: 12px;
        margin-top: 10px;
    }
}