/* ---------------------------- Fonts ------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Boogaloo&family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap');


/* ============================================================
   RESET
============================================================ */

html {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: inherit;
    text-decoration: none;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul {
    margin: 0;
    padding: 0;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;

    background-color: white;

    font-family:
        "Google Sans",
        sans-serif;
}

img {
    max-width: 100%;
    height: auto;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    touch-action: manipulation;
}

[hidden] {
    display: none !important;
}


/* ============================================================
   COLORS / VARIABLES
============================================================ */

:root {
    --blickishhh: #444444;
    --bluishhh: #134287;
    --backgroundishhh: #EEEEEE;

    --play-page-padding:
        clamp(0.85rem, 4vw, 2rem);

    --navbar-height:
        3.5rem;

    --smooth-motion:
        cubic-bezier(0.22,
            1,
            0.36,
            1);
}


/* ============================================================
   TYPOGRAPHY
============================================================ */

h1,
h2 {
    font-family:
        "Boogaloo",
        sans-serif;

    font-weight: 400;
    font-style: normal;
}

h1 {
    font-size: 5rem;
}

h2 {
    font-size: 3rem;
}

h3 {
    font-size: 1.3rem;
}

p {
    font-size: 1.2rem;
}

a {
    font-size: 1.35rem;
}


/* ============================================================
   NAVBAR
============================================================ */

#navbar {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;

    margin-left: 0;

    background-color: white;

    box-shadow:
        0 0 3px 0 var(--blickishhh);

    font-family: Calibri, sans-serif;

    z-index: 900;

    transition:
        top 0.3s ease,
        width 0.5s ease,
        margin-left 0.5s ease;
}


#navbar .navdiv {
    width: 100%;
    max-width: 60rem;

    min-height:
        var(--navbar-height);

    margin-left: auto;
    margin-right: auto;

    padding:
        0.45rem clamp(0.75rem,
            3vw,
            1.25rem);

    display: flex;

    align-items: center;

    gap: 0.45rem;

    background-color: white;
}


#navbar .navdiv .logo_img {
    display: block;

    width: 27px;
    height: 27px;

    margin:
        0 3px 0 0;

    flex-shrink: 0;
}


#navbar .navdiv .logo {
    min-width: 0;
}


#navbar .navdiv .logo a {
    display: block;

    margin-right: 1rem;

    color: black;

    font-size:
        clamp(1.35rem,
            3vw,
            2rem);

    font-weight: 600;

    line-height: 1;

    white-space: nowrap;
}


#navbar .navdiv ul {
    display: flex;

    align-items: center;

    gap:
        clamp(1rem,
            3vw,
            2.5rem);

    margin-left: auto;

    list-style: none;
}


#navbar .navdiv ul li {
    flex-shrink: 0;
}


#navbar .navdiv ul li a {
    margin: 0;

    color: black;

    font-size:
        clamp(1rem,
            2vw,
            1.3rem);

    font-weight: bold;

    white-space: nowrap;
}


#navbar .navdiv ul li a:hover {
    text-decoration: underline;
}


/* ============================================================
   MENU BUTTON
============================================================ */

.menu_btn {
    width: 44px;
    height: 44px;

    flex:
        0 0 44px;

    margin: 0;
    padding: 6px;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 4px;

    border: none;

    background:
        transparent;

    cursor: pointer;
}


.bar1,
.bar2,
.bar3 {
    width: 30px;
    height: 4px;

    margin: 0;

    border-radius: 20px;

    background-color:
        #0c0c0c;

    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        background-color 0.2s ease;
}


@media (hover: hover) and (pointer: fine) {

    .menu_btn:hover .bar1,
    .menu_btn:hover .bar2,
    .menu_btn:hover .bar3 {
        background-color:
            #871b1b;
    }

}


.change .bar1 {
    transform:
        translateY(8px) rotate(-45deg);
}


.change .bar2 {
    opacity: 0;
}


.change .bar3 {
    transform:
        translateY(-8px) rotate(45deg);
}


/* ============================================================
   SIDEBAR
============================================================ */

