/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Language switcher: fixed top-right flag buttons */
.lang-switcher {
    position: fixed;
    top: 10px;
    right: 14px;
    z-index: 1000;
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.85);
    padding: 4px 6px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.lang-btn {
    border: 2px solid transparent;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 999px;
    opacity: 0.55;
    transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.lang-btn:hover { opacity: 0.9; transform: scale(1.08); }
.lang-btn.active { opacity: 1; border-color: #1e88e5; background: rgba(30, 136, 229, 0.1); }
@media (max-width: 480px) {
    .lang-switcher { top: 6px; right: 6px; padding: 2px 4px; }
    .lang-btn { font-size: 18px; padding: 3px 5px; }
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #90EE90, #32CD32);
    min-height: 100vh;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* Little Kids Theme (default) */
body.little-kids-theme {
    background: linear-gradient(135deg, #90EE90, #32CD32);
}

/* Bigger Kids Theme - matches age selection screen */
body.bigger-kids-theme {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4a90e2 100%);
}

/* Screen management */
.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
}

.hidden {
    display: none !important;
}

/* Game Screen Layout - 5 Part Grid */
#gameScreen {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: min-content min-content min-content auto auto;
    gap: 6px; /* consistent spacing between sections, ~30% larger than ultra-tight */
    padding: 4px;
    max-height: 100vh;
    overflow-y: auto;
}

#gameScreen .game-header {
    grid-column: 1 / 4;
    background: #32CD32;
    color: white;
    text-align: center;
    padding: 0 6px;
    border-radius: 10px;
    min-height: 24px;
}

#gameScreen .game-stats {
    grid-column: 1 / 4;
    display: flex;
    gap: 4px;
    padding: 0 4px;
    background: #F0FFF0;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    min-height: 28px;
}

#gameScreen .question-container {
    grid-column: 2;
    padding: 0;
    margin: 0;
    min-height: 28px;
}

#gameScreen .fruits-container {
    grid-column: 2;
    background: transparent;
    border-radius: 10px;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 12px; /* tighter to free vertical space */
    min-height: 260px;
    width: 600px;
    height: 300px;
    margin: 0 auto;
    overflow: visible;
}

/* When using random positioning */
#gameScreen .fruits-container[style*="position: relative"] {
    display: block;
    position: relative;
}

/* Compare layout: two boxes with operators in the middle */
#gameScreen .fruits-container.compare-layout {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    grid-auto-flow: column;
    column-gap: 40px;
    row-gap: 0;
    align-items: center;
    justify-items: center;
    overflow: visible;
}

/* Match layout: two columns (numbers and groups) with SVG overlay for lines */
#gameScreen .fruits-container.match-layout {
    display: grid !important;
    grid-template-rows: auto auto;
    grid-template-columns: 1fr;
    row-gap: 4px;
    align-items: center;
    justify-items: center;
    position: relative;
    width: 100%;
    overflow: visible;
}

.match-row { display: flex; gap: 10px; justify-content: center; width: 100%; flex-wrap: wrap; max-width: 620px; }
.groups-row { display: grid; grid-template-columns: repeat(2, auto); gap: 12px; justify-content: center; justify-items: center; }
.match-column { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.match-item {
    background: white;
    border: 2px solid #32CD32;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.match-item:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.match-item.selected { border-color: #FF8C00; box-shadow: 0 0 0 3px #FFF8DC inset; }
.match-item.matched { opacity: 0.6; cursor: default; }

.match-number { font-size: 24px; font-weight: 800; color: #1E90FF; min-width: 64px; min-height: 44px; padding: 4px 8px; }

.match-group { padding: 10px; }
.match-group .group-box {
    position: relative;
    width: 140px;
    height: 92px;
    background: #ffffff;
    border: 2px dashed #a5d6a7;
    border-radius: 12px;
    overflow: hidden;
}
.match-group .fruit-item { margin: 0 !important; box-sizing: border-box; }

/* SVG Lines */
.match-svg {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 100%; pointer-events: none;
}
.match-line { fill: none; stroke-width: 4px; stroke-linecap: round; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2)); }
.match-line.success { stroke: #32CD32; animation: glow 1s ease 1; }
.match-line.fail { stroke: #FF0000; animation: shakeLine 0.5s ease 1; }

@keyframes glow {
    0% { stroke-width: 4px; }
    50% { stroke-width: 7px; }
    100% { stroke-width: 4px; }
}

@keyframes shakeLine {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(2px, -2px); }
    50% { transform: translate(-2px, 2px); }
    75% { transform: translate(2px, 2px); }
}

.compare-box {
    background: white;
    border: 2px solid #32CD32;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 6px white inset; /* ensure outer white edge to avoid apparent clipping */
}

#gameScreen .options-container {
    grid-column: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0;
    justify-items: center;
    max-width: 280px;
    justify-self: center;
}

#gameScreen .input-container {
    grid-column: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    gap: 15px;
    justify-self: center;
}

