/* Child's Play - kid-friendly theme */

:root {
    --happy-yellow: #ffd93b;
    --sky: #aee2ff;
    --grass: #8fe388;
    --ink: #1f1f1f;
    --btn-blue: #3d8bfd;
    --btn-blue-dark: #2b6fd4;
    --btn-orange: #ff9f1c;
    --btn-orange-dark: #e08600;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, var(--sky) 0%, #e8f8ff 55%, var(--grass) 100%);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}

.center-screen {
    justify-content: center;
    gap: 1.25rem;
}

.game-title {
    font-size: clamp(2.4rem, 8vw, 4rem);
    margin: 0;
    color: #d35400;
    text-shadow: 2px 3px 0 rgba(255, 255, 255, 0.8);
    letter-spacing: 0.02em;
}

.prompt {
    font-size: clamp(1.3rem, 4.5vw, 2rem);
    font-weight: bold;
    text-align: center;
    margin: 0;
}

/* --- buttons --- */

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: min(90vw, 26rem);
}

.big-btn {
    font-family: inherit;
    font-size: clamp(1.5rem, 5vw, 2.1rem);
    font-weight: bold;
    color: #fff;
    background: var(--btn-blue);
    border: none;
    border-radius: 1.4rem;
    padding: 1.1rem 1.5rem;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--btn-blue-dark), 0 8px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

    .big-btn:hover {
        filter: brightness(1.06);
    }

    .big-btn:active {
        transform: translateY(4px);
        box-shadow: 0 2px 0 var(--btn-blue-dark), 0 3px 6px rgba(0, 0, 0, 0.25);
    }

.back-btn {
    background: var(--btn-orange);
    box-shadow: 0 6px 0 var(--btn-orange-dark), 0 8px 12px rgba(0, 0, 0, 0.25);
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    padding: 0.8rem 1.5rem;
}

    .back-btn:active {
        box-shadow: 0 2px 0 var(--btn-orange-dark), 0 3px 6px rgba(0, 0, 0, 0.25);
    }

/* --- top bar (game screens) --- */

.top-bar {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.bar-btn {
    font-family: inherit;
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    font-weight: bold;
    color: var(--ink);
    background: #ffffff;
    border: 3px solid var(--ink);
    border-radius: 1rem;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

    .bar-btn:active {
        transform: translateY(2px);
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
    }

/* --- happy faces --- */

.faces-row {
    display: flex;
    gap: 1rem;
}

    .faces-row .face {
        width: clamp(64px, 18vw, 110px);
    }

.face {
    display: inline-flex;
    width: clamp(52px, 11vw, 92px);
    aspect-ratio: 1;
    animation: face-pop 0.25s ease;
}

    .face svg {
        width: 100%;
        height: 100%;
        filter: drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.25));
    }

.face-crossed svg {
    filter: grayscale(0.4) drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.25));
    opacity: 0.75;
}

@keyframes face-pop {
    from {
        transform: scale(0.4);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- game area --- */

.play-area {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 30vh;
}

.faces-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 1.5rem;
    padding: 1rem;
    min-height: 6rem;
    min-width: min(80vw, 20rem);
}

.faces-area-second {
    background: rgba(255, 255, 255, 0.3);
    min-height: 0;
    padding: 0.5rem 1rem;
}

.no-faces {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: bold;
    color: rgba(0, 0, 0, 0.35);
}

.equation {
    font-size: clamp(2rem, 8vw, 3.4rem);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.question-mark {
    color: var(--btn-blue);
}

.big-answer {
    font-size: clamp(2.6rem, 10vw, 4.2rem);
    font-weight: bold;
    color: #d35400;
    animation: face-pop 0.3s ease;
}

.feedback {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.verdict {
    display: inline-flex;
    width: clamp(64px, 16vw, 110px);
    aspect-ratio: 1;
    animation: verdict-zoom 0.35s ease;
}

    .verdict svg {
        width: 100%;
        height: 100%;
    }

@keyframes verdict-zoom {
    0% {
        transform: scale(0) rotate(-20deg);
    }

    70% {
        transform: scale(1.25) rotate(5deg);
    }

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

/* --- number pad --- */

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    width: min(96vw, 30rem);
    padding-bottom: 0.5rem;
}

.digit-btn {
    font-family: inherit;
    font-size: clamp(1.8rem, 7vw, 2.8rem);
    font-weight: bold;
    color: var(--ink);
    background: var(--happy-yellow);
    border: none;
    border-radius: 1.1rem;
    padding: 0.7rem 0;
    cursor: pointer;
    box-shadow: 0 5px 0 #d4a017, 0 7px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.07s ease, box-shadow 0.07s ease;
}

    .digit-btn:hover:not(:disabled) {
        filter: brightness(1.05);
    }

    .digit-btn:active:not(:disabled) {
        transform: translateY(3px);
        box-shadow: 0 2px 0 #d4a017, 0 3px 5px rgba(0, 0, 0, 0.2);
    }

    .digit-btn:disabled {
        opacity: 0.45;
        cursor: default;
    }

/* --- Blazor chrome --- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }
