:root {
    --primary: #ffcb05;
    --secondary: #2a75bb;
    --bg: #f0f0f0;
    --card-bg: #ffffff;
    --text: #333;
    --hp-green: #4caf50;
    --hp-yellow: #ffeb3b;
    --hp-red: #f44336;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg);
    margin: 0;
    padding: 0;
    color: var(--text);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-family: 'Press Start 2P', cursive;
    color: var(--secondary);
    font-size: 24px;
    text-shadow: 2px 2px var(--primary);
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.5s;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Selection Screen */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    align-items: center;
}

input,
select {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    cursor: pointer;
}

.selection-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--secondary);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    position: sticky;
    top: 10px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.selection-box {
    font-weight: bold;
}

#start-btn {
    background: var(--primary);
    border: none;
    padding: 10px 20px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    border-radius: 5px;
    color: var(--secondary);
}

#start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    color: #666;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    height: 60vh;
    overflow-y: auto;
    padding: 5px;
}

.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card.selected-p1 {
    border-color: var(--secondary);
    background: #e3f2fd;
}

.card.selected-p2 {
    border-color: var(--primary);
    background: #fffde7;
}

.card img {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.card h3 {
    margin: 5px 0;
    font-size: 14px;
    text-transform: capitalize;
}

.info-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #eee;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
}

.info-btn:hover {
    background: #ddd;
    color: #333;
}

.types span {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    margin: 0 2px;
    color: white;
    text-transform: uppercase;
}

/* Type Colors */
.type-fire {
    background: #ee8130;
}

.type-water {
    background: #6390f0;
}

.type-grass {
    background: #7ac74c;
}

.type-electric {
    background: #f7d02c;
    color: black !important;
}

.type-ice {
    background: #96d9d6;
}

.type-fighting {
    background: #c22e28;
}

.type-poison {
    background: #a33ea1;
}

.type-ground {
    background: #e2bf65;
}

.type-flying {
    background: #a98ff3;
}

.type-psychic {
    background: #f95587;
}

.type-bug {
    background: #a6b91a;
}

.type-rock {
    background: #b6a136;
}

.type-ghost {
    background: #735797;
}

.type-dragon {
    background: #6f35fc;
}

.type-dark {
    background: #705746;
}

.type-steel {
    background: #b7b7ce;
}

.type-fairy {
    background: #d685ad;
}

.type-normal {
    background: #a8a77a;
}

/* Battle Screen */
.battle-arena {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 300px;
    background: linear-gradient(to bottom, #87ceeb 0%, #e0f7fa 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

.fighter {
    width: 40%;
    text-align: center;
}

.fighter img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.info-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.name-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.battle-info-btn {
    background: #eee;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
}

.battle-info-btn:hover {
    background: #ddd;
    color: #333;
}

.hp-bar-container {
    width: 100%;
    height: 15px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: 5px 0;
}

.hp-bar {
    height: 100%;
    background: var(--hp-green);
    transition: width 0.5s, background-color 0.5s;
}

.battle-controls {
    background: #333;
    color: white;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    gap: 20px;
}

.log {
    flex: 2;
    height: 100px;
    overflow-y: auto;
    background: #222;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
}

.log p {
    margin: 5px 0;
    border-bottom: 1px solid #444;
    padding-bottom: 2px;
}

.actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.action-btn {
    padding: 15px;
    font-family: 'Press Start 2P', cursive;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

#attack-btn {
    background: var(--hp-red);
    color: white;
}

#attack-btn:hover {
    background: #d32f2f;
}

#reset-btn {
    background: var(--primary);
    color: var(--text);
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #000;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-body {
    display: flex;
    gap: 20px;
    align-items: center;
}

.modal-body img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

.stats-grid {
    flex: 1;
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.stat-row span:first-child {
    width: 70px;
    font-weight: bold;
}

.stat-bar-bg {
    flex: 1;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    margin: 0 10px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    /* Set via JS */
}

#val-hp,
#val-atk,
#val-def,
#val-spa,
#val-spd,
#val-spe {
    width: 30px;
    text-align: right;
}