#gameScreen .back-button {
    grid-column: 2;
    background: #FF8C00;
    color: white;
    border: none;
    padding: 6px 14px;
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    justify-self: center;
    max-width: 160px;
    margin-top: 2px;
}

/* Age Selection Screen Styles */
#ageSelectionScreen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.age-split-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.age-section {
    flex: 1;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.age-section:hover {
    flex: 1.1;
    z-index: 10;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

.age-section:active {
    transform: scale(0.98);
}

/* Little Kids Section - Playful & Colorful */
.little-kids-section {
    background: linear-gradient(135deg, #FFB347 0%, #FF6B6B 50%, #FF8C94 100%);
    border-right: 4px solid rgba(255, 255, 255, 0.3);
}

.little-kids-section:hover {
    background: linear-gradient(135deg, #FFC966 0%, #FF8080 50%, #FFA0A6 100%);
}

.age-emoji-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.bounce-emoji {
    position: absolute;
    font-size: 3rem;
    animation: bounceFloat 3s ease-in-out infinite;
    opacity: 0.7;
}

.bounce-emoji.delay-1 { animation-delay: 0.5s; top: 15%; left: 10%; }
.bounce-emoji.delay-2 { animation-delay: 1s; top: 60%; left: 80%; }
.bounce-emoji.delay-3 { animation-delay: 1.5s; top: 30%; left: 70%; }
.bounce-emoji.delay-4 { animation-delay: 2s; top: 75%; left: 20%; }
.bounce-emoji.delay-5 { animation-delay: 2.5s; top: 45%; left: 5%; }

@keyframes bounceFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(10deg);
    }
}

/* Bigger Kids Section - Cool & Math-Focused */
.bigger-kids-section {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4a90e2 100%);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.bigger-kids-section:hover {
    background: linear-gradient(135deg, #2a4a7a 0%, #3a62a8 50%, #5aa0f2 100%);
}

.math-symbols-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.math-symbol {
    position: absolute;
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    animation: floatRotate 4s ease-in-out infinite;
}

.math-symbol:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.math-symbol:nth-child(2) { top: 25%; right: 20%; animation-delay: 0.8s; }
.math-symbol:nth-child(3) { bottom: 30%; left: 25%; animation-delay: 1.6s; }
.math-symbol:nth-child(4) { bottom: 15%; right: 15%; animation-delay: 2.4s; }
.math-symbol:nth-child(5) { top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: 3.2s; }

@keyframes floatRotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.15;
    }
    50% {
        transform: translateY(-15px) rotate(180deg) scale(1.1);
        opacity: 0.25;
    }
}

.age-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 40px;
    color: white;
}

/* Fun Font for Little Kids */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.fun-font {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', cursive, sans-serif;
    text-shadow: 3px 3px 0px rgba(255, 255, 255, 0.5),
                 5px 5px 10px rgba(0, 0, 0, 0.3);
    animation: wiggle 2s ease-in-out infinite;
}

.age-title.fun-font {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 10px;
    letter-spacing: 2px;
    color: #FFF8DC;
    text-transform: uppercase;
}

.age-subtitle.fun-font {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: #FFE4B5;
}