.sidebar {
    position: fixed;

    top: 0;
    left: 0;

    width: 0;

    max-width: 88vw;

    height: 100vh;
    height: 100dvh;

    padding-top:
        max(60px,
            env(safe-area-inset-top));

    padding-bottom:
        env(safe-area-inset-bottom);

    background-color:
        var(--blickishhh);

    overflow-x: hidden;
    overflow-y: auto;

    z-index: 1000;

    transition:
        width 0.5s ease;
}


.sidebar a {
    display: block;

    padding:
        0.65rem 2rem;

    color: #a7a7a7;

    font-size:
        clamp(1.15rem,
            4vw,
            1.5rem);

    line-height: 1.3;

    white-space: nowrap;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}


@media (hover: hover) and (pointer: fine) {

    .sidebar a:hover {
        color: white;

        background:
            rgba(255,
                255,
                255,
                0.06);
    }

}


.sidebar .closebtn {
    position: absolute;

    top: 0;
    right: 1rem;

    width: auto;

    margin: 0;

    padding:
        0.15rem 0.5rem;

    color: #d0d0d0;

    font-size: 4rem;

    line-height: 1;
}


.sidebar .closebtn:hover {
    color: white;
}


/* ============================================================
   SIDEBAR NAVIGATION LINKS
============================================================ */

#sidebar_nav_links {
    margin-bottom: 1rem;
}


#sidebar_nav_links #navbar_links {
    display: block;

    margin: 0;

    padding:
        0 0 1rem 0;

    list-style: none;

    border-bottom:
        1px solid #666;
}


#sidebar_nav_links #navbar_links li {
    display: block;
}


#sidebar_nav_links #navbar_links li a {
    display: block;

    margin: 0;

    padding:
        0.7rem 2rem;

    color: #d0d0d0;

    font-size:
        clamp(1.15rem,
            4vw,
            1.5rem);

    font-weight: bold;
}


/* ============================================================
   SIDEBAR BACKDROP
============================================================ */

.sidebar_backdrop {
    position: fixed;

    inset: 0;

    z-index: 950;

    background:
        rgba(0,
            0,
            0,
            0.35);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}


body.sidebar-overlay-open .sidebar_backdrop {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* ============================================================
   SIDEBAR RESTORE
============================================================ */

body.restoring_sidebar .sidebar,

body.restoring_sidebar #navbar,

body.restoring_sidebar #main,

body.restoring_sidebar .sidebar_backdrop,

body.restoring_sidebar .bar1,

body.restoring_sidebar .bar2,

body.restoring_sidebar .bar3 {
    transition:
        none !important;
}


/* ============================================================
   PLAY PAGE
============================================================ */

.play_page,
#main {
    width: 100%;

    min-height: 100vh;
    min-height: 100dvh;

    margin-left: 0;

    padding-top:
        calc(var(--navbar-height) + clamp(1.25rem,
                4vh,
                2.5rem));

    padding-right:
        var(--play-page-padding);

    padding-bottom:
        clamp(1.25rem,
            4vh,
            2.5rem);

    padding-left:
        var(--play-page-padding);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    transform: none;

    overflow: visible;

    transition:
        width 0.5s ease,
        margin-left 0.5s ease,
        padding 0.42s var(--smooth-motion);
}


/* ============================================================
   PROGRESS
============================================================ */

.question_progress {
    width:
        min(100%,
            55rem);

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 0.8rem;

    transition:
        gap 0.42s var(--smooth-motion),
        width 0.5s ease;
}


.progress_dots {
    width: 100%;

    display: flex;

    flex-wrap: wrap;

    align-items: center;
    justify-content: center;

    gap:
        0.55rem 0.65rem;

    padding:
        0.15rem 0;
}


.progress_dot {
    width: 0.75rem;
    height: 0.75rem;

    flex:
        0 0 auto;

    background-color:
        #bdbdbd;

    border-radius: 50%;

    transition:
        width 0.2s ease,
        height 0.2s ease,
        background-color 0.3s ease,
        transform 0.2s ease;
}


.progress_dot.current {
    width: 1.05rem;
    height: 1.05rem;

    background-color:
        #8a8a8a;

    box-shadow:
        0 0 0 3px rgba(0,
            0,
            0,
            0.08);
}


