/* ---------------------------------------------------------------------------
   Group voice chat — the round mic control and its three states, the level meter, the top-bar voice pill,
   and the voice bar's participant strip. Backed by VoiceBar.razor, VoicePill.razor, VoiceMic.razor.
   See docs/design/voice-chat.md.
   --------------------------------------------------------------------------- */

/* The mic's three states: not yet enabled (recvonly, in the call but sending nothing — a quiet mic), live
   (sending, green ring + glow), and muted (captured but disabled). The first press acquires the mic (the
   gesture browsers require); later presses toggle mute. A speaking group member wears a matching green glow
   on their roster row (css/group.css) and on the voice-bar avatar below. */
.voice-mic {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 9999px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.voice-mic:hover { background: var(--bg-hover); border-color: var(--accent-blue); }
.voice-mic--off { color: var(--text-muted); }
.voice-mic--on {
    color: var(--text-status-positive);
    border-color: var(--accent-green);
    /* A steady green ring (not a pulse) so the live state reads unambiguously as "on" rather than "loading". */
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-green) 35%, transparent);
}
.voice-mic--muted { color: var(--text-muted); border-color: var(--border-color); }
/* A small listening meter beside the mic button while the local mic is live: bars animate with the real-time
   audio level so the player can see the mic is hearing them. */
.voice-meter { display: inline-flex; align-items: flex-end; gap: 0.12rem; height: 2.1rem; padding: 0.35rem 0.3rem; }
.voice-meter__bar {
    width: 0.18rem;
    min-height: 0.18rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--accent-green) 70%, var(--border-color));
    transition: height 0.08s linear;
}
/* The top-bar voice pill: shown only while in a call, so the player can always tell they're participating and
   mute or leave it from anywhere. Holds the mute/enable toggle, the listening meter, and a hang-up. The pill
   itself wears a green tint while audio is flowing, mirroring the mic's live glow. See docs/design/voice-chat.md. */
.voice-pill {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.2rem 0.15rem 0.3rem;
    border-radius: 9999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.voice-pill--live {
    background: color-mix(in srgb, var(--accent-green) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent-green) 45%, var(--border-color));
}
.voice-pill__hangup {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.voice-pill__hangup:hover { color: var(--accent-red-ink); background: color-mix(in srgb, var(--accent-red) 14%, transparent); }
/* The voice bar in the group conversation: the single place a member joins or leaves the group voice
   channel and sees who's in it. A Join button until the player is in the call, then the participants' avatars
   (each glowing while speaking) and a Leave button. See docs/design/voice-chat.md. */
.voice-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.voice-bar--live { border-color: color-mix(in srgb, var(--accent-green) 45%, var(--border-color)); }
.voice-bar__icon { font-size: 0.95rem; line-height: 1; }
.voice-bar__label { font-weight: 600; white-space: nowrap; }
.voice-bar__members { display: inline-flex; align-items: center; gap: 0.25rem; margin-inline: auto 0; }
.voice-bar__avatar { --avatar-size: var(--avatar-xs); }
.voice-bar__join,
.voice-bar__leave {
    flex: none;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.voice-bar__join { color: var(--accent-blue-ink); background: color-mix(in srgb, var(--accent-blue) 12%, transparent); }
.voice-bar__join:hover { background: color-mix(in srgb, var(--accent-blue) 20%, transparent); }
.voice-bar__leave { color: var(--text-muted); background: transparent; border-color: var(--border-color); }
.voice-bar__leave:hover { color: var(--accent-red-ink); border-color: color-mix(in srgb, var(--accent-red) 40%, var(--border-color)); }