/* Cool Font for Bigger Kids */
.cool-font {
    font-family: 'Arial Black', 'Impact', 'Helvetica', sans-serif;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3),
                 0 0 40px rgba(255, 255, 255, 0.2),
                 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.age-title.cool-font {
    font-size: 4.5rem;
    margin-bottom: 10px;
    color: #E0F7FA;
    background: linear-gradient(135deg, #ffffff 0%, #E0F7FA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.age-subtitle.cool-font {
    font-size: 2.8rem;
    margin-bottom: 30px;
    color: #B3E5FC;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.age-icons-row {
    font-size: 2.5rem;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    animation: pulse 2s ease-in-out infinite;
}

.age-icons-row.math-style {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.age-description {
    margin-top: 30px;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.8;
}

.age-description.cool-text {
    font-family: 'Arial', sans-serif;
    color: #E1F5FE;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.age-description p {
    margin: 10px 0;
}

/* Responsive Design for Age Selection */
@media (max-width: 768px) {
    .age-split-container {
        flex-direction: column;
    }
    
    .age-section {
        flex: 1;
    }
    
    .age-section:hover {
        flex: 1;
    }
    
    .little-kids-section {
        border-right: none;
        border-bottom: 4px solid rgba(255, 255, 255, 0.3);
    }
    
    .bigger-kids-section {
        border-left: none;
        border-top: 4px solid rgba(255, 255, 255, 0.3);
    }
    
    .age-title.fun-font,
    .age-title.cool-font {
        font-size: 2.5rem;
    }
    
    .age-subtitle.fun-font,
    .age-subtitle.cool-font {
        font-size: 1.8rem;
    }
    
    .age-content {
        padding: 30px 20px;
    }
    
    .bounce-emoji,
    .math-symbol {
        font-size: 2rem;
    }
}

/* Home Screen Styles */
.home-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-align: center;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

.game-subtitle {
    font-size: 1.5rem;
    color: white;
    font-weight: 500;
    text-align: center;
    margin-bottom: 50px;
}

.start-button {
    background: #FF8C00;
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 1.75rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.start-button:hover {
    background: #FF7F00;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

.start-button:active {
    transform: translateY(0);
}

.instructions {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    max-width: 600px;
}

.instructions p {
    font-size: 1.125rem;
    color: white;
    font-weight: 500;
    margin: 8px 0;
}

/* Game Screen Styles */
.game-header h2 {
    font-size: 1.1rem;
    line-height: 1.05;
    margin: 0;
}

.stat-box {
    padding: 4px 8px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 0.85rem;
    border: 2px solid;
    min-width: 90px;
    max-width: 120px;
    white-space: nowrap;
}

.score-box {
    background: #FFF8DC;
    border-color: #FFD700;
    color: #FF8C00;
}

.timer-box {
    background: #F0FFF0;
    border-color: #32CD32;
    color: #228B22;
}

.timer-box.warning {
    background: #FFE4E1;
    border-color: #FF0000;
    color: #DC143C;
}

.points-box {
    background: #E6F3FF;
    border-color: #1E90FF;
    color: #0066CC;
}

.question-text {
    background: white;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: bold;
    color: #32CD32;
}

.speak-button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.speak-button:hover {
    background: #F0FFF0;
}

.fruit-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0;
}

.fruit-item {
    width: 60px;
    height: 60px;
    margin: 0 5px;
    border-radius: 50%;
    border: 2px solid #32CD32;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 32px;
    line-height: 1;
}

.fruit-random {
    margin: 0;
    animation: fruitAppear 0.5s ease-out;
}

/* Compare game operators */
.compare-operators {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compare-operator {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid #1E90FF;
    background: #E6F3FF;
    color: #0066CC;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-operator:hover {
    background: #d6ebff;
    transform: translateY(-1px);
}

.compare-operator.selected {
    background: #FFF8DC;
    border-color: #FF8C00;
    color: #FF8C00;
}

.compare-operator.correct {
    background: #F0FFF0;
    border-color: #32CD32;
    color: #228B22;
}

.compare-operator.incorrect {
    background: #FFE4E1;
    border-color: #FF0000;
    color: #DC143C;
}

@keyframes fruitAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.fruit-item img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
}

.fruit-item .fruit-letter {
    font-size: 24px;
    font-weight: bold;
    color: #32CD32;
}

/* Unicode Fruit Symbol Styles */

/* Game Selection */
.game-selection {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 720px;
}

.game-btn {
    background: linear-gradient(135deg, #FF9999, #FFAA66);
    color: white;
    border: none;
    padding: 16px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    text-align: center;
}

/* Bigger Kids Game Buttons - Cool Blue Theme */
.bigger-kids-game {
    background: linear-gradient(135deg, #2a5298 0%, #4a90e2 50%, #5aa0f2 100%);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.bigger-kids-game:hover {
    background: linear-gradient(135deg, #3a62a8 0%, #5aa0f2 50%, #6ab0ff 100%);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.6);
    transform: translateY(-3px);
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.game-icon {
    font-size: 32px;
    margin-bottom: 6px;
}

.game-btn h3 {
    margin: 6px 0 4px 0;
    font-size: 18px;
}

.game-btn p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Game Mode Selection */
.mode-selection {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    margin: 20px auto;
}
/* Reuse for Play Mode screen: allow two large buttons */
.screen #playModeScreen .mode-buttons { gap: 20px; }

/* Settings Panel */
.settings-panel {
    background: rgba(255, 255, 255, 0.3);
    padding: 16px;
    border-radius: 15px;
    text-align: center;
    max-width: 720px;
    width: 100%;
    margin: 8px auto 20px auto;
    color: white;
}
.settings-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.settings-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0 12px 0;
}
.settings-label {
    font-weight: 700;
    padding: 6px 10px;
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}
.settings-options { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.2s ease;
}
.settings-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.settings-btn.active { outline: 3px solid #FFF8DC; filter: brightness(1.05); }
.settings-saved { margin-top: 6px; font-weight: 800; color: #FFF8DC; }
.settings-hint { margin-top: 4px; font-size: 0.9rem; color: #fff; opacity: 0.9; }

.mode-selection h3 {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mode-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 20px 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-width: 160px;
    text-align: center;
}

.mode-btn:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.mode-btn.keyboard {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.mode-btn.keyboard:hover {
    background: linear-gradient(135deg, #1976D2, #2196F3);
}

.mode-icon {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
}

.mode-btn h3 {
    margin: 10px 0 5px 0;
    font-size: 18px;
}

.mode-btn p {
    margin: 5px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.back-btn {
    background: linear-gradient(135deg, #757575, #616161);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.back-btn:hover {
    background: linear-gradient(135deg, #616161, #757575);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.option-btn {
    width: 80px;
    height: 50px;
    background: #1E90FF;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: #0080FF;
    transform: scale(1.05);
}

.option-btn:active {
    transform: scale(0.95);
}

/* Feedback positioning - next to fruits */
.feedback-container {
    position: fixed;
    left: calc(66.66% + 20px);
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 3px solid;
    text-align: center;
    width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.feedback-container.correct {
    background: #F0FFF0;
    border-color: #32CD32;
}

.feedback-container.incorrect {
    background: #FFE4E1;
    border-color: #FF0000;
}

.feedback-container.correct #feedbackTitle {
    color: #228B22;
}

.feedback-container.incorrect #feedbackTitle {
    color: #DC143C;
}

#feedbackTitle {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
}

#feedbackText {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 6px;
    font-size: 20px;
}
.star { color: #FFD700; }
.star.empty { color: #ddd; }

.next-question-btn {
    background: #32CD32;
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.next-question-btn:hover {
    background: #228B22;
}

/* Add styles for keyboard input */
.answer-input {
    width: 140px;
    height: 60px;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    border: 3px solid #1E90FF;
    border-radius: 12px;
    margin: 0;
    background: white;
    color: #1E90FF;
    -moz-appearance: textfield; /* Remove spinner arrows in Firefox */
    box-sizing: border-box;
    vertical-align: top;
}

/* Remove spinner arrows in Chrome, Safari, Edge */
.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-input:focus {
    outline: none;
    border-color: #FF8C00;
    background: #FFF8DC;
}

.submit-btn {
    width: 140px;
    height: 60px;
    background: #32CD32;
    color: white;
    border: 3px solid transparent;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    vertical-align: top;
}

.submit-btn:hover {
    background: #228B22;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.input-mode-toggle {
    background: #FF8C00;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 10px;
}

.input-mode-toggle:hover {
    background: #FF7F00;
}

.back-button:hover {
    background: #FF7F00;
}

/* Responsive design */
@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .game-subtitle {
        font-size: 1.25rem;
    }
    
    .game-selection {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        max-width: 360px;
    }
    .game-btn {
        padding: 14px 10px;
    }
    .game-icon {
        font-size: 28px;
    }
    .game-btn h3 {
        font-size: 16px;
    }
    
    .mode-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .mode-btn {
        min-width: 140px;
        padding: 15px 10px;
    }
    
    .mode-btn h3 {
        font-size: 16px;
    }
    
    .option-btn {
        width: 80px;
        height: 50px;
        font-size: 1.25rem;
    }
}

@media (max-height: 600px) {
    #gameScreen {
        gap: 5px;
        padding: 5px;
    }
    
    #gameScreen .fruits-container {
        min-height: 200px;
        height: 200px;
    }
    
    #gameScreen .game-header {
        padding: 6px;
    }
    
    #gameScreen .back-button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .stat-box {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: 90px;
        max-width: 110px;
    }
    
    .game-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .game-subtitle {
        margin-bottom: 30px;
    }
} 

/* Mobile adjustments */
@media (max-width: 768px) {
    #gameScreen {
        display: flex;
        flex-direction: column;
        padding: 5px;
        gap: 5px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    #gameScreen .fruits-container {
        min-height: 200px;
        padding: 10px 18px; /* maintain extra horizontal padding on mobile */
        width: 320px;
        height: 200px;
        overflow: visible;
    }
    .compare-operator {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    #gameScreen .game-header {
        padding: 8px;
    }
    
    #gameScreen .back-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        max-width: 150px;
        margin: 5px auto;
    }
    
    .stat-box {
        padding: 10px 16px;
        font-size: 0.9rem;
        min-width: 100px;
        max-width: 120px;
    }
    
    .feedback-container {
        position: fixed;
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 80px;
        transform: none;
        width: auto;
    }
    
    .fruit-item {
        width: 50px;
        height: 50px;
        margin: 0 3px;
    }
    
    .fruit-item {
        font-size: 24px;
    }
    
    .fruit-item .fruit-letter {
        font-size: 20px;
    }
    
    .answer-input {
        width: 120px;
        height: 50px;
        font-size: 1.5rem;
        box-sizing: border-box;
        vertical-align: top;
    }
    
    .submit-btn {
        width: 120px;
        height: 50px;
        font-size: 1.2rem;
        border: 3px solid transparent;
        box-sizing: border-box;
        vertical-align: top;
    }
    .game-selection {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        max-width: 520px;
    }
} 