dialog {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 46rem);
    max-width: 40rem;
    border: none;
    box-shadow: 0 0 1rem 0.125rem #0003;
    border-radius: 0.5rem;
    padding: 0;
    z-index: 10;
    font-size: 0.9em;
    background-color: var(--background-color);
    color: var(--text-color);
}

dialog:not([open]) {
    display: none;
}

dialog>header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color, #ddd);
    flex-shrink: 0;
}

dialog>header h2 {
    margin: 0;
    font-size: 1.05rem;
}

dialog fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.25rem;
}

dialog fieldset>legend {
    padding: 0;
    margin-bottom: .5rem;
    font-weight: 600;
    font-size: .95rem;
}

dialog .hint {
    font-size: .8rem;
    opacity: .7;
    margin: 0 0 .75rem;
}

dialog .field {
    margin-bottom: .75rem;
}

/* detalhes de inscrição (grand prix) — usa a largura disponível para não cortar a peça */
dialog#detalhes {
    max-width: none;
    width: min(96vw, 120rem);
}

dialog::backdrop {
    backdrop-filter: blur(1px) contrast(0.5);
    background-color: var(--surface-color);
}

dialog.auth-dialog {
    max-width: 24rem;
    background-color: var(--background-color);
}

dialog form {
    margin: 0;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

dialog button.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: transparent;
    box-shadow: none;
    color: var(--text-color);
}

dialog button.close::before {
    content: '\2715';
}

dialog>header button.close {
    top: 0.5rem;
    right: 0.5rem;
}

.home dialog h2,
dialog h2 {
    padding-right: 3rem;
    margin: 0.25em 0 .5em 0;
    font-size: 2em;
    font-weight: 600;
    color: var(--color-link);
    line-height: 1;
}

dialog#register-dialog {
    max-width: 42rem;
}

dialog#register-dialog fieldset {
    flex-flow: row wrap;
}

dialog#register-dialog .field {
    flex: 0 1 calc(50% - 0.5rem);
    align-content: flex-start;
}

dialog#register-dialog .field.termos {
    flex: 0 1 100%;
    flex-wrap: nowrap;
}

dialog#register-dialog .buttons {
    flex-flow: row wrap;
}

dialog#register-dialog button[type="submit"] {
    order: 2;
    margin-left: auto;
}

dialog .buttons {
    align-items: stretch;
}

dialog footer {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--border-color, #ddd);
    flex-shrink: 0;
}

@media (min-width: 640px) and (max-height: 560px) {
    dialog.auth-dialog {
        max-width: 40rem;
    }

    dialog form {
        flex-direction: row;
        flex-wrap: wrap;
    }

    dialog .buttons {
        min-width: 32%;
        justify-content: flex-end;
        margin: 0;
    }
}

@media (max-width: 480px) or (max-height: 400px) {
    dialog.auth-dialog {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
    }
}