:root {
    --bg-base: #030508;
    --bg-surface: #0a0e17;
    --bg-glass: rgba(12, 16, 28, 0.65);
    --primary: #00f0ff;
    --primary-dim: rgba(0, 240, 255, 0.12);
    --primary-glow: rgba(0, 240, 255, 0.4);
    --secondary: #7000ff;
    --accent: #a855f7;
    --text-main: #edf2f7;
    --text-dim: #64748b;
    --glass-border: rgba(255, 255, 255, 0.06);
    --danger: #ff3366;
    --gold: #fbbf24;
    --sidebar-w: 280px;
    --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:where(button, a, input, select):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

body.immersive-mode {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    height: 100dvh; width: 100vw;
    overflow: hidden;
    display: flex; flex-direction: column;
}

/* ── Canvas ──────────────────────────────────── */
/* ── Canvas Mascot Widget ───────────────────── */
#canvas-container {
    position: fixed;
    top: 90px;
    bottom: auto;
    right: 24px;
    width: 200px;
    height: 200px;
    z-index: 30;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}
#canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
#canvas-container:hover {
    transform: translateY(5px);
}
#canvas-container:not(.minimized):not(:hover) {
    animation: mascotFloat 5s ease-in-out infinite;
}
#canvas-container.fallback-active {
    width: 168px;
    height: 178px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#canvas-container.minimized {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    top: 90px;
    bottom: auto;
    right: 24px;
    background: rgba(8, 12, 24, 0.8);
    border: 1px solid rgba(0, 240, 255, 0.35);
    box-shadow: 0 8px 32px rgba(0, 240, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
#canvas-container.minimized:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 240, 255, 0.45);
}

.mascot-toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1010;
    transition: all 0.2s ease;
    opacity: 0;
}
#canvas-container:hover .mascot-toggle-btn {
    opacity: 1;
}
.mascot-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
#canvas-container.minimized .mascot-toggle-btn {
    display: none;
}

.mascot-fallback {
    position: relative;
    width: 168px;
    min-height: 178px;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.mascot-fallback-avatar {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 28px 28px 32px 32px;
    background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,0.95), rgba(237,242,247,0.62) 34%, rgba(148,163,184,0.32) 72%),
        linear-gradient(145deg, rgba(255,255,255,0.36), rgba(0,240,255,0.12));
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow:
        0 16px 38px rgba(0,0,0,0.34),
        0 0 34px rgba(0,240,255,0.22),
        inset 0 1px 0 rgba(255,255,255,0.7);
    display: grid;
    place-items: center;
    animation: mascotBuddyFloat 4.8s ease-in-out infinite;
}
.mascot-fallback-avatar::before {
    content: '';
    position: absolute;
    top: -13px;
    width: 2px;
    height: 18px;
    border-radius: 999px;
    background: rgba(0,240,255,0.8);
    box-shadow: 0 0 12px rgba(0,240,255,0.7);
}
.mascot-fallback-avatar::after {
    content: '';
    position: absolute;
    top: -20px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 18px rgba(0,240,255,0.9);
}
.mascot-fallback-face {
    position: relative;
    width: 62px;
    height: 45px;
    border-radius: 24px;
    background: rgba(3,8,26,0.96);
    box-shadow: inset 0 0 18px rgba(0,240,255,0.16);
}
.mascot-fallback-eye {
    position: absolute;
    top: 15px;
    width: 8px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 14px rgba(0,240,255,0.78);
    animation: mascotBlink 5.2s infinite;
}
.mascot-fallback-eye.eye-left { left: 15px; }
.mascot-fallback-eye.eye-right { right: 15px; }
.mascot-fallback-smile {
    position: absolute;
    left: 50%;
    bottom: 9px;
    width: 24px;
    height: 11px;
    transform: translateX(-50%);
    border-bottom: 2px solid var(--primary);
    border-radius: 0 0 24px 24px;
    filter: drop-shadow(0 0 7px rgba(0,240,255,0.65));
}
.mascot-fallback-status {
    position: absolute;
    right: 12px;
    bottom: 11px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 14px rgba(52,211,153,0.82);
    z-index: 2;
    animation: statusPulse 2.4s infinite;
}
.mascot-fallback-bubble {
    position: absolute;
    right: calc(100% - 4px);
    top: 16px;
    width: 188px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(0,240,255,0.28);
    background: rgba(8,12,24,0.94);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.35;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 0 20px rgba(0,240,255,0.1);
    pointer-events: none;
}
.mascot-fallback-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 24px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: rgba(8,12,24,0.94);
    border-top: 1px solid rgba(0,240,255,0.28);
    border-right: 1px solid rgba(0,240,255,0.28);
}
.mascot-fallback-toggle {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(3,8,26,0.72);
    color: var(--text-dim);
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity .2s, color .2s, border-color .2s;
}
#canvas-container.fallback-active:hover .mascot-fallback-toggle {
    opacity: 1;
}
.mascot-fallback-toggle:hover {
    color: var(--text-main);
    border-color: rgba(0,240,255,0.35);
}
#canvas-container.fallback-active.minimized .mascot-fallback {
    width: 68px;
    min-height: 68px;
}
#canvas-container.fallback-active.minimized .mascot-fallback-avatar {
    width: 54px;
    height: 54px;
    border-radius: 19px;
    animation: none;
}
#canvas-container.fallback-active.minimized .mascot-fallback-face {
    width: 39px;
    height: 30px;
    border-radius: 15px;
}
#canvas-container.fallback-active.minimized .mascot-fallback-eye {
    top: 10px;
    width: 5px;
    height: 8px;
}
#canvas-container.fallback-active.minimized .mascot-fallback-eye.eye-left { left: 10px; }
#canvas-container.fallback-active.minimized .mascot-fallback-eye.eye-right { right: 10px; }
#canvas-container.fallback-active.minimized .mascot-fallback-smile {
    width: 16px;
    height: 7px;
    bottom: 6px;
}
#canvas-container.fallback-active.minimized .mascot-fallback-bubble,
#canvas-container.fallback-active.minimized .mascot-fallback-toggle {
    display: none;
}

