body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #222;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    margin: 0;
    min-height: 100vh;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-top: 1.5rem;
    letter-spacing: 2px;
    color: #d32f2f;
}

#main {
    max-width: 900px;
    margin: 2rem auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
}

.hidden {
    display: none !important;
}


#pokemon-containers {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.pokemon-container {
    display: flex;
    flex-direction: column;
    margin: auto;
    width: 25vw;
}

.pokemon-status {
    font-size: 1rem;
    color: #1976d2;
    margin-bottom: 0.5rem;
}

.pokemon-hp-bar {
    width: 90%;
    height: 1.2rem;
    border-radius: 8px;
    background: #eee;
    margin-bottom: 0.7rem;
    appearance: none;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.10);
    transition: all 0.8s ease-in-out;
}

.pokemon-hp-bar::-webkit-progress-bar {
    background-color: #eee;
    border-radius: 8px;
}

.pokemon-hp-bar::-webkit-progress-value {
    background: #66bb6a;
    border-radius: 8px;
}

.pokemon-hp-bar::-moz-progress-bar {
    background: #66bb6a;
    border-radius: 8px;
}

.pokemon-image {
    image-rendering: crisp-edges;
    width: 20vw;
    min-width: 120px;
    max-width: 180px;
    aspect-ratio: 1/1;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border: 3px solid #bdbdbd;
}

#main-buttons,
#move-buttons,
#switch-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

button {
    background: #d32f2f;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover, button:focus {
    background: #b71c1c;
    transform: translateY(-2px) scale(1.04);
}

button:active {
    transform: translateY(1px) scale(0.98);
}

#battle-log {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(44, 62, 80, 0.08);
    max-height: 280px;
    overflow-y: auto;
    font-size: 1rem;
}

#battle-log li {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
    color: #333;
    animation: log-entry-slide 0.4s ease-out;
}

.current-log {
    background: #fffde7;
    font-weight: bold;
}

#team-builder {
    padding: 2rem;
}

#team-builder h2 {
    text-align: center;
    color: #d32f2f;
    margin-bottom: 2rem;
}

#selected-team {
    margin-bottom: 2rem;
}

#selected-team h3 {
    color: #1976d2;
    margin-bottom: 1rem;
}

#selected-pokemon {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.selected-slot {
    background: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selected-slot.filled {
    background: #e3f2fd;
    border: 2px solid #1976d2;
    color: #1976d2;
    font-weight: bold;
}

.selected-slot:hover {
    background: #e0e0e0;
}

.selected-slot.filled:hover {
    background: #bbdefb;
}

#pokemon-selection h3 {
    color: #1976d2;
    margin-bottom: 1rem;
}

#pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.pokemon-option {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pokemon-option:hover {
    border-color: #1976d2;
    background: #e3f2fd;
}

.pokemon-option.selected {
    border-color: #4caf50;
    background: #e8f5e8;
    color: #2e7d32;
}

.pokemon-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#team-builder-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

#team-builder-actions button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

#start-battle-button {
    background: #4caf50;
    color: white;
}

#start-battle-button:hover:not(:disabled) {
    background: #45a049;
}

#start-battle-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#random-team-button {
    background: #ff9800;
    color: white;
}

#random-team-button:hover {
    background: #f57c00;
}

#clear-team-button {
    background: #f44336;
    color: white;
}

#clear-team-button:hover {
    background: #d32f2f;
}

/* Animation classes */
.pokemon-attack {
    animation: attack-shake 0.6s ease-in-out;
}

.pokemon-damage {
    animation: damage-flash 0.8s ease-in-out;
}

.pokemon-heal {
    animation: heal-glow 1s ease-in-out;
}

.pokemon-faint {
    animation: faint-slide 1.2s ease-in-out forwards;
}

.pokemon-switch-in {
    animation: switch-in 0.8s ease-out;
}

.pokemon-switch-out {
    animation: switch-out 0.6s ease-in forwards;
}

.status-effect {
    animation: status-pulse 2s ease-in-out infinite;
}

.move-text {
    animation: move-announce 2s ease-in-out;
}

.hp-bar-animate {
    transition: value 1s ease-in-out;
}

/* Keyframe animations */
@keyframes attack-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

@keyframes damage-flash {
    0%, 100% {
        filter: brightness(1);
    }
    25% {
        filter: brightness(1.8) hue-rotate(20deg);
    }
    50% {
        filter: brightness(0.6) hue-rotate(-10deg);
    }
    75% {
        filter: brightness(1.4) hue-rotate(15deg);
    }
}

@keyframes heal-glow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.4) hue-rotate(90deg);
    }
}

@keyframes faint-slide {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(20px) rotate(-15deg);
        opacity: 0.3;
    }
}

@keyframes switch-in {
    0% {
        transform: scale(0.5) translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes switch-out {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.5) translateY(-50px);
        opacity: 0;
    }
}

@keyframes status-pulse {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2) hue-rotate(180deg);
    }
}

@keyframes move-announce {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    25% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    75% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Battle log entry animation */
@keyframes log-entry-slide {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}
