body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f8ff;
    color: #333;
    margin: 0;
    padding: 20px;
    text-align: center;
}

h1 {
    font-size: 2.5em;
    color: #ff6347;
}

h2 {
    font-size: 2em;
    color: #4682b4;
}

button {
    background-color: #ff6347;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #ff4500;
}

.pokemon {
    font-size: 3em;
    margin: 20px 0;
}

.math-problem {
    font-size: 1.5em;
    margin: 20px 0;
}

.feedback {
    font-size: 1.2em;
    margin: 10px 0;
}

.pokedex {
    margin-top: 30px;
    font-size: 1.2em;
}

/* Pokédex header with toggle */
#pokedex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#pokedex-header h2 {
    margin: 0;
    flex: 1;
}

#pokedex-toggle {
    margin-left: 10px;
    font-size: 1em;
    padding: 4px 8px;
    min-width: 30px;
    transition: transform 0.3s ease;
    display: none;
    /* Hidden by default on desktop */
}

#pokedex-toggle:hover {
    transform: scale(1.1);
}

.pokedex-item {
    margin: 5px 0;
    color: #32cd32;
}

/* Pokémon list smooth transitions */
#pokemon-list {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Pokemon preview styles */
.pokemon-preview {
    background: linear-gradient(135deg, #ffeb3b, #ffc107);
    border: 3px solid #ff9800;
    border-radius: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: bounce 2s infinite;
}

.pokemon-emoji {
    font-size: 4em;
    margin-bottom: 10px;
}

.pokemon-name {
    font-size: 1.5em;
    font-weight: bold;
    color: #d84315;
    margin-bottom: 5px;
}

.pokemon-type {
    font-size: 1em;
    color: #5d4037;
    font-style: italic;
}

/* Problem container styles */
#problem-container {
    margin: 20px 0;
}

#problem-text {
    background: linear-gradient(135deg, #fff9c4, #f9f7d9);
    border: 3px solid #ff9800;
    border-radius: 15px;
    padding: 25px 30px;
    margin: 20px auto;
    max-width: 100%;
    min-width: 80%;
    font-size: 2.2em;
    font-weight: bold;
    color: #d84315;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    letter-spacing: 1px;
    line-height: 1.2;
    animation: problemPulse 3s ease-in-out infinite;
    position: relative;
}

@keyframes problemPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    }
}

#read-problem {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 26px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    background-color: #2196f3;
    color: white;
    font-size: 0.4em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 10px 15px;
}

#read-problem:hover {
    background-color: #1976d2;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Caught Pokemon styles */
.caught-pokemon-item {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    color: white;
    padding: 10px;
    margin: 8px auto;
    border-radius: 10px;
    max-width: 250px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    list-style: none;
    width: 45%;
}

.caught-emoji {
    font-size: 1.5em;
    margin-right: 8px;
}

.caught-name {
    font-weight: bold;
    margin-right: 5px;
}

.caught-type {
    opacity: 0.9;
    font-size: 0.9em;
}

/* Animation */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

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

    60% {
        transform: translateY(-5px);
    }
}

/* Stats display */
#stats-display {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.stat-item {
    color: #333;
    padding: 12px 16px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: 120px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: linear-gradient(135deg, #fecb08 0%, #fff2a6 50%, #fecb08 100%);
    border: 3px solid #3267b1;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(50, 103, 177, 0.4);
}

.stat-label {
    font-size: 0.8em;
    opacity: 0.8;
    font-weight: 500;
    margin-bottom: 4px;
    color: #444;
}

.stat-value {
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Legacy support for old score element */
#score {
    background: linear-gradient(45deg, #9c27b0, #e91e63);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Progress controls */
#progress-controls {
    text-align: center;
    margin: 10px 0;
}

.small-button {
    background: linear-gradient(135deg, #6c757d, #868e96);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.small-button:hover {
    background: linear-gradient(135deg, #5a6268, #6c757d);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Answer controls */
#answer-controls {
    margin: 20px 0;
}

#number-input-container,
#true-false-container {
    margin: 15px 0;
}

/* Input field styling */
#user-answer {
    font-size: 1.8em;
    padding: 15px 20px;
    border: 3px solid #ff9800;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff, #f8f8f8);
    color: #333;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    min-width: 200px;
    font-weight: bold;
}

#user-answer:focus {
    outline: none;
    border-color: #4caf50;
    background: linear-gradient(135deg, #fff, #f0fff0);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
}

#user-answer::placeholder {
    color: #999;
    font-style: italic;
    font-weight: normal;
}

/* Answer feedback styles */
#user-answer.correct-answer {
    border-color: #4caf50 !important;
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9) !important;
    color: #2e7d32 !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4) !important;
}

