/* ═══════════════════════════════════════════════════════════════
   AUDIO ROOM — PARTICIPANTS GRID
   Discord-style: grid fills all available space without scrolling.
   Layout adapts to participant count via data-count attribute.
   ═══════════════════════════════════════════════════════════════ */

.participants-grid {
    display: grid;
    gap: 12px;
    padding: 12px;
    /* CRITICAL: flex-grow + min-height:0 ensures grid never overflows
       the 100vh parent. Without min-height:0 flex children ignore shrink. */
    flex-grow: 1;
    min-height: 0;
    overflow: hidden; /* No scroll — grid scales to fit */
    box-sizing: border-box;
}

    /* ── 1 participant: single card fills entire grid ── */
    .participants-grid[data-count="1"] {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* ── 2 participants: side by side, full height ── */
    .participants-grid[data-count="2"] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
    }

    /* ── 3 participants: 2+1 layout (Discord style) ── */
    .participants-grid[data-count="3"] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }
        /* Third card spans both columns on second row */
        .participants-grid[data-count="3"] .participant-card:nth-child(3) {
            grid-column: 1 / -1;
        }

    /* ── 4 participants: 2x2 ── */
    .participants-grid[data-count="4"] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    /* ── 5 participants: 3+2 ── */
    .participants-grid[data-count="5"] {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr 1fr;
    }

    /* ── 6 participants: 3x2 ── */
    .participants-grid[data-count="6"] {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr 1fr;
    }

    /* ── 7-9 participants: 3x3 ── */
    .participants-grid[data-count="7"],
    .participants-grid[data-count="8"],
    .participants-grid[data-count="9"] {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }

    /* ── 10+ participants: 4-column auto rows ── */
    .participants-grid[data-count="10"],
    .participants-grid[data-count="11"],
    .participants-grid[data-count="12"] {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr 1fr 1fr;
    }

/* ═══════════════════════════════════════════════════════════════
   PARTICIPANT CARD
   All inner elements use position:absolute so that nothing
   disrupts the card's own dimensions. Avatar is centered with
   top/left 50% + transform — the only reliable method
   when siblings are absolutely positioned.
   ═══════════════════════════════════════════════════════════════ */

.participant-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px !important;
    /* Reset MudPaper flex so it doesn't interfere with our absolute layout */
    display: block !important;
    min-height: 0;
}

/* Gradient glow background on speaking */
.participant-volume-bg {
    position: absolute;
    inset: 0;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 0;
}

/* ── FIX 3: AVATAR CENTRE BLOCK ─────────────────────────────── */
/* Absolute centering via transform — immune to sibling positioning.
   Contains avatar + dB label stacked vertically. */
.participant-card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%); /* -55% nudges up slightly for name badge clearance */
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}

.participant-card-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── FIX (dB label): real-time dB value below avatar ─────── */
.participant-db-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.03em;
    text-align: center;
    min-width: 3.5rem; /* stable width so layout doesn't jump on value change */
    transition: opacity 0.3s ease;
}

    .participant-db-label.silent {
        opacity: 0.3;
    }

/* ── SPECTRUM CANVAS — 12-bar MD3 equalizer ───────────────────── */
/* Canvas element where audioVisualizer.js draws frequency bars.
   Always visible (resting bars at min height).
   Positioned at card bottom-centre, above name badge. */
.participant-viz-canvas {
    position: absolute;
    bottom: 34px; /* clears name badge (~24px) + 10px margin */
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 56px;
    z-index: 1;
    border-radius: 6px;
    opacity: 0.35;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: block;
}
/* Full opacity when speaking */
.speaking-border .participant-viz-canvas {
    opacity: 1;
}

/* ── NAME BADGE ─────────────────────────────────────────────── */
.participant-card-name-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px; /* stretch to prevent overflow */
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Speaking border glow — primary colour to match brand & equalizer */
.speaking-border {
    border: 2px solid var(--color-primary) !important;
    box-shadow: inset 0 0 16px rgba(157, 36, 153, 0.25);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROL BAR
   ═══════════════════════════════════════════════════════════════ */

.audio-room-fullpage {
    background: var(--color-background, #1a1a1a);
}

.audio-room-control-bar {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-700) 100%) !important;
    color: var(--color-accent) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    min-height: 52px;
}

