/* Global Styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --text-color: #ecf0f1;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-type: #4a4a4a;
    --steel-type: #b8b8d0;
    --fire-type: #ff4422;
    --psychic-type: #ff5599;
    --ice-type: #77ddff;
    --grass-type: #77cc55;
    --ghost-type: #9370DB;
}

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

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--primary-color);
    color: var(--text-color);
    line-height: 1.6;
}

#game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.screen {
    position: fixed;
    width: 100%;
    height: 100%;
    display: none;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#victory-screen, #game-complete-screen {
    text-align: center;
    background-color: rgba(0, 0, 0, 0.8);
}

#victory-screen h1, #game-complete-screen h1 {
    color: var(--success-color);
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#victory-screen .result-message, #game-complete-screen .result-message {
    font-size: 1.5em;
    margin-bottom: 30px;
    color: var(--text-color);
}

.action-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: scale(1.05);
    background-color: #27ae60;
}

.action-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#next-level-btn, #retry-btn, #play-again-btn {
    opacity: 0;
    transform: translateY(20px);
}

.screen.active #next-level-btn,
.screen.active #retry-btn,
.screen.active #play-again-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Character Selection Screen */
#character-select {
    background-color: var(--secondary-color);
    text-align: center;
}

#character-select h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

#character-select h2 {
    font-size: 2em;
    margin-bottom: 40px;
}

.monster-selection {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.monster-option {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    width: 300px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.monster-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.monster-preview {
    margin-bottom: 15px;
}

.monster-preview img {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.monster-details h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.type-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.type-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
}

.dark { background-color: var(--dark-type); }
.steel { background-color: var(--steel-type); }
.fire { background-color: var(--fire-type); }
.psychic { background-color: var(--psychic-type); }
.ice { background-color: var(--ice-type); }
.grass { background-color: var(--grass-type); }
.ghost { background-color: var(--ghost-type); }

.stats-list {
    list-style: none;
    margin-top: 10px;
}

/* Battle Arena Screen */
#battle-arena {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.battle-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0.8;
}

.enemy-section, .player-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px;
    position: relative;
}

.enemy-section {
    margin-bottom: auto;
}

.player-section {
    margin-top: auto;
}

.monster-sprite {
    width: 200px;
    height: 200px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.monster-info {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    width: 300px;
}

.name-level {
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: bold;
}

.status-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.health-container, .mana-container {
    display: flex;
    flex-direction: column;
}

.health-bar, .mana-bar {
    height: 15px;
    border-radius: 10px;
    transition: width 0.3s;
}

.health-bar {
    background-color: var(--success-color);
}

.mana-bar {
    background-color: var(--accent-color);
}

.health-text, .mana-text {
    font-size: 0.9em;
    margin-top: 2px;
}

.battle-controls {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px 10px 0 0;
    width: 100%;
}

.moves-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.move-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--accent-color);
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.move-btn:hover {
    background-color: #2980b9;
}

.move-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.battle-message {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    min-height: 60px;
}

/* Victory, Game Over, and Complete Screens */
#victory-screen, #game-over-screen, #game-complete-screen {
    text-align: center;
    background-color: rgba(0, 0, 0, 0.9);
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#victory-screen::before, #game-over-screen::before, #game-complete-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

#victory-screen h1, #game-over-screen h1, #game-complete-screen h1 {
    font-size: 3em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#victory-screen h1 {
    color: var(--success-color);
}

#game-over-screen h1 {
    color: var(--danger-color);
}

#game-complete-screen h1 {
    color: gold;
}

.result-message {
    font-size: 1.5em;
    margin-bottom: 40px;
    max-width: 600px;
    line-height: 1.4;
}

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#next-level-btn, #play-again-btn {
    background-color: var(--success-color);
    color: white;
}

#retry-btn {
    background-color: var(--accent-color);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .monster-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .enemy-section, .player-section {
        flex-direction: column;
    }
    
    .monster-info {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .monster-sprite {
        width: 150px;
        height: 150px;
    }
    
    .moves-container {
        grid-template-columns: 1fr;
    }
}