html, body {
    margin: 0;
    zoom: 1;
    font-size: clamp(14px, min(1.75vw, 2.25vh), 48px);
}

body {
    position: fixed;
    inset: 0;
    overflow: clip;
    isolation: isolate;
}

#lamp-anim {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.contentPage {
    inset-inline: 0;
    width: auto;
    box-sizing: border-box;
}

#formSection {
    padding: 1rem;
    gap: clamp(.6rem, 2vh, 1.5rem);
    justify-content: safe center;
    overflow-y: auto;
}

#formSection > * {
    flex-shrink: 0;
}

#logo {
    width: auto;
    height: clamp(3rem, 13vh, 9rem);
    max-width: 100%;
    object-fit: contain;
    margin: 0;
}

h1 {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 2.4rem);
    line-height: 1.12;
}

form {
    margin: 0;
    width: min(100%, 40rem);
    gap: 1rem;
}

#fields {
    display: contents;
}

.horizontalRow {
    align-items: flex-start;
}

.field {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: .75rem;
}

.field--checkbox {
    flex: 0 0 auto;
    grid-template-columns: auto auto;
    /* Mesma altura dos campos de texto ao lado. */
    padding-block: calc(var(--field-pad) + .1rem);
}

/* Fica no espaço entre as linhas: o formulário não cresce quando um erro aparece. */
.fieldError {
    position: absolute;
    top: calc(100% + .12rem);
    right: 0;
    margin: 0;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--error);
}

.field.invalid input {
    outline: .12rem solid var(--error);
}

#formSection input::placeholder {
    color: inherit;
    opacity: .45;
}

#formSection {
    --field-pad: .65rem;
    --field-pad-x: .8rem;
}

#formSection input:not([type="checkbox"]) {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    padding: var(--field-pad) var(--field-pad-x);
}

#formSection input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--accent);
}

#soldOut {
    display: none;
    margin: 0;
    text-align: center;
    font-weight: 700;
    font-size: clamp(1.25rem, 4vw, 2.4rem);
    line-height: 1.12;
}

#formSection.soldOut :is(h1, form) {
    display: none;
}

#formSection.soldOut #soldOut {
    display: block;
}

#notice {
    position: fixed;
    inset: .5rem .5rem auto;
    z-index: 3000;
    margin: 0;
    padding: .6rem .9rem;
    border-radius: .6rem;
    background: #8a1c1c;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
}

.confirmButton, #endGame {
    margin-top: .75rem;
    font-size: 1.25rem;
}

.rouletteWrapper {
    width: min(90vw, calc(100vh - 7rem));
    height: auto;
    padding: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.roulette {
    position: relative;
    border-radius: 50%;
    /* Fundo no lugar do desfoque: mantém os textos legíveis sobre as bolhas. */
    background: color-mix(in srgb, var(--bg) 45%, transparent);
}

.rouletteFace {
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Fora do fluxo: a biblioteca fixa o tamanho do canvas em pixels, e dentro do fluxo
   ele impediria a roleta de voltar a ser quadrada quando a janela muda de tamanho. */
.roulette > canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.roulette::before {
    top: -.75rem;
    width: 4rem;
    height: 2rem;
    pointer-events: none;
}

.currentPrizeWrapper, .currentPrizeWrapper span {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
}

.currentPrizeWrapper span {
    display: block;
    text-align: center;
    white-space: normal;
    font-size: clamp(1rem, 4vw, 2rem);
}

#prizeModal {
    box-sizing: border-box;
    padding: 1rem;
    gap: clamp(.75rem, 3vh, 1.5rem);
    justify-content: safe center;
    text-align: center;
    overflow: auto;
}

.wonItem {
    font-size: clamp(1.5rem, 5vw, 2.75rem);
}

#wonItemText {
    display: inline-block;
    margin: .35rem;
    padding: .6rem .85rem;
}

.info {
    font-size: 1.15rem;
}

@media (max-width: 540px) {
    #formSection {
        gap: .5rem;
        padding-block: .5rem;
    }

    #logo {
        height: 2.75rem;
    }

    .horizontalRow {
        flex-direction: column;
        gap: .4rem;
    }

    .field, .field--checkbox {
        flex: 0 0 auto;
        width: 100%;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
        padding-block: 0;
    }

    .field label {
        justify-content: flex-start;
    }

    .field.invalid {
        margin-bottom: .7rem;
    }
}

@media (min-width: 1600px) and (max-aspect-ratio: 2/3) {
    html, body {
        font-size: clamp(18px, 1.2vw, 36px);
    }

    #formSection {
        gap: 3rem;
        --field-pad: 1.2rem;
        --field-pad-x: 1.5rem;
    }

    #logo {
        width: 20%;
        height: auto;
    }

    h1 {
        font-size: 4rem;
    }

    .confirmButton, #endGame {
        font-size: 2rem;
    }

    .currentPrizeWrapper span {
        font-size: 3rem;
    }
}