#user-answer.incorrect-answer {
    border-color: #f44336 !important;
    background: linear-gradient(135deg, #ffebee, #ffcdd2) !important;
    color: #c62828 !important;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.4) !important;
}

/* True/False button feedback styles */
.tf-button.correct-answer {
    background: linear-gradient(135deg, #4caf50, #66bb6a) !important;
    border-color: #388e3c !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4) !important;
}

.tf-button.incorrect-answer {
    background: linear-gradient(135deg, #f44336, #ef5350) !important;
    border-color: #d32f2f !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.4) !important;
}

/* True/False buttons */
.tf-button {
    background: linear-gradient(135deg, #607d8b, #455a64);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 25px;
    font-size: 1.2em;
    margin: 5px 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tf-button:hover {
    background: linear-gradient(135deg, #546e7a, #37474f);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tf-button.selected {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* Next Problem button */
#next-problem {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    margin-top: 15px;
    padding: 12px 24px;
    font-size: 1.1em;
    animation: pulse 1.5s infinite;
}

#next-problem:hover {
    background: linear-gradient(135deg, #ff8f00, #ef6c00);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Mute toggle button */
#mute-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    border: 2px solid #333;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

#mute-toggle:hover {
    background: #f5f5f5;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Enhanced Pokémon Display Styles */
.pokemon-preview.enhanced {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 3px solid #ddd;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

/* Stats Toggle Icon Button */
.stats-toggle-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    background-color: #3498db;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.stats-toggle-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Shiny Pokémon Styles */
.pokemon-preview.enhanced.shiny {
    background: linear-gradient(135deg, #fff9c4, #fffacd, #f0f8ff);
    border: 3px solid gold !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 8px 25px rgba(0, 0, 0, 0.15);
    }
}

.shiny-sparkles {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.2em;
    animation: sparkle 1.5s infinite;
    z-index: 10;
}

@keyframes sparkle {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    25% {
        transform: scale(1.2) rotate(90deg);
        opacity: 0.7;
    }

    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 1;
    }

    75% {
        transform: scale(1.1) rotate(270deg);
        opacity: 0.8;
    }
}

.pokemon-sprite.shiny {
    filter: brightness(1.1) saturate(1.3) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from {
        filter: brightness(1.1) saturate(1.3) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    }

    to {
        filter: brightness(1.2) saturate(1.4) drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    }
}

.pokemon-preview.loading {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    border: 2px dashed #ccc;
    padding: 20px;
    border-radius: 15px;
}

.pokemon-sprite-container {
    position: relative;
    margin-bottom: 15px;
}

.pokemon-sprite {
    width: 120px;
    height: 120px;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.pokemon-sprite:hover {
    transform: scale(1.1);
}

.pokemon-emoji-fallback {
    font-size: 4em;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pokemon-types {
    margin: 10px 0;
}

.type-badge {
    display: inline-block;
    color: white;
    padding: 4px 12px;
    margin: 2px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pokemon-stats {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 10px;
}

.stat {
    text-align: center;
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 0.8em;
    color: #555555;
    font-weight: bold;
    margin-bottom: 2px;
}

.stat-value {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.pokemon-info {
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
}

.pokemon-size {
    margin-bottom: 5px;
}

.pokemon-abilities {
    font-style: italic;
    color: #777;
}

/* Rarity Badge */
.rarity-badge {
    display: inline-block;
    color: white;
    padding: 4px 12px;
    margin: 8px 0;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Legendary rarity styling */
.rarity-badge.legendary {
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF8C00);
    color: #8B4513;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    animation: legendaryGlow 2s ease-in-out infinite alternate;
    border: 2px solid #FFD700;
}

@keyframes legendaryGlow {
    0% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.3);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4);
    }
}

/* Pokemon Details Container */
.pokemon-details {
    margin-top: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 1px solid #ddd;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 15px;
        padding-bottom: 15px;
    }
}

/* Enhanced Pokédex Styles */
.caught-pokemon-enhanced {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.caught-pokemon-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.caught-sprite-container {
    margin-right: 15px;
    flex-shrink: 0;
}

.caught-sprite {
    width: 60px;
    height: 60px;
    image-rendering: pixelated;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
}

.caught-emoji-fallback {
    font-size: 2.5em;
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.caught-details {
    flex: 1;
    text-align: left;
}

.caught-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.caught-type-badge {
    background: #4CAF50;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 4px;
}

/* Rarity badges in Pokédex */
.caught-rarity-badge {
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.5em;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Badge container layout */
.caught-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0;
}

.caught-types {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.caught-rarity {
    display: flex;
    align-items: center;
}

.caught-stats {
    font-size: 0.8em;
    color: #666;
    font-family: monospace;
}

/* Shiny Pokédex Entries */
.caught-pokemon-enhanced.shiny-caught {
    border: 2px solid gold !important;
    background: linear-gradient(135deg, #fff9c4, #fffacd) !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    position: relative;
}

.caught-shiny-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2em;
    z-index: 10;
    animation: sparkle 1.5s infinite;
}

.caught-sprite.shiny-caught {
    filter: brightness(1.1) saturate(1.2);
}

#pokemon-list {
    display: flex;
    flex-wrap: wrap;
}


/* Responsive Design for Enhanced Elements */
@media (max-width: 768px) {
    .pokemon-sprite {
        width: 100px;
        height: 100px;
    }

    .pokemon-stats {
        flex-direction: column;
        gap: 5px;
    }

    .stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .caught-pokemon-enhanced {
        flex-direction: column;
        text-align: center;
    }

    .caught-sprite-container {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* New Responsive Layout Styles */
body {
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
#welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
}

/* Main Game Layout */
#main-game-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Desktop Layout */
@media (min-width: 768px) {
    #main-game-layout {
        flex-direction: row;
    }

    #pokedex-section {
        width: 50%;
        height: 100vh;
        display: flex;
        flex-direction: column;
        background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
        border-right: 2px solid #ddd;
        overflow: hidden;
    }

    #score-display {
        padding: 20px;
        background: white;
        border-bottom: 1px solid #ddd;
        flex-shrink: 0;
    }

    #pokedex {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }

    #math-section {
        width: 50%;
        height: 100vh;
        display: flex;
        flex-direction: column;
        background: linear-gradient(135deg, #f8f9fa, #ffffff);
    }

    #math-problem {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    #bottom-button-area {
        padding: 20px;
        background: white;
        border-top: 1px solid #ddd;
        flex-shrink: 0;
    }
}

/* Mobile Layout */
@media (max-width: 767px) {
    body {
        overflow: auto;
        height: auto;
    }

    #game-container {
        height: auto;
        min-height: 100vh;
    }

    #main-game-layout {
        flex-direction: column;
        height: auto;
        min-height: 200vh;
        /* Allow for scrolling between sections */
    }

    #pokedex-section {
        background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
        border-bottom: 2px solid #ddd;

        max-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #score-display {
        text-align: center;
        padding: 15px;
        background: white;
        border-bottom: 1px solid #ddd;
        flex-shrink: 0;
    }

    #pokedex {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
    }

    #math-section {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background: linear-gradient(135deg, #f8f9fa, #ffffff);
    }

    #stats-display {
        flex-direction: row;
        gap: 8px;
        margin: 10px 0;
    }

    .stat-item {
        padding: 8px 12px;
        min-width: 90px;
        flex: 1;
    }

    .stat-label {
        font-size: 0.7em;
    }

    .stat-value {
        font-size: 1em;
    }

    /* Mobile Pokédex header */
    #pokedex-header {
        margin-bottom: 10px;
    }

    #pokedex-toggle {
        display: block;
        /* Show on mobile */
        font-size: 0.9em;
        padding: 3px 6px;
    }

    #math-problem {
        flex: 1;
        padding: 15px;
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 90px);
        /* Account for button area */
    }

    #bottom-button-area {
        padding: 15px;
        background: white;
        border-top: 1px solid #ddd;
        flex-shrink: 0;
        height: 60px;
    }
}

