/* Styles specific to Numbers & Math game */
/* Sections:
    - Layout & header UI
    - Mode selection and mode-specific styles
    - Animations and accessibility tweaks
*/

/* Reduce selection tile font-size only for Numbers & Math so numbers/operators fit better */
.numbers-and-math-game .letter-box {
    font-size: clamp(0.9em, 2.6vw, 1.5em);
}

/* Mobile adjustments: make tiles' text larger for small screens for readability */
@media (max-width: 600px) {
    .numbers-and-math-game .letter-box {
        font-size: 1.4em;
        /* larger on phones/tablets for readability */
        padding: 7px;
        /* slightly more breathing room */
        box-sizing: border-box;
    }
}

@media (max-width: 400px) {
    .numbers-and-math-game .letter-box {
        font-size: 1.25em;
        /* scale down on very small screens to avoid overflow */
        padding: 6px;
        box-sizing: border-box;
    }
}

.numbers-and-math-game .toggle-container .toggle-label {
    font-size: 1em;
    /* match .select-all-button */
    font-weight: 600;
    color: #fff;
}

.numbers-and-math-game .toggle-container .toggle-label .toggle-on {
    display: none;
}

.numbers-and-math-game .toggle-container .toggle-checkbox:checked+.toggle-label .toggle-off {
    display: none;
}

.numbers-and-math-game .toggle-container .toggle-checkbox:checked+.toggle-label .toggle-on {
    display: inline;
}

/* Ensure spacing remains consistent for the custom label */
.numbers-and-math-game .toggle-container {
    gap: 10px;
    align-items: center;
}

@keyframes float-lightly {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes background-flash {

    0%,
    100% {
        background: linear-gradient(45deg, #2c3e50, #000000);
        box-shadow: none;
    }

    50% {
        background: #00d9ff;
        box-shadow: 0 0 20px #00d9ff;
    }
}

.numbers-and-math-game .game-area {
    background-image: url('../assets/images/numbers-and-math/numbers-and-math-background.png');
}

.numbers-and-math-game .letter-grid .operators-separator {
    grid-column: 1 / -1;
    /* full width */
    height: 1px;
    margin: 8px 0 12px 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* Extended categories container: inline row of fit-content buttons */
.numbers-and-math-game .extended-row {
    grid-column: 1 / -1;
    /* full width row in the grid */
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 6px 6px 12px 6px;
}

.numbers-and-math-game .extended-row .extended-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    min-width: 0;
    width: auto;
    aspect-ratio: unset;
    border-radius: 10px;
    font-size: 1em;
    text-transform: capitalize;
    /* override global uppercase so only first letter is capitalized */
}

/* -----------------------------
    Mode selection modal & options
    ----------------------------- */
.numbers-and-math-game .mode-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.6);
}

.numbers-and-math-game .mode-modal[aria-hidden="false"] {
    display: flex;
}

.numbers-and-math-game .mode-modal-inner {
    background: #123;
    padding: 18px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.numbers-and-math-game .mode-modal-inner h3 {
    margin-top: 0;
    text-align: center;
}

.numbers-and-math-game .mode-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.numbers-and-math-game .mode-option {
    background: #2b6fb2;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: 700;
}

.numbers-and-math-game .mode-option:hover {
    background: #3498db;
}

/* Keyboard focus for mode options */
.numbers-and-math-game .mode-option:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.numbers-and-math-game .mode-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Simple alert OK focus (keyboard) */
#simpleAlertModal button.simple-alert-ok:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

/* Extended boxes and operator boxes keyboard focus */
.numbers-and-math-game .extended-box:focus-visible,
.numbers-and-math-game .operator-box:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

/* Make modal cover the selection panel instead of full screen */
.numbers-and-math-game .letter-selection-screen {
    position: relative;
}

.numbers-and-math-game .letter-selection-screen .mode-modal {
    position: absolute;
    inset: 0;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.numbers-and-math-game .letter-selection-screen .mode-modal[aria-hidden="false"] {
    display: flex;
}

.numbers-and-math-game .letter-selection-screen .mode-modal-inner {
    width: 100%;
    max-width: 680px;
    padding: 18px;
    box-shadow: none;
    background: #111;
}

.numbers-and-math-game .mode-title {
    font-size: 1.05em;
    font-weight: 800;
}

.numbers-and-math-game .mode-subtitle {
    font-size: 0.8em;
    opacity: 0.85;
    margin-top: 6px;
    font-weight: 600;
}

.numbers-and-math-game .mode-options {
    align-items: center;
}

.numbers-and-math-game .mode-option {
    max-width: 520px;
    width: 100%;
    box-sizing: border-box;
    min-height: 84px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.numbers-and-math-game .mode-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.32));
    pointer-events: none;
}