@keyframes mascotFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}
@keyframes mascotBuddyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes mascotBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.18); }
}
@media (prefers-reduced-motion: reduce) {
    #canvas-container,
    #canvas-container:not(.minimized):not(:hover),
    .mascot-fallback-avatar,
    .mascot-fallback-eye,
    .mascot-fallback-status,
    .mascot-bubble,
    .mascot-fallback-bubble {
        animation: none !important;
        transition: none !important;
    }
}
.nebula-overlay {
    position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background:
        radial-gradient(ellipse 60% 50% at 30% 60%, rgba(112,0,255,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 75% 30%, rgba(0,240,255,0.05) 0%, transparent 70%),
        radial-gradient(circle at center, transparent 30%, var(--bg-base) 100%);
}

/* ── Top Nav ─────────────────────────────────── */
.top-nav {
    position: relative; z-index: 20; width: 100%;
    padding: 0.7rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background: rgba(3,5,8,0.85);
    backdrop-filter: blur(24px);
    flex-shrink: 0;
}
.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem; font-weight: 800; letter-spacing: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 18px rgba(0,240,255,0.3));
}
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.online-stats {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.035);
    padding: 6px 14px; border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem; font-weight: 500; color: var(--text-dim);
}
.pulsing {
    width: 7px; height: 7px; background: var(--primary);
    border-radius: 50%; box-shadow: 0 0 6px rgba(0,240,255,0.7);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 var(--primary-glow); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.user-profile {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.04); padding: 5px 12px 5px 5px;
    border-radius: 100px; border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.15; }
.username { font-size: 0.8rem; font-weight: 600; }
.user-level { font-size: 0.65rem; color: var(--text-dim); cursor: pointer; transition: color .2s; }
.user-level { background: none; border: 0; padding: 0; text-align: left; font-family: inherit; }
.user-level i { display: none; }
.user-level:hover { color: var(--primary); }
.btn-auth {
    background: rgba(0,240,255,0.08); border: 1px solid rgba(0,240,255,0.2);
    color: var(--primary); padding: 6px 16px; border-radius: 100px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-auth:hover { background: rgba(0,240,255,0.15); box-shadow: 0 0 20px rgba(0,240,255,0.15); }
.sidebar-toggle {
    display: none; background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border); color: var(--text-main);
    width: 34px; height: 34px; border-radius: 10px;
    align-items: center; justify-content: center; cursor: pointer;
}

/* ── Layout ──────────────────────────────────── */
.app-layout {
    display: flex; flex: 1; position: relative; z-index: 10;
    overflow: hidden; height: calc(100dvh - 50px);
}

/* ── Sidebar ─────────────────────────────────── */
.control-panel {
    width: var(--sidebar-w); display: flex; flex-direction: column;
    padding: 1rem 0.85rem; gap: 0.65rem;
    overflow-y: auto; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(8,12,22,0.8) 0%, rgba(5,8,16,0.9) 100%);
    backdrop-filter: blur(30px) saturate(1.4);
    border-right: 1px solid rgba(255,255,255,0.04);
    transition: opacity .3s, transform .35s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
    z-index: 1100;
}
.control-panel::-webkit-scrollbar { width: 3px; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.panel-section {
    display: flex; flex-direction: column; gap: 0.55rem;
    padding: 0.85rem; border-radius: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    position: relative; overflow: hidden;
    flex: 0 0 auto;
}
.panel-section::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.panel-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 1.8px; font-weight: 600;
}
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-group label { font-size: 0.72rem; color: var(--text-dim); font-weight: 500; }
.panel-links {
    display: grid;
    gap: 6px;
}
.panel-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.78rem;
    padding: 7px 9px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}
.panel-links a:hover {
    border-color: rgba(0,240,255,0.24);
    color: var(--primary);
}
.glass-input {
    width: 100%; background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06); color: var(--text-main);
    padding: 8px 10px; border-radius: 10px; font-size: 0.82rem;
    appearance: none; cursor: pointer; transition: all .2s;
}
.glass-input:focus { border-color: rgba(0,240,255,0.3); box-shadow: 0 0 0 3px rgba(0,240,255,0.08); }

.tags-container { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-dim); padding: 4px 10px; border-radius: 100px;
    font-size: 0.72rem; cursor: pointer; transition: all .2s; font-weight: 500;
}
.tag:hover { background: rgba(255,255,255,0.07); color: var(--text-main); transform: translateY(-1px); }
.tag.active {
    background: rgba(0,240,255,0.1); border-color: rgba(0,240,255,0.25);
    color: var(--primary); box-shadow: 0 0 12px rgba(0,240,255,0.1);
}

.premium-module {
    background: linear-gradient(135deg, rgba(251,191,36,0.06), rgba(245,158,11,0.03)) !important;
    border-color: rgba(251,191,36,0.15) !important;
}
.premium-module::before { background: linear-gradient(90deg, transparent, rgba(251,191,36,0.12), transparent) !important; }
.premium-module h3 { color: var(--gold) !important; display: flex; align-items: center; gap: 4px; }
.premium-module p { font-size: 0.7rem; color: var(--text-dim); line-height: 1.4; }

.tabs { display: flex; gap: 2px; background: rgba(255,255,255,0.03); border-radius: 8px; padding: 2px; }
.tab {
    background: transparent; border: none; color: var(--text-dim);
    padding: 5px 12px; font-size: 0.75rem; cursor: pointer;
    border-radius: 6px; transition: all .2s; font-weight: 500;
}
.tab.active { color: var(--primary); background: rgba(0,240,255,0.08); }
.recent-list { overflow-y: auto; max-height: 120px; }
.empty-state { font-size: 0.75rem; color: var(--text-dim); font-style: italic; opacity: 0.7; }

