html {
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    background-color: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 44rem;
    padding: 16px 20px;
    gap: 10px;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 10pt;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
    color: #000000;
}

.title {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    color: #000000;
    font-size: 3em;
    margin: 0;
    line-height: 1.1;
}

.lede {
    margin: 12px 0 0;
    font-size: 0.95rem;
    color: #000000;
}

.sentence {
    font-size: clamp(1.35rem, 3.4vw, 2.15rem);
    font-family: 'Instrument Serif', serif;
    color: #000000;
    text-align: center;
    margin: 0 0 28px;
    line-height: 1.25;
    min-height: 3.75em;
    max-width: 34rem;
    text-wrap: balance;
}

/* End of a round: the sentence box shows the score. */
.sentence--score {
    font-size: clamp(3rem, 9vw, 4.5rem);
    line-height: 1;
    min-height: 0;
    margin-bottom: 8px;
}

.progress {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.55);
}

.blank-line {
    display: inline-block;
    font-weight: 700;
    color: transparent;
    user-select: none;
    box-shadow: inset 0 -3px 0 0 #000000;
}

.blank-filled {
    display: inline-block; /* so it can turn */
    text-align: center;
    font-weight: 700;
}

/* Until the blank has flipped: the word's place is held, the rule stays. */
.blank-filled.is-landing {
    color: transparent;
    box-shadow: inset 0 -3px 0 0 #000000;
}

.blank-filled--premiere { color: #5B8DEF; }
.blank-filled--premier { color: #F46C3F; }

.animate-in {
    animation: fadeInUp 0.45s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.choices {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    min-height: 4.5rem;
}

.choices[hidden] {
    display: none;
}

.choice-button {
    box-sizing: border-box;
    min-width: 10.5rem;
    padding: 1rem 1.75rem;
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    scale: 1;
    transition: scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s, opacity 0.25s;
}

.choice-button--premiere {
    background-color: #5B8DEF;
    transform: rotate(-3deg);
}

.choice-button--premier {
    background-color: #F46C3F;
    transform: rotate(3deg);
}

@media (hover: hover) and (pointer: fine) {
    .choice-button:hover:not(:disabled) {
        scale: 1.08;
    }
}

.choice-button:active:not(:disabled) {
    scale: 0.96;
}

.choice-button:disabled {
    cursor: default;
}

.choice-button.is-wrong {
    filter: grayscale(1);
    opacity: 0.35;
    box-shadow: none;
}

.choice-button.is-right {
    scale: 1.06;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {
    10%, 90% { transform: rotate(-3deg) translate3d(-1px, 0, 0); }
    20%, 80% { transform: rotate(-3deg) translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: rotate(-3deg) translate3d(-4px, 0, 0); }
    40%, 60% { transform: rotate(-3deg) translate3d(4px, 0, 0); }
}

.choice-button--premier.shake {
    animation-name: shake-premier;
}

@keyframes shake-premier {
    10%, 90% { transform: rotate(3deg) translate3d(-1px, 0, 0); }
    20%, 80% { transform: rotate(3deg) translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: rotate(3deg) translate3d(-4px, 0, 0); }
    40%, 60% { transform: rotate(3deg) translate3d(4px, 0, 0); }
}

#result {
    margin: 1rem 0 0;
    min-height: 2.8em;
    max-width: 22rem;
    line-height: 1.4;
    font-size: 1rem;
    font-weight: 700;
    color: #000000;
}

#nextButton {
    box-sizing: border-box;
    margin-top: 0.75rem;
    padding: 0.65rem 1.25rem;
    border: 2px solid #000000;
    border-radius: 5px;
    background: #ffffff;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.2s, color 0.2s;
}

#nextButton.show {
    visibility: visible;
    opacity: 1;
}

.choice-button:focus-visible,
#nextButton:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 3px;
}

#nextButton:hover {
    background: #000000;
    color: #ffffff;
}

@media screen and (max-width: 767px) {
    .container {
        padding: max(12px, env(safe-area-inset-top)) 20px max(12px, env(safe-area-inset-bottom));
    }
    .subtitle { font-size: 8pt; }
    .title { font-size: 2em; }
    .title-container { margin-bottom: 12px; }
    .lede { font-size: 0.85rem; }
    .sentence { min-height: 5em; margin-bottom: 20px; }
    .sentence--score { min-height: 0; margin-bottom: 8px; }
    .choices { gap: 12px; }
    .choice-button {
        min-width: 0;
        padding: 0.85rem 1.4rem;
        font-size: 1.05rem;
    }
    #nextButton { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .animate-in,
    .shake {
        animation: none;
    }
}
