* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Calibri', 'Segoe UI', 'Arial', sans-serif;
}

body {
    background-color: #a0e6ff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* To ensure proper behavior on mobile browsers */
html {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.game-container {
    width: 95%;
    max-width: 1800px;
    background-color: #ffffff;
    border-radius: 20px;
    padding: 20px 30px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
}

h1 {
    color: #ff6b6b;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #ffd166;
}

h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

h3 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

/* Setup Screen Styles */
.setup-screen {
    margin-top: 20px;
    overflow-y: visible;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 15px;
    align-items: start;
}

/* Grid layout for setup sections */
.mode-selection {
    grid-column: span 12;
}

#player1-setup {
    grid-column: span 6;
}

#player2-setup {
    grid-column: span 6;
}

.home-away-selection {
    grid-column: span 6;
}

.team-fun-facts {
    grid-column: span 6;
}

.difficulty-selection {
    grid-column: span 6;
}

.innings-selection {
    grid-column: span 6;
}

#start-game-btn {
    grid-column: span 12;
    width: 100%;
    max-width: 300px;
    margin: 15px auto 0;
    display: block;
}

.mode-selection, .player-setup, .difficulty-selection, .home-away-selection, .team-fun-facts, .innings-selection {
    background-color: #f8f8f8;
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 0;
    border: 3px solid #e1e1e1;
    height: 100%;
}

.mode-buttons, .jersey-buttons, .home-away-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* Make difficulty grid more compact and horizontal */
.difficulty-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    justify-content: center;
}

/* More compact difficulty buttons */
.difficulty-button {
    padding: 8px 12px;
    font-size: 0.9rem;
    min-height: 40px;
    flex: 0 0 calc(25% - 8px);
    min-width: 90px;
}

/* Responsive adjustments for the horizontal layout */
@media (max-width: 1024px) {
    .setup-screen {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .mode-selection {
        grid-column: span 6;
    }
    
    #player1-setup, #player2-setup, 
    .home-away-selection, .team-fun-facts,
    .difficulty-selection, .innings-selection {
        grid-column: span 3;
    }
    
    #start-game-btn {
        grid-column: span 6;
    }
    
    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .difficulty-button {
        flex: 0 0 calc(50% - 8px);
    }
    
    .teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .team-logo-small {
        width: 45px;
        height: 45px;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .setup-screen {
        display: grid;
        grid-template-columns: 1fr;
    }
    
    .mode-selection, #player1-setup, #player2-setup, 
    .home-away-selection, .team-fun-facts,
    .difficulty-selection, .innings-selection {
        grid-column: span 1;
        margin-bottom: 15px;
    }
    
    #start-game-btn {
        grid-column: span 1;
    }
    
    .difficulty-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .setup-screen {
        display: block;
    }
    
    .mode-selection, #player1-setup, #player2-setup, 
    .home-away-selection, .team-fun-facts,
    .difficulty-selection, .innings-selection {
        margin-bottom: 15px;
    }
    
    .teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .team-logo-small {
        width: 40px;
        height: 40px;
    }
    
    .team-name-small {
        font-size: 0.7rem;
    }
    
    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .difficulty-button {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
}

.mode-button, .difficulty-button, .jersey-button, .home-away-button {
    background-color: #ffd166;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 3px 0 #e6bc5c;
    transition: all 0.1s;
    min-height: 44px;
}

.mode-button:hover, .difficulty-button:hover, .jersey-button:hover, .home-away-button:hover {
    filter: brightness(1.1);
}

.mode-button:active, .difficulty-button:active, .jersey-button:active, .home-away-button:active {
    transform: translateY(3px);
    box-shadow: none;
}

.mode-button.active, .difficulty-button.active, .jersey-button.active, .home-away-button.active {
    background-color: #ff9a3c;
    box-shadow: none;
    transform: translateY(3px);
}

.player-name-input {
    padding: 10px;
    font-size: 1.2rem;
    border: 2px solid #ffd166;
    border-radius: 10px;
    width: 80%;
    max-width: 300px;
    margin-bottom: 15px;
    text-align: center;
}

/* More compact team selection */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.team-item {
    background-color: white;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
}

.team-item:hover {
    border-color: #ffd166;
    transform: scale(1.05);
}

.team-item.selected {
    border-color: #ff6b6b;
    background-color: #fff8e8;
    transform: scale(1.05);
}

.team-logo-small {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.team-name-small {
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: bold;
}

/* Game Screen Styles */
.game-screen {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    grid-gap: 15px;
    overflow: visible;
    align-items: start;
}

.game-header {
    grid-column: 1 / span 2;
    margin-bottom: 15px;
    position: relative;
}

#game-status {
    grid-column: 1 / span 2;
    margin-bottom: 15px;
}

.baseball-field-container {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Enhanced baseball field with 3D elements */
.baseball-field {
    padding-top: 10px;
    background-color: #7bce65;
    background-image: 
        radial-gradient(circle at center, #8dd876 0%, #7bce65 70%),
        repeating-linear-gradient(0deg, transparent, transparent 30px, #78c862 30px, #78c862 32px);
    height: 450px;
    width: 100%;
    max-width: 650px;
    border-radius: 300px;
    position: relative;
    margin: 0 auto;
    overflow: hidden;
    border: 8px solid #5a9147;
    box-shadow: 
        inset 0 0 30px rgba(0,0,0,0.1),
        0 10px 20px rgba(0,0,0,0.2);
}

.question-side {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.question-container {
    background-color: #fff8e8;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 3px solid #ffd166;
    width: 100%;
    max-width: 400px;
}

.question {
    font-size: 1.6rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.answer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#custom-numpad {
    width: 100%;
    max-width: 400px;
    margin: 10px auto 0;
}

/* Responsive design for game screen */
@media (max-width: 1024px) {
    .game-screen {
        grid-template-columns: 1.2fr 1fr;
    }
    
    .baseball-field {
        height: 400px;
        max-width: 550px;
    }
    
    .baseball-diamond {
        width: 270px;
        height: 270px;
        margin-left: -135px;
        margin-top: -135px;
    }
    
    .question {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    .game-screen {
        grid-template-columns: 1fr;
    }
    
    .game-header, #game-status {
        grid-column: 1;
    }
    
    .baseball-field-container {
        grid-column: 1;
        grid-row: 2;
    }
    
    .question-side {
        grid-column: 1;
        grid-row: 3;
    }
    
    .baseball-field {
        height: 350px;
        max-width: 400px;
    }
    
    .baseball-diamond {
        width: 240px;
        height: 240px;
        margin-left: -120px;
        margin-top: -120px;
    }
    
    .question {
        font-size: 1.3rem;
    }
}

@media (min-width: 769px) and (max-width: 850px) and (orientation: landscape) {
    /* Specific landscape tweaks for tablets */
    .baseball-field {
        height: 250px;
        max-width: 250px;
    }
    
    .question {
        font-size: 1.2rem;
    }
}

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

.team-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 35%;
}

.vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b;
}

.team-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

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

.inning-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 10;
    font-size: 1rem;
    border: 2px solid #ff9a3c;
}

/* Add infield dirt */
.baseball-field::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 320px;
    height: 320px;
    transform: translate(-50%, -50%) rotate(45deg);
    background-color: #e2c58d;
    border-radius: 40% 40% 40% 40% / 40% 40% 40% 40%;
    z-index: 1;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.1);
}