/* Bottom Button Styling */
#bottom-button-area {
    position: relative;
}

#bottom-button-area button {
    width: 100%;
    height: 60px;
    font-size: 1.3em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-answer {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

#submit-answer:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

#next-problem {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

#next-problem:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-2px);
}

/* Adjust existing elements for new layout */
#current-pokemon {
    margin-bottom: 20px;
    align-self: center;
    min-width: 60%;
}

#problem-container {
    margin-bottom: 20px;
}

#answer-controls {
    margin-bottom: 20px;
}

#feedback {
    margin-bottom: auto;
    padding: 10px;
}

/* Pokémon card flip styles */
.pokemon-card {
    max-width: 320px;
    height: 220px;
    perspective: 1200px;
    margin: 0 auto 10px auto;
    position: relative;
}

.pokemon-card .card-front,
.pokemon-card .card-back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.6s cubic-bezier(.2, .8, .2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 245, 0.95));
}

.pokemon-card .card-back {
    transform: rotateY(180deg);
}

.pokemon-card.flipped .card-front {
    transform: rotateY(180deg);
}

.pokemon-card.flipped .card-back {
    transform: rotateY(360deg);
}

.turn-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    padding: 6px 8px;
    font-size: 1em;
}

.turn-icon.back {
    right: auto;
    left: 8px;
}

.story-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-loading {
    font-style: italic;
    color: #666;
}

.story-text {
    padding: 8px 12px;
    color: #333;
    font-size: 1.05em;
}