.numbers-and-math-game .mode-option .mode-title,
.numbers-and-math-game .mode-option .mode-subtitle {
    position: relative;
    z-index: 2;
}

/* stronger overlay and hover effects for mode options */
.numbers-and-math-game .mode-option::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0.56));
    opacity: 1;
    transition: background 180ms ease, opacity 180ms ease;
}

.numbers-and-math-game .mode-option:hover::after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.56), rgba(0, 0, 0, 0.78));
}

.numbers-and-math-game .mode-option:hover {
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.44);
}

.numbers-and-math-game .mode-option .mode-title {
    font-size: 1.1rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.numbers-and-math-game .mode-option .mode-subtitle {
    font-size: 0.9rem;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/*blurry pill behind the text to improve legibility on bright images */
.numbers-and-math-game .mode-option .mode-text {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    min-width: 250px;
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    z-index: 2;
}

.numbers-and-math-game .mode-option .mode-text .mode-subtitle {
    margin-top: 0;
}

/* Per-mode containers inside gameplay area */
.numbers-and-math-game .mode-containers {
    position: relative;
    width: 100%;
    height: 100%;
}

.numbers-and-math-game .mode-container {
    display: none;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.numbers-and-math-game .mode-container[aria-hidden="false"] {
    display: block;
}

.numbers-and-math-game .mode-container {
    background-size: cover;
    background-position: center;
    padding: 12px;
}

/* How Many mode styles */
#mode-how-many .howmany-display {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: fit-content;
    margin: 0 auto;
}

#mode-how-many .howmany-things {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 8px;
    overflow: auto;
    /* medium-tone muted gradient: between light and dark for comfortable contrast */
    background: linear-gradient(180deg, rgba(230, 235, 238, 0.8) 0%, rgba(210, 217, 222, 0.8) 100%);
    padding: 12px;
    border-radius: 8px;
    /* softened shadow for a lighter feel */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Fireworks layer inside how-many mode: positioned full-size and behind content */
#mode-how-many .fireworks-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    /* behind rows/images */
}

#mode-how-many .howmany-display,
#mode-how-many .howmany-things,
#mode-how-many .howmany-row {
    position: relative;
    /* ensure they stack above fireworks layer */
    z-index: 2;
}

#mode-how-many .howmany-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

#mode-how-many .howmany-things img {
    /* Responsive size: small screens show slightly smaller icons, larger screens larger icons */
    width: clamp(36px, 16%, 66px);
    height: auto;
    display: inline-block;
    filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
    -webkit-filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
}

/* Larger icons on mobile/tablet for better readability */
@media (max-width: 600px) {
    #mode-how-many .howmany-things img {
        width: clamp(50px, 16%, 64px);
        filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
        -webkit-filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
    }

    #mode-how-many .howmany-things.many-items img {
        width: clamp(50px, 16%, 55px);
        filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
        -webkit-filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
    }
}

#mode-how-many .howmany-answers {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

/* Colorful answer buttons */
#mode-how-many .howmany-answers .answer-button {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    color: #fff;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    min-width: 48px;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

/* Math modes styling */
#mode-equation-solver .math-display,
#mode-select-operator .math-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#mode-equation-solver .math-question .question-card,
#mode-select-operator .math-question .question-card {
    padding: 18px;
    border-radius: 12px;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    min-width: 100vw;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* Larger equation text for readability */
.numbers-and-math-game .question-card .question-text,
.numbers-and-math-game .question-card .question-text span {
    font-size: 2.2rem;
    line-height: 1.1;
}

.numbers-and-math-game .question-card .question-text .eq-op {
    font-size: 2.4rem;
}

.numbers-and-math-game .question-card .question-text .eq-res {
    font-weight: 900;
    font-size: 2.2rem;
}

#mode-equation-solver .math-answers,
#mode-select-operator .math-answers {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

#mode-equation-solver .math-answers .answer-button,
#mode-select-operator .math-answers .answer-button {
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    min-width: 64px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    font-size: clamp(16px, 3.5vw, 20px);
}

