:root {
    --primary-bg: #0a0a0f;
    --secondary-bg: #141419;
    --card-bg: #1a1a24;
    --tile-bg: #11111a;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.72);
    --text-muted: rgba(255, 255, 255, 0.5);

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --danger: #dc2626;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;

    /* Seed for the navbar height; the component publishes the measured value at runtime. */
    --tt-topnav-h: 64px;
    --call-layer-z: calc(var(--tt-z-modal, 1000) + 10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: calc(100vh - var(--tt-topnav-h, 56px));
    min-height: calc(100dvh - var(--tt-topnav-h, 56px));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: clip; /* not hidden: hidden on an ancestor breaks the sticky navbar */
}

button, input, select { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

.app { min-height: calc(100vh - var(--tt-topnav-h, 56px)); min-height: calc(100dvh - var(--tt-topnav-h, 56px)); display: flex; flex-direction: column; }
.main-app { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.tc-remote-audio { display: none; }

/* ==================== WELCOME + PREJOIN ==================== */
.auth-screen {
    min-height: calc(100vh - var(--tt-topnav-h, 56px));
    min-height: calc(100dvh - var(--tt-topnav-h, 56px));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex: 1;
    padding: var(--spacing-md);
    padding-left: max(var(--spacing-md), env(safe-area-inset-left));
    padding-right: max(var(--spacing-md), env(safe-area-inset-right));
}
#ttnav .topnav-inner { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (max-width: 600px) { #ttnav .topnav-inner { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); } }
.auth-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.auth-glow { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.4; }
.auth-glow-1 { width: 400px; height: 400px; background: var(--accent-primary); top: -100px; left: -100px; }
.auth-glow-2 { width: 360px; height: 360px; background: var(--accent-secondary); bottom: -80px; right: -80px; }

.auth-container {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.auth-header { text-align: center; margin-bottom: var(--spacing-lg); }
.auth-logo {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    margin-bottom: var(--spacing-sm);
}
.auth-header h1 { font-size: 1.6rem; line-height: 1.25; }
.auth-header p { color: var(--text-secondary); font-size: 0.95rem; margin-top: 0.35rem; }

.welcome-features { list-style: none; margin: 0 0 var(--spacing-lg); padding: 0; display: grid; gap: 0.65rem; }
.welcome-features li { display: flex; align-items: center; gap: 0.7rem; font-size: 0.92rem; color: var(--text-secondary); }
.welcome-features li i { width: 1.4rem; flex: none; text-align: center; color: var(--accent-primary); }
#welcome-start-btn { min-height: 48px; font-size: 1rem; }

.prejoin-screen { align-items: flex-start; }
.prejoin-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: var(--spacing-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.prejoin-header { margin-bottom: var(--spacing-md); }
.prejoin-header h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
.prejoin-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--tile-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.prejoin-preview video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    background: #000;
    display: none;
}
.prejoin-preview.has-video video { display: block; }
.prejoin-preview.mirror video { transform: scaleX(-1); }
.prejoin-preview-placeholder {
    position: absolute; inset: 0;
    padding-bottom: 64px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, #171723, #24243a);
    color: var(--text-secondary);
    pointer-events: none;
}
.prejoin-preview.has-video .prejoin-preview-placeholder { display: none; }
.prejoin-preview-placeholder .avatar,
.tile-avatar,
.person-avatar {
    border-radius: 50%;
    background: hsl(var(--hue, 245) 55% 46%);
    color: #fff;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.prejoin-preview-placeholder .avatar { width: 84px; height: 84px; font-size: 1.9rem; }
.preview-hint { font-size: 0.85rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.4rem; }
.prejoin-preview-name {
    position: absolute; left: 10px; top: 10px;
    max-width: calc(100% - 20px);
    padding: 2px 9px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    font-size: 0.8rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.prejoin-level {
    position: absolute; left: 10px; top: 38px;
    width: 96px; height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
    pointer-events: none;
}
.prejoin-level span, .level-bar span {
    display: block; width: 100%; height: 100%;
    background: var(--success);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 80ms linear;
}
.prejoin-preview-controls {
    position: absolute; left: 0; right: 0; bottom: 12px;
    display: flex; justify-content: center; gap: 14px;
}
.round-btn {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(20, 20, 30, 0.72);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.round-btn:hover { transform: scale(1.05); }
.round-btn.off { background: var(--danger); border-color: transparent; }
.prejoin-devices { display: grid; gap: 10px; margin-top: var(--spacing-md); }
.prejoin-wrap > * { min-width: 0; }
.btn-join { min-height: 52px; font-size: 1.05rem; }
.guest-login { font-size: 0.9rem; }
.guest-login-title { color: var(--text-secondary); }
.guest-login-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; color: var(--text-muted); }
.guest-login-row code { color: var(--text-primary); font-family: 'SF Mono', Monaco, Consolas, monospace; word-break: break-all; text-align: right; }
.guest-login .btn { justify-self: start; }

.prejoin-iab-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    margin-bottom: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.prejoin-iab-warning .iab-warning-text i { color: var(--warning); margin-right: 0.3rem; }
.prejoin-iab-warning .iab-warning-actions { display: flex; gap: var(--spacing-sm); margin-top: 0.6rem; flex-wrap: wrap; }
.prejoin-iab-warning .iab-btn { flex: 1 1 auto; min-height: 44px; padding: 0.55rem 0.9rem; font-size: 0.85rem; }

@media (max-width: 859px) {
    .prejoin-header, .prejoin-iab-warning { margin-bottom: 0; }
    .prejoin-devices { margin-top: 0; }
    .prejoin-wrap { gap: var(--spacing-md); }
}
@media (min-width: 860px), (max-height: 500px) and (orientation: landscape) {
    .prejoin-screen { align-items: center; }
    .prejoin-wrap {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        grid-template-areas: "preview header" "preview iab" "preview form" "devices form";
        grid-template-rows: auto auto 1fr auto;
        column-gap: 28px;
        row-gap: 0;
        align-items: start;
        padding: var(--spacing-lg);
    }
    .prejoin-header { grid-area: header; text-align: left; }
    .prejoin-iab-warning { grid-area: iab; }
    .prejoin-preview { grid-area: preview; aspect-ratio: 16 / 10; }
    #prejoin-form { grid-area: form; }
    .prejoin-devices { grid-area: devices; }
}
@media (max-height: 500px) and (orientation: landscape) {
    .prejoin-screen { align-items: flex-start; }
    .prejoin-wrap { padding: var(--spacing-md); column-gap: 16px; }
    .prejoin-preview { aspect-ratio: auto; height: min(56dvh, 260px); }
    .prejoin-header h1 { font-size: 1.1rem; }
    .prejoin-header p { display: none; }
}

/* ==================== FORMS + BUTTONS ==================== */
.form-group { margin-bottom: var(--spacing-md); }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.form-group input[type="text"] {
    width: 100%;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.7rem 0.85rem;
    min-height: 46px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition-fast);
}
.form-group input:focus { outline: none; border-color: var(--accent-primary); }
.form-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: var(--spacing-sm); text-align: center; }
.form-hint a { color: #a5b4fc; text-decoration: none; display: inline-block; padding: 0.35rem 0; }
.form-hint a:hover { text-decoration: underline; }
.terms-note { font-size: 0.78rem; color: var(--text-muted); text-align: center; line-height: 1.5; margin: 0.4rem 0 0; }
.terms-note a { color: #a5b4fc; text-decoration: underline; text-underline-offset: 2px; }
.auth-error, .lobby-error { color: #fca5a5; font-size: 0.85rem; margin-top: var(--spacing-sm); min-height: 1.1em; text-align: center; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.65rem 1.1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    color: #fff;
    text-decoration: none;
}
.btn-primary { background: var(--accent-gradient); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--secondary-bg); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--card-bg); }
.btn-block { width: 100%; }
.btn-small { min-height: 34px; padding: 0.35rem 0.8rem; font-size: 0.82rem; }
.btn-icon {
    width: 44px; height: 44px; min-height: 44px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    color: var(--text-primary);
}
.btn-icon:hover { background: var(--card-bg); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.toggles { display: flex; gap: var(--spacing-sm); justify-content: center; flex-wrap: wrap; }
.toggle {
    display: inline-flex; align-items: center; gap: 0.45rem;
    min-height: 44px;
    padding: 0.4rem 0.8rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.toggle input { accent-color: var(--accent-primary); width: 18px; height: 18px; }
.toggle:has(input:checked) { color: var(--text-primary); border-color: var(--accent-primary); }

.device-row { display: grid; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); }
.device-row > span { display: inline-flex; align-items: center; gap: 0.45rem; }
.device-row select,
.modal select {
    width: 100%;
    min-height: 44px;
    padding: 0 0.75rem;
    background: var(--secondary-bg);
    color: #ffffff;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 1rem;
}
select option { background-color: #1a1a24; color: #ffffff; }

/* ==================== LOBBY ==================== */
.lobby-rejoin {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--spacing-sm) var(--spacing-md);
    max-width: 900px;
    margin: 0 auto var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}
.lobby-rejoin[hidden] { display: none; }
.main { flex: 1; padding: var(--spacing-lg) max(var(--spacing-md), env(safe-area-inset-right)) var(--spacing-lg) max(var(--spacing-md), env(safe-area-inset-left)); }
.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: var(--spacing-lg);
    max-width: 900px;
    margin: 0 auto;
}
.lobby-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
}
.lobby-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: var(--spacing-md);
    font-size: 1.4rem;
    align-self: center;
}
.lobby-card h2 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.lobby-card > p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: var(--spacing-md); }
.lobby-card .form-group { text-align: left; }
.lobby-card .btn-block { margin-top: auto; min-height: 48px; }

/* ==================== CALL LAYOUT ==================== */
body.in-call { overflow: hidden; }
body.in-call .app {
    height: calc(100vh - var(--tt-topnav-h, 56px));
    height: calc(100dvh - var(--tt-topnav-h, 56px));
    min-height: 0;
    overflow: hidden;
}
body.in-call .seo-content { display: none; }

.call {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    background: var(--primary-bg);
}
.call-top {
    flex: none;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 6px 12px;
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
}
.call-title { min-width: 0; }
.room-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.room-meta code { color: #a5b4fc; font-family: 'SF Mono', Monaco, Consolas, monospace; }
.call-top-actions { display: flex; gap: 8px; flex: none; }
.top-btn {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.top-btn:hover { border-color: var(--accent-primary); }
.top-btn.active { border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.16); }
.top-btn i { color: #a5b4fc; }
#participant-count { font-variant-numeric: tabular-nums; min-width: 1ch; }

.call-banner {
    flex: none;
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    text-align: center;
    background: rgba(245, 158, 11, 0.14);
    border-bottom: 1px solid rgba(245, 158, 11, 0.4);
    color: #fde68a;
}
.call-banner[data-kind="audio"] { background: rgba(99, 102, 241, 0.16); border-bottom-color: rgba(99, 102, 241, 0.45); color: var(--text-primary); }

.call-body { flex: 1; min-height: 0; display: flex; position: relative; }

/* ==================== STAGE ==================== */
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; overflow: hidden; }
.stage-grid {
    flex: 1;
    min-width: 0; min-height: 0;
    display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
    gap: 8px;
    padding: 8px;
}
.stage-grid > .tile { flex: none; width: var(--tile-w, 320px); height: var(--tile-h, 180px); }
.stage-main { flex: 1; min-width: 0; min-height: 0; display: flex; padding: 8px; }
.stage-main > .tile { flex: 1; }
.stage-strip { flex: none; display: flex; flex-direction: column; gap: 8px; width: 236px; padding: 8px 8px 8px 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.stage-strip > .tile { flex: none; width: 100%; aspect-ratio: 16 / 9; }
.stage-strip:empty { display: none; }
.stage[data-mode="grid"] .stage-main,
.stage[data-mode="grid"] .stage-strip { display: none; }
.stage[data-mode="present"] .stage-grid { display: none; }
.stage-pip:empty { display: none; }
.stage-pip {
    position: absolute;
    z-index: 6;
    width: min(30vw, 128px);
    aspect-ratio: var(--pip-ar, 0.75);
    max-height: 42%;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    touch-action: none;
    cursor: grab;
    transition: left 0.18s ease, right 0.18s ease, top 0.18s ease, bottom 0.18s ease;
}
.stage-pip.dragging { transition: none; cursor: grabbing; }
.stage-pip[data-corner="br"] { right: 10px; bottom: 10px; }
.stage-pip[data-corner="bl"] { left: 10px; bottom: 10px; }
.stage-pip[data-corner="tr"] { right: 10px; top: 10px; }
.stage-pip[data-corner="tl"] { left: 10px; top: 10px; }
.stage-pip > .tile { width: 100%; height: 100%; }
.stage-pip .tile-name, .stage-pip .tile-actions, .stage-pip .tile-net { display: none; }
.stage-pip .tile-avatar { width: 46%; font-size: 1.1rem; }

.stage-waiting {
    display: none;
    position: absolute; left: 50%; bottom: 16px;
    transform: translateX(-50%);
    z-index: 5;
    width: min(420px, calc(100% - 32px));
    flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 16px;
    text-align: center;
    background: rgba(20, 20, 30, 0.88);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.stage[data-alone="true"][data-mode="grid"] .stage-waiting { display: flex; }
.waiting-icon { width: 40px; height: 40px; border-radius: 50%; background: rgba(99, 102, 241, 0.2); color: #a5b4fc; display: flex; align-items: center; justify-content: center; }
.waiting-title { font-weight: 600; }
.waiting-text { font-size: 0.85rem; color: var(--text-secondary); }
.waiting-actions { margin-top: 6px; }

/* ==================== TILES ==================== */
.tile {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: var(--tile-bg);
    border: 1px solid var(--border-color);
    isolation: isolate;
    user-select: none;
    -webkit-user-select: none;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.tile.has-video video { display: block; }
.tile.fit-contain video { object-fit: contain; }
.tile.mirror video { transform: scaleX(-1); }
.tile-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #171723, #24243a); }
.tile.has-video .tile-ph { display: none; }
.tile-avatar { width: clamp(44px, 26%, 104px); aspect-ratio: 1; font-size: clamp(1rem, 3.6vmin, 2.3rem); }
.tile-bar {
    position: absolute; left: 8px; right: 8px; bottom: 8px;
    display: flex; align-items: center; gap: 6px;
    pointer-events: none;
    z-index: 2;
}
.tile-name {
    min-width: 0;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.58);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-mic {
    display: none;
    flex: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.92);
    font-size: 0.68rem;
    align-items: center; justify-content: center;
}
.tile.mic-off .tile-mic { display: inline-flex; }
.tile-net {
    margin-left: auto;
    flex: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    font-size: 0.68rem;
    display: inline-flex; align-items: center; justify-content: center;
    pointer-events: auto;
}
.tile-net[data-level="good"] { display: none; }
.tile-net[data-level="fair"] { color: var(--warning); }
.tile-net[data-level="poor"] { color: var(--error); }
.tile.speaking::after {
    content: "";
    position: absolute; inset: 0;
    border: 3px solid var(--success);
    border-radius: inherit;
    pointer-events: none;
    z-index: 3;
}
.tile-status {
    position: absolute; left: 50%; bottom: 40px;
    transform: translateX(-50%);
    z-index: 2;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
}
.tile-actions {
    position: absolute; top: 8px; left: 8px;
    z-index: 4;
    display: flex; gap: 6px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.tile:hover .tile-actions,
.tile:focus-within .tile-actions,
.tile.pinned .tile-actions { opacity: 1; }
.tile-btn {
    width: 36px; height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--transition-fast);
}
.tile-btn:hover, .tile-btn:focus-visible { background: var(--accent-primary); }
.tile.pinned .tile-pin { background: var(--accent-gradient); }
.tile:not(.has-video) .tile-fs { display: none; }

.tile-volume {
    position: absolute; top: 8px; right: 8px;
    z-index: 4;
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    font-size: 0.72rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.tile:hover .tile-volume, .tile-volume:focus-within, .tile-volume.muted { opacity: 1; }
.tile-volume.muted { background: rgba(220, 38, 38, 0.78); }
.tile-volume-btn {
    width: 28px; height: 28px;
    border: none; border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.tile-volume-slider { width: 86px; accent-color: var(--accent-primary); cursor: pointer; }
.tile-volume-value { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.tile-volume.mute-only { padding-right: 4px; }
.tile-volume.mute-only .tile-volume-slider,
.tile-volume.mute-only .tile-volume-value { display: none; }
.tile-self .tile-volume { display: none; }
.tile { container-type: inline-size; }
@container (max-width: 320px) {
    .tile-volume-slider, .tile-volume-value { display: none; }
    .tile-volume { padding-right: 4px; }
}

.tile:fullscreen { border: none; border-radius: 0; background: #000; }
.tile:-webkit-full-screen { border: none; border-radius: 0; background: #000; }
.tile:fullscreen video { object-fit: contain; }
.tile:-webkit-full-screen video { object-fit: contain; }
.tile:fullscreen .tile-actions { opacity: 1; top: 16px; left: 16px; }
.tile:-webkit-full-screen .tile-actions { opacity: 1; top: 16px; left: 16px; }
.tile:fullscreen .tile-btn { width: 46px; height: 46px; font-size: 1rem; }
.tile:-webkit-full-screen .tile-btn { width: 46px; height: 46px; font-size: 1rem; }
.tile:fullscreen .tile-bar { left: 16px; right: 16px; bottom: 16px; }
.tile:-webkit-full-screen .tile-bar { left: 16px; right: 16px; bottom: 16px; }

/* ==================== CONTROL BAR + MENU ==================== */
.control-bar {
    flex: none;
    position: relative;
    z-index: 8;
    display: flex; justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: rgba(10, 10, 15, 0.96);
    border-top: 1px solid var(--border-color);
}
.ctrl {
    position: relative;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    min-width: 76px;
    min-height: 54px;
    padding: 6px 10px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.74rem;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.ctrl i { font-size: 1.1rem; }
.ctrl:hover { background: var(--card-bg); }
.ctrl.active { background: var(--accent-gradient); border-color: transparent; }
.ctrl.warning { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.5); color: #fecaca; }
.ctrl.warning:hover { background: rgba(239, 68, 68, 0.26); }
.ctrl-leave { background: var(--danger); border-color: transparent; }
.ctrl-leave:hover { background: #b91c1c; }
.ctrl span { white-space: nowrap; }
.ctrl-badge {
    position: absolute; top: 3px; right: 6px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem; font-weight: 700; line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--primary-bg);
}
body.no-screen-share .ctrl-screen { display: none; }

.more-menu {
    position: absolute;
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 30;
    min-width: 230px;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 92px - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    display: flex; flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}
.more-menu button {
    display: flex; align-items: center; gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: var(--text-primary);
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
}
.more-menu button i { width: 1.2rem; text-align: center; color: #a5b4fc; }
.more-menu button:hover, .more-menu button:focus-visible { background: var(--secondary-bg); outline: none; }

/* ==================== SIDE PANELS (chat, people) ==================== */
.side-panel {
    display: none;
    flex-direction: column;
    width: 340px;
    flex: none;
    min-height: 0;
    position: relative;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
}
.side-panel.open { display: flex; }
.panel-header {
    flex: none;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 6px 8px 6px 16px;
    min-height: 54px;
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
}
.panel-header h3 { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.panel-header h3 i { color: var(--accent-primary); }
.panel-count { color: var(--text-muted); font-weight: 500; }
.panel-close { background: transparent; border: none; color: var(--text-secondary); }
.panel-close:hover { color: var(--text-primary); background: var(--card-bg); }

.chat-messages {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex; flex-direction: column; gap: 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    overscroll-behavior: contain;
}
.chat-empty { margin: auto; text-align: center; color: var(--text-muted); padding: var(--spacing-lg) var(--spacing-md); }
.chat-empty i { font-size: 2rem; margin-bottom: 0.5rem; display: block; opacity: 0.6; }
.chat-empty p { margin: 0; font-size: 0.85rem; }
.chat-msg { display: flex; flex-direction: column; gap: 0.15rem; max-width: 85%; overflow-wrap: anywhere; }
.chat-msg-meta { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.7rem; color: var(--text-muted); }
.chat-msg-name { font-weight: 600; color: var(--text-secondary); }
.chat-msg-bubble {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.7rem;
    border-radius: 0.75rem;
    border-top-left-radius: 0.2rem;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}
.chat-msg-bubble a { color: #c7d2fe; text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.self { align-self: flex-end; align-items: flex-end; }
.chat-msg.self .chat-msg-bubble { background: var(--accent-gradient); border-color: transparent; border-top-left-radius: 0.75rem; border-top-right-radius: 0.2rem; }
.chat-msg.self .chat-msg-bubble a { color: #fff; }
.chat-input-row {
    flex: none;
    display: flex; gap: 0.5rem;
    padding: 0.6rem;
    border-top: 1px solid var(--border-color);
    background: var(--secondary-bg);
}
.chat-input-row input[type="text"] {
    flex: 1; min-width: 0;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}
.chat-input-row input[type="text"]:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25); }
.chat-send, .chat-attach-btn { flex-shrink: 0; }
.chat-send { background: var(--accent-gradient); border-color: transparent; color: #fff; }
.chat-send:hover { background: var(--accent-gradient); filter: brightness(1.1); }
.chat-attach-btn { background: var(--card-bg); color: var(--text-secondary); cursor: pointer; }
.chat-attach-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.chat-attach-tray {
    flex: none;
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    padding: 0.6rem;
    border-top: 1px solid var(--border-color);
    background: var(--secondary-bg);
    max-height: 150px;
    overflow-y: auto;
}
.chat-attach-chip {
    position: relative;
    display: flex; align-items: center; gap: 0.5rem;
    max-width: 100%;
    padding: 0.4rem 1.9rem 0.4rem 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
.chat-attach-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.chat-attach-chip-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--accent-primary); flex-shrink: 0; }
.chat-attach-chip-meta { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chat-attach-chip-name { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.chat-attach-chip-size { font-size: 0.7rem; color: var(--text-muted); }
.chat-attach-chip-remove {
    position: absolute; top: 2px; right: 2px;
    width: 26px; height: 26px;
    border: none; border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
}
.chat-attach-chip-remove:hover { color: #fff; background: var(--danger); }
.chat-attach-link { display: inline-block; line-height: 0; border-radius: 0.6rem; overflow: hidden; border: 1px solid var(--border-color); max-width: 100%; }
.chat-attach-img { display: block; max-width: min(240px, 100%); max-height: 280px; object-fit: cover; background: var(--secondary-bg); }
.chat-file {
    display: flex; align-items: center; gap: 0.6rem;
    max-width: 240px;
    padding: 0.55rem 0.7rem;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
}
.chat-file:hover { border-color: var(--accent-primary); }
.chat-file > .fas:first-child { font-size: 1.4rem; color: var(--accent-primary); flex-shrink: 0; }
.chat-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-file-name { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-file-size { font-size: 0.7rem; color: var(--text-muted); }
.chat-file-dl { color: var(--text-muted); flex-shrink: 0; }
.chat-msg.self .chat-file { background: rgba(255, 255, 255, 0.08); }
.chat-drop-overlay {
    position: absolute; inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    background: rgba(99, 102, 241, 0.18);
    backdrop-filter: blur(2px);
    border: 2px dashed var(--accent-primary);
}
.chat-drop-inner { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; font-weight: 600; }
.chat-drop-inner i { font-size: 2rem; color: var(--accent-primary); }

.people-actions { padding: 12px; border-bottom: 1px solid var(--border-color); }
.people-list { list-style: none; overflow-y: auto; flex: 1; min-height: 0; padding: 6px 0; overscroll-behavior: contain; }
.person { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av main icons" "vol vol vol"; align-items: center; column-gap: 10px; row-gap: 6px; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.person-avatar { grid-area: av; width: 40px; height: 40px; font-size: 1rem; }
.person-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.person-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-sub { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person[data-level="fair"] .person-sub { color: var(--warning); }
.person[data-level="poor"] .person-sub { color: #fca5a5; }
.person-icons { grid-area: icons; display: flex; gap: 8px; font-size: 0.85rem; }
.person-icons .on { color: var(--success); }
.person-icons .off { color: var(--error); }
.person-volume { grid-area: vol; display: flex; align-items: center; gap: 10px; padding-left: 50px; }
.person-vol-btn {
    width: 40px; height: 40px;
    flex: none;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: var(--secondary-bg);
    color: var(--text-primary);
    cursor: pointer;
}
.person-vol-btn.muted { background: rgba(220, 38, 38, 0.8); border-color: transparent; }
.person-vol-slider { flex: 1; min-width: 0; height: 32px; accent-color: var(--accent-primary); }
.person-vol-value { min-width: 40px; text-align: right; font-size: 0.78rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ==================== SOUND BOT ==================== */
.bot-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.bot-intro, .bot-empty { font-size: 0.85rem; color: var(--text-secondary); }
.bot-now { display: grid; gap: 8px; padding: 12px; background: var(--secondary-bg); border: 1px solid var(--border-color); border-radius: 12px; }
.bot-now-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.bot-now-title i { color: var(--accent-secondary); }
.bot-now-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bot-seek, #bot-volume { width: 100%; height: 32px; accent-color: var(--accent-primary); }
.bot-times { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bot-transport { display: flex; justify-content: center; align-items: center; gap: 14px; }
.round-btn-small { width: 44px; height: 44px; font-size: 0.95rem; }
.bot-volume { display: grid; gap: 4px; font-size: 0.82rem; color: var(--text-secondary); }
.bot-actions { display: grid; gap: 8px; }
.bot-list { list-style: none; display: grid; gap: 6px; }
.bot-item { display: flex; align-items: stretch; gap: 6px; }
.bot-item-play {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}
.bot-item-play:disabled { cursor: default; opacity: 0.85; }
.bot-item-play i { color: var(--text-muted); }
.bot-item.active .bot-item-play { border-color: var(--accent-primary); }
.bot-item.active .bot-item-play i { color: var(--success); }
.bot-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-item-remove { width: 44px; flex: none; border: 1px solid var(--border-color); border-radius: 10px; background: var(--secondary-bg); color: var(--text-muted); cursor: pointer; }
.bot-item-remove:hover { color: #fff; background: var(--danger); }
.tile-bot .tile-ph { background: linear-gradient(135deg, #1e1b4b, #312e81); }
.tile-bot .tile-avatar { background: var(--accent-gradient); }

/* ==================== MODAL ==================== */
.modal {
    position: fixed; inset: 0;
    z-index: calc(var(--tt-z-modal, 1000) + 20);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.62);
}
.modal-card {
    width: min(460px, 100%);
    max-height: calc(100% - 32px);
    overflow: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-body { padding: 16px; display: grid; gap: 14px; }
.level-row { display: grid; gap: 6px; }
.level-label { font-size: 0.78rem; color: var(--text-muted); }
.level-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }

/* ==================== TOASTS ==================== */
.toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: calc(var(--tt-z-toast, 1100) + 100);
    display: flex; flex-direction: column; gap: var(--spacing-sm);
    max-width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}
body.in-call .toast-container,
body.in-call .tt-toast-container { bottom: calc(92px + env(safe-area-inset-bottom)); }
@media (min-width: 769px) {
    body.in-call.panel-open .toast-container { right: calc(340px + 1rem); }
}
@media (min-width: 769px) and (max-width: 1099px) {
    body.panel-open .stage[data-mode="present"] .stage-strip { display: none; }
}
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 0.55rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.86rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: toast-in 0.18s ease-out;
}
.toast > i { margin-top: 0.15rem; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast.success { border-left-color: var(--success); }
.toast.success > i { color: var(--success); }
.toast.error { border-left-color: var(--error); pointer-events: none; }
.toast.error > i { color: var(--error); }
.toast.chat { border-left-color: var(--accent-secondary); }
.toast.clickable { cursor: pointer; }
.toast-action {
    pointer-events: auto;
    flex: none;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--secondary-bg);
    color: var(--text-primary);
    cursor: pointer;
}
.toast.credentials { border-left-color: var(--warning); flex-direction: column; gap: 0.4rem; position: relative; padding-right: 2.6rem; }
.toast.credentials strong { display: flex; align-items: center; gap: 0.4rem; }
.toast.credentials .cred-line { background: var(--secondary-bg); padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }
.toast.credentials .close-toast {
    position: absolute; top: 0.25rem; right: 0.25rem;
    width: 36px; height: 36px;
    background: transparent; border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.toast.credentials .close-toast:hover { color: var(--text-primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==================== PHONES ==================== */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
    body.in-call .call {
        position: fixed;
        left: 0; right: 0;
        top: var(--vvtop, 0px);
        height: var(--vvh, 100dvh);
        z-index: var(--call-layer-z);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .call-top { padding-top: max(6px, env(safe-area-inset-top)); min-height: 52px; }
    .call-body { position: static; }
    .side-panel {
        position: absolute; inset: 0;
        z-index: 20;
        width: auto;
        border-left: none;
        padding-top: env(safe-area-inset-top);
    }
    .side-panel .chat-input-row,
    .people-list { padding-bottom: max(0.6rem, env(safe-area-inset-bottom)); }
    .stage-grid { gap: 6px; padding: 6px; }
    .stage-main { padding: 6px; }
    .tile { border-radius: 10px; }
    .tile-actions { opacity: 1; }
    .tile-pin, .tile-volume { display: none !important; }
    .stage-pip .tile-fs, .stage-strip .tile-actions { display: none; }
    .tile-btn { width: 40px; height: 40px; }
    .control-bar { gap: 6px; padding-left: 8px; padding-right: 8px; }
    .ctrl { flex: 1 1 0; min-width: 0; max-width: 92px; min-height: 56px; padding: 6px 4px; font-size: 0.68rem; }
    .ctrl span:not(.ctrl-badge) { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .more-menu {
        left: calc(12px + env(safe-area-inset-left));
        right: calc(12px + env(safe-area-inset-right));
        min-width: 0;
        max-height: calc(100% - 92px - env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .side-panel { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .top-btn { padding: 0 12px; }
    .toast-container { left: calc(1rem + env(safe-area-inset-left)); right: calc(1rem + env(safe-area-inset-right)); max-width: none; align-items: stretch; }
    body.in-call .toast-container,
    body.in-call .tt-toast-container { bottom: calc(84px + env(safe-area-inset-bottom)); }
    .main { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }
    .auth-container { padding: var(--spacing-lg); }
}
@media (max-width: 768px) and (orientation: portrait) {
    .stage[data-mode="present"] { flex-direction: column; }
    .stage-strip { width: auto; height: 96px; flex-direction: row; padding: 0 6px 6px; overflow-x: auto; overflow-y: hidden; }
    .stage-strip > .tile { width: auto; height: 100%; aspect-ratio: 4 / 3; }
    .stage-strip .tile-name { font-size: 0.68rem; }
}
@media (max-height: 500px) and (pointer: coarse) {
    .waiting-icon, .waiting-text { display: none; }
    .stage-waiting { bottom: 8px; padding: 10px 14px; max-height: calc(100% - 16px); overflow: auto; }
    .stage-strip { width: 168px; }
    .call-top { min-height: 44px; }
    .ctrl { min-height: 46px; }
    .ctrl span:not(.ctrl-badge) { display: none; }
}
@media (pointer: coarse) {
    .tile-btn, .tile-volume-btn, .person-vol-btn, .chat-attach-chip-remove { width: 44px; height: 44px; }
    .person-vol-slider, #bot-seek, #bot-volume { height: 44px; }
    .chat-attach-chip { padding-right: 3rem; }
    .toast-action, .btn-small { min-height: 44px; }
    .form-hint a { padding: 0.8rem 0; }
    .top-btn { min-width: 44px; }
    .tile-actions, .tile-volume { opacity: 1; }
}
@media (max-width: 380px) {
    .top-btn span[data-i18n="inviteShort"] { display: none; }
    .ctrl i { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==================== ABOUT (below the welcome and lobby screens, hidden in a call) ==================== */
.seo-content {
    background: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    padding: 3rem max(var(--spacing-md), env(safe-area-inset-right)) 3rem max(var(--spacing-md), env(safe-area-inset-left));
    color: var(--text-secondary);
}
.seo-container { max-width: 800px; margin: 0 auto; }
.seo-section + .seo-section,
.seo-content .related { margin-top: 3rem; }
.seo-content h2 { font-size: 1.4rem; line-height: 1.3; color: var(--text-primary); margin-bottom: var(--spacing-md); }
.seo-content h3 { font-size: 1.05rem; color: var(--text-primary); margin-bottom: var(--spacing-xs); }
.seo-content p { margin-bottom: var(--spacing-md); line-height: 1.65; }
.seo-content strong { color: var(--text-primary); }
.seo-content a { color: #a5b4fc; }
.seo-list { list-style: none; display: grid; gap: var(--spacing-sm); line-height: 1.6; }
.seo-list li { position: relative; padding-left: 1.25rem; }
.seo-list li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-secondary); }
.seo-steps { list-style: none; counter-reset: seo-step; display: grid; gap: var(--spacing-md); }
.seo-steps li {
    counter-increment: seo-step; position: relative;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-xs) 3.5rem;
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md);
}
.seo-steps li::before {
    content: counter(seo-step); position: absolute; left: var(--spacing-md); top: var(--spacing-md);
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff; background: var(--accent-gradient);
}
.seo-steps p { margin-bottom: var(--spacing-sm); }
.faq-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: var(--spacing-sm); }
.faq-item summary {
    min-height: 44px; display: flex; align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600; color: var(--text-primary); cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; margin-left: auto; padding-left: var(--spacing-md); color: var(--accent-secondary); font-size: 1.2rem; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { padding: 0 var(--spacing-md) var(--spacing-md); margin: 0; }
.related-links { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); }
.seo-content .related-links a {
    min-height: 44px; display: inline-flex; align-items: center; gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 999px;
    color: var(--text-primary); text-decoration: none;
    transition: border-color var(--transition-fast);
}
.seo-content .related-links a:hover,
.seo-content .related-links a:focus-visible { border-color: var(--accent-primary); }
.related-links i { color: var(--accent-secondary); }
@media (min-width: 1024px) {
    .seo-content { padding-left: clamp(16px, 2.2vw, 40px); padding-right: clamp(16px, 2.2vw, 40px); }
    .seo-container { max-width: none; display: grid; gap: 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
    .seo-container > * { min-width: 0; }
    .seo-section + .seo-section,
    .seo-content .related { margin-top: 0; }
    .seo-content p { max-width: 80ch; }
    .faq-section,
    .seo-content .related { grid-column: 1 / -1; }
    .faq-section { display: grid; gap: var(--spacing-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; }
    .faq-section h2 { grid-column: 1 / -1; }
    .faq-section .faq-item { margin-bottom: 0; }
}

/* Embed mode (#room=<code>&embed=1 inside tools/warcraft3): the call only, no navbar or about text */
html.tc-embed { --tt-topnav-h: 0px !important; }
html.tc-embed #ttnav,
html.tc-embed #ttnav-tab,
html.tc-embed .seo-content { display: none !important; }