/* Room icon + participant count inline */
.audio-room-room-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.audio-room-control-icon {
    width: 28px;
    height: 28px;
    opacity: 0.95;
    display: block;
    flex-shrink: 0;
}

.audio-room-participant-count {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-accent);
    opacity: 0.9;
    white-space: nowrap;
}

.audio-room-stat-label {
    opacity: 0.8;
    font-size: 0.7rem !important;
}

.audio-room-stat-value {
    font-weight: bold !important;
    font-size: 0.8rem !important;
}

/* Connection badge: clean transparent style — no MudPaper grey */
.audio-room-connection-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-accent) !important;
    font-size: 0.78rem;
    transition: background 0.3s ease;
}

/* Right group — margin-left:auto docks Leave to far right */
.audio-bar-right-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.audio-controls-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════
   CONNECTION INDICATOR DOT
   ═══════════════════════════════════════════════════════════════ */

.connection-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

    .connection-indicator.connected {
        background: #4caf50;
        box-shadow: 0 0 6px #4caf50;
        animation: pulse 2s infinite;
    }

    .connection-indicator.connecting {
        background: #ff9800;
        animation: blink 1s infinite;
    }

    .connection-indicator.disconnected {
        background: #f44336;
        box-shadow: 0 0 6px #f44336;
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }

    25%, 75% {
        opacity: 0.3;
    }
}

/* ═══════════════════════════════════════════════════════════════
   CONTROL BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.audio-control-btn .mud-icon-root,
.audio-control-btn .mud-icon-root svg {
    font-size: 1rem !important;
    width: 1rem !important;
    height: 1rem !important;
}

/* Layout only — colours come from MudButton Color prop + MudBlazor dark theme */
.audio-control-btn {
    min-width: 110px !important;
    padding: 6px 14px !important;
    font-size: 0.82rem !important;
    font-weight: 600;
    cursor: pointer;
    transition: var(--btn-transition);
    box-shadow: var(--elevation-1);
    position: relative;
    white-space: nowrap;
}

    .audio-control-btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--elevation-2);
    }

    .audio-control-btn:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }

    .audio-control-btn:active {
        transform: translateY(0);
    }

/* Fixed width for hear-self — prevents layout shift on On/Off change */
.audio-control-btn-hear-self {
    min-width: 130px !important;
}

/* Icon sizes follow MudBlazor Size prop — no global overrides needed. */

/* ═══════════════════════════════════════════════════════════════
   ROOM LIST PAGE (browse/card view — unchanged)
   ═══════════════════════════════════════════════════════════════ */

.audio-room-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-700) 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.audio-room-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.audio-room-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.audio-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    font-size: 0.875rem;
    color: var(--color-accent);
}

.connection-status-panel {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--elev-1);
}

.connection-status-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.participants-panel {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--elev-1);
    height: 100%;
}

.participants-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: rgba(157, 36, 153, 0.1);
    transition: background 0.2s ease;
}

    .participant-item:hover {
        background: rgba(157, 36, 153, 0.2);
    }

.participant-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.875rem;
}

.participant-name {
    font-size: 0.95rem;
    color: var(--color-accent);
    font-weight: 500;
}

.participant-status {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.participant-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.participant-meters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spectrum-canvas {
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    display: block;
}

.volume-db {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    min-width: 3rem;
}

.audio-room-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--elev-1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

    .audio-room-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(157, 36, 153, 0.3);
    }

.audio-room-card-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-700) 100%);
    padding: 1.5rem;
    position: relative;
}

.audio-room-card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.audio-room-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.audio-room-card-participants {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-accent);
    font-weight: 600;
}

.audio-room-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.audio-room-card-description {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    line-height: 1.5;
    flex: 1;
}