.progress_dots.progress_dense {
    gap:
        0.4rem 0.45rem;
}


.progress_dots.progress_dense .progress_dot {
    width: 0.65rem;
    height: 0.65rem;
}


.progress_dots.progress_dense .progress_dot.current {
    width: 0.9rem;
    height: 0.9rem;
}


.progress_dots.progress_very_dense {
    gap:
        0.32rem 0.36rem;
}


.progress_dots.progress_very_dense .progress_dot {
    width: 0.55rem;
    height: 0.55rem;
}


.progress_dots.progress_very_dense .progress_dot.current {
    width: 0.8rem;
    height: 0.8rem;
}


.question_number {
    margin-top: 0;

    font-size:
        clamp(1rem,
            3vw,
            1.2rem);

    font-weight: bold;
}


/* ============================================================
   QUESTION AREA
============================================================ */

.question_area {
    width:
        min(100%,
            55rem);

    margin-top:
        clamp(2rem,
            6vh,
            3.5rem);

    display: flex;

    flex-direction: column;

    align-items: center;

    text-align: center;

    transition:
        margin 0.42s var(--smooth-motion),
        width 0.5s ease;
}


.question-container {
    width: 100%;
}


#question {
    width: 100%;

    margin: 0;

    font-size:
        clamp(1.8rem,
            5vw,
            2.7rem);

    line-height: 1.18;

    overflow-wrap: anywhere;
}


.unit_text {
    max-width: 100%;

    margin-top: 0.4rem;
    margin-bottom: 0.8rem;

    color: #777;

    font-size:
        clamp(0.85rem,
            2.5vw,
            0.95rem);

    line-height: 1.4;
}


/* ============================================================
   EXPLANATION BUTTON
============================================================ */

#explanation-button,
#play_again_button,
#return_home_button {
    min-height: 44px;

    padding:
        0.8rem 1.4rem;

    font-family: inherit;

    font-size: 1rem;

    font-weight: 600;

    border:
        2px solid var(--blickishhh);

    border-radius:
        0.5rem;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease,
        margin 0.42s var(--smooth-motion);
}


#explanation-button {
    margin-top: 1rem;

    color:
        var(--blickishhh);

    background-color:
        white;
}


#explanation-button:hover {
    background-color:
        #eeeeee;
}


#explanation-button:active {
    transform:
        scale(0.97);
}


/* ============================================================
   EXPLANATION BOX
============================================================ */

/*
    IMPORTANT:

    The explanation box is NEVER switched to display:none
    while the game is running.

    That is what allows CSS to animate its real height.

    CLOSED:
        grid row = 0fr
        padding = 0
        margin = 0
        opacity = 0

    OPEN:
        grid row = 1fr
        natural content height

    OPENING:
        transform-origin = bottom

    CLOSING:
        transform-origin = top
*/

#explanation-box {
    width:
        min(100%,
            40rem);

    max-width: 100%;

    display: grid;

    grid-template-rows:
        0fr;

    margin:
        0 auto;

    padding:
        0 1.5rem;

    text-align: left;

    overflow: hidden;

    overflow-wrap: anywhere;

    background-color:
        #f7f7f7;

    border:
        0 solid #d5d5d5;

    border-radius:
        0.6rem;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform:
        scaleY(0.965) translateY(0.4rem);

    /*
        CLOSED state uses TOP as origin.

        Therefore when closing, the bottom edge
        contracts upward toward the top.
    */
    transform-origin:
        top center;

    transition:
        grid-template-rows 0.42s var(--smooth-motion),

        opacity 0.28s ease,

        transform 0.42s var(--smooth-motion),

        margin 0.42s var(--smooth-motion),

        padding 0.42s var(--smooth-motion),

        border-width 0.3s ease,

        visibility 0s linear 0.42s;
}


/*
    This child is what makes the 0fr -> 1fr
    height animation work reliably.
*/

.explanation-inner {
    min-height: 0;

    overflow: hidden;
}


/* ============================================================
   EXPLANATION OPEN
============================================================ */