/* ── Main Stage ──────────────────────────────── */
.main-stage {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.state-container {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.8rem; text-align: center; width: 100%; max-width: 760px;
    padding: 2rem; transition: opacity .5s;
    z-index: 10;
}
#lobby-state, #invite-landing-state {
    transform: translateY(-2vh);
}
.glitch-text {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.1rem, 4.4vw, 3.65rem); font-weight: 800; line-height: 1.02;
    color: white;
    text-shadow: 0 0 60px rgba(0,240,255,0.2), 0 0 120px rgba(112,0,255,0.1);
}
.lobby-subcopy {
    width: min(620px, 100%);
    line-height: 1.42;
    margin-bottom: 0.05rem;
}
.main-stage p { font-size: 0.98rem; color: var(--text-dim); font-weight: 400; }
.status-text {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem; color: var(--primary); font-weight: 500;
    animation: fadeIn .4s ease;
}
.status-text::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary); animation: pulse 1.5s infinite;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Buttons ─────────────────────────────────── */
.btn {
    padding: 10px 20px; border: none; border-radius: 10px;
    font-weight: 600; cursor: pointer; transition: all .25s;
    font-size: 0.9rem; font-family: 'Inter', sans-serif;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #000; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(112,0,255,0.4); }
.btn-secondary {
    background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
    color: var(--text-main); backdrop-filter: blur(8px);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }

.massive-btn {
    padding: 16px 48px; font-size: 1.25rem; border-radius: 100px;
    margin-top: 1rem; position: relative; overflow: hidden;
    box-shadow: 0 0 40px rgba(0,240,255,0.25), 0 0 80px rgba(112,0,255,0.15);
    animation: breathe 4s ease-in-out infinite;
    letter-spacing: 0.5px;
}
.massive-btn::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%);
    transform: translateX(-100%); animation: shimmer 3s infinite 1s;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes breathe {
    0%,100% { box-shadow: 0 0 40px rgba(0,240,255,0.25), 0 0 80px rgba(112,0,255,0.15); }
    50% { box-shadow: 0 0 50px rgba(0,240,255,0.35), 0 0 100px rgba(112,0,255,0.25); }
}
.massive-btn:hover { transform: translateY(-3px) scale(1.03); }

.danger { color: var(--danger) !important; border-color: rgba(255,51,102,0.2) !important; }
.danger:hover { background: rgba(255,51,102,0.08) !important; }

/* ── Call Card ────────────────────────────────── */
.call-card {
    background: rgba(10,14,26,0.75);
    backdrop-filter: blur(40px) saturate(1.6);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 24px; padding: 1.8rem;
    width: 100%; max-width: 480px;
    display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.03),
        0 20px 60px rgba(0,0,0,0.5),
        0 0 80px rgba(0,240,255,0.04),
        0 0 120px rgba(112,0,255,0.03);
    animation: cardIn .5s cubic-bezier(.4,0,.2,1);
    position: relative; overflow: hidden;
}
.call-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent 10%, rgba(0,240,255,0.15) 50%, transparent 90%);
}
@keyframes cardIn { from { opacity: 0; transform: scale(.96) translateY(16px); } to { opacity: 1; transform: none; } }

/* Timer */
.session-timer-wrap {
    position: relative; width: 96px; height: 96px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.timer-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: rgba(255,255,255,0.04); stroke-width: 3.5; }
.timer-progress {
    fill: none; stroke: url(#timerGrad); stroke-width: 3.5;
    stroke-linecap: round; stroke-dasharray: 283; stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 4px rgba(0,240,255,0.4));
}
.timer-display { display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1; }
.timer-value {
    font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700;
    color: var(--primary); text-shadow: 0 0 16px rgba(0,240,255,0.3); line-height: 1;
    font-variant-numeric: tabular-nums;
}
.timer-label { font-size: 0.55rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 2px; }
.timer-value.warning { color: #f59e0b; text-shadow: 0 0 16px rgba(245,158,11,0.4); }
.timer-value.critical { color: var(--danger); text-shadow: 0 0 16px rgba(255,51,102,0.4); animation: blink .6s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.partner-info { display: flex; flex-direction: column; gap: 3px; }
.partner-name { font-family: 'Outfit', sans-serif; font-size: 1.15rem; font-weight: 700; }
.partner-status { display: flex; align-items: center; gap: 5px; font-size: 0.7rem; color: var(--primary); font-weight: 500; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: pulse 1.5s infinite; }

.icebreaker-card {
    background: rgba(0,240,255,0.04); border: 1px solid rgba(0,240,255,0.1);
    padding: 10px 14px; border-radius: 12px; font-size: 0.8rem;
    color: rgba(0,240,255,0.85); font-weight: 500; text-align: left; width: 100%;
    line-height: 1.4; animation: slideDown .4s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.captions-container {
    background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.04);
    border-left: 2px solid var(--accent); padding: 10px 14px;
    border-radius: 12px; width: 100%; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
#transcript-preview { font-size: 0.88rem; color: rgba(255,255,255,0.6); font-style: italic; margin: 0; text-align: center; }

.voice-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.btn-circle {
    width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.04);
    color: var(--text-dim); display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .2s; backdrop-filter: blur(8px);
}
.btn-circle:hover { background: rgba(255,255,255,0.1); color: var(--text-main); transform: scale(1.08); }
.btn-circle.mic-active {
    background: rgba(0,240,255,0.1); border-color: rgba(0,240,255,0.25);
    color: var(--primary); box-shadow: 0 0 14px rgba(0,240,255,0.2);
}
.btn-circle.danger-circle {
    background: rgba(255,51,102,0.1); border-color: rgba(255,51,102,0.25);
    color: var(--danger); width: 56px; height: 56px;
    box-shadow: 0 0 16px rgba(255,51,102,0.12);
}
.btn-circle.danger-circle:hover { background: rgba(255,51,102,0.2); transform: scale(1.1); }

/* ── Chat ────────────────────────────────────── */
.chat-panel {
    position: absolute; bottom: 80px; right: 1.5rem;
    width: 300px; height: 360px; border-radius: 18px;
    display: flex; flex-direction: column; padding: 0.85rem; z-index: 100;
    background: rgba(8,12,22,0.88); backdrop-filter: blur(30px);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.chat-messages { flex: 1; overflow-y: auto; margin-bottom: 8px; display: flex; flex-direction: column; gap: 5px; }
.message { padding: 6px 10px; border-radius: 10px; font-size: 0.82rem; max-width: 85%; word-break: break-word; }
.message.sent { background: var(--primary); color: #000; align-self: flex-end; border-bottom-right-radius: 2px; font-weight: 500; }
.message.received { background: rgba(255,255,255,0.07); color: #fff; align-self: flex-start; border-bottom-left-radius: 2px; }
.message.system { background: transparent; color: var(--text-dim); font-size: 0.7rem; align-self: center; font-style: italic; }
.chat-input-container { display: flex; gap: 6px; }

/* ── Modal ────────────────────────────────────── */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px); display: flex; align-items: center;
    justify-content: center; z-index: 1000; opacity: 0;
    pointer-events: none; transition: all .3s;
}
.modal.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: rgba(12,16,28,0.95); padding: 2.2rem;
    border-radius: 24px; width: 100%; max-width: 380px;
    position: relative; border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 0 80px rgba(0,240,255,0.06), 0 40px 80px rgba(0,0,0,0.5);
}
.close-modal {
    position: absolute; top: 0.8rem; right: 1.1rem;
    background: none; border: none; color: var(--text-dim);
    font-size: 1.3rem; cursor: pointer;
}
.auth-forms { display: flex; flex-direction: column; gap: 8px; }

/* ── Utility ──────────────────────────────────── */
.hidden { display: none !important; }
.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 1050;
}

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 768px) {
    .top-nav { padding: 0.6rem 0.65rem; gap: 0.45rem; }
    .logo { font-size: 1.1rem; }
    .nav-right { gap: 0.35rem; min-width: 0; }
    .nav-right > * { flex-shrink: 0; }
    .online-stats { display: none; }
    .user-profile { padding: 0; background: transparent; border: 0; }
    .user-profile .avatar,
    .user-profile .username { display: none !important; }
    .user-info { display: flex; }
    .user-level {
        width: 34px;
        height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--glass-border);
        border-radius: 50%;
        background: rgba(255,255,255,0.04);
        color: var(--text-dim);
    }
    .user-level i { display: block; width: 16px; height: 16px; }
    .user-level span { display: none; }
    .sidebar-toggle { display: flex; flex: 0 0 34px; }
    #header-invite-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        align-items: center;
        justify-content: center;
    }
    #header-invite-text { display: none; }
    .control-panel {
        position: fixed; top: 55px; left: 0;
        width: 88vw; max-width: 320px; height: calc(100dvh - 55px);
        transform: translateX(-100%); z-index: 1100;
        padding: 1rem 0.75rem 2rem; border-right: 1px solid rgba(0,240,255,0.06);
    }
    .control-panel.open { transform: translateX(0); }
    .main-stage {
        padding: 0 1rem;
        align-items: flex-start;
        justify-content: flex-start;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .state-container { padding: 1rem; gap: 0.8rem; }
    #lobby-state, #invite-landing-state {
        transform: none;
        margin: 0 auto;
        padding-top: 1.5rem;
        padding-bottom: 3rem;
    }
    .glitch-text { font-size: clamp(1.8rem, 8vw, 2.8rem); }
    .massive-btn { padding: 14px 36px; font-size: 1.1rem; }
    .call-card { padding: 1.3rem; gap: 1rem; border-radius: 20px; }
    .session-timer-wrap { width: 80px; height: 80px; }
    .timer-value { font-size: 1.3rem; }
    .voice-actions { gap: 8px; }
    .chat-panel { position: fixed; bottom: 12px; left: 10px; right: 10px; width: auto; height: 280px; }
    .modal-content { margin: 1rem; padding: 1.8rem; }
}