.audio-room-card-meta {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.audio-room-card-meta-icon {
    font-size: 0.875rem !important;
    width: 0.875rem !important;
    height: 0.875rem !important;
}

.audio-room-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
}

/* ── Card join button: uses .btn-app--fill from common.css.
      This extra class just stretches it to fill the card actions row. ── */
.audio-room-card-join {
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640.98px) {
    /* On mobile: single column, fixed row height, allow scroll */
    .participants-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: unset !important;
        grid-auto-rows: 160px;
        overflow-y: auto;
    }
        /* Reset any span overrides */
        .participants-grid .participant-card {
            grid-column: unset !important;
        }

    .audio-controls-container {
        flex-direction: column;
        align-items: stretch;
    }

    .audio-room-card-header {
        padding: 1rem;
    }

    .audio-room-card-title {
        font-size: 1.1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ROOM FULL CHIP (inside participant badge on card)
   ═══════════════════════════════════════════════════════════════ */

.room-full-chip {
    display: inline-block;
    background: var(--mud-palette-error);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0.04em;
    line-height: 1.4;
    margin-left: 4px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   INLINE ICON HELPER (Material Icons ligature, controllable size)
   Use instead of standalone MudIcon to avoid uncontrolled sizing.
   ═══════════════════════════════════════════════════════════════ */

.audio-inline-icon {
    font-size: 1rem;          /* 16px — matches button icons */
    line-height: 1;
    vertical-align: middle;
    flex-shrink: 0;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════
   MIC SENSITIVITY MODAL OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.audio-sensitivity-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.audio-sensitivity-modal {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    width: 340px;
    box-shadow: 0 8px 12px 6px rgba(0,0,0,0.15), 0 4px 4px rgba(0,0,0,0.3);
    animation: slideUp 0.2s ease;
    overflow: hidden;
}

.audio-sensitivity-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-accent, white);
}

/* ── Modal header icon ───────────────────────────────────────── */

.audio-sens-header-icon {
    font-size: 20px;
    line-height: 1;
    opacity: 0.75;
    flex-shrink: 0;
    margin-right: 8px;
}

/* ── Modal header close button ───────────────────────────────── */

.audio-sens-close-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}

.audio-sens-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.87);
}

.audio-sens-close-btn .material-symbols-rounded {
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Modal body ───────────────────────────────────────────────── */

.audio-sensitivity-modal-body {
    padding: 4px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

/* ── Gain numeric display (MD3 Display-Small style) ──────────── */

.audio-sensitivity-gain-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 14px;
    gap: 6px;
}

.audio-sensitivity-gain-value {
    font-size: 3rem;
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.87);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.audio-sensitivity-gain-unit {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.4;
    vertical-align: super;
    line-height: 1;
    margin-left: 2px;
}

.audio-sensitivity-gain-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #b83db5;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ── Slider: let it fill the container width ──────────────────── */

.audio-sensitivity-slider {
    width: 100%;
    padding: 8px 0 0;
}

/* ── Track edge labels: Silent / Normal / Boosted ────────────── */

.audio-sensitivity-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px 0;
    font-size: 0.67rem;
    color: rgba(255, 255, 255, 0.32);
    letter-spacing: 0.025em;
    user-select: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════
   TEXT CHAT PANEL
   Fixed-width right column inside the room body flex container.
   ═══════════════════════════════════════════════════════════════ */

.audio-chat-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.45);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.audio-chat-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent, white);
    flex-shrink: 0;
}

.audio-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

    .audio-chat-messages::-webkit-scrollbar {
        width: 4px;
    }

    .audio-chat-messages::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.15);
        border-radius: 4px;
    }

.audio-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    text-align: center;
    padding: 2rem 1rem;
}

.audio-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

    .audio-chat-msg.own {
        align-self: flex-end;
        align-items: flex-end;
    }

    .audio-chat-msg.other {
        align-self: flex-start;
        align-items: flex-start;
    }

.audio-chat-msg-author {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 2px;
    padding: 0 4px;
}