/* Add pitcher's mound */
.baseball-field::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    background-color: #d6b276;
    border-radius: 50%;
    z-index: 2;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

/* Pitcher */
.pitcher {
    width: 22px;
    height: 45px;
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4a6eca;
    border-radius: 50% 50% 0 0;
    z-index: 5;
}

.pitcher::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    background-color: #ffcc99;
    border-radius: 50%;
    z-index: 5;
}

.pitcher::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 15px;
    background-color: #f5f5f5;
    border-radius: 50% 50% 5px 5px / 70% 70% 10% 10%;
    z-index: 4;
}

/* Fielders */
.fielder {
    width: 20px;
    height: 40px;
    position: absolute;
    z-index: 5;
    background-color: #4a6eca;
    border-radius: 50% 50% 0 0;
}

.fielder::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    background-color: #ffcc99;
    border-radius: 50%;
    z-index: 5;
}

.fielder::after {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 12px;
    background-color: #f5f5f5;
    border-radius: 50% 50% 5px 5px / 70% 70% 10% 10%;
    z-index: 4;
}

/* Fielder positions */
.fielder-1b {
    left: 65%;
    top: 40%;
}

.fielder-2b {
    left: 58%;
    top: 30%;
}

.fielder-ss {
    left: 42%;
    top: 30%;
}

.fielder-3b {
    left: 35%;
    top: 40%;
}

.fielder-lf {
    left: 22%;
    top: 25%;
}

.fielder-cf {
    left: 50%;
    top: 15%;
}

.fielder-rf {
    left: 78%;
    top: 25%;
}