@media (max-width: 380px) {
    .btn-circle { width: 42px; height: 42px; }
    .btn-circle.danger-circle { width: 50px; height: 50px; }
}

/* ── DM Chat Drawer ─────────────────────────── */
.dm-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 360px; max-width: 100vw;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(24px);
    border-left: 1px solid var(--glass-border);
    z-index: 1100;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dm-drawer:not(.hidden) {
    transform: translateX(0);
}
.dm-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(3, 5, 8, 0.6);
}
.dm-partner-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700; font-size: 0.95rem;
}
.dm-status {
    font-size: 0.7rem; color: var(--text-dim);
}
.dm-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 6px;
}
.dm-messages .dm-msg {
    max-width: 80%; padding: 8px 14px;
    border-radius: 16px; font-size: 0.85rem;
    line-height: 1.5; word-wrap: break-word;
}
.dm-messages .dm-msg.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #000; border-bottom-right-radius: 4px;
}
.dm-messages .dm-msg.received {
    align-self: flex-start;
    background: rgba(255,255,255,0.06);
    color: var(--text-main); border-bottom-left-radius: 4px;
}
.dm-messages .dm-msg .dm-time {
    font-size: 0.6rem; opacity: 0.6; margin-top: 2px;
    display: block;
}
.dm-input-bar {
    display: flex; gap: 8px; padding: 10px 16px;
    border-top: 1px solid var(--glass-border);
    background: rgba(3, 5, 8, 0.6);
}
.dm-msg-friend {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    cursor: pointer; transition: background 0.2s;
}
.dm-msg-friend:hover { background: rgba(255,255,255,0.04); }
.dm-msg-friend .dm-f-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #000;
    flex-shrink: 0;
}
.dm-msg-friend .dm-f-info { flex: 1; min-width: 0; }
.dm-msg-friend .dm-f-name { font-weight: 600; font-size: 0.85rem; }
.dm-msg-friend .dm-f-preview {
    font-size: 0.75rem; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-msg-friend .dm-f-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #34d399; flex-shrink: 0;
}
@media (max-width: 640px) {
    .dm-drawer { width: 100vw; }
}

