/* ==========================================================================
   PROFILES — the "who's listening?" sign-in screen and the Profile tab
   ========================================================================== */

/* ---------- Sign-in screen ---------- */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    background: var(--bg);
    overflow-y: auto;
}
.login-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.login-card h1 {
    text-align: center;
    font-size: 1.8rem;
    margin: 0 0 6px;
}
.login-sub {
    margin: 0 0 24px;
    color: #b3b3b3;
    font-size: 0.95rem;
}
.login-names {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}
.login-names:empty {
    display: none;
}
.login-name-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 92px;
    padding: 12px 6px;
    background: transparent;
    color: #ffffff;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
}
.login-name-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}
.login-avatar,
.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 800;
    overflow: hidden;
}
.login-avatar img,
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.login-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.6rem;
}
.login-chip-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.login-form {
    text-align: left;
}
.login-form input[type="text"] {
    height: 50px;
    font-size: 1rem;
    margin-bottom: 12px;
}
.login-form button {
    width: 100%;
    min-height: 50px;
    margin-bottom: 10px;
}
.login-create-btn {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}
.login-create-btn:hover {
    background: rgba(var(--accent-rgb), 0.12);
}
.login-message {
    min-height: 1.2em;
    margin: 4px 0 0;
    text-align: center;
    font-size: 0.88rem;
    color: #f87171;
}

/* ---------- Profile tab ---------- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 6px 0 20px;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    font-size: 2rem;
    flex-shrink: 0;
}
.avatar-upload-wrap {
    position: relative;
    flex-shrink: 0;
}
.avatar-upload-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: #2a2a2a;
    color: #ffffff;
    border: 2px solid var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-upload-btn:hover {
    background: #3a3a3a;
}
.profile-heading h1 {
    margin: 0;
    font-size: 1.5rem;
    overflow-wrap: anywhere;
}
.profile-sub {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #b3b3b3;
}
.profile-card {
    margin-bottom: 14px;
    padding: 18px;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
}
.profile-card h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}
.profile-note {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #b3b3b3;
}
.profile-note + .slider-row {
    margin-top: 14px;
}
.profile-sound-reset-btn {
    display: block;
    margin: 14px 0 0;
}

.swatch-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.swatch {
    position: relative;
    height: 48px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 50%;
    max-width: 56px;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    justify-self: center;
}
.swatch:hover {
    transform: scale(1.06);
}
.swatch.selected {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px var(--bg) inset;
}
.custom-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid #2a2a2a;
    text-transform: none;
    font-size: 0.92rem;
    color: #ffffff;
}
.custom-color-row input[type="color"] {
    width: 56px;
    height: 36px;
    padding: 0;
    border: 2px solid #3e3e3e;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.bg-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.bg-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    background: transparent;
    color: #b3b3b3;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.bg-option:hover {
    background: rgba(255, 255, 255, 0.05);
}
.bg-option.selected {
    color: #ffffff;
    border-color: var(--accent);
}
.bg-preview {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #3e3e3e;
}

.sign-out-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin-top: 6px;
    background: transparent;
    color: #ffffff;
    border: 1px solid #727272;
}
.sign-out-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: #ffffff;
}

.menu-empty-note {
    margin: 0 0 8px;
    font-size: 0.85rem;
    color: #b3b3b3;
}

@media (min-width: 769px) {
    #view-profile {
        max-width: 560px;
        margin: 0 auto;
    }
}

/* Only appear when the server asks for them, so the usual sign-in stays a
   name and a button. */
.login-extra-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    text-align: left;
}
.login-extra-row.hidden {
    display: none;
}
.login-extra-row input {
    text-transform: none;
}
#login-invite {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