/* Base runners */
.baserunner {
    width: 18px;
    height: 38px;
    position: absolute;
    z-index: 6;
    background-image: linear-gradient(to bottom, var(--team-primary-color, #333) 70%, #3e3e3e 70%);
    border-radius: 5px 5px 0 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.baserunner::before {
    content: '';
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background-color: #ffcc99;
    border-radius: 50%;
    z-index: 5;
}

.baserunner::after {
    content: '';
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 13px;
    background-color: var(--team-primary-color, #333);
    border-radius: 50% 50% 5px 5px / 70% 70% 10% 10%;
    z-index: 4;
}

/* Base runner positions */
.baserunner-1b {
    top: 50%;
    right: 8%;
    transform: translateY(-50%);
}

.baserunner-2b {
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
}

.baserunner-3b {
    top: 50%;
    left: 8%;
    transform: translateY(-50%);
}

.baserunner.active {
    opacity: 1;
}

.baseball-diamond {
    width: 300px;
    height: 300px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -150px;
    margin-top: -150px;
    z-index: 2;
}

/* Base paths - faint lines connecting the bases */
.baseball-diamond::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    clip-path: polygon(50% 100%, 100% 50%, 50% 0%, 0% 50%);
    z-index: 2;
}

/* Enhanced 3D bases */
.base {
    width: 20px;
    height: 20px;
    background-color: #ffffff;
    position: absolute;
    border-radius: 5px;
    border: 3px solid #333;
    /* 3D effect for bases */
    box-shadow: 
        0 3px 5px rgba(0,0,0,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.1);
    transform-style: preserve-3d;
    z-index: 5;
}

.home-base {
    bottom: 97%;
    left: 50%;
    transform: translateX(-50%) perspective(100px) rotateX(20deg);
    /* Home plate is pentagon shaped */
    clip-path: polygon(0% 50%, 50% 100%, 100% 50%, 100% 0%, 0% 0%);
    background-color: #ffffff;
    margin-bottom: -15px; /* Move it slightly down */
    /* Make home plate larger and more visible */
    width: 36px;
    height: 36px;
    /* Enhanced 3D effect with stronger glow */
    box-shadow: 
        0 3px 5px rgba(0,0,0,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.1),
        0 0 20px rgba(255, 255, 255, 0.8);
    /* Add a stronger glow effect */
    animation: homePlateGlow 1.5s infinite alternate;
    border: 4px solid #333;
    z-index: 10; /* Ensure it's above everything else */
    position: absolute; /* Ensure absolute positioning */
}

/* Add stronger glowing animation for home plate */
@keyframes homePlateGlow {
    from {
        box-shadow: 
            0 3px 5px rgba(0,0,0,0.3),
            inset 0 -2px 0 rgba(0,0,0,0.1),
            0 0 20px rgba(255, 255, 255, 0.8);
    }
    to {
        box-shadow: 
            0 3px 5px rgba(0,0,0,0.3),
            inset 0 -2px 0 rgba(0,0,0,0.1),
            0 0 25px #ffffff,
            0 0 35px rgba(255, 255, 255, 0.9);
    }
}

.first-base {
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
    background-image: linear-gradient(to bottom, #ffffff, #f0f0f0);
}

.second-base {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background-image: linear-gradient(to bottom, #ffffff, #f0f0f0);
}

.third-base {
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
    background-image: linear-gradient(to bottom, #ffffff, #f0f0f0);
}

/* 3D Player Models - More realistic human figures */
.player {
    width: 25px;
    height: 50px;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    border-radius: 50% 50% 0 0;
    background-color: #ee3b1e;
    transition: all 0.3s ease;
    /* 3D effects */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 8px 8px 0 0;
    /* Add 3D transform */
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Player head - simplified cartoon style */
.player::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background-color: #ffcc99; /* Lighter cartoon skin tone */
    border-radius: 50%;
    z-index: 2;
    /* Simple cartoon face */
    box-shadow: 
        inset 0 -2px 0 rgba(0,0,0,0.1),
        0 -2px 5px rgba(0, 0, 0, 0.2);
}

/* Player helmet on top of head */
.player::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 16px;
    background-color: var(--team-primary-color, #333);
    border-radius: 50% 50% 5px 5px / 70% 70% 10% 10%;
    z-index: 1;
    box-shadow: 
        0 -2px 5px rgba(0,0,0,0.2),
        inset 0 -2px 0 rgba(0,0,0,0.3);
}

/* Team jersey styles with 3D effects - for home team */
.player.home-jersey {
    color: var(--team-secondary-color, #fff);
    /* Body shape with team colors */
    background-image: 
        linear-gradient(
            to bottom, 
            var(--team-primary-color, #333) 70%, 
            #3e3e3e 70%, #3e3e3e 85%,  /* Dark pants */
            #ddd 85% /* Socks */
        );
    /* Arms with proper shading */
    box-shadow: 
        inset 0 -3px 0 rgba(0,0,0,0.2),
        0 3px 5px rgba(0, 0, 0, 0.2),
        -10px 15px 0 -5px var(--team-primary-color, #333), /* Left arm */
        10px 15px 0 -5px var(--team-primary-color, #333); /* Right arm */
}

/* Team jersey styles with 3D effects - for away team */
.player.away-jersey {
    color: var(--team-primary-color, #333);
    /* Body shape with away colors */
    background-image: 
        linear-gradient(
            to bottom, 
            #f5f5f5 70%, 
            #3e3e3e 70%, #3e3e3e 85%,  /* Dark pants */
            #ddd 85% /* Socks */
        );
    /* Arms with proper shading */
    box-shadow: 
        inset 0 -3px 0 rgba(0,0,0,0.1),
        0 3px 5px rgba(0, 0, 0, 0.2),
        -10px 15px 0 -5px #f5f5f5, /* Left arm */
        10px 15px 0 -5px #f5f5f5; /* Right arm */
    /* Jersey number and trim */
    position: relative;
}

/* Jersey number */
.player.home-jersey::before,
.player.away-jersey::before {
    top: -20px;
}

/* Running legs animation for player */
@keyframes running-legs {
    0%, 100% {
        box-shadow: 
            inset 0 -3px 0 rgba(0,0,0,0.2),
            0 3px 5px rgba(0, 0, 0, 0.2),
            -10px 10px 0 -5px currentColor, /* Left arm forward */
            10px 15px 0 -5px currentColor, /* Right arm back */
            -5px 0px 0 -2px #3e3e3e, /* Left leg forward */
            5px 8px 0 -2px #3e3e3e; /* Right leg back */
    }
    50% {
        box-shadow: 
            inset 0 -3px 0 rgba(0,0,0,0.2),
            0 3px 5px rgba(0, 0, 0, 0.2),
            -10px 15px 0 -5px currentColor, /* Left arm back */
            10px 10px 0 -5px currentColor, /* Right arm forward */
            -5px 8px 0 -2px #3e3e3e, /* Left leg back */
            5px 0px 0 -2px #3e3e3e; /* Right leg forward */
    }
}

/* Apply running animation to player when moving */
.animate-home-to-first,
.animate-first-to-second,
.animate-second-to-third,
.animate-third-to-home {
    animation-name: running-legs, var(--running-path);
    animation-duration: 0.5s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

/* Set the path variables for each base path */
.animate-home-to-first {
    --running-path: run-home-to-first;
}

.animate-first-to-second {
    --running-path: run-first-to-second;
}

.animate-second-to-third {
    --running-path: run-second-to-third;
}

.animate-third-to-home {
    --running-path: run-third-to-home;
}

/* Add realistic batting stance */
.swing-animation {
    transform: translateX(-50%) rotate(15deg) !important;
    transform-origin: bottom center;
}

/* Add baseball bat with better positioning */
.swing-animation::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 5px;
    background-color: #8B4513;
    bottom: 45px;
    right: -40px;
    transform-origin: left center;
    border-radius: 2px;
    animation: swing-bat 0.3s forwards;
    box-shadow: 0 2px 2px rgba(0,0,0,0.2);
}

/* Scoreboard Styles (updated) */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffd166;
    padding: 10px 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 4px solid #ff9a3c;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.team-batting {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.score-display {
    display: flex;
    gap: 15px;
}

.team-score-box {
    font-size: 1.2rem;
    font-weight: bold;
}

.outs-display {
    font-size: 1.2rem;
}

.game-status {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    background-color: #f8f8f8;
    padding: 5px 10px;
    border-radius: 10px;
    margin: 0 0 15px 0;
    border: 2px solid #e1e1e1;
    grid-column: 1 / span 2;
    text-align: center;
}

/* Status message colors */
.status-correct {
    color: #4CAF50; /* Green for correct answers */
    animation: pulse-success 0.5s ease;
}

.status-incorrect {
    color: #FF0000; /* Red for incorrect answers */
    animation: shake 0.5s ease;
}

@keyframes pulse-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.question-container {
    background-color: #fff8e8;
    padding: 8px 15px;
    border-radius: 15px;
    margin: 3px auto 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 3px solid #ffd166;
    max-width: 600px;
}

.question {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.answer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
}

.answer-input {
    padding: 10px;
    font-size: 1.2rem;
    border: 2px solid #ff9a3c;
    border-radius: 10px;
    width: 60%;
    max-width: 200px;
    text-align: center;
}

/* Button Styles */
.hit-button, .next-button, .return-button, .exit-button {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #e64c4c;
    transition: all 0.1s;
    min-width: 80px;
}

.hit-button:active, .start-button:active, .next-button:active, .return-button:active, .exit-button:active {
    transform: translateY(4px);
    box-shadow: none;
}

.hit-button:hover, .start-button:hover, .next-button:hover, .return-button:hover, .exit-button:hover {
    filter: brightness(1.1);
}

.start-button {
    background-color: #06d6a0;
    box-shadow: 0 5px 0 #04aa82;
    padding: 15px 30px;
    font-size: 1.8rem;
    margin: 20px 0;
}

.next-button {
    background-color: #3498db;
    box-shadow: 0 5px 0 #2980b9;
    margin: 10px 0;
    width: 100%;
    max-width: 400px;
}

.return-button {
    background-color: #9b59b6;
    box-shadow: 0 5px 0 #8e44ad;
    margin: 10px 0;
    width: 100%;
    max-width: 400px;
}

/* Media query for smaller screens */
@media (max-width: 480px) {
    .game-screen {
        grid-template-columns: 1fr;
        grid-gap: 10px;
    }
    
    .game-header, #game-status {
        grid-column: 1;
    }
    
    .baseball-field-container {
        grid-column: 1;
        grid-row: 2;
    }
    
    .question-side {
        grid-column: 1;
        grid-row: 3;
    }
    
    .baseball-field {
        height: 280px;
        max-width: 320px;
    }
    
    .baseball-diamond {
        width: 180px;
        height: 180px;
        margin-left: -90px;
        margin-top: -90px;
    }
    
    .hit-button, .next-button, .return-button {
        font-size: 1.1rem;
        padding: 8px 15px;
    }
}

/* Animation classes */
.hit-animation {
    animation: hit 0.5s forwards;
}

/* Base running animations with improved paths */
.run-to-first {
    transform: translate(160px, 0);
}

.run-to-second {
    transform: translate(0, -160px);
}

.run-to-third {
    transform: translate(-160px, 0);
}

.run-to-home {
    transform: translate(0, 160px);
}

/* Path animations for the bases */
@keyframes run-home-to-first {
    0% { 
        transform: translate(0, 160px) rotateY(0deg); 
        animation-timing-function: ease-in;
    }
    20% { 
        transform: translate(50px, 130px) rotateY(10deg) scale(1.05); 
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    }
    50% { 
        transform: translate(90px, 80px) rotateY(-5deg); 
        animation-timing-function: ease-out;
    }
    70% {
        transform: translate(130px, 40px) rotateY(5deg) scale(0.95);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }
    100% { 
        transform: translate(160px, 0) rotateY(0deg); 
    }
}

@keyframes run-first-to-second {
    0% { 
        transform: translate(160px, 0) rotateX(0deg); 
        animation-timing-function: ease-in;
    }
    20% { 
        transform: translate(130px, -50px) rotateX(10deg) scale(1.05); 
    }
    50% { 
        transform: translate(80px, -90px) rotateX(-5deg); 
        animation-timing-function: ease-out;
    }
    70% {
        transform: translate(40px, -130px) rotateX(5deg) scale(0.95);
    }
    100% { 
        transform: translate(0, -160px) rotateX(0deg); 
    }
}

@keyframes run-second-to-third {
    0% { 
        transform: translate(0, -160px) rotateY(0deg); 
        animation-timing-function: ease-in;
    }
    20% { 
        transform: translate(-50px, -130px) rotateY(-10deg) scale(1.05); 
    }
    50% { 
        transform: translate(-90px, -80px) rotateY(5deg); 
        animation-timing-function: ease-out;
    }
    70% {
        transform: translate(-130px, -40px) rotateY(-5deg) scale(0.95);
    }
    100% { 
        transform: translate(-160px, 0) rotateY(0deg); 
    }
}

@keyframes run-third-to-home {
    0% { 
        transform: translate(-160px, 0) rotateX(0deg); 
        animation-timing-function: ease-in;
    }
    20% { 
        transform: translate(-130px, 50px) rotateX(-10deg) scale(1.05); 
    }
    50% { 
        transform: translate(-80px, 90px) rotateX(5deg); 
        animation-timing-function: ease-out;
    }
    70% {
        transform: translate(-40px, 130px) rotateX(-5deg) scale(0.95);
    }
    100% { 
        transform: translate(0, 160px) rotateX(0deg); 
    }
}

/* Add animated versions of base running */
.animate-home-to-first {
    animation: run-home-to-first 0.5s forwards;
}

.animate-first-to-second {
    animation: run-first-to-second 0.5s forwards;
}

.animate-second-to-third {
    animation: run-second-to-third 0.5s forwards;
}

.animate-third-to-home {
    animation: run-third-to-home 0.5s forwards;
}

@keyframes hit {
    0% {
        transform: translateX(-50%) rotate(0deg);
        box-shadow: 0 0 0 rgba(0,0,0,0.3);
    }
    10% {
        transform: translateX(-30%) rotate(90deg) scale(1.1);
    }
    100% {
        transform: translate(150px, -150px) rotate(720deg) scale(0.7);
        box-shadow: 0 50px 30px rgba(0,0,0,0.1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-container {
        width: 95%;
        padding: 15px 10px;
        max-height: 100vh;
        overflow: hidden;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }
    
    .team-logo-small {
        width: 45px;
        height: 45px;
    }
    
    .difficulty-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .difficulty-button {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
    
    .scoreboard {
        padding: 8px 12px;
        margin: 15px 0;
    }
    
    .team-score-box, .outs-display {
        font-size: 1.1rem;
    }
    
    .question {
        font-size: 1.6rem;
    }
    
    .answer-input {
        font-size: 1.3rem;
        width: 90px;
    }
    
    .hit-button, .next-button, .return-button {
        font-size: 1.2rem;
        padding: 8px 15px;
    }
    
    .start-button {
        font-size: 1.5rem;
        padding: 12px 25px;
    }
    
    .exit-button {
        font-size: 0.9rem;
        padding: 4px 12px;
    }

    .baseball-field {
        height: 320px;
        padding-top: 5px;
    }
    
    .baseball-diamond {
        width: 220px;
        height: 220px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px 0;
    }
    
    .game-container {
        width: 98%;
        padding: 10px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 12px;
    }
    
    .baseball-field {
        padding-top: 60px;
        height: 350px;
    }
    
    .baseball-diamond {
        width: 150px;
        height: 150px;
    }
    
    .teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }
    
    .team-logo-small {
        width: 45px;
        height: 45px;
    }
    
    .team-name-small {
        font-size: 0.7rem;
    }
    
    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mode-buttons, .jersey-buttons, .home-away-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .mode-button, .jersey-button, .home-away-button {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .player-name-input {
        width: 90%;
    }
    
    .question-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .question {
        font-size: 1.4rem;
    }
    
    .game-status {
        font-size: 1.5rem;
        min-height: 40px;
        margin: 15px 0;
    }
    
    .team-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .team-container {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .team-logo {
        width: 60px;
        height: 60px;
    }
    
    .vs {
        margin: 5px 0;
    }
    
    .exit-button {
        font-size: 0.8rem;
        padding: 3px 10px;
        top: -5px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px 5px;
        border-radius: 15px;
        max-height: 100vh;
        width: 98%;
    }
    
    .baseball-field {
        height: 280px;
        padding-top: 5px;
    }
    
    .baseball-diamond {
        width: 180px;
        height: 180px;
    }
    
    .integrated-scoreboard {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    .team-score-box, .outs-display {
        padding: 2px 5px;
        margin: 0 2px;
    }
    
    .current-batter-display {
        padding: 3px 5px;
        font-size: 0.8rem;
    }
    
    .player {
        width: 20px;
        height: 40px;
    }
    
    .fielder {
        width: 10px;
        height: 20px;
    }
    
    .pitcher {
        width: 15px;
        height: 35px;
    }
    
    .baserunner {
        width: 12px;
        height: 24px;
    }
    
    .base {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 850px) and (orientation: landscape) {
    body {
        padding: 5px 0;
    }
    
    .game-container {
        width: 98%;
        max-width: 98vw;
        padding: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    /* Split game screen in landscape */
    .game-screen {
        display: grid;
        grid-template-columns: 0.6fr 0.4fr;
        gap: 5px;
    }
    
    .game-header {
        grid-column: 1 / span 2;
        margin-bottom: 5px;
    }
    
    .game-status {
        grid-column: 1 / span 2;
        margin-top: 0;
        padding: 4px 10px;
        font-size: 1rem;
    }
    
    .baseball-field {
        grid-column: 1;
        height: 170px;
        width: 100%;
        margin: 0 auto;
        border-radius: 50%;
    }
    
    .baseball-diamond {
        width: 140px;
        height: 140px;
    }
    
    .question-container {
        grid-column: 2;
        margin: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 5px 10px;
    }
    
    .question {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    .answer-container {
        gap: 5px;
    }
    
    .answer-input {
        font-size: 1rem;
        padding: 5px;
        height: 35px;
    }
    
    .hit-button {
        padding: 5px 10px;
        font-size: 0.9rem;
        height: 35px;
    }
    
    .player {
        width: 15px;
        height: 35px;
    }
    
    .fielder {
        width: 8px;
        height: 18px;
    }
    
    .pitcher {
        width: 12px;
        height: 28px;
    }
    
    .baserunner {
        width: 10px;
        height: 22px;
    }
    
    .base {
        width: 12px;
        height: 12px;
    }
}

/* Jersey-specific styles */
.jersey-selection {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed #e1e1e1;
}

.jersey-button.active[id$="home-jersey"] {
    background-color: #4CAF50;
    box-shadow: none;
}

.jersey-button.active[id$="away-jersey"] {
    background-color: #9E9E9E;
    box-shadow: none;
}

/* Home/Away team selection styles */
.home-team-indicator, .away-team-indicator {
    font-size: 0.8rem;
    background-color: #f8f8f8;
    padding: 3px 6px;
    border-radius: 4px;
    margin-top: 5px;
}

.home-team-indicator {
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.away-team-indicator {
    color: #9E9E9E;
    border: 1px solid #9E9E9E;
}

/* Home/Away explanation */
.home-away-explanation {
    margin-top: 15px;
    padding: 10px;
    background-color: #f0f9ff;
    border-radius: 10px;
    border: 2px dashed #90cdf4;
    font-size: 1rem;
}

.home-away-explanation p {
    margin: 5px 0;
    color: #2c5282;
}

.home-away-explanation strong {
    color: #2b6cb0;
}

/* Team fun facts styles */
.team-fun-facts {
    background-color: #f0fff4;
    border-radius: 15px;
    padding: 15px;
    margin: 20px 0;
    border: 3px solid #9ae6b4;
}

.team-fun-facts h3 {
    color: #276749;
    margin-bottom: 10px;
}

.fun-fact-content {
    padding: 10px;
    background-color: #ffffff;
    border-radius: 10px;
    border: 2px solid #9ae6b4;
    font-size: 1.1rem;
    color: #2f855a;
}

.fun-fact-list {
    text-align: left;
    padding-left: 20px;
}

.fun-fact-list li {
    margin: 8px 0;
    list-style-type: disc;
}

/* Add bat swinging animation */
@keyframes swing-bat {
    0% {
        transform: rotate(-10deg) translateX(0);
    }
    30% {
        transform: rotate(-45deg) translateX(-5px);
    }
    60% {
        transform: rotate(30deg) translateX(10px);
    }
    100% {
        transform: rotate(0deg) translateX(0);
    }
}

/* Improve the baseball */
.ball {
    width: 20px;
    height: 20px;
    background-color: #ffffff;
    border-radius: 50%;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    border: 2px solid #333;
    transition: all 0.5s ease;
    /* 3D baseball with stitching */
    background-image: 
        linear-gradient(to right, transparent 45%, #d32f2f 45%, #d32f2f 55%, transparent 55%),
        linear-gradient(to bottom, transparent 45%, #d32f2f 45%, #d32f2f 55%, transparent 55%);
    box-shadow: 
        inset 0 0 5px rgba(0,0,0,0.2),
        0 3px 5px rgba(0,0,0,0.2);
}

/* Difficulty selection styles */
.difficulty-selection {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 15px;
    background-color: #f8f8f8;
    border: 3px solid #e1e1e1;
}

.difficulty-title {
    margin-bottom: 10px;
    color: #333;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.difficulty-button {
    background-color: #ffd166;
    color: #333;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 3px 0 #e6bc5c;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    position: relative;
    border: 2px solid transparent;
}

.difficulty-button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.difficulty-button:active, .difficulty-button.active {
    transform: translateY(3px);
    box-shadow: none;
}

/* Add a checkmark for selected operations */
.difficulty-button.active::before {
    content: "✓";
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 1rem;
    font-weight: bold;
}

/* Multi-selection style for difficulty buttons */
.difficulty-button.active {
    border: 2px solid #333;
}

/* Specific colors for each math operation button */
#addition-btn.active {
    background-color: #4CAF50; /* Green */
    color: white;
}

#subtraction-btn.active {
    background-color: #2196F3; /* Blue */
    color: white;
}

#multiplication-btn.active {
    background-color: #F44336; /* Red */
    color: white;
}

#division-btn.active {
    background-color: #9C27B0; /* Purple */
    color: white;
}

#fractions-btn.active {
    background-color: #FF9800; /* Orange */
    color: white;
}

#decimals-btn.active {
    background-color: #795548; /* Brown */
    color: white;
}

#decimals-btn.active {
    background-color: #4ecdc4;
    color: white;
}

#comparison-btn.active {
    background-color: #8338ec;
    color: white;
}

/* Add landscape orientation support */
@media (max-width: 850px) and (orientation: landscape) {
    body {
        padding: 5px 0;
    }
    
    .game-container {
        width: 95%;
        max-width: 90vw;
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    /* Split game screen in landscape */
    .game-screen {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .game-header {
        grid-column: 1 / span 2;
        margin-bottom: 5px;
    }
    
    .game-status {
        grid-column: 1 / span 2;
        margin-top: 0;
        padding: 4px 10px;
        font-size: 1rem;
    }
    
    .baseball-field {
        grid-column: 1;
        height: 170px;
        width: 100%;
        margin: 0 auto;
        border-radius: 50%;
    }
    
    .baseball-diamond {
        width: 140px;
        height: 140px;
    }
    
    .question-container {
        grid-column: 2;
        margin: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 5px 10px;
    }
    
    .question {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    .answer-container {
        gap: 5px;
    }
    
    .answer-input {
        font-size: 1rem;
        padding: 5px;
        height: 35px;
    }
    
    .hit-button {
        padding: 5px 10px;
        font-size: 0.9rem;
        height: 35px;
    }
    
    .player {
        width: 15px;
        height: 35px;
    }
    
    .fielder {
        width: 8px;
        height: 18px;
    }
    
    .pitcher {
        width: 12px;
        height: 28px;
    }
    
    .baserunner {
        width: 10px;
        height: 22px;
    }
    
    .base {
        width: 12px;
        height: 12px;
    }
}

.answer-tip {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* Random button special styling */
#random-btn.active {
    background: linear-gradient(135deg, #4CAF50, #2196F3, #F44336, #9C27B0, #FF9800, #795548);
    color: white;
    background-size: 600% 600%;
    animation: gradientAnimation 5s ease infinite;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Adaptive button special styling */
#adaptive-btn.active {
    background: linear-gradient(to bottom, #4CAF50, #2196F3);
    color: white;
    position: relative;
    overflow: hidden;
}

#adaptive-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, transparent, white, transparent);
    animation: adaptive-sweep 2s infinite;
}

@keyframes adaptive-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Adaptive level indicator styles - adjusted for the new layout */
.adaptive-indicator {
    background-color: rgba(232, 244, 253, 0.9);
    padding: 8px 10px;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid #90caf9;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 200px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    position: relative;
    z-index: 10;
}

.game-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-top: 15px;
}

/* Improve the current batter display in the new layout */
.current-batter-display {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 5px 15px;
    z-index: 10;
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Override landscape mode media query now that we're using a horizontal layout by default */
@media (max-width: 850px) and (orientation: landscape) {
    .game-screen {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .game-header {
        grid-column: 1 / span 2;
        margin-bottom: 5px;
    }
    
    .game-status {
        grid-column: 1 / span 2;
        margin-top: 0;
        padding: 4px 10px;
        font-size: 1rem;
    }
    
    .baseball-field {
        height: 300px;
        max-width: 350px;
    }
    
    .baseball-diamond {
        width: 200px;
        height: 200px;
        margin-left: -100px;
        margin-top: -100px;
    }
}

.adaptive-level, .adaptive-operation-display {
    font-size: 0.85rem;
    font-weight: bold;
    color: #1976d2;
}

.adaptive-progress {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-top: 3px;
    overflow: hidden;
}

.adaptive-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #4CAF50, #2196F3);
    width: 0%;
    transition: width 0.5s ease;
}

/* Responsive adjustments for adaptive indicator */
@media (max-width: 768px) {
    .baseball-field {
        padding-top: 10px;
    }
    
    .integrated-scoreboard {
        top: 35px;
    }
    
    .inning-display {
        top: 8px;
        font-size: 0.9rem;
    }
    
    .adaptive-indicator {
        top: 65px;
    }
}

@media (max-width: 480px) {
    .baseball-field {
        padding-top: 10px;
    }
    
    .integrated-scoreboard {
        top: 30px;
    }
    
    .inning-display {
        top: 5px;
        font-size: 0.8rem;
        padding: 3px 8px;
    }
    
    .adaptive-indicator {
        top: 60px;
    }
}

/* Innings selection styles */
.innings-selection {
    margin: 20px 0;
    padding: 15px;
    border-radius: 15px;
    background-color: #f8f8f8;
    border: 3px solid #90cdf4;
    text-align: center;
}

.innings-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
}

.innings-slider {
    -webkit-appearance: none;
    width: 80%;
    max-width: 400px;
    height: 20px;
    border-radius: 10px;
    background: #d1e9ff;
    outline: none;
    margin: 10px 0;
}

.innings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0078d7;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.innings-slider::-moz-range-thumb {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0078d7;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: none;
}

.innings-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0078d7;
    margin-top: 10px;
}

.innings-description {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

#innings-value {
    font-size: 1.8rem;
    color: #0078d7;
}

/* Responsive adjustments for innings selection */
@media (max-width: 600px) {
    .innings-slider {
        width: 90%;
    }
    
    .innings-display {
        font-size: 1.3rem;
    }
    
    #innings-value {
        font-size: 1.6rem;
    }
    
    .innings-description {
        font-size: 0.8rem;
        padding: 0 10px;
    }
}

/* Stadium crowd styles */
.stadium-crowd {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.crowd-section {
    position: absolute;
    background-color: rgba(51, 51, 51, 0.8);
    background-image: 
        radial-gradient(circle at 10% 10%, #4a4a4a 0%, transparent 30%),
        radial-gradient(circle at 30% 40%, #4a4a4a 0%, transparent 40%),
        radial-gradient(circle at 50% 20%, #4a4a4a 0%, transparent 30%),
        radial-gradient(circle at 70% 30%, #4a4a4a 0%, transparent 35%),
        radial-gradient(circle at 90% 15%, #4a4a4a 0%, transparent 25%);
    border-radius: 10px;
    box-shadow: 
        0 5px 15px rgba(0,0,0,0.3),
        inset 0 -10px 20px rgba(0,0,0,0.4);
    animation: crowd-wave 8s infinite ease-in-out;
    overflow: hidden;
}

.crowd-left {
    left: 0;
    top: 15%;
    width: 15%;
    height: 70%;
    animation-delay: 0s;
    border-radius: 0 10px 10px 0;
    background-image: 
        linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.1) 30%, transparent 100%),
        radial-gradient(ellipse at 80% 20%, #ff6b6b 0%, transparent 30%),
        radial-gradient(ellipse at 40% 40%, #4ecdc4 0%, transparent 30%),
        radial-gradient(ellipse at 60% 60%, #ffbe0b 0%, transparent 30%),
        radial-gradient(ellipse at 20% 80%, #3a86ff 0%, transparent 30%);
}

.crowd-right {
    right: 0;
    top: 15%;
    width: 15%;
    height: 70%;
    animation-delay: 1s;
    border-radius: 10px 0 0 10px;
    background-image: 
        linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.1) 30%, transparent 100%),
        radial-gradient(ellipse at 20% 20%, #ff6b6b 0%, transparent 30%),
        radial-gradient(ellipse at 60% 40%, #4ecdc4 0%, transparent 30%),
        radial-gradient(ellipse at 40% 60%, #ffbe0b 0%, transparent 30%),
        radial-gradient(ellipse at 80% 80%, #3a86ff 0%, transparent 30%);
}

.crowd-top {
    top: 0;
    left: 20%;
    width: 60%;
    height: 10%;
    animation-delay: 0.5s;
    border-radius: 0 0 10px 10px;
    background-image: 
        linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 30%, transparent 70%, rgba(255,255,255,0.1) 100%),
        radial-gradient(ellipse at 20% 50%, #ff6b6b 0%, transparent 30%),
        radial-gradient(ellipse at 40% 50%, #4ecdc4 0%, transparent 30%),
        radial-gradient(ellipse at 60% 50%, #ffbe0b 0%, transparent 30%),
        radial-gradient(ellipse at 80% 50%, #3a86ff 0%, transparent 30%);
}

/* Crowd animation */
@keyframes crowd-wave {
    0%, 100% {
        transform: scaleY(1);
    }
    25% {
        transform: scaleY(1.02) translateY(-2px);
    }
    50% {
        transform: scaleY(0.98) translateY(1px);
    }
    75% {
        transform: scaleY(1.01) translateY(-1px);
    }
}

/* Add cheer animation for crowd when scoring */
.crowd-cheer .crowd-section {
    animation: crowd-cheer 1s ease-in-out;
}

@keyframes crowd-cheer {
    0%, 100% {
        transform: scaleY(1);
    }
    25%, 75% {
        transform: scaleY(1.05) translateY(-3px);
    }
    50% {
        transform: scaleY(1.08) translateY(-5px);
    }
}

/* Individual fans in the crowd */
.fan {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transform-origin: center bottom;
    animation: fan-sway 4s infinite ease-in-out;
}

/* Fan animations */
@keyframes fan-sway {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(2px);
    }
    75% {
        transform: translateX(-2px);
    }
}

/* Fan stand-up animation */
.fan-stand {
    animation: fan-stand 1s ease-in-out;
    z-index: 3;
}

@keyframes fan-stand {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

/* Custom Numpad Styles */
#custom-numpad {
    position: relative;
    max-width: 400px;
    width: 90%;
    margin: 10px auto 0;
    background-color: rgba(240, 240, 240, 0.95);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 2px solid #333;
    transition: transform 0.2s ease-in-out;
}

.numpad-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.numpad-button {
    flex: 1;
    padding: 12px;
    font-size: 22px;
    font-weight: bold;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.numpad-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.3s, opacity 0.3s;
}

.numpad-button:active::after {
    opacity: 1;
    transform: scale(2);
}

.numpad-button:active {
    transform: translateY(2px);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    background-color: #e6e6e6;
}

.numpad-special {
    background-color: var(--team-primary-color, #4e86d9);
    color: white;
    font-size: 16px;
}

/* Adjust numpad for landscape mode */
@media (orientation: landscape) {
    #custom-numpad {
        width: 90%;
        max-width: 400px;
        margin: 10px auto 0;
    }
    
    .numpad-button {
        padding: 8px;
    }
}

/* Always show numpad on iPads, tablets, and iOS devices */
@media only screen and (max-width: 1024px) and (min-width: 768px) and (orientation: portrait),
       only screen and (max-width: 480px) {
    #answer-input.numpad-active {
        background-color: #f9f9f9;
        pointer-events: none; /* Prevent keyboard from showing */
        cursor: default;
        border: 2px dashed #888;
    }
    
    #custom-numpad.visible {
        display: flex;
        transform: none;
    }
    
    #custom-numpad.hidden {
        display: none;
    }
}

/* Improve numpad for iOS (iPhone) */
@media only screen and (max-width: 480px) {
    #custom-numpad {
        width: 90%;
        max-width: 300px;
        margin: 10px auto 0;
        padding: 10px;
        border-radius: 15px;
    }
    
    .numpad-button {
        padding: 14px 5px;
        font-size: 20px;
        border-radius: 10px;
    }

    /* Highlight fraction template buttons */
    .numpad-button.fraction-template {
        background-color: #f0f9ff;
        border: 1px solid var(--team-secondary-color, #0078d7);
    }
}

/* Full-width scoreboard across the top of the field */
.integrated-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 5px 10px;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid #333;
    width: 80%;
    max-width: 400px;
    z-index: 10;
}

.team-score-box {
    background-color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #333;
    margin: 0 5px;
}

.outs-display {
    font-weight: bold;
    color: #d32f2f;
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.6rem;
    }
    
    .game-container {
        padding: 8px 5px;
        border-radius: 10px;
    }
    
    .baseball-field {
        padding-top: 5px;
        height: 240px;
    }
    
    .baseball-diamond {
        width: 120px;
        height: 120px;
    }
    
    .teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .team-logo-small {
        width: 40px;
        height: 40px;
    }
    
    .team-name-small {
        font-size: 0.6rem;
    }
    
    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .difficulty-button {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
    
    .question {
        font-size: 1rem;
    }
    
    .answer-input {
        font-size: 1rem;
        width: 80px;
    }
    
    .hit-button, .next-button, .return-button {
        font-size: 1rem;
        padding: 8px 12px;
    }
    
    .player {
        width: 18px;
        height: 38px;
    }
    
    .player::before {
        width: 16px;
        height: 16px;
        top: -12px;
    }
    
    .player::after {
        width: 20px;
        height: 12px;
        top: -15px;
    }
    
    .fun-fact-content {
        font-size: 0.9rem;
    }
    
    .exit-button {
        font-size: 0.75rem;
        padding: 2px 8px;
    }
    
    .integrated-scoreboard {
        padding: 2px 5px;
        font-size: 0.6rem;
        width: 90%;
    }
    
    .team-score-box, .outs-display {
        padding: 1px 3px;
        margin: 0 1px;
    }
}

/* Position the current batter display properly with the new scoreboard */
.current-batter-display {
    position: absolute;
    bottom: 55px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
}

/* Responsive styles for the scoreboard */
@media (max-width: 768px) {
    .integrated-scoreboard {
        gap: 10px;
        font-size: 0.9rem;
        padding: 4px 5px;
    }
    
    .team-score-box, .outs-display {
        font-size: 0.9rem;
        padding: 3px 6px;
        min-width: 60px;
    }
    
    .current-batter-display {
        bottom: 45px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .integrated-scoreboard {
        gap: 5px;
        font-size: 0.8rem;
        padding: 3px 4px;
    }
    
    .team-score-box, .outs-display {
        font-size: 0.8rem;
        padding: 2px 5px;
        min-width: 50px;
    }
    
    .current-batter-display {
        bottom: 40px;
        padding: 5px;
    }
}

/* Restore needed adaptive toggle switch styles */
.adaptive-toggle-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

.adaptive-toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
    background-color: #f0f9ff;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #90caf9;
    transition: all 0.3s ease;
}

.adaptive-toggle-label:hover {
    background-color: #e1f5fe;
}

.adaptive-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    position: relative;
    outline: none;
    transition: all 0.3s ease;
}

.adaptive-checkbox:checked {
    background: linear-gradient(to right, #4CAF50, #2196F3);
}

.adaptive-checkbox::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.adaptive-checkbox:checked::before {
    left: 22px;
}

.adaptive-toggle-text {
    font-weight: bold;
    color: #1976d2;
    font-size: 1.1rem;
}

.adaptive-toggle-description {
    font-size: 0.85rem;
    color: #777;
    margin-left: 5px;
}

/* Additional adaptive operation display settings */
.adaptive-operation-display::before {
    content: 'Op: ';
    font-size: 0.8rem;
    font-weight: normal;
    margin-right: 4px;
    color: #555;
}

/* Responsive styles for adaptive toggle */
@media (max-width: 600px) {
    .adaptive-toggle-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 8px 12px;
    }
    
    .adaptive-toggle-description {
        margin-left: 0;
        font-size: 0.8rem;
    }
}

/* Current batter display at bottom of field */
.current-batter-display {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 5px 15px;
    z-index: 10;
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.current-batter-display .team-batting {
    font-size: 0.9rem;
    margin: 0;
}

.current-batter-display .exit-button {
    font-size: 0.8rem;
    padding: 3px 10px;
    margin: 0;
    height: auto;
    min-height: auto;
}

/* Responsive adjustments for batter display */
@media (max-width: 768px) {
    .current-batter-display {
        padding: 3px 10px;
    }
    
    .current-batter-display .team-batting {
        font-size: 0.8rem;
    }
}

/* Remove the old scoreboard styles since we're not using it anymore */
.scoreboard {
    display: none;
}

.scoreboard-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.7);
    border-bottom: 2px solid rgba(255, 154, 60, 0.7);
    padding-bottom: 3px;
}

@media (max-width: 768px) {
    .scoreboard-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .scoreboard-title {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }
}

/* Adjust field size and layout for better horizontal proportions */
@media (min-width: 1200px) {
    .game-container {
        max-width: 1200px;
    }
    
    .baseball-field {
        height: 450px;
        max-width: 550px;
    }
    
    .baseball-diamond {
        width: 320px;
        height: 320px;
    }
    
    .question {
        font-size: 1.8rem;
    }
}

.hit-button {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #e64c4c;
    transition: all 0.1s;
    min-width: 80px;
}

.exit-button {
    background-color: #e74c3c;
    box-shadow: 0 5px 0 #c0392b;
    font-size: 1rem;
    padding: 5px 15px;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
}

/* For very large screens, allow more space */
@media (min-width: 1400px) {
    .game-container {
        max-width: 1300px;
    }
}

@media (min-width: 1200px) {
    .baseball-field {
        height: 500px;
        max-width: 750px;
    }
    
    .baseball-diamond {
        width: 320px;
        height: 320px;
        margin-left: -160px;
        margin-top: -160px;
    }
}

@media (min-width: 1400px) {
    .game-container {
        max-width: 1800px;
    }
    
    .baseball-field {
        height: 550px;
        max-width: 850px;
    }
    
    .baseball-diamond {
        width: 350px;
        height: 350px;
        margin-left: -175px;
        margin-top: -175px;
    }
} 