/* ── Text Chat (Stranger) ───────────────────── */
.text-chat-container {
    width: 100%; max-width: 640px; margin: 0 auto;
    height: 70vh; max-height: 600px;
    display: flex; flex-direction: column;
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px; overflow: hidden;
    backdrop-filter: blur(20px);
}
.text-chat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(3,5,8,0.5);
}
.text-chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 6px;
}
.text-chat-messages .tc-msg {
    max-width: 75%; padding: 10px 16px;
    border-radius: 18px; font-size: 0.9rem;
    line-height: 1.5; word-wrap: break-word;
    animation: tcFadeIn 0.2s ease-out;
}
@keyframes tcFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.text-chat-messages .tc-msg.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #000; border-bottom-right-radius: 4px;
}
.text-chat-messages .tc-msg.received {
    align-self: flex-start;
    background: rgba(255,255,255,0.07);
    color: var(--text-main); border-bottom-left-radius: 4px;
}
.tc-system-msg {
    text-align: center; color: var(--text-dim);
    font-size: 0.75rem; padding: 8px;
    font-style: italic;
}
.ai-retry-system {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-retry-inline {
    border: 1px solid rgba(0,240,255,0.42);
    border-radius: 999px;
    background: rgba(0,240,255,0.08);
    color: var(--primary);
    font: inherit;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 800;
    padding: 4px 10px;
    cursor: pointer;
}
.ai-retry-inline:hover {
    background: rgba(0,240,255,0.14);
}
.tc-typing {
    align-self: flex-start; color: var(--text-dim);
    font-size: 0.8rem; font-style: italic; padding: 4px 16px;
}
.conversation-entry-grid {
    width: min(620px, 100%);
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
}
.ai-entry-panel,
.human-entry-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    box-shadow: 0 18px 70px rgba(0,0,0,0.16);
    text-align: left;
}
.ai-entry-panel {
    border-color: rgba(0,240,255,0.18);
}
.conversation-launcher-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.022));
    border-color: rgba(0,240,255,0.2);
}
.human-entry-panel {
    align-content: space-between;
}
.launcher-copy {
    display: grid;
    gap: 5px;
    text-align: center;
}
.launcher-copy span,
.human-quick-start span {
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.launcher-copy strong {
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.12rem;
    line-height: 1.25;
    text-align: center;
}
.ai-entry-copy {
    display: grid;
    gap: 5px;
}
.ai-entry-kicker {
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.ai-entry-copy strong {
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    line-height: 1.25;
}
.ai-entry-copy small,
.ai-credit-hint {
    color: var(--text-dim);
    font-size: 0.76rem;
    line-height: 1.45;
}
.ai-intent-router {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
}
.ai-intent-chip {
    min-height: 38px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    background: rgba(255,255,255,0.035);
    color: var(--text-main);
    font: inherit;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s, transform .2s;
}
.ai-intent-chip:hover {
    border-color: rgba(0,240,255,0.35);
    background: rgba(0,240,255,0.07);
}
.ai-intent-chip.active {
    border-color: rgba(0,240,255,0.75);
    background: rgba(0,240,255,0.12);
    color: var(--primary);
    box-shadow: 0 0 0 1px rgba(0,240,255,0.16) inset;
}
.ai-seed-wrap {
    display: grid;
    gap: 8px;
}
.ai-seed-wrap span {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.ai-seed-wrap textarea {
    min-height: 84px;
    width: 100%;
    resize: none;
    color: var(--text-main);
    background: rgba(8,12,22,0.72);
    border: 1px solid rgba(0,240,255,0.24);
    border-radius: 8px;
    padding: 14px 15px;
    line-height: 1.45;
    box-shadow: 0 18px 70px rgba(0,0,0,0.24);
}
.ai-seed-wrap textarea:focus {
    border-color: rgba(0,240,255,0.72);
    box-shadow: 0 0 0 3px rgba(0,240,255,0.12), 0 18px 70px rgba(0,0,0,0.24);
}
.ai-intent-select-wrap {
    display: grid;
    gap: 5px;
}
.ai-intent-select-wrap span {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.ai-intent-select-wrap select {
    min-height: 42px;
    color: var(--text-main);
    background:
        linear-gradient(45deg, transparent 50%, var(--primary) 50%),
        linear-gradient(135deg, var(--primary) 50%, transparent 50%),
        rgba(255,255,255,0.04);
    background-position:
        calc(100% - 18px) 18px,
        calc(100% - 12px) 18px,
        0 0;
    background-size: 6px 6px, 6px 6px, 100% 100%;
    background-repeat: no-repeat;
}
.ai-primary-start {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    color: #001316;
}
.ai-primary-start i {
    width: 17px;
    height: 17px;
}
.launcher-primary-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}
.ai-play-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
}
.ai-play-select-wrap,
.live-prompt-select-wrap {
    min-width: 0;
    display: grid;
    gap: 6px;
}
.ai-play-select-wrap span,
.live-prompt-select-wrap span {
    color: var(--text-dim);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.ai-play-select-wrap select,
.live-prompt-select-wrap select {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 0 36px 0 12px;
    color: var(--text-main);
    background:
        linear-gradient(45deg, transparent 50%, var(--primary) 50%),
        linear-gradient(135deg, var(--primary) 50%, transparent 50%),
        rgba(255,255,255,0.04);
    background-position:
        calc(100% - 18px) 18px,
        calc(100% - 12px) 18px,
        0 0;
    background-size: 6px 6px, 6px 6px, 100% 100%;
    background-repeat: no-repeat;
    border: 1px solid rgba(0,240,255,0.2);
    border-radius: 8px;
    appearance: none;
}
.ai-surprise-start {
    min-height: 48px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 8px;
    white-space: nowrap;
}
.ai-surprise-start i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}
.ai-credit-hint {
    text-align: center;
    margin-top: -2px;
}
.human-quick-start {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}
.human-quick-start small {
    color: var(--text-dim);
    font-size: 0.76rem;
}
.human-entry-copy {
    display: grid;
    gap: 6px;
}
.human-entry-copy span {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.human-entry-copy strong {
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.02rem;
    line-height: 1.25;
}
.human-entry-copy small {
    color: var(--text-dim);
    font-size: 0.76rem;
    line-height: 1.45;
}
.human-match-strip {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 2px;
}
.human-match-strip .btn {
    min-height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(0,240,255,0.28);
    background: rgba(0,240,255,0.07);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 0.98rem;
    font-weight: 800;
}
.human-match-strip .btn:hover {
    border-color: rgba(0,240,255,0.55);
    background: rgba(0,240,255,0.12);
}
.human-match-strip i {
    width: 21px;
    height: 21px;
    color: var(--primary);
}
.ai-backup-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
}
.ai-backup-copy {
    display: grid;
    gap: 3px;
}
.ai-backup-copy span {
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 800;
}
.ai-backup-copy small {
    color: var(--text-dim);
    font-size: 0.73rem;
    line-height: 1.35;
}
.ai-backup-panel .launcher-primary-actions {
    grid-template-columns: repeat(2, auto);
    justify-content: end;
}
.ai-backup-panel .ai-primary-start,
.ai-backup-panel .ai-surprise-start {
    min-height: 38px;
    width: auto;
    padding: 0 12px;
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    font-size: 0.78rem;
}
.ai-backup-panel .ai-primary-start:hover,
.ai-backup-panel .ai-surprise-start:hover {
    border-color: rgba(0,240,255,0.34);
    background: rgba(0,240,255,0.08);
    transform: none;
    box-shadow: none;
}
.launcher-options {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 8px;
}
.launcher-options summary {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
}
.launcher-options summary::-webkit-details-marker {
    display: none;
}
.launcher-options summary::after {
    content: '+';
    color: var(--primary);
    font-weight: 800;
    font-size: 1.05rem;
}
.launcher-options[open] summary::after {
    content: '-';
}
.launcher-options summary span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.launcher-options summary small {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 0.72rem;
}
.launcher-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
}
.launcher-options .ai-seed-wrap {
    padding-top: 8px;
}
.live-prompt-preview {
    min-height: 42px;
    margin-top: 8px;
    padding: 10px 11px;
    display: flex;
    align-items: center;
    color: var(--text-main);
    background: rgba(0,240,255,0.045);
    border: 1px solid rgba(0,240,255,0.16);
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
}
.shared-prompt-card {
    display: grid;
    gap: 4px;
    border-color: rgba(0,240,255,0.2);
    background: rgba(0,240,255,0.055);
}
.shared-prompt-card strong {
    color: var(--primary);
    font-size: 0.66rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.shared-prompt-card span {
    color: var(--text-main);
}
.ai-outcome-pulse {
    width: min(440px, 100%);
    padding: 12px;
    border-top: 1px solid rgba(0,240,255,0.25);
    border-bottom: 1px solid rgba(0,240,255,0.16);
    text-align: center;
}
.ai-outcome-pulse strong { display: block; margin-bottom: 8px; font-size: 0.82rem; }
.ai-outcome-pulse > div { display: flex; justify-content: center; gap: 8px; }
.ai-outcome-pulse button,
.ai-memory-actions button,
.ai-next-actions button {
    padding: 7px 10px;
    border: 1px solid rgba(0,240,255,0.25);
    border-radius: 7px;
    background: rgba(0,240,255,0.05);
    color: var(--text-main);
    font: inherit;
    font-size: 0.74rem;
    cursor: pointer;
}
.ai-memory-proposal {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(255,215,0,0.18);
    background: rgba(255,215,0,0.04);
}
.ai-memory-proposal strong { font-size: 0.78rem; color: #ffd75e; }
.ai-memory-proposal p { margin: 3px 0 0; color: var(--text-dim); font-size: 0.72rem; line-height: 1.35; }
.ai-memory-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.ai-next-actions {
    padding: 0 16px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    background: rgba(3,5,8,0.5);
}
.ai-next-actions-note {
    flex: 1 0 100%;
    color: var(--text-dim);
    font-size: 0.75rem;
    line-height: 1.35;
}
.ai-session-bar {
    min-height: 42px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(3,5,8,0.82);
    border-top: 1px solid var(--glass-border);
}
.ai-mode-control {
    min-width: 0;
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
}
.ai-mode {
    min-height: 28px;
    padding: 4px 9px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
}
.ai-mode:hover,
.ai-mode:focus-visible { color: var(--text-main); outline: none; }
.ai-mode.active {
    color: #001316;
    background: var(--primary);
    font-weight: 700;
}
.ai-language-status {
    flex: 0 0 auto;
    color: var(--text-dim);
    font-size: 0.68rem;
}
.ai-starter-options {
    display: flex; gap: 8px; padding: 0 16px 12px;
    flex-wrap: wrap; background: rgba(3,5,8,0.5);
}
.ai-starter-option {
    border: 1px solid rgba(0,240,255,0.28);
    background: rgba(0,240,255,0.05);
    color: var(--text-main);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.ai-starter-option:hover,
.ai-starter-option:focus-visible {
    border-color: var(--primary);
    background: rgba(0,240,255,0.1);
    outline: none;
}
.continuity-card {
    margin: 10px auto 4px;
    width: min(620px, 100%);
    padding: 12px 14px;
    border: 1px solid rgba(0,240,255,0.24);
    border-radius: 10px;
    background: rgba(0,240,255,0.04);
    text-align: left;
}
.continuity-title { font-size: 0.82rem; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.continuity-copy { margin: 0 0 6px; color: var(--text-main); font-size: 0.82rem; line-height: 1.45; }
.continuity-copy strong { color: #fff; }
.continuity-meta { margin: 0 0 10px; color: var(--text-dim); font-size: 0.68rem; }
.continuity-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ai-reflection-share {
    width: min(440px, 100%);
    margin-top: 0.35rem;
    border-color: rgba(0,240,255,0.35);
    color: var(--text-main);
}

.ai-reflection-share:hover,
.ai-reflection-share:focus-visible {
    border-color: var(--primary);
    background: rgba(0,240,255,0.08);
}

.ai-reflection-copy {
    display: inline-block;
    font-size: 0.78rem;
}

.ai-credit-bar {
    min-height: 34px;
    padding: 7px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-dim);
    background: rgba(3,5,8,0.5);
    border-top: 1px solid var(--glass-border);
    font-size: 0.75rem;
}
.ai-credit-bar button {
    color: var(--primary);
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}
.ai-gate {
    padding: 16px;
    background: rgba(3,5,8,0.94);
    border-top: 1px solid rgba(0,240,255,0.22);
}
.ai-gate strong { display: block; margin-bottom: 5px; font-family: 'Outfit', sans-serif; }
.ai-gate > p { color: var(--text-dim); font-size: 0.78rem; line-height: 1.45; margin-bottom: 12px; }
.ai-gate-row { display: flex; gap: 8px; }
.ai-gate-row input {
    min-width: 0; flex: 1; border: 1px solid var(--glass-border); border-radius: 8px;
    background: rgba(255,255,255,0.04); color: var(--text-main); padding: 10px 12px;
}
.ai-gate-row .btn { flex: 0 0 auto; padding: 9px 12px; border-radius: 8px; }
.ai-gate-note { min-height: 18px; margin-top: 8px; margin-bottom: 0 !important; color: var(--text-dim); font-size: 0.72rem; }
.ai-pack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-pack {
    min-width: 0; padding: 13px 10px; border: 1px solid rgba(0,240,255,0.22);
    border-radius: 8px; background: rgba(0,240,255,0.04); color: var(--text-main);
    text-align: left; cursor: pointer;
}
.ai-pack:hover, .ai-pack:focus-visible { border-color: var(--primary); background: rgba(0,240,255,0.09); }
.ai-pack:disabled { cursor: not-allowed; opacity: 0.55; }
.ai-pack-name { display: block; font-weight: 700; font-size: 0.85rem; }
.ai-pack-price { display: block; margin-top: 5px; color: var(--primary); font-size: 1rem; font-weight: 700; }
.ai-pack-detail { display: block; margin-top: 3px; color: var(--text-dim); font-size: 0.68rem; line-height: 1.35; }
.ai-membership {
    margin-bottom: 12px;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    border: 1px solid rgba(255,215,0,0.34);
    border-radius: 8px;
    background: rgba(255,215,0,0.045);
    text-align: left;
}
.ai-membership h3 { margin: 0; font-size: 0.95rem; color: #ffd75e; }
.ai-membership p { grid-column: 1 / -1; margin: 0; color: var(--text-dim); font-size: 0.72rem; line-height: 1.45; }
.ai-membership button { grid-row: 1 / 2; grid-column: 2; padding: 7px 10px; border-radius: 7px; }
.ai-account-modal { width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 760px); overflow-y: auto; text-align: left; }
.ai-account-modal > h2 { margin: 0 0 5px; font-family: 'Outfit', sans-serif; font-size: 1.35rem; color: #ffd75e; }
.ai-account-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--glass-border); }
.ai-account-section > p { margin: 0 0 10px; color: var(--text-dim); font-size: 0.72rem; line-height: 1.45; }
.ai-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.ai-section-heading h3 { margin: 0; font-size: 0.82rem; }
.ai-section-heading span { color: var(--text-dim); font-size: 0.68rem; }
.ai-memory-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--glass-border); }
.ai-memory-row input { min-width: 0; width: 100%; padding: 7px 8px; }
.ai-memory-row button, .ai-text-command {
    border: 0; background: none; color: var(--text-dim); font: inherit; font-size: 0.7rem; cursor: pointer;
}
.ai-text-command { margin-top: 8px; color: var(--danger); padding: 0; }
.ai-checkin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ai-checkin-email { display: flex; align-items: center; gap: 7px; margin: 9px 0; color: var(--text-dim); font-size: 0.72rem; }
.ai-switch input { position: absolute; opacity: 0; }
.ai-switch span { display: block; width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,0.14); position: relative; cursor: pointer; }
.ai-switch span::after { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.ai-switch input:checked + span { background: var(--primary); }
.ai-switch input:checked + span::after { transform: translateX(14px); background: #001316; }
.ai-purchase-history { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--glass-border); text-align: left; }
.ai-purchase-history h3 { font-size: 0.8rem; margin-bottom: 8px; }
.ai-purchase-row { padding: 8px 0; border-bottom: 1px solid var(--glass-border); font-size: 0.72rem; color: var(--text-dim); }
.ai-purchase-row strong { color: var(--text-main); }
.text-chat-input {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    background: rgba(3,5,8,0.5);
}
@media (max-width: 640px) {
    .text-chat-container { height: 80vh; max-height: none; border-radius: 0; }
    .conversation-entry-grid { grid-template-columns: 1fr; gap: 10px; }
    .ai-entry-panel, .human-entry-panel { padding: 12px; }
    .launcher-copy { display: grid; gap: 5px; }
    .launcher-copy strong { text-align: left; }
    .launcher-copy { text-align: left; }
    .human-match-strip { grid-template-columns: 1fr; }
    .human-match-strip .btn { min-height: 52px; }
    .ai-backup-panel { grid-template-columns: 1fr; gap: 9px; }
    .ai-backup-panel .ai-primary-start,
    .ai-backup-panel .ai-surprise-start { width: 100%; }
    .launcher-primary-actions { grid-template-columns: 1fr; }
    .ai-backup-panel .launcher-primary-actions { grid-template-columns: 1fr 1fr; justify-content: stretch; }
    .launcher-options summary { align-items: flex-start; }
    .launcher-options summary small { display: none; }
    .launcher-options-grid { grid-template-columns: 1fr; }
    .ai-play-row { grid-template-columns: 1fr; }
    .ai-surprise-start { width: 100%; }
    .ai-intent-router { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ai-intent-chip { min-height: 40px; }
    .ai-pack-grid { grid-template-columns: 1fr 1fr; }
    .ai-session-bar { align-items: stretch; flex-direction: column; gap: 5px; }
    .ai-mode-control { width: 100%; }
    .ai-mode { flex: 1; padding-inline: 4px; }
    .ai-language-status { padding-left: 4px; }
    .ai-memory-proposal { align-items: stretch; flex-direction: column; }
    .ai-memory-actions { justify-content: flex-end; }
}

.searching-text {
  animation: cosmicPulse 3s ease-in-out infinite;
}

@keyframes cosmicPulse {
  0%, 100% { opacity: 0.8; text-shadow: 0 0 10px rgba(0, 240, 255, 0.2); }
  50% { opacity: 1; text-shadow: 0 0 25px rgba(0, 240, 255, 0.6); }
}

/* Chibi Mascot Speech Bubble */
.mascot-bubble {
    display: none !important;
    position: absolute;
    right: calc(100% + 15px);
    bottom: auto;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(8, 12, 24, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 11px 18px;
    border-radius: 16px;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 200px;
    width: max-content;
    text-align: center;
    box-shadow: 0 10px 36px 0 rgba(0, 240, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transform-origin: right center;
    animation: bubblePopLeft 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.mascot-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    bottom: auto;
    left: auto;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(8, 12, 24, 0.95);
    border-top: 1px solid rgba(0, 240, 255, 0.35);
    border-right: 1px solid rgba(0, 240, 255, 0.35);
    border-bottom: none;
    border-left: none;
}

@keyframes bubblePopLeft {
    0% { opacity: 0; transform: translate(15px, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(0, -50%) scale(1); }
}

@media (max-width: 980px) {
    .mascot-bubble,
    .mascot-fallback-bubble {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #canvas-container {
        display: flex !important;
        top: auto;
        right: 14px;
        bottom: 82px;
        width: 74px;
        height: 74px;
        z-index: 80;
    }
    #canvas-container.fallback-active {
        width: 74px;
        height: 74px;
    }
    #canvas-container.fallback-active .mascot-fallback {
        width: 74px;
        min-height: 74px;
    }
    #canvas-container.fallback-active .mascot-fallback-avatar {
        width: 58px;
        height: 58px;
        border-radius: 20px;
    }
    #canvas-container.fallback-active .mascot-fallback-face {
        width: 42px;
        height: 31px;
        border-radius: 16px;
    }
    #canvas-container.fallback-active .mascot-fallback-eye {
        top: 10px;
        width: 6px;
        height: 9px;
    }
    #canvas-container.fallback-active .mascot-fallback-eye.eye-left { left: 11px; }
    #canvas-container.fallback-active .mascot-fallback-eye.eye-right { right: 11px; }
    #canvas-container.fallback-active .mascot-fallback-smile {
        width: 17px;
        height: 7px;
        bottom: 6px;
    }
    #canvas-container.fallback-active .mascot-fallback-toggle,
    #canvas-container.fallback-active .mascot-fallback-bubble {
        display: none;
    }
}