body.explanation-open #explanation-box {
    grid-template-rows:
        1fr;

    margin:
        clamp(0.6rem,
            1.5vh,
            1rem) auto 0;

    padding:
        clamp(0.9rem,
            2.5vh,
            1.25rem) 1.5rem;

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    border-width: 1px;

    transform:
        scaleY(1) translateY(0);

    /*
        OPEN state uses BOTTOM as origin.

        Therefore opening visually grows upward
        from the bottom edge.
    */
    transform-origin:
        bottom center;

    transition:
        grid-template-rows 0.42s var(--smooth-motion),

        opacity 0.3s ease 0.04s,

        transform 0.42s var(--smooth-motion),

        margin 0.42s var(--smooth-motion),

        padding 0.42s var(--smooth-motion),

        border-width 0.3s ease,

        visibility 0s;
}


.explanation-section h3 {
    margin-bottom:
        0.5rem;

    color:
        var(--blickishhh);

    font-size:
        clamp(1rem,
            3vw,
            1.1rem);

    font-weight: 700;
}


.explanation-section p {
    color: #555;

    font-size:
        clamp(0.95rem,
            2.5vw,
            1rem);

    line-height: 1.6;
}


.explanation-separator {
    width: 100%;
    height: 1px;

    margin:
        1.2rem 0;

    background-color:
        #d5d5d5;

    transition:
        margin 0.42s var(--smooth-motion);
}


/* ============================================================
   EXPLANATION OPEN — COMPACT GAME
============================================================ */

body.explanation-open .question_area {
    margin-top:
        clamp(0.8rem,
            2vh,
            1.4rem);
}


body.explanation-open #explanation-button {
    margin-top:
        clamp(0.5rem,
            1.5vh,
            0.8rem);
}


body.explanation-open .explanation-separator {
    margin:
        clamp(0.7rem,
            2vh,
            1rem) 0;
}


body.explanation-open .value_slider_area {
    margin-top:
        clamp(1rem,
            2.5vh,
            1.8rem);
}


body.explanation-open .answer_area {
    margin-top:
        clamp(0.8rem,
            2vh,
            1.2rem);
}


body.explanation-open .question_progress {
    gap:
        clamp(0.3rem,
            1vh,
            0.5rem);
}


body.explanation-open .play_page,

body.explanation-open #main {
    padding-top:
        calc(var(--navbar-height) + clamp(0.75rem,
                2vh,
                1.25rem));

    padding-bottom:
        clamp(0.75rem,
            2vh,
            1.25rem);
}






/* ============================================================
   VALUE SLIDER — CROSS-BROWSER
============================================================ */

.value_slider_area {
    width:
        min(100%,
            46rem);

    margin-top:
        clamp(2.5rem,
            8vh,
            5rem);

    display: grid;

    grid-template-columns:
        minmax(4.5rem,
            auto) minmax(0,
            1fr) minmax(4.5rem,
            auto);

    align-items: center;

    gap:
        clamp(0.6rem,
            3vw,
            1rem);

    transition:
        margin 0.42s var(--smooth-motion),
        width 0.5s ease;
}


/*
    Completely remove the browser's native
    range-slider appearance.

    This is important because Firefox,
    Chrome and Safari otherwise use
    different native dimensions.
*/

#value_slider {
    --slider-fill: 0%;

    width: 100%;

    min-width: 0;

    /*
        The thumb is exactly 21px tall.

        Giving the input the same height prevents
        browsers from giving the control different
        invisible vertical dimensions.
    */
    height: 21px;

    margin: 0;
    padding: 0;

    background:
        transparent;

    border: none;

    outline: none;

    cursor: pointer;

    -webkit-appearance:
        none;

    appearance:
        none;
}


/* ============================================================
   SLIDER LABELS
============================================================ */

.slider_label {
    min-width: 0;

    max-width: 8rem;

    text-align: center;

    color:
        var(--blickishhh);

    font-size:
        clamp(0.78rem,
            2.5vw,
            1rem);

    font-weight: bold;

    line-height: 1.2;

    overflow-wrap: anywhere;
}


/* ============================================================
   FIREFOX TRACK
============================================================ */

#value_slider::-moz-range-track {
    width: 100%;

    height: 11px;

    background-color:
        #b8b8b8;

    border: none;

    border-radius:
        999px;
}


