@font-face {
    font-family: "Andika";
    src: url("../../fonts/Andika-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: black;
    font-family: "Andika", sans-serif;
}
* {
    box-sizing: border-box;
}
[hidden] {
    display: none !important;
}
#introduction {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: black;
}
.scene {
    position: fixed;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0;
    transform: scale(1);
    transform-origin: center center;
}
#shade {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.00) 0%,
        rgba(0, 0, 0, 0.02) 48%,
        rgba(0, 0, 0, 0.72) 100%
    );
}
#welcomePanel {
    position: fixed;
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 20;
    width: min(720px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 24px;
    color: white;
    text-align: center;
    background: rgba(28, 18, 10, 0.78);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.38);
}
#message {
    margin: 0;
    font-size: clamp(1.45rem, 4.4vw, 2.35rem);
    line-height: 1.15;
    text-wrap: balance;
}
#buttonRow {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
}
button {
    min-width: 150px;
    padding: 13px 24px;
    border: 0;
    border-radius: 999px;
    color: #3d2409;
    background: #ffd86f;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    text-transform: lowercase;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
    touch-action: manipulation;
}
button:active {
    transform: scale(0.97);
}
button:disabled {
    opacity: 0.62;
    cursor: default;
}
#loader {
    display: grid;
    justify-items: center;
    gap: 7px;
    margin-top: 18px;
}
#loader p {
    margin: 0;
    font-weight: 700;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.28);
    border-top-color: #ffd86f;
    border-radius: 50%;
    animation: spin 850ms linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
@media (orientation: landscape) {
    #welcomePanel {
        padding: 15px 20px;
    }
    #message {
        font-size: clamp(1.3rem, 3vw, 2rem);
    }
}
.accelerated-test-link {
    margin-top: 0.35rem;
    text-align: center;
    font-size: 0.9rem;
}
.accelerated-test-link a {
    color: #1f5fbf;
    text-decoration: none;
}
.accelerated-test-link a:hover {
    text-decoration: underline;
}
/* Pre-start permission gate. Technical setup stays here, before the story. */
#microphoneGate {
    position: fixed;
    inset: 0;
    z-index: 100;
    overflow: hidden;
    background: #c99b6a;
}
#microphoneGatePortrait {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
#microphoneGate::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.02) 0%,
        rgba(0, 0, 0, 0.03) 48%,
        rgba(0, 0, 0, 0.66) 100%
    );
}
#microphoneGatePanel {
    position: absolute;
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: max(28px, env(safe-area-inset-bottom));
    z-index: 2;
    width: min(720px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 20px 16px;
    border: 1px solid rgba(255, 255, 255, 0.44);
    border-radius: 24px;
    color: white;
    text-align: center;
    background: rgba(28, 18, 10, 0.76);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.34);
}
#microphoneGateMessage {
    margin: 0;
    font-size: clamp(1.15rem, 3.9vw, 1.8rem);
    line-height: 1.25;
    text-wrap: balance;
}
#microphoneGateButton {
    display: inline-grid;
    place-items: center;
    min-width: 0;
    width: 78px;
    height: 78px;
    margin-top: 16px;
    padding: 0;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: white;
    background: #2eaa4f;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}
#microphoneGateButton svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}
#microphoneGateButton:disabled {
    opacity: 0.72;
}
#microphoneGateStatus {
    min-height: 1.2em;
    margin: 8px 0 0;
    font-size: 0.92rem;
}
/* Stage 4: pulse the microphone itself rather than its faint shadow. */
@keyframes krumyloo-microphone-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.17);
    }
}
#microphoneGateButton:not(:disabled) {
    transform-origin: center center;
    animation: krumyloo-microphone-pulse 1.35s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    #microphoneGateButton:not(:disabled) {
        animation: none;
        outline: 3px solid #eaff8c;
        outline-offset: 4px;
    }
}
/* Language control: fixed to the portrait lesson viewport, above the microphone gate. */
/* .language-flag {position:fixed;right:max(12px,env(safe-area-inset-right));top:27%;z-index:1000; */
.language-flag {
    position: fixed;
    left: max(12px,env(safe-area-inset-left));
    top: 72px;
    z-index: 1000;
    width: 52px;
    height: 44px;
    min-width: 0;
    padding: 5px;
    border: 1px solid #fff9;
    border-radius: 9px;
    background: #fff9e6;
    box-shadow: 0 3px 12px #0007;
    display: grid;
    place-items: center;
}
.language-flag img {
    display: block;
    width: 40px;
    height: auto;
    border-radius: 2px;
}
.language-flag:focus-visible {
    outline: 3px solid #ffe56b;
    outline-offset: 3px;
}