/* Larger answer text specifically for Select Operator mode */
#mode-select-operator .math-answers .answer-button {
    font-size: clamp(20px, 4.5vw, 26px);
}

/* Question text sizing */
#mode-equation-solver .question-text,
#mode-select-operator .question-text {
    font-size: clamp(20px, 5vw, 36px);
    font-weight: 900;
}

@media (max-width: 600px) {

    #mode-equation-solver .math-answers .answer-button,
    #mode-equation-solver .math-answers .answer-button {
        font-size: clamp(18px, 4.5vw, 22px);
        padding: 14px 18px;
        min-width: 72px;
    }

    /* Keep Select Operator buttons larger on mobile as well */
    #mode-select-operator .math-answers .answer-button {
        font-size: clamp(20px, 4.5vw, 26px);
        padding: 14px 18px;
        min-width: 72px;
    }

    #mode-equation-solver .question-text,
    #mode-select-operator .question-text {
        font-size: clamp(24px, 8vw, 40px);
    }
}

#mode-equation-solver .math-answers .answer-button:nth-child(1),
#mode-select-operator .math-answers .answer-button:nth-child(1) {
    background: linear-gradient(90deg, #ff7b7b, #ff5252);
}

#mode-equation-solver .math-answers .answer-button:nth-child(2),
#mode-select-operator .math-answers .answer-button:nth-child(2) {
    background: linear-gradient(90deg, #7bd389, #3fc56a);
}

#mode-equation-solver .math-answers .answer-button:nth-child(3),
#mode-select-operator .math-answers .answer-button:nth-child(3) {
    background: linear-gradient(90deg, #ffd36b, #ffb347);
}

#mode-equation-solver .math-answers .answer-button:nth-child(4),
#mode-select-operator .math-answers .answer-button:nth-child(4) {
    background: linear-gradient(90deg, #7bb8ff, #3f94ff);
}

#mode-equation-solver .math-answers .answer-button:nth-child(5),
#mode-select-operator .math-answers .answer-button:nth-child(5) {
    background: linear-gradient(90deg, #c98bff, #9b59b6);
}

.math-mode-placeholder {
    color: #fff;
    font-weight: 700;
    text-align: center;
}

/* help modal mode bullets */
.help-modal-content .mode-bullet {
    display: block;
    position: relative;
    padding-left: 18px;
    margin: 2px 0;
}

.help-modal-content .mode-bullet::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.help-modal-content .mode-name {
    color: #000;
    font-weight: 700;
}

/* Immediate hover and click effects (non-animated) for answer buttons */
#mode-how-many .howmany-answers .answer-button:hover,
#mode-equation-solver .math-answers .answer-button:hover,
#mode-select-operator .math-answers .answer-button:hover {
    transition: none !important;
    /* immediate change */
    filter: brightness(1.06);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    transform: none;
}

#mode-how-many .howmany-answers .answer-button:active,
#mode-equation-solver .math-answers .answer-button:active,
#mode-select-operator .math-answers .answer-button:active {
    transition: none !important;
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
    opacity: 0.98;
}

/* Keyboard focus visible styling */
#mode-how-many .howmany-answers .answer-button:focus,
#mode-how-many .howmany-answers .answer-button:focus-visible,
#mode-how-many .howmany-answers .answer-button:active {
    outline: none !important;
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.25), inset 0 6px 18px rgba(0, 0, 0, 0.28);
}

#mode-equation-solver .math-answers .answer-button:focus-visible,
#mode-select-operator .math-answers .answer-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

#mode-how-many .howmany-answers .answer-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Ensure disabled/incorrect answers in equation & operator modes are visually disabled and not clickable */
#mode-equation-solver .math-answers .answer-button:disabled,
#mode-select-operator .math-answers .answer-button:disabled,
#mode-equation-solver .math-answers .answer-button.wrong,
#mode-select-operator .math-answers .answer-button.wrong {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* Prevent hover effects for buttons marked wrong */
#mode-equation-solver .math-answers .answer-button.wrong:hover,
#mode-select-operator .math-answers .answer-button.wrong:hover,
#mode-how-many .howmany-answers .answer-button.wrong:hover {
    filter: none;
    box-shadow: none;
}

/* Give wrong state a clear visual (red outline) and keep it non-interactive */
#mode-equation-solver .math-answers .answer-button.wrong,
#mode-select-operator .math-answers .answer-button.wrong,
#mode-how-many .howmany-answers .answer-button.wrong {
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.12);
    pointer-events: none;
}