/*
    Firefox has its own special progress element.

    Before an answer has been selected,
    keep the filled section gray too.
*/

#value_slider::-moz-range-progress {
    height: 11px;

    background-color:
        #b8b8b8;

    border: none;

    border-radius:
        999px;
}


/* ============================================================
   FIREFOX THUMB
============================================================ */

#value_slider::-moz-range-thumb {
    /*
        EXACT SAME SIZE AS WEBKIT
    */

    width: 21px;
    height: 21px;

    padding: 0;

    background-color:
        #777777;

    border: none;

    border-radius:
        50%;

    box-shadow: none;

    cursor: pointer;
}


/* ============================================================
   FIREFOX — ANSWER SELECTED
============================================================ */

#value_slider.slider_selected::-moz-range-progress {
    background-color:
        var(--bluishhh);
}


#value_slider.slider_selected::-moz-range-thumb {
    background-color:
        var(--bluishhh);
}


/* ============================================================
   CHROME / EDGE / SAFARI TRACK
============================================================ */

/*
    WebKit/Blink do NOT have Firefox's
    ::-moz-range-progress equivalent.

    Therefore JavaScript calculates --slider-fill.

    Example:

        --slider-fill: 37%;

    and this gradient creates:

        BLUE  |  GRAY
        37%      63%
*/

#value_slider::-webkit-slider-runnable-track {
    width: 100%;

    height: 11px;

    background:
        #b8b8b8;

    border: none;

    border-radius:
        999px;

    box-shadow: none;

    cursor: pointer;
}


#value_slider.slider_selected::-webkit-slider-runnable-track {
    background:
        linear-gradient(to right,

            var(--bluishhh) 0%,

            var(--bluishhh) var(--slider-fill),

            #b8b8b8 var(--slider-fill),

            #b8b8b8 100%);
}


/* ============================================================
   CHROME / EDGE / SAFARI THUMB
============================================================ */

#value_slider::-webkit-slider-thumb {
    /*
        IMPORTANT:

        WebKit has its own native thumb appearance,
        so this must also explicitly be removed.
    */

    -webkit-appearance:
        none;

    appearance:
        none;


    /*
        EXACT SAME SIZE AS FIREFOX
    */

    width: 21px;
    height: 21px;

    padding: 0;


    background-color:
        #777777;

    border: none;

    border-radius:
        50%;

    box-shadow: none;

    cursor: pointer;


    /*
        Track = 11px
        Thumb = 21px

        Difference = 10px

        Half = 5px

        Therefore move the thumb upward by 5px
        so its center exactly matches the
        center of the track.
    */

    margin-top: -5px;
}


/* ============================================================
   CHROME / EDGE / SAFARI — ANSWER SELECTED
============================================================ */

#value_slider.slider_selected::-webkit-slider-thumb {
    background-color:
        var(--bluishhh);
}


/* ============================================================
   RANGE FOCUS
============================================================ */

/*
    The normal focus-visible rule elsewhere in
    your CSS outlines the entire input.

    Keep the thumb itself clean so Chrome/Safari
    don't add additional platform-specific shadows.
*/

#value_slider:focus {
    outline: none;
}


#value_slider:focus-visible {
    outline:
        3px solid var(--bluishhh);

    outline-offset:
        4px;

    border-radius:
        999px;
}


/* ============================================================
   MULTIPLIER SELECT — CROSS-BROWSER
============================================================ */

/*
    Safari, Firefox and Chrome render native
    select arrows differently.

    Removing the native appearance and drawing
    one ourselves makes the control much more
    consistent.
*/

#multiplier {
    width: auto;

    min-width:
        5.5rem;

    padding:
        0 2rem 0 0.75rem;

    color: black;

    background-color:
        white;

    border:
        2px solid black;

    border-left: none;

    border-radius: 0;

    font-weight: bold;

    cursor: pointer;

    -webkit-appearance:
        none;

    appearance:
        none;


    /*
        Custom dropdown arrow
    */

    background-image:
        linear-gradient(45deg,
            transparent 50%,
            #333333 50%),

        linear-gradient(135deg,
            #333333 50%,
            transparent 50%);

    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 9px) 50%;

    background-size:
        5px 5px,
        5px 5px;

    background-repeat:
        no-repeat;
}


