/* Avatar URL field with the gallery toggle next to it and the panel below. */
.avatar-url-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 0.25rem;
}
.auth-page .avatar-url-field input[type="url"] {
    flex: 1 1 12rem;
    width: auto;
    min-width: 0;
    margin-top: 0;
}
/* Toggle and panel take part in the field's flex row directly. */
.avatar-gallery { display: contents; }
.avatar-gallery-toggle {
    flex-shrink: 0;
    padding: 0.35rem 0.6rem;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    background: var(--button-bg);
    color: var(--text);
    border: 1px solid var(--button-border);
    border-radius: var(--radius);
    line-height: 1.2;
}
.avatar-gallery-toggle:hover { filter: brightness(0.97); }
.avatar-gallery-toggle[aria-expanded="true"] { outline: 2px solid var(--link); outline-offset: 1px; }
.avatar-gallery-panel {
    flex: 1 0 100%;
    max-height: 20rem;
    overflow-y: auto;
    padding: 0.25rem 0.6rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.avatar-gallery-panel[hidden] { display: none !important; }
.avatar-gallery-panel h3 {
    margin: 0.6rem 0 0.35rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.avatar-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 0.4rem;
}
.avatar-gallery .avatar-gallery-choice {
    display: block;
    width: 64px;
    height: 64px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    box-shadow: none;
    overflow: hidden;
}
.avatar-gallery .avatar-gallery-choice:hover,
.avatar-gallery .avatar-gallery-choice:focus-visible {
    background: transparent;
    outline: 2px solid var(--link);
    outline-offset: 1px;
}
.avatar-gallery-choice img {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: cover;
}