/* Real-time Friend Online Pulse */
.online-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #34d399;
    box-shadow: 0 0 8px #34d399;
    animation: statusPulse 1.8s infinite;
}

@keyframes statusPulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Streak Badge Style */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 102, 0, 0.12);
    border: 1px solid rgba(255, 102, 0, 0.35);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff6600;
    box-shadow: 0 0 12px rgba(255, 102, 0, 0.15);
    transition: all 0.3s ease;
    animation: fireGlow 2.5s ease-in-out infinite alternate;
}

@keyframes fireGlow {
    0% { box-shadow: 0 0 5px rgba(255, 102, 0, 0.1), inset 0 0 2px rgba(255, 102, 0, 0.05); }
    100% { box-shadow: 0 0 15px rgba(255, 102, 0, 0.3), inset 0 0 5px rgba(255, 102, 0, 0.15); }
}

/* Feedback Tag Selectors */
.feedback-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.feedback-tag:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.feedback-tag.selected-good {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.5);
    color: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.15);
}

.feedback-tag.selected-bad {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* AI Typing Indicator */
.ai-typing-indicator {
    display: inline-block;
    color: var(--text-dim);
    font-style: italic;
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Keep active conversation surfaces focused. */
body:has(#lobby-state:not(.hidden)) #canvas-container,
body:has(#text-chat-state:not(.hidden)) #canvas-container {
    display: none !important;
}

/* Keep the buddy present on secondary mobile surfaces, but shrink it around active chat surfaces. */
@media (max-width: 768px) {
    body:has(#text-chat-state:not(.hidden)) #canvas-container,
    body:has(#chat-panel:not(.hidden)) #canvas-container,
    body:has(#dm-drawer:not(.hidden)) #canvas-container {
        display: flex !important;
        width: 54px;
        height: 54px;
        right: 10px;
        bottom: 74px;
        opacity: 0.74;
    }
    body:has(#text-chat-state:not(.hidden)) #canvas-container.fallback-active .mascot-fallback,
    body:has(#chat-panel:not(.hidden)) #canvas-container.fallback-active .mascot-fallback,
    body:has(#dm-drawer:not(.hidden)) #canvas-container.fallback-active .mascot-fallback {
        width: 54px;
        min-height: 54px;
    }
    body:has(#text-chat-state:not(.hidden)) #canvas-container.fallback-active .mascot-fallback-avatar,
    body:has(#chat-panel:not(.hidden)) #canvas-container.fallback-active .mascot-fallback-avatar,
    body:has(#dm-drawer:not(.hidden)) #canvas-container.fallback-active .mascot-fallback-avatar {
        width: 46px;
        height: 46px;
        border-radius: 16px;
    }
    body:has(.modal.active) #canvas-container {
        display: none !important;
    }
}




/* AdSense Containers */
.adsense-container {
    display: none; /* Hidden until we turn ads on */
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.ad-label {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.ad-placeholder {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: "Inter", sans-serif;
    opacity: 0.5;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

/* Connection Status Badges */
.status-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}
.status-badge.connected {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.35);
    color: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.1);
}
.status-badge.reconnecting {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    animation: statusPulse 1.8s infinite;
}
.status-badge.muted-badge {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

/* Cyber-Radar Sonar Animation Styles */
.radar-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.radar-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.15));
}
.radar-circle {
    fill: none;
    stroke: rgba(0, 240, 255, 0.08);
    stroke-width: 1;
}
.radar-grid {
    stroke: rgba(0, 240, 255, 0.08);
    stroke-width: 0.5;
    stroke-dasharray: 2 4;
}
.radar-center {
    fill: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary));
}
.radar-sweep {
    stroke: var(--primary);
    stroke-width: 1.5;
    transform-origin: 100px 100px;
    animation: radarScan 4s linear infinite;
    opacity: 0.8;
}
.radar-blip {
    fill: #34d399;
    opacity: 0;
    filter: drop-shadow(0 0 4px #34d399);
}
.blip-1 {
    animation: blipFade 4s ease-in-out infinite;
    animation-delay: 1s;
}
.blip-2 {
    animation: blipFade 4s ease-in-out infinite;
    animation-delay: 2.8s;
}

@keyframes radarScan {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes blipFade {
    0%, 100% { opacity: 0; }
    5% { opacity: 1; }
    40% { opacity: 0.1; }
}

/* Radar Stopwatch Overlay */
.radar-stopwatch {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.4), 0 0 30px var(--primary-glow);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    z-index: 10;
}

/* Matchmaking Dashboard & Stats */
.matchmaking-dashboard {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}
.matchmaking-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.4rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}
.matchmaking-subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 1.8rem;
}
.matchmaking-stats {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.stat-pill {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}
.pill-label {
    color: var(--text-dim);
}
.pill-val {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

@media (max-width: 768px) {
    body:has(#text-chat-state:not(.hidden)) #canvas-container,
    body:has(#chat-panel:not(.hidden)) #canvas-container,
    body:has(#dm-drawer:not(.hidden)) #canvas-container,
    body:has(.modal.active) #canvas-container {
        display: none !important;
    }
}