/* ============================================================
   FORM CONTROL NORMALIZATION
============================================================ */

#answer_input,
#submit_button,
#explanation-button,
#play_again_button,
#return_home_button,
#result_continue_button {
    -webkit-appearance:
        none;

    appearance:
        none;
}


/*
    Prevent Safari/iOS from changing text sizing
    independently of the rest of the layout.
*/

html {
    -webkit-text-size-adjust:
        100%;

    text-size-adjust:
        100%;
}






/* ============================================================
   ANSWER AREA
============================================================ */

.answer_area {
    width:
        min(100%,
            32rem);

    margin-top:
        clamp(1.3rem,
            4vh,
            2rem);

    display: grid;

    grid-template-columns:
        minmax(0,
            1fr) auto auto;

    align-items: stretch;

    transition:
        margin 0.42s var(--smooth-motion);
}


#answer_input,
#multiplier,
#submit_button {
    min-height:
        3.75rem;

    height: auto;
}


#answer_input {
    width: 100%;

    min-width: 0;

    padding:
        0.85rem 1rem;

    font-size:
        max(1rem,
            16px);

    border:
        2px solid black;

    border-radius:
        0.4rem 0 0 0.4rem;

    outline: none;
}


#answer_input:focus {
    background-color:
        #f5f5f5;
}


#multiplier {
    width: auto;

    min-width:
        5.5rem;

    padding:
        0 0.75rem;

    border:
        2px solid black;

    border-left: none;

    border-radius: 0;

    background-color:
        white;

    font-weight: bold;

    cursor: pointer;
}


#submit_button {
    min-width:
        6.5rem;

    padding:
        0.75rem 1.25rem;

    color: white;

    background-color:
        #888;

    border:
        2px solid black;

    border-left: none;

    border-radius:
        0 0.4rem 0.4rem 0;

    font-weight: bold;

    cursor:
        not-allowed;

    transition:
        background-color 0.2s ease,
        transform 0.15s ease;
}


#submit_button.valid {
    background-color:
        #35a853;

    cursor: pointer;
}


#submit_button.valid:hover {
    background-color:
        #2d9148;
}


/* ============================================================
   END GAME BUTTONS
============================================================ */

#end_game_buttons {
    width:
        min(100%,
            30rem);

    margin-top:
        clamp(2rem,
            6vh,
            3rem);

    display: flex;

    justify-content: center;

    align-items: stretch;

    gap: 0.8rem;
}


#play_again_button,
#return_home_button {
    flex:
        1 1 0;
}


#play_again_button {
    color: white;

    background-color:
        var(--bluishhh);
}


#play_again_button:hover {
    background-color:
        #0e356e;
}


#play_again_button:active {
    transform:
        scale(0.97);
}


#return_home_button {
    color:
        var(--blickishhh);

    background-color:
        white;
}


#return_home_button:hover {
    background-color:
        #eeeeee;
}


#return_home_button:active {
    transform:
        scale(0.97);
}


/* ============================================================
   RESULT SCREEN
============================================================ */

body.result-open {
    overflow: hidden;
}


.answer_result_screen {
    position: fixed;

    inset: 0;

    width: auto;
    height: auto;

    min-height: 100vh;
    min-height: 100dvh;

    padding:
        max(1rem,
            env(safe-area-inset-top)) max(1rem,
            env(safe-area-inset-right)) max(1rem,
            env(safe-area-inset-bottom)) max(1rem,
            env(safe-area-inset-left));

    display: flex;

    align-items: center;
    justify-content: center;

    overflow-y: auto;

    overscroll-behavior:
        contain;

    background-color:
        rgba(255,
            255,
            255,
            0.96);

    z-index: 2000;
}


.answer_result_box {
    width:
        min(100%,
            31.25rem);

    margin: auto;

    padding:
        clamp(1.5rem,
            6vw,
            3rem);

    text-align: center;

    background-color:
        white;

    border-radius:
        clamp(0.6rem,
            3vw,
            0.95rem);

    box-shadow:
        0 4px 25px rgba(0,
            0,
            0,
            0.2);
}