.audio-chat-msg-bubble {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
    line-height: 1.4;
}

.audio-chat-msg.own .audio-chat-msg-bubble {
    background: var(--btn-fill-bg);
    color: white;
}

.audio-chat-msg-time {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
    padding: 0 4px;
}

.audio-chat-input-row {
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

    .audio-chat-input-row .mud-input-root {
        color: rgba(255, 255, 255, 0.9) !important;
    }

    .audio-chat-input-row .mud-input-outlined-border {
        border-color: rgba(255, 255, 255, 0.2) !important;
    }

    .audio-chat-input-row .mud-input-outlined:hover .mud-input-outlined-border {
        border-color: rgba(255, 255, 255, 0.5) !important;
    }

/* Close button in chat header — native button, no MudBlazor quirks */
.audio-chat-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

    .audio-chat-close-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        color: white;
    }

/* Send button in chat input — native button */
.audio-chat-send-btn {
    background: var(--btn-fill-bg);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

    .audio-chat-send-btn:hover {
        opacity: 0.85;
    }

    .audio-chat-send-btn:active {
        opacity: 0.7;
    }

    /* Icon inside send button — force small size */
    .audio-chat-send-btn .mud-icon-root {
        font-size: 1rem !important;
        width: 1rem !important;
        height: 1rem !important;
    }

@media (max-width: 640.98px) {
    .audio-chat-panel {
        position: fixed;
        right: 0;
        top: 52px;
        bottom: 0;
        z-index: 100;
        width: 100vw;
        max-width: 320px;
        box-shadow: -4px 0 20px rgba(0,0,0,0.5);
    }
}

/* ═══════════════════════════════════════════════════════════════
   REFRESH BUTTON — replaces MudTooltip+MudIconButton (no layout shifts)
   ═══════════════════════════════════════════════════════════════ */

.ar-refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;   /* vertical centering inside the flex header row */
    flex-shrink: 0;
    transition: background 0.2s ease;
    padding: 0;
}

.ar-refresh-btn .material-symbols-rounded {
    font-size: 1.1rem;
    line-height: 1;
}

.ar-refresh-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
}

.ar-refresh-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.ar-refresh-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@keyframes ar-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.ar-spin {
    animation: ar-spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE — MD3 guidelines: centred, unobtrusive, max-width content
   ═══════════════════════════════════════════════════════════════ */

.ar-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px 48px;
    text-align: center;
}

.ar-empty-state-icon {
    font-size: 80px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.12);
    margin-bottom: 20px;
    display: block;
}

.ar-empty-state-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.87);
    margin: 0 0 8px;
    letter-spacing: 0.01em;
}

.ar-empty-state-body {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 28px;
    max-width: 280px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   TWO-PANEL SPLIT LAYOUT  (AudioRooms page)
   Sidebar on the left, AudioRoomPanel on the right.
   Fills the entire viewport below the sticky nav bar without scrolling.
   ═══════════════════════════════════════════════════════════════ */

.ar-split-layout {
    display: flex;
    flex-direction: row;
    /* --nav-height is measured in JS on first render (actual .top-nav height).
       Fallback 6rem covers the two-row nav (brand bar + links row).
       Negative margins cancel article.content padding so the layout fills
       all four viewport edges below the sticky nav without a scrollbar.  */
    height: calc(100vh - var(--nav-height, 6rem));
    margin: -1.5rem -2rem -2rem;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.ar-sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.ar-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    gap: 6px;
    flex-shrink: 0;
}

.ar-sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.87);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Create button (circular, matching refresh btn style) ── */

.ar-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(157, 36, 153, 0.25);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.ar-create-btn:hover {
    background: rgba(157, 36, 153, 0.45);
}

.ar-create-btn:active {
    background: rgba(157, 36, 153, 0.6);
}

.ar-create-btn .material-symbols-rounded {
    font-size: 1.1rem;
    line-height: 1;
}

/* Override refresh btn size in sidebar header */
.ar-sidebar-header .ar-refresh-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