/* Specific how-many hover: invert to darker feel (less bright) */
#mode-how-many .howmany-answers .answer-button:hover {
    transition: none !important;
    filter: brightness(0.92);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.36);
}

/* Fireworks layer scoped to math modes: full-size and behind content */
#mode-equation-solver .fireworks-layer,
#mode-select-operator .fireworks-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* Ensure math UI sits above the fireworks layer */
#mode-equation-solver .math-display,
#mode-select-operator .math-display {
    position: relative;
    z-index: 2;
}

/* While equation audio is playing, place an overlay over answer buttons to block input */
#mode-equation-solver .math-answers,
#mode-select-operator .math-answers {
    position: relative;
}

#mode-equation-solver .math-answers.audio-playing::after,
#mode-select-operator .math-answers.audio-playing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    cursor: wait;
    z-index: 40;
    border-radius: 8px;
}

/* dim buttons slightly while audio plays */
#mode-equation-solver .math-answers.audio-playing .answer-button,
#mode-select-operator .math-answers.audio-playing .answer-button {
    opacity: 0.7;
}



/* Visual cue while speaking */
.math-question.speaking .question-card {
    box-shadow: 0 0 28px rgba(255, 255, 255, 0.12), 0 20px 40px rgba(0, 0, 0, 0.25) !important;
}

/* Specific how-many click/active: slight scale for pressed feel */
#mode-how-many .howmany-answers .answer-button:active {
    transition: none !important;
    transform: scale(0.98);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
}

/* Provide five distinct color styles by position */
#mode-how-many .howmany-answers .answer-button:nth-child(1) {
    background: linear-gradient(90deg, #ff7b7b, #ff5252);
}

#mode-how-many .howmany-answers .answer-button:nth-child(2) {
    background: linear-gradient(90deg, #7bd389, #3fc56a);
}

#mode-how-many .howmany-answers .answer-button:nth-child(3) {
    background: linear-gradient(90deg, #ffd36b, #ffb347);
}

#mode-how-many .howmany-answers .answer-button:nth-child(4) {
    background: linear-gradient(90deg, #7bb8ff, #3f94ff);
}

#mode-how-many .howmany-answers .answer-button:nth-child(5) {
    background: linear-gradient(90deg, #c98bff, #9b59b6);
}

/* wrong/correct states */
#mode-how-many .howmany-answers .answer-button.wrong {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.12);
}

#mode-how-many .howmany-answers .answer-button.correct {
    outline: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 16px rgba(0, 200, 100, 0.14);
}

/* Numbers Bubbles styles */
.numbers-and-math-game .bubbles-area {
    position: relative;
    width: 100%;
    height: 100%;
}

.numbers-and-math-game .bubble {
    position: absolute;
    min-width: 64px;
    min-height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
    user-select: none;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    z-index: 11;
}

.numbers-and-math-game .bubble.small {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.05rem;
}

.numbers-and-math-game .bubble .label {
    padding: 4px;
}

.numbers-and-math-game .bubble.pop-anim {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Unified interaction styles for bubbles and answer buttons */
.numbers-and-math-game .bubble:hover,
#mode-how-many .howmany-answers .answer-button:hover,
#mode-equation-solver .math-answers .answer-button:hover,
#mode-select-operator .math-answers .answer-button:hover {
    filter: brightness(0.92);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.36);
    transform: none;
}

.numbers-and-math-game .bubble:active,
#mode-how-many .howmany-answers .answer-button:active,
#mode-equation-solver .math-answers .answer-button:active,
#mode-select-operator .math-answers .answer-button:active {
    outline: none !important;
    transform: translateY(2px) scale(0.985);
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.18), inset 0 6px 18px rgba(0, 0, 0, 0.22);
}

.numbers-and-math-game .bubble:focus,
.numbers-and-math-game .bubble:focus-visible,
#mode-how-many .howmany-answers .answer-button:focus,
#mode-how-many .howmany-answers .answer-button:focus-visible,
#mode-equation-solver .math-answers .answer-button:focus,
#mode-equation-solver .math-answers .answer-button:focus-visible,
#mode-select-operator .math-answers .answer-button:focus,
#mode-select-operator .math-answers .answer-button:focus-visible {
    outline: none !important;
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.18), inset 0 6px 18px rgba(0, 0, 0, 0.22);
}