.answer_result_label {
    margin-top:
        clamp(1rem,
            4vw,
            1.5rem);

    color:
        var(--blickishhh);

    font-size:
        clamp(1rem,
            3vw,
            1.2rem);

    font-weight: bold;
}


#result_correct_answer,
#result_accuracy {
    max-width: 100%;

    padding:
        0.4rem 0 clamp(0.7rem,
            3vw,
            1rem);

    font-size:
        clamp(2.2rem,
            10vw,
            3rem);

    line-height: 1.1;

    overflow-wrap: anywhere;
}


#result_continue_button {
    width:
        min(100%,
            18rem);

    min-width: 0;

    min-height: 48px;

    margin-top:
        clamp(1.3rem,
            5vw,
            2rem);

    padding:
        0.8rem 1rem;

    border: none;

    border-radius:
        8px;

    font-size:
        clamp(1rem,
            3vw,
            1.2rem);

    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.2s ease;
}


#result_continue_button:hover {
    transform:
        scale(1.05);
}


/* ============================================================
   PUSH MODE
============================================================ */

body.sidebar-tight-push .question_area,

body.sidebar-tight-push .question_progress {
    width:
        min(100%,
            48rem);
}


body.sidebar-tight-push .value_slider_area {
    width:
        min(100%,
            42rem);
}


/* ============================================================
   ≤ 800px
============================================================ */

@media (max-width: 800px) {

    .question_area {
        margin-top:
            clamp(1.5rem,
                4vh,
                3rem);
    }


    .value_slider_area {
        margin-top:
            clamp(1.75rem,
                5vh,
                4rem);
    }


    .answer_area {
        margin-top:
            clamp(1rem,
                3vh,
                1.75rem);
    }

}


/* ============================================================
   SHORTER WINDOWS
============================================================ */

@media (max-height: 750px) {

    .play_page,
    #main {
        padding-top:
            calc(var(--navbar-height) + 1rem);

        padding-bottom:
            1rem;
    }


    .question_area {
        margin-top:
            1.25rem;
    }


    .value_slider_area {
        margin-top:
            1.75rem;
    }


    .answer_area {
        margin-top:
            1rem;
    }


    #explanation-button {
        margin-top:
            0.8rem;
    }


    .question_progress {
        gap:
            0.5rem;
    }


    body.explanation-open .question_area {
        margin-top:
            0.6rem;
    }


    body.explanation-open #explanation-button {
        margin-top:
            0.45rem;
    }


    body.explanation-open #explanation-box {
        margin-top:
            0.5rem;

        padding:
            0.85rem 1rem;
    }


    body.explanation-open .explanation-separator {
        margin:
            0.65rem 0;
    }


    body.explanation-open .value_slider_area {
        margin-top:
            0.9rem;
    }


    body.explanation-open .answer_area {
        margin-top:
            0.7rem;
    }

}


@media (min-height: 900px) {

    .question_area {
        margin-top:
            3rem;
    }


    .value_slider_area {
        margin-top:
            4.5rem;
    }


    .answer_area {
        margin-top:
            1.75rem;
    }

}


/* ============================================================
   ≤ 650px
============================================================ */

@media (max-width: 650px) {

    #navbar .navdiv>#navbar_links {
        display: none;
    }


    .menu_btn {
        margin-left: auto;
    }


    .value_slider_area {
        width:
            min(100%,
                34rem);

        grid-template-columns:
            1fr 1fr;

        grid-template-areas:
            "slider slider"
            "minimum maximum";

        row-gap:
            0.7rem;
    }


    #value_slider {
        grid-area:
            slider;
    }


    #slider_min_label {
        grid-area:
            minimum;

        justify-self:
            start;

        text-align:
            left;
    }


    #slider_max_label {
        grid-area:
            maximum;

        justify-self:
            end;

        text-align:
            right;
    }


    .slider_label {
        max-width:
            45%;
    }

}


/* ============================================================
   ≤ 560px
============================================================ */