.ar-sidebar-header .ar-refresh-btn .material-symbols-rounded {
    font-size: 1.1rem;
}

/* ── Search ──────────────────────────────────────────────────── */

.ar-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.ar-search-icon {
    font-size: 1rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.ar-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    min-width: 0;
}

.ar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ── Room list ────────────────────────────────────────────────── */

.ar-room-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.ar-room-list::-webkit-scrollbar { width: 4px; }
.ar-room-list::-webkit-scrollbar-track { background: transparent; }
.ar-room-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.ar-room-list-loading {
    display: flex;
    justify-content: center;
    padding: 24px;
}

/* ── Sidebar empty state ─────────────────────────────────────── */

.ar-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    text-align: center;
    gap: 8px;
}

.ar-sidebar-empty-icon {
    font-size: 40px;
    color: rgba(255, 255, 255, 0.1);
    line-height: 1;
}

.ar-sidebar-empty-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.38);
    margin: 0;
    line-height: 1.4;
}

/* ── Room item ────────────────────────────────────────────────── */

.ar-room-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
    position: relative;
}

.ar-room-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ar-room-item.selected {
    background: rgba(157, 36, 153, 0.18);
    border-left-color: var(--color-primary);
}

.ar-room-item.full {
    opacity: 0.55;
    cursor: not-allowed;
}

.ar-room-item-top {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.ar-room-item-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.87);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ar-room-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.ar-room-lock-icon {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
}

.ar-room-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 80, 80, 0.6);
    cursor: pointer;
    padding: 0;
    transition: background 0.12s ease, color 0.12s ease;
    opacity: 0;
}

.ar-room-item:hover .ar-room-delete-btn {
    opacity: 1;
}

.ar-room-delete-btn:hover {
    background: rgba(255, 80, 80, 0.15);
    color: rgba(255, 100, 100, 0.9);
}

.ar-room-delete-btn .material-symbols-rounded {
    font-size: 0.85rem;
    line-height: 1;
}

.ar-room-item-bottom {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
}

/* ── Right panel ─────────────────────────────────────────────── */

.ar-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Panel empty state ───────────────────────────────────────── */

.ar-panel-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 32px;
    text-align: center;
}

.ar-panel-empty-icon {
    font-size: 72px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.07);
    margin-bottom: 8px;
    display: block;
    font-variation-settings: 'FILL' 0, 'wght' 200;
}

.ar-panel-empty-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.ar-panel-empty-body {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.28);
    margin: 0;
    max-width: 300px;
    line-height: 1.5;
}

/* ── Active room item (user is currently inside) ────────────── */

.ar-room-item.active-room {
    cursor: default;
    background: rgba(157, 36, 153, 0.14);
    border-left-color: var(--color-primary);
}

.ar-room-item.active-room:hover {
    background: rgba(157, 36, 153, 0.18);
}

.ar-room-active-badge {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-primary);
    background: rgba(157, 36, 153, 0.18);
    border: 1px solid rgba(157, 36, 153, 0.4);
    border-radius: 3px;
    padding: 1px 5px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ── Participant avatar row ───────────────────────────────────── */

.ar-room-avatars {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;           /* overlap handled by negative margin on each avatar */
    margin: 3px 0 1px;
}

.ar-room-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #1e1e1e;
    background: #333;
    overflow: hidden;
    flex-shrink: 0;
    margin-left: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ar-room-avatars .ar-room-avatar:first-child {
    margin-left: 0;
}

.ar-room-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ar-room-avatar-fallback {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1;
    display: none;   /* shown via JS onerror */
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #444;
}

.ar-room-avatar-overflow {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    background: #3a3a3a;
    letter-spacing: -0.02em;
}

/* ── Responsive: on narrow screens stack sidebar above panel ── */
@media (max-width: 700px) {
    .ar-split-layout {
        flex-direction: column;
        height: auto;
    }

    .ar-sidebar {
        width: 100%;
        max-width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .ar-panel {
        flex: 1;
        min-height: 60vh;
    }
}