/* Progress bar (rocket -> planet) placed under header and above mode content */
.numbers-and-math-game .mode-progress-bar {
    width: 100%;
    height: 35px;
    display: none;
    align-items: center;
}

.numbers-and-math-game .mode-progress-bar[aria-hidden="false"] {
    display: flex;
}

.numbers-and-math-game .mode-progress-track {
    position: relative;
    width: 100%;
    height: 26px;
    margin: 0;
}

.numbers-and-math-game .mode-progress-track {
    background: #000;
    border-radius: 4px;
}

.numbers-and-math-game .mode-planet {
    position: absolute;
    right: 8px;
    top: 0;
    height: 26px;
    display: flex;
    align-items: center;
}

.numbers-and-math-game .mode-planet img {
    height: 34px;
    width: auto;
}

.numbers-and-math-game .mode-rocket {
    position: absolute;
    left: 8px;
    top: 0;
    height: 34px;
    display: flex;
    align-items: center;
    transition: transform 0.6s linear;
}

.numbers-and-math-game .mode-rocket img {
    height: 34px;
    width: auto;
}

.numbers-and-math-game .mode-progress-bar .progress-filled {
    position: absolute;
    left: 0;
    top: 16px;
    height: 3px;
    background: linear-gradient(90deg, #ffb347, #ff6b6b);
    width: 0%;
    border-radius: 2px;
}

.numbers-and-math-game .mode-planet {
    position: absolute;
    right: 8px;
    top: 50%;
    height: 34px;
    display: flex;
    align-items: center;
    z-index: 3;
}

.numbers-and-math-game .mode-planet img {
    height: 34px;
    width: auto;
    transform: translateY(-50%);
}

.numbers-and-math-game .mode-rocket {
    position: absolute;
    left: 8px;
    top: 50%;
    height: 34px;
    display: flex;
    align-items: center;
    transition: transform 0.6s linear;
    z-index: 3;
}

.numbers-and-math-game .mode-rocket img {
    height: 34px;
    width: auto;
    transform: translateY(-50%);
}

.numbers-and-math-game .mode-progress-bar .progress-filled {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    background: linear-gradient(90deg, #ffb347, #ff6b6b);
    width: 0%;
    border-radius: 2px;
    z-index: 2;
}

/* animate progress width in sync with rocket movement */
.numbers-and-math-game .mode-progress-bar .progress-filled {
    transition: width 0.6s linear;
}

.numbers-and-math-game .mode-subtitle {
    font-family: Arial, Helvetica, sans-serif;
}

.numbers-and-math-game .operator-box {
    font-family: Arial, Helvetica, sans-serif;
}

.game-area {
    /* Generic game area style if needed, specific background handled above */
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* general numbers-and-math styles */

/* Centered header bubble target */
.numbers-and-math-game .game-header-ui {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
}

.numbers-and-math-game .game-header-left {
    justify-self: start;
}

.numbers-and-math-game .game-header-center {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.numbers-and-math-game.mode-count-active .game-header-center {
    display: none !important;
}

.numbers-and-math-game.mode-math-active .game-header-center {
    display: none !important;
}

.numbers-and-math-game .game-header-right {
    justify-self: end;
}

.numbers-and-math-game .bubble-target {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    width: auto;
    min-width: 0;
    max-width: 100%;
    text-align: center;
    padding: 2px 6px;
    pointer-events: none;
}

@media (max-width: 420px) {
    .numbers-and-math-game .bubble-target {
        font-size: 0.85rem;
        padding: 2px 4px;
    }
}

/* subtle 1px outline color pulse (gray <-> white) for bubble target */
.numbers-and-math-game .bubble-target {
    border-radius: 6px;
    outline: 1px solid rgba(180, 180, 180, 0.9);
    animation: pulse-outline-color 1.8s ease-in-out infinite;
    width: 30px;
    height: 30px;
    align-content: center;
    min-width: fit-content;
}

@keyframes pulse-outline-color {
    0% {
        outline-color: rgba(180, 180, 180, 0.9);
    }

    50% {
        outline-color: rgba(255, 255, 255, 0.95);
    }

    100% {
        outline-color: rgba(180, 180, 180, 0.9);
    }
}

@media (prefers-reduced-motion: reduce) {
    .numbers-and-math-game .bubble-target {
        animation: none;
    }
}

.numbers-and-math-game .bubble-target::before {
    content: '';
    display: inline-block;
    width: 0;
}