button#open-large-story {
    border-radius: 50%;
    padding: 3px 3px 4px 5px;
    text-align: right;
    position: absolute;
    bottom: 10px;
    right: 10px;
}

button#open-large-story b {
    transform: rotate(45deg);
    display: inline-block;
}

/* Slightly hide the duplicated name used for accessibility */
.visually-hidden {
    display: none;
}

/* Modal for large story viewing */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: #fffbe6;
    border-radius: 12px;
    padding: 24px;
    max-width: 720px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.modal-content h3 {
    margin-top: 0;
    color: #2b4a76;
}

.modal-content .small-button {
    position: absolute;
    top: 12px;
    right: 12px;
}

.large-story {
    font-size: 2.2rem;
    line-height: 1.5;
    color: #2b2b2b;
    padding: 12px 6px;
    text-align: center;
}

@media (max-width: 600px) {
    .large-story {
        font-size: 1.6rem;
    }
}

/* Review Screen Styles */
#review-screen {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

#review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

#review-header h2 {
    margin: 0;
}

#review-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#no-mistakes {
    text-align: center;
    padding: 40px 20px;
    color: #4682b4;
    font-size: 1.2em;
}

#mistakes-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

#mistakes-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

#mistakes-table th,
#mistakes-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#mistakes-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #4682b4;
    position: sticky;
    top: 0;
}

#mistakes-table tr:hover {
    background-color: #f5f5f5;
}

#mistakes-table td {
    vertical-align: top;
}

.mistake-problem {
    font-family: 'Courier New', monospace;
    background-color: #f0f8ff;
    padding: 4px 8px;
    border-radius: 4px;
}

.correct-answer {
    color: #28a745;
    font-weight: bold;
}

.wrong-answer {
    color: #dc3545;
    font-weight: bold;
}

.mistake-pokemon {
    display: inline-block;
    font-size: 0.9em;
}

.mistake-date {
    font-size: 0.9em;
    color: #666;
}

#review-controls {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Mobile responsiveness for review screen */
@media (max-width: 768px) {
    #review-header {
        flex-direction: column;
        text-align: center;
    }

    #mistakes-table th,
    #mistakes-table td {
        padding: 8px 4px;
        font-size: 0.9em;
    }

    #mistakes-table {
        font-size: 0.85em;
    }

    .mistake-problem {
        font-size: 0.8em;
    }
}

/* Battle Screen Styles */
#battle-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px;
    box-sizing: border-box;
}

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

.battle-title {
    font-size: 2.5rem;
    color: #e74c3c;
    text-shadow: 2px 2px 0 #000;
    margin: 0;
    animation: pulse 1s infinite;
}

.battle-arena {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.battle-opponent {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.battle-player {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.battle-info {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 150px;
}

.battle-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.hp-container {
    background: #ddd;
    border-radius: 10px;
    padding: 2px;
}

.hp-hearts {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.battle-sprite-container {
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 20px;
}

.battle-sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
}

.battle-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.battle-message {
    font-size: 3rem;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 3px 3px 0 #c0392b;
}

.battle-controls {
    background: white;
    border-radius: 15px;
    padding: 20px;
    color: #333;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.2);
}

#battle-question-text {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}

.battle-input-area {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#battle-answer {
    padding: 10px;
    font-size: 1.2rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    width: 200px;
}

#battle-submit {
    padding: 10px 20px;
    font-size: 1.2rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
}

#battle-submit:active {
    transform: scale(0.95);
}

#battle-feedback {
    text-align: center;
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    min-height: 1.5em;
}

/* Animations */
@keyframes shake {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-10px, 0);
    }

    50% {
        transform: translate(10px, 0);
    }

    75% {
        transform: translate(-10px, 0);
    }

    100% {
        transform: translate(0, 0);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes attack-right {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(50px);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes attack-left {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-50px);
    }

    100% {
        transform: translateX(0);
    }
}

.attack-right {
    animation: attack-right 0.3s ease-in-out;
}

.attack-left {
    animation: attack-left 0.3s ease-in-out;
}

.damage-flash {
    filter: sepia(100%) saturate(300%) hue-rotate(-50deg) !important;
}

.speaker-btn {
    background-color: #2196f3;
    color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 10px;
    vertical-align: middle;
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.speaker-btn:hover {
    background-color: #1976d2;
    transform: scale(1.1);
}

/* Battle Progress Bar */
.battle-progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid #ccc;
}

#battle-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #f44336);
    transition: width 0.5s ease-in-out;
}

/* Selection Modal Styles */
.selection-content {
    max-width: 800px;
    background: #f0f8ff;
}

.selection-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.selection-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100px;
    text-align: center;
}

.selection-item:hover {
    transform: scale(1.1);
    border-color: #2196f3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.selection-sprite {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.selection-name {
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 5px;
}