@media (max-width: 560px) {

    .answer_area {
        width:
            min(100%,
                26rem);

        grid-template-columns:
            minmax(0,
                1fr) auto;
    }


    #answer_input {
        border-radius:
            0.4rem 0 0 0;
    }


    #multiplier {
        border-radius:
            0 0.4rem 0 0;
    }


    #submit_button {
        grid-column:
            1 / -1;

        width: 100%;

        border-left:
            2px solid black;

        border-top:
            none;

        border-radius:
            0 0 0.4rem 0.4rem;
    }


    #end_game_buttons {
        flex-direction:
            column;
    }


    #play_again_button,
    #return_home_button {
        width: 100%;
    }


    .progress_dots {
        gap:
            0.4rem 0.45rem;
    }

}


/* ============================================================
   ≤ 420px
============================================================ */

@media (max-width: 420px) {

    :root {
        --play-page-padding:
            0.85rem;
    }


    #navbar .navdiv {
        padding-left:
            0.7rem;

        padding-right:
            0.7rem;
    }


    #navbar .navdiv .logo_img {
        width: 24px;
        height: 24px;
    }


    #navbar .navdiv .logo a {
        margin-right:
            0.25rem;

        font-size:
            clamp(1.15rem,
                6vw,
                1.45rem);
    }


    .menu_btn {
        width: 42px;
        height: 42px;

        flex-basis:
            42px;
    }


    .play_page,
    #main {
        padding-top:
            calc(var(--navbar-height) + 1rem);

        padding-bottom:
            1rem;
    }


    .question_area {
        margin-top:
            1.5rem;
    }


    #question {
        font-size:
            clamp(1.55rem,
                8vw,
                2rem);
    }


    .value_slider_area {
        margin-top:
            2rem;
    }


    #explanation-box {
        border-radius:
            0.45rem;
    }


    .answer_result_box {
        padding:
            1.5rem 1rem;
    }

}


/* ============================================================
   ≤ 350px
============================================================ */

@media (max-width: 350px) {

    #navbar .navdiv {
        gap:
            0.2rem;
    }


    #navbar .navdiv .logo a {
        font-size:
            1.08rem;
    }


    .bar1,
    .bar2,
    .bar3 {
        width:
            27px;
    }


    .answer_area {
        grid-template-columns:
            1fr;
    }


    #answer_input {
        border-radius:
            0.4rem 0.4rem 0 0;
    }


    #multiplier {
        width:
            100%;

        border-left:
            2px solid black;

        border-top:
            none;

        border-radius:
            0;
    }


    #submit_button {
        grid-column:
            auto;

        border-top:
            none;

        border-radius:
            0 0 0.4rem 0.4rem;
    }

}


/* ============================================================
   SHORT LANDSCAPE
============================================================ */

@media (max-height: 550px) and (orientation: landscape) {

    .play_page,
    #main {
        min-height:
            100dvh;

        padding-top:
            calc(var(--navbar-height) + 0.75rem);

        padding-bottom:
            0.75rem;

        justify-content:
            center;
    }


    .question_area {
        margin-top:
            1rem;
    }


    .value_slider_area {
        margin-top:
            1.5rem;
    }


    .answer_area {
        margin-top:
            1rem;
    }


    .sidebar {
        padding-top:
            3rem;
    }


    .answer_result_screen {
        align-items:
            flex-start;
    }


    body.explanation-open .play_page,

    body.explanation-open #main {
        padding-top:
            calc(var(--navbar-height) + 0.5rem);

        padding-bottom:
            0.5rem;
    }


    body.explanation-open .question_area {
        margin-top:
            0.5rem;
    }


    body.explanation-open #explanation-button {
        margin-top:
            0.4rem;
    }


    body.explanation-open #explanation-box {
        margin-top:
            0.45rem;

        padding:
            0.75rem 0.9rem;
    }


    body.explanation-open .value_slider_area {
        margin-top:
            0.75rem;
    }


    body.explanation-open .answer_area {
        margin-top:
            0.6rem;
    }

}


/* ============================================================
   ACCESSIBILITY
============================================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline:
        3px solid var(--bluishhh);

    outline-offset:
        2px;
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration:
            0.01ms !important;

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;
    }

}