@charset "UTF-8";
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Arial, "Noto Sans", sans-serif;
    font-size: 16px;
    font-weight: 360;
    line-height: 16px;
    letter-spacing: -0.3px;
    background-color: #fff;
    color: #0a0e22;
    word-wrap: break-word;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-backface-visibility: hidden;
}

canvas {
    letter-spacing: 0;
    font-family: Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    white-space: nowrap;
}

.divWithLineBreaks {
    letter-spacing: 0;
    font-family: Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    position: fixed;
    top: -10000px;
    left: 250px;
    white-space: nowrap;
    border: 1px black solid;
}

.hiddenTextWidthDetect {
    letter-spacing: 0;
    font-family: Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    position: fixed;
    top: -1000px;
    right: -1000px;
    white-space: nowrap;
}

button, hr, input {
    overflow: visible;
}

progress, sub, sup {
    vertical-align: baseline;
}

[type=checkbox], [type=radio], legend {
    box-sizing: border-box;
    padding: 0;
}

details, main {
    display: block;
}

h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

hr {
    box-sizing: content-box;
    height: 0;
}

code, kbd, pre, samp {
    font-family: monospace, monospace;
    font-size: 1em;
}

abbr[title] {
    border-bottom: none;
    text-decoration: underline;
    text-decoration: underline dotted;
}

sub, sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

img {
    border-style: none;
}

button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

button, select {
    text-transform: none;
}

[type=button], [type=reset], [type=submit], button {
    -webkit-appearance: button;
}

[type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner, button::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

[type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring, button:-moz-focusring {
    outline: ButtonText dotted 1px;
}

fieldset {
    padding: 0.35em 0.75em 0.625em;
}

legend {
    color: inherit;
    display: table;
    max-width: 100%;
    white-space: normal;
}

textarea {
    overflow: auto;
}

[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button {
    height: auto;
}

[type=search] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

[type=search]::-webkit-search-decoration {
    -webkit-appearance: none;
}

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

summary {
    display: list-item;
}

[hidden], template {
    display: none;
}

.adminSecure {
    background-color: #ffe9e9;
    border: 1px red solid;
    display: flex;
    padding: 10px;
}

.mb20 {
    margin-bottom: 20px;
}

.mt20 {
    margin-top: 20px;
}

.mb2 {
    margin-bottom: 2px;
}

.ptb48 {
    padding: 48px 0;
}

@media only screen and (max-width: 853px) {
    .ptb48 {
        padding: 20px 0;
    }
}
ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

strike {
    text-decoration: line-through;
}

img {
    vertical-align: middle;
    max-width: 100%;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

input::-ms-clear {
    display: none;
}

::selection {
    background-color: #cef3d1;
    color: #0a0e22;
}

::-moz-selection {
    background-color: #cef3d1;
    color: #0a0e22;
}

a {
    background-color: transparent;
    cursor: pointer;
    text-decoration: none;
}
a:focus {
    outline: 0;
}

button {
    outline: 0 !important;
}

h1, h2, h3, h4, h5, h6, p, ol, ul, li {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    vertical-align: baseline;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 440;
    color: #0a0e22;
    line-height: 100%;
}

h1 {
    font-size: 250%;
    letter-spacing: -0.75px;
    margin: 12px 0;
}

h2 {
    font-size: 200%;
    letter-spacing: -0.6px;
    margin: 10px 0;
}

h3 {
    font-size: 150%;
    letter-spacing: -0.45px;
    margin: 8px 0;
}

h4 {
    font-size: 120%;
    letter-spacing: -0.36px;
    margin: 6px 0;
}

h5 {
    font-size: 110%;
    letter-spacing: -0.33px;
    margin: 4px 0;
}

h6 {
    font-size: 105%;
    letter-spacing: -0.315px;
    margin: 2px 0;
}

.text80n {
    vertical-align: baseline;
    font-size: 80%;
    letter-spacing: -0.24px;
    line-height: 1;
    font-weight: 360;
    color: #0a0e22;
}

.text90n {
    vertical-align: baseline;
    font-size: 90%;
    letter-spacing: -0.27px;
    line-height: 1;
    font-weight: 360;
    color: #0a0e22;
}

.text100n {
    vertical-align: baseline;
    font-size: 100%;
    letter-spacing: -0.3px;
    line-height: 1;
    font-weight: 360;
    color: #0a0e22;
}

.text100n16 {
    vertical-align: baseline;
    font-size: 100%;
    letter-spacing: -0.3px;
    line-height: 1.6;
    font-weight: 360;
    color: #0a0e22;
}

.text105n16 {
    vertical-align: baseline;
    font-size: 105%;
    letter-spacing: -0.315px;
    line-height: 1.6;
    font-weight: 360;
    color: #0a0e22;
}

.text120n {
    vertical-align: baseline;
    font-size: 120%;
    letter-spacing: -0.36px;
    line-height: 1.2;
    font-weight: 360;
    color: #0a0e22;
}

b, strong, .bold {
    font-weight: 440;
}

.boldx {
    font-weight: 660;
}

.gray {
    color: #737373;
}

.link {
    color: #737373;
    cursor: pointer;
}
.link.link:hover, .link.link:focus {
    color: #0a0e22;
}

hr {
    width: 100%;
    margin: 12px 0;
    padding: 0;
    border: 0;
}

.developers-screen-size {
    background-image: none;
    background-color: rgba(229, 229, 229, 0.5);
    position: fixed;
    z-index: 1;
    right: 12px;
    bottom: 12px;
    width: 64px;
    height: 28px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: initial;
    gap: normal;
    border: 0;
    border-radius: 6px;
    font-size: 100%;
    letter-spacing: -0.3px;
    line-height: 1.4;
    font-weight: 500;
    color: #0a0e22;
    -webkit-backdrop-filter: saturate(105%) blur(120px);
    backdrop-filter: saturate(105%) blur(120px);
}

.flex.row {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: row;
    gap: 0;
}
.flex.column {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: column;
    gap: 0;
}
.flex.gap5 {
    gap: 6.4px;
}
.flex.ac {
    align-items: center;
}
.flex.jc {
    justify-content: center;
}
.flex.width {
    width: 100%;
}
.flex.sb {
    justify-content: space-between;
}

.flexrow {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: row;
    gap: 0;
}
.flexrow.flexc, .flexrow.ac {
    align-items: center;
}
.flexrow.jc {
    justify-content: center;
}

.flexcolumn {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: column;
    gap: 0;
}
.flexcolumn.flexc {
    justify-content: center;
}
.flexcolumn.ac {
    align-items: center;
}
.flexcolumn.jc {
    justify-items: center;
}

.flexrowleft {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.flextop {
    align-items: flex-start;
}

.flexrowright {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.flxstrt {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.flexwrap {
    flex-wrap: wrap;
}

.flexvcenter {
    align-items: center;
}

.flexcetncntn {
    align-content: center;
}

.h10 {
    height: 13.28px;
}

.h20 {
    height: 25.6px;
}

.h40 {
    height: 51.2px;
}

.site-content {
    position: relative;
    margin: 0 auto;
    padding: 0 24px;
    max-width: 1280px;
}

.hsa {
    -o-transition: transform 0.2s linear;
    transition: transform 0.2s linear;
    cursor: pointer;
}
.hsa:hover {
    transform: scale(1.05);
}
.hsa:active {
    transform: scale(0.95);
}

/* ================================
   МИНИМАЛИСТИЧНАЯ ВЕБИНАР ПЛАТФОРМА
   Светлая тема, Roboto
   ================================ */

:root {
    /* Primary */
    --primary: #3c8aff;
    --primary-dark: #176ef0;
    --primary-darkest: #0259b2;
    --primary-light: #caeaff;

    /* Backgrounds */
    --bg-page: #f5f5f5;
    --bg-card: #fff;
    --bg-dark: #aeaeae;

    /* Text */
    --text-primary: #595959;
    --text-secondary: #555;
    --text-muted: #999;

    /* Borders */
    --border-color: #e0e0e0;

    /* Status */
    --success: #28b536;
    --success-light: #cef3d1;
    --error: #b9005b;
    --warn: #f86434;
    --warn-light: #ffe192;
    --info: #0481fd;

    /* Accents */
    --purple: #7a4495;
    --pink: #ffe6e6;
    --dark-pink: #b63f9c;
    --yellow: #fff6a9;
    --orange-dark: #bf4219;
}

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

html, body {
    height: 100%;
    font-family: 'Roboto', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===============================
   ROLE BADGE
   =============================== */

.role-badge {
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.role-badge.viewer {
    background: var(--text-secondary);
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    background: var(--pink);
    border: 1px solid rgba(185, 0, 91, 0.2);
    border-radius: 6px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

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

.live-text {
    color: var(--error);
    font-weight: 700;
    font-size: 0.8rem;
}

.duration {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ===============================
   TOP BAR
   =============================== */
/* ===============================
   MEDIA TOOLBAR
   =============================== */
.media-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.media-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}
.media-toolbar-btn img {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.media-toolbar-btn:hover {
    background: var(--border-color);
}
.media-toolbar-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.media-toolbar-btn.active img {
    opacity: 1;
    filter: brightness(0) invert(1);
}
.media-toolbar-emoji {
    font-size: 1.2rem;
    line-height: 1;
}
.media-toolbar-btn.active .media-toolbar-emoji {
    filter: none;
}
.media-toolbar-label {
    pointer-events: none;
}
@media (max-width: 480px) {
    .media-toolbar {
        gap: 8px;
        padding: 6px 8px;
    }
    .media-toolbar-btn {
        height: 42px;
        padding: 0 14px;
        gap: 6px;
        border-radius: 10px;
        font-size: 0.8rem;
    }
    .media-toolbar-btn img {
        width: 22px;
        height: 22px;
    }
}

/* ===============================
   TOP BAR
   =============================== */
.top-bar {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 8px;
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.top-bar-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===============================
   BOTTOM TABS
   =============================== */
.bottom-tabs {
    height: 40px;
    display: flex;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}
.bottom-tab {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.bottom-tab.active {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}
.chat-badge {
    position: absolute;
    top: 4px;
    margin-left: 4px;
    background: var(--error);
    color: white;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

/* ===============================
   CHAT FULLSCREEN TAB
   =============================== */
.chat-fullscreen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.chat-fullscreen .chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chat-fullscreen .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ===============================
   MAIN CONTENT
   =============================== */
.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.left-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Host tile container (webinar) */
.host-tile-container {
    display: none;
    justify-content: center;
    padding: 8px 8px 0;
    flex-shrink: 0;
}

.host-tile-container:has(.user-tile) {
    display: flex;
}

.host-tile-container .user-tile {
    width: 100%;
    max-height: 100px;
    /*max-width: 320px;*/
    /*aspect-ratio: 16 / 9;*/
}

.host-tile-container .user-tile .tile-video {
    border-radius: 6px;
}

.right-column {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

/* Video Area */
.video-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-height: 0;
    max-height: 240px;
}

.main-video {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 8px;
    overflow: hidden;
}

#mainVideoElement {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.main-video-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.placeholder-icon {
    font-size: 3.5rem;
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

.placeholder-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Unmute Button */
.unmute-btn {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 4000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.unmute-btn:hover {
    transform: translateX(-50%) scale(1.05);
}

.unmute-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.main-video-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #fff;
}

/* Video Controls */
.video-controls-overlay {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.video-control-btn img {
    width: 20px;
    height: 20px;
}

.video-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-control-btn.active {
    background: var(--success);
    border-color: var(--success);
}

.video-control-btn.active.screen {
    background: #6366f1;
    border-color: #6366f1;
}

/* Audio Level Indicator */
#audioLevel {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-level-bar {
    width: 100px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.audio-level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #f59e0b, var(--error));
    width: 0%;
    transition: width 0.1s;
}

/* PiP Video */
.pip-video {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 160px;
    height: 90px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

#pipVideoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pip-label {
    position: absolute;
    bottom: 0.4rem;
    left: 0.4rem;
    padding: 0.15rem 0.4rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    font-size: 0.7rem;
    color: #fff;
}

/* Fullscreen Button */
.fullscreen-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 34px;
    height: 34px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fullscreen-btn:hover {
    background: var(--primary);
}

/* ===============================
   NETWORK TOPOLOGY SVG
   =============================== */
.network-topology-container {
    flex: 0 0 100%;
    min-height: 120px;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.network-svg {
    width: 100%;
    height: 100%;
}

/* SFU центральный узел */
.sfu-dot {
    fill: var(--primary);
    stroke: var(--primary-dark, #176ef0);
    stroke-width: 2;
}

.sfu-label {
    fill: #fff;
    font-size: 8px;
    font-weight: 700;
    font-family: inherit;
}

.sfu-sublabel {
    fill: rgba(255, 255, 255, 0.5);
    font-size: 6px;
    font-family: inherit;
}

/* Клиентские узлы */
.client-node {
    transition: opacity 0.3s ease;
}

.client-dot {
    fill: var(--border-color);
    stroke: var(--text-muted, #999);
    stroke-width: 1.5;
    transition: fill 0.4s, stroke 0.4s;
}

.client-dot.streaming {
    fill: var(--success);
    stroke: var(--success);
}

.client-dot.dead-stream {
    fill: var(--error, #b9005b);
    stroke: var(--error, #b9005b);
}

.client-label {
    fill: var(--text-primary);
    font-size: 7px;
    font-weight: 600;
    font-family: inherit;
}

.client-node.is-host .client-dot {
    stroke-width: 2;
}

.client-node.is-host .client-label {
    font-weight: 700;
}

.client-node.is-me .client-label {
    fill: var(--primary);
}

/* Линии (edges) */
.stream-edge {
    transition: opacity 0.3s ease;
}

.edge-bg {
    stroke: rgba(150, 150, 150, 0.25);
    stroke-width: 1.5;
    stroke-linecap: round;
}

.edge-flow {
    stroke: rgba(150, 150, 150, 0.15);
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
    transition: stroke 0.4s;
}

.edge-flow.idle {
    stroke: rgba(150, 150, 150, 0.15);
    stroke-dasharray: none;
    animation: none;
}

.edge-flow.active {
    stroke: var(--success);
    stroke-width: 2.5;
    stroke-dasharray: 6 4;
    animation: dashFlow 0.8s linear infinite;
}

.edge-flow.dead {
    stroke: var(--error, #b9005b);
    stroke-width: 2;
    stroke-dasharray: 3 3;
    animation: none;
    opacity: 0.6;
}

@keyframes dashFlow {
    to { stroke-dashoffset: -10; }
}

/* Downstream линии (SFU → клиент) — обратная анимация */
.edge-flow.downstream.active {
    stroke: var(--success);
    stroke-width: 2;
    stroke-dasharray: 6 4;
    animation: dashFlowDown 0.8s linear infinite;
    opacity: 0.8;
}

.edge-flow.downstream.dead {
    stroke: var(--error, #b9005b);
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
    animation: none;
    opacity: 0.5;
}

.edge-flow.downstream.idle {
    stroke: rgba(150, 150, 150, 0.1);
}

.downstream-edge .edge-bg {
    stroke: rgba(150, 150, 150, 0.12);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

@keyframes dashFlowDown {
    to { stroke-dashoffset: 10; }
}

/* ===============================
   PARTICIPANTS PANEL
   =============================== */
.participants-panel {
    background: var(--bg-card);
    padding: 0.4rem;
    overflow-y: auto;
}

/* Room Controls (top of participants panel) */
.room-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.room-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.room-controls .close-room-btn,
.room-controls .leave-room-btn {
    width: 100%;
}

.leave-room-btn {
    background: var(--text-secondary);
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.leave-room-btn:hover {
    opacity: 0.9;
}

/* Room Link */
.room-link-section {
    display: flex;
    align-items: center;
}

.room-link-row {
    display: flex;
    gap: 0.25rem;
}

.room-link-url {
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-page);
    color: var(--text-primary);
    cursor: text;
}

.room-link-url:focus {
    outline: none;
    border-color: var(--primary);
}

.room-link-copy {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-page);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    transition: background 0.2s;
}

.room-link-copy:hover {
    background: var(--primary-light);
}

.room-link-copy.copied {
    background: var(--success-light);
    border-color: var(--success);
}

.participants-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Stream Monitor — Graph: Client → Server */
.stream-monitor {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.4rem 0;
}

.stream-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.4rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.4s ease, background 0.4s ease;
}

.stream-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.stream-bar.removing {
    opacity: 0;
    transform: translateY(-6px);
}

/* Узлы графа (клиент / сервер) */
.stream-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 32px;
}

.stream-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--border-color);
    transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

.stream-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.stream-node.server .stream-label {
    color: var(--text-muted, #999);
    font-weight: 500;
}

/* Линия между узлами */
.stream-line {
    flex: 1;
    height: 3px;
    position: relative;
    min-width: 30px;
    border-radius: 2px;
    overflow: hidden;
}

.stream-line-bg {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 2px;
}

.stream-line-flow {
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--success) 30%, var(--success-light) 50%, var(--success) 70%, transparent 100%);
    background-size: 200% 100%;
    animation: streamFlow 1.2s linear infinite;
}

.stream-bar-bitrate {
    font-size: 0.58rem;
    color: var(--text-muted, #999);
    white-space: nowrap;
    min-width: 38px;
    text-align: right;
}

/* Healthy state — зелёный */
.stream-bar.healthy {
    border-color: color-mix(in srgb, var(--success) 40%, transparent);
    background: var(--success-light);
}

.stream-bar.healthy .stream-dot {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 4px rgba(40, 181, 54, 0.4);
}

.stream-bar.healthy .stream-line-flow {
    background: linear-gradient(90deg, transparent 0%, var(--success) 30%, #6dd67e 50%, var(--success) 70%, transparent 100%);
    background-size: 200% 100%;
}

/* Dead state — красный */
.stream-bar.dead {
    border-color: color-mix(in srgb, var(--error, #b9005b) 40%, transparent);
    background: #fce4ec;
}

.stream-bar.dead .stream-dot {
    background: var(--error, #b9005b);
    border-color: var(--error, #b9005b);
    box-shadow: none;
}

.stream-bar.dead .stream-line-flow {
    background: var(--error, #b9005b);
    animation: none;
    opacity: 0.3;
}

.stream-bar.dead .stream-label,
.stream-bar.dead .stream-bar-bitrate {
    color: var(--error, #b9005b);
}

@keyframes streamFlow {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.participants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.2rem 0.45rem 0.2rem 0.55rem;
    transition: background 0.2s;
}

.participant-chip:hover {
    background: #ececec;
}

.participant-chip.is-me {
    background: var(--primary-light);
    border-color: var(--primary);
}

.participant-chip.is-me:hover {
    background: #b8deff;
}

.participant-chip.is-admin {
    border-color: #f59e0b;
}

.chip-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.chip-media {
    display: flex;
    gap: 0.2rem;
}

.participant-chip .media-indicator {
    width: 24px;
    height: 24px;
}

.participant-chip .media-indicator img {
    width: 13px;
    height: 13px;
}

.participant-chip .media-indicator.hand-raised {
    font-size: 11px;
}

.me-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary-dark);
    background: rgba(60, 138, 255, 0.15);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* ===============================
   TILES GRID
   =============================== */
.tiles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    align-content: flex-start;
    min-height: 0;
}

/* ===============================
   USERS LIST (badges)
   =============================== */
.users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 8px 4px;
    align-items: center;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-tertiary, #1a1a2e);
    border: 1.5px solid transparent;
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
    white-space: nowrap;
}

.user-badge.is-me {
    border-color: var(--primary);
}

.user-badge.speaking {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.user-badge.hand-raised {
    border-color: #f59e0b;
}

.user-badge.removing {
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.3s;
}

.badge-name {
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-name.me {
    color: var(--success);
    font-weight: 600;
}

.badge-mic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.badge-mic img {
    width: 14px;
    height: 14px;
    filter: invert(1);
    opacity: 0.5;
}

.badge-mic.on img {
    opacity: 1;
}

.badge-mic.clickable {
    cursor: pointer;
}

.badge-hand {
    font-size: 0.9rem;
    animation: handWave 1s ease-in-out infinite;
}

.badge-action {
    cursor: pointer;
    font-size: 0.85rem;
}

.badge-action:hover {
    transform: scale(1.15);
}

/* Adaptive tile widths */
.tiles-grid.tiles-1 .user-tile {
    width: 100%;
    max-width: 160px;
}
.tiles-grid.tiles-2 .user-tile {
    width: calc(50% - 4px);
    max-width: 160px;
    max-height: 160px;
}
.tiles-grid.tiles-3-4 .user-tile {
    width: calc(50% - 4px);
    max-width: 160px;
    max-height: 160px;
}
.tiles-grid.tiles-many .user-tile {
    width: calc(33.333% - 6px);
}

.user-tile {
    aspect-ratio: 1;
    border-radius: 8px;
    background: var(--bg-tertiary, #1a1a2e);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.user-tile.is-me {
    border-color: var(--primary);
}

.tiles-grid.tiles-2 .user-tile.is-me,
.tiles-grid.tiles-3-4 .user-tile.is-me {
    width: calc(60% - 4px);
    max-width: 190px;
    max-height: 190px;
}

.tiles-grid.tiles-many .user-tile.is-me {
    width: calc(40% - 6px);
}

.user-tile.speaking {
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.user-tile.removing {
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.3s;
}

.tile-video {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #16162a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tile-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Когда в тайле и экран и камера — камера маленькая в углу */
.tile-video.has-screen .tile-video-camera {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 30%;
    height: 30%;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 3;
    object-fit: cover;
}

.tile-video.has-screen .tile-video-screen {
    z-index: 1;
}

.tile-placeholder {
    font-size: 1.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    user-select: none;
}

.tile-name {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    z-index: 2;
    max-width: calc(100% - 40px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}



.tile-media {
    position: absolute;
    bottom: 4px;
    left: 6px;
    display: flex;
    gap: 4px;
    z-index: 2;
}

.tile-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.tile-icon img {
    width: 14px;
    height: 14px;
    filter: invert(1);
    opacity: 0.5;
}

.tile-icon.active {
    background: rgba(34, 197, 94, 0.7);
}

.tile-icon.active img {
    opacity: 1;
}

/* Свои иконки — крупнее */
.user-tile.is-me .tile-icon {
    width: 30px;
    height: 30px;
}

.user-tile.is-me .tile-icon img {
    width: 18px;
    height: 18px;
}

.user-tile.is-me .tile-icon.hand-icon {
    font-size: 15px;
}

.tile-icon.clickable {
    cursor: pointer;
}

.tile-icon.clickable:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tile-icon.active.clickable:hover {
    background: rgba(34, 197, 94, 0.9);
}

.tile-icon.hand-icon {
    font-size: 12px;
    line-height: 1;
}

.tile-icon.hand-icon.active {
    background: rgba(255, 165, 0, 0.7);
}

.tile-icon.hand-icon.active:hover {
    background: rgba(255, 165, 0, 0.9);
}

.tile-icon.floor-btn {
    font-size: 0.9rem;
    cursor: pointer;
}

.tile-icon.floor-btn.give {
    background: rgba(76, 175, 80, 0.6);
}

.tile-icon.floor-btn.give:hover {
    background: rgba(76, 175, 80, 0.9);
}

.tile-icon.floor-btn.revoke {
    background: rgba(244, 67, 54, 0.6);
}

.tile-icon.floor-btn.revoke:hover {
    background: rgba(244, 67, 54, 0.9);
}

.tile-hand {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 1.2rem;
    display: none;
    z-index: 2;
}

.user-tile.hand-raised .tile-hand {
    display: block;
    animation: handWave 1s ease-in-out infinite;
}

@keyframes handWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

.tile-controls {
    position: absolute;
    bottom: 4px;
    right: 6px;
    z-index: 2;
}

.tile-btn {
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tile-btn.give {
    background: var(--primary);
    color: #fff;
}

.tile-btn.revoke {
    background: var(--error, #ef4444);
    color: #fff;
}

.tile-btn:hover {
    opacity: 0.85;
}

/* Pin button */
.tile-pin-btn {
    position: absolute;
    top: 4px;
    right: 28px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
}

.tile-pin-btn img {
    width: 14px;
    height: 14px;
    filter: invert(1);
}

.tile-video.has-camera ~ .tile-pin-btn,
.tile-video.has-screen ~ .tile-pin-btn {
    display: flex;
}

.user-tile:hover > .tile-video.has-camera ~ .tile-pin-btn,
.user-tile:hover > .tile-video.has-screen ~ .tile-pin-btn {
    opacity: 1;
}

.tile-pin-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.tile-pin-btn.active {
    opacity: 1;
    background: var(--primary);
}

/* Spotlight — fullscreen mode */
.tiles-grid.spotlight-mode {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #000;
    flex-wrap: nowrap;
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.tiles-grid.spotlight-mode .user-tile {
    width: auto;
    max-width: none;
    border-radius: 0;
}

/* Закреплённый тайл — весь экран */
.tiles-grid.spotlight-mode .user-tile.pinned {
    flex: 1;
    aspect-ratio: auto;
    min-height: 0;
    border: none;
}

.tiles-grid.spotlight-mode .user-tile.pinned .tile-video video {
    object-fit: contain;
}

/* Имя на закреплённом — крупно, внизу слева, с фоном */
.tiles-grid.spotlight-mode .user-tile.pinned .tile-name {
    top: auto;
    bottom: 68px;
    left: 12px;
    font-size: 0.95rem;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 6px;
    max-width: 320px;
}

/* Медиа-иконки на закреплённом — прячем (есть панель контролов) */
.tiles-grid.spotlight-mode .user-tile.pinned .tile-media {
    display: none;
}

/* Рука на закреплённом — крупнее */
.tiles-grid.spotlight-mode .user-tile.pinned .tile-hand {
    top: 12px;
    right: 56px;
    font-size: 1.5rem;
}

/* Миниатюры — поверх, внизу слева */
.tiles-grid.spotlight-mode .user-tile.thumbnail {
    position: absolute;
    bottom: 64px;
    width: 112px;
    height: 84px;
    aspect-ratio: auto;
    flex: none;
    z-index: 5;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.2s;
}

.tiles-grid.spotlight-mode .user-tile.thumbnail:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Имя на миниатюре — снизу, с фоном */
.tiles-grid.spotlight-mode .user-tile.thumbnail .tile-name {
    top: auto;
    bottom: 4px;
    left: 4px;
    font-size: 0.55rem;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 3px;
    max-width: calc(100% - 8px);
}

/* Медиа-иконки на миниатюрах — только активные */
.tiles-grid.spotlight-mode .user-tile.thumbnail .tile-media {
    gap: 2px;
}

.tiles-grid.spotlight-mode .user-tile.thumbnail .tile-icon {
    width: 18px;
    height: 18px;
}

.tiles-grid.spotlight-mode .user-tile.thumbnail .tile-icon img {
    width: 10px;
    height: 10px;
}

.tiles-grid.spotlight-mode .user-tile.thumbnail .tile-icon.inactive {
    display: none;
}

/* Скрытые тайлы */
.tiles-grid.spotlight-mode .user-tile.spotlight-hidden {
    display: none;
}

/* Speaking в spotlight */
.tiles-grid.spotlight-mode .user-tile.pinned.speaking {
    border: 2px solid var(--success);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.tiles-grid.spotlight-mode .user-tile.thumbnail.speaking {
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* Скрываем кнопку pin внутри spotlight */
.tiles-grid.spotlight-mode .tile-pin-btn {
    display: none !important;
}

/* Кнопка закрытия (×) */
.spotlight-exit-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.spotlight-exit-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Панель контролов — нижний центр */
.spotlight-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.spotlight-ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.spotlight-ctrl-btn img {
    width: 20px;
    height: 20px;
    filter: invert(1);
}

.spotlight-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.spotlight-ctrl-btn.unpin {
    background: rgba(239, 68, 68, 0.6);
    border-color: rgba(239, 68, 68, 0.4);
}

.spotlight-ctrl-btn.unpin:hover {
    background: rgba(239, 68, 68, 0.85);
}

/* Mobile spotlight */
@media (max-width: 768px) {
    .tiles-grid.spotlight-mode .user-tile.thumbnail {
        width: 88px;
        height: 66px;
        bottom: 54px;
    }

    .tiles-grid.spotlight-mode .user-tile.pinned .tile-name {
        font-size: 0.85rem;
        bottom: 60px;
    }

    .spotlight-controls {
        height: 50px;
    }

    .spotlight-ctrl-btn {
        width: 38px;
        height: 38px;
    }

    .spotlight-ctrl-btn img {
        width: 18px;
        height: 18px;
    }
}

/* Tiles Sidebar */
.tiles-sidebar {
    background: var(--bg-card);
    padding: 0.4rem;
    flex-shrink: 0;
}

/* Chat */
.chat-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    padding: 0.75rem;
}

.chat-messages {
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    min-height: 140px;
    flex: 1;
    overflow-y: auto;
}

.chat-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-input {
    display: flex;
    gap: 0.4rem;
}

.chat-input input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 16px;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input input:disabled {
    opacity: 0.6;
    background: var(--bg-page);
}

.chat-input button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: not-allowed;
    opacity: 0.6;
}

.chat-input button:not(:disabled) {
    cursor: pointer;
    opacity: 1;
}

.chat-input button:not(:disabled):hover {
    background: var(--primary-dark);
}

/* Chat Bubbles */
.chat-bubble-row {
    display: flex;
    margin-bottom: 0.3rem;
}

.chat-bubble-row-own {
    justify-content: flex-end;
}

.chat-bubble-row-other {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.45rem 0.65rem;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.chat-bubble-own {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble-other {
    background: #e8e8e8;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.15rem;
}

.chat-system-message {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    padding: 4px 0;
}

.chat-bubble-text {
    font-size: 0.88rem;
}

.chat-bubble-time {
    font-size: 0.65rem;
    text-align: right;
    margin-top: 0.15rem;
    opacity: 0.6;
}

.chat-bubble-own .chat-bubble-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Media Indicators */
.media-indicators {
    display: flex;
    gap: 0.35rem;
}

.media-indicator {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.media-indicator img {
    width: 16px;
    height: 16px;
}

.media-indicator.active {
    background: var(--success-light);
    border-color: var(--success);
}

.media-indicator.inactive {
    opacity: 0.5;
}

.media-indicator.hand-raised {
    background: var(--warn-light);
    border-color: #f59e0b;
    animation: handPulse 1.5s ease-in-out infinite;
    font-size: 13px;
    opacity: 1;
}

.media-indicator.speaking {
    background: var(--success-light);
    border-color: var(--success);
    box-shadow: 0 0 6px rgba(40, 181, 54, 0.3);
}

.media-indicator.clickable {
    cursor: pointer;
}

.media-indicator.clickable:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

@keyframes handPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 10px 2px rgba(245, 158, 11, 0.3); }
}

/* Raise Hand Button (viewer) */
.hand-btn {
    font-size: 1.1rem;
}

.hand-btn-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.hand-btn.hand-raised-active {
    background: rgba(245, 158, 11, 0.3);
    border-color: #f59e0b;
    animation: handPulse 1.5s ease-in-out infinite;
}

.hand-btn.speaking-active {
    background: var(--success);
    border-color: var(--success);
}

/* Viewer Info */
.viewer-info {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
}

.status-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.status-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

/* ===============================
   MODAL / LOGIN
   =============================== */
html,
body {
    height: 100%;
}

.login-page {
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-page) 60%, #fff 100%);
}

.login-page .modal {
    position: static;
    width: 100%;
    height: 100%;
    background: transparent;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page .modal-content {
    width: min(680px, 94vw);
    max-height: 92vh;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
}

.login-page .modal-header {
    background: linear-gradient(135deg, var(--primary-darkest), var(--primary));
}

.login-page .modal-body {
    padding: 1rem 1.25rem 1.25rem;
}

.login-page .form-group {
    margin-bottom: 0.85rem;
}

.login-page .role-option {
    padding: 0.75rem;
}

.login-page .role-icon {
    font-size: 1.6rem;
}

.login-page .join-btn {
    padding: 0.65rem;
    font-size: 0.9rem;
}

.my-rooms {
    padding: 0 1.25rem 1.25rem;
}

.my-rooms-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.my-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.my-room-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-secondary, #f5f5f5);
    text-decoration: none;
    color: inherit;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.my-room-item:hover {
    background: var(--bg-tertiary, #eee);
}

.my-room-type {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary, #4a6cf7);
    color: #fff;
    flex-shrink: 0;
}

.my-room-id {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.8rem;
}

.my-room-count {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    flex-shrink: 0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 480px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-dark);
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 0.35rem;
}

.modal-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.modal-body {
    padding: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
}

.form-group input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(60, 138, 255, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Role Selector */
.role-selector {
    display: flex;
    gap: 0.5rem;
}

.role-selector input[type="radio"] {
    display: none;
}

.role-option {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.role-option:hover {
    background: #ececec;
}

.role-selector input[type="radio"]:checked + .role-option {
    background: var(--primary-light);
    border-color: var(--primary);
}

.role-icon {
    font-size: 1.8rem;
    margin-bottom: 0.35rem;
    display: block;
}

.role-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.role-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.role-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.role-warning {
    color: var(--error);
    font-size: 0.7rem;
    margin-top: 0.2rem;
}

/* Choice Cards (Step 1) */
.choice-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.25rem;
    background: var(--bg-page);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.choice-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(60, 138, 255, 0.15);
}

.choice-icon { font-size: 2.2rem; }
.choice-title { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.choice-desc { font-size: 0.85rem; color: var(--text-secondary); }

/* Back Button */
.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-bottom: 0.75rem;
}

.back-btn:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.join-btn {
    width: 100%;
    padding: 0.7rem;
    background: var(--primary-dark);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.join-btn:hover {
    opacity: 0.9;
}

/* ===============================
   UTILITIES
   =============================== */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.video-notification {
    position: relative;
    top: auto;
    left: auto;
    transform: translateY(-20px);
    padding: 0.5rem 1rem;
    /*background: var(--bg-card);*/
    /*box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);*/
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    animation: videoNotifIn 0.3s ease forwards;
    /*border-left: 3px solid var(--primary);*/
}

.video-notification.success {
    border-left-color: var(--success);
}

.video-notification.error {
    border-left-color: var(--error);
}

.video-notification.fade-out {
    animation: videoNotifOut 0.3s ease forwards;
}

@keyframes videoNotifIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes videoNotifOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-20px); }
}

/* Legacy notification (fallback) */
.notification,
.notification-container {
    position: fixed;
    top: 0.75rem;
    right: -400px;
    max-width: 340px;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
    transition: right 0.3s ease;
    z-index: 3000;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.notification.show {
    right: 0.75rem;
}

.notification.success {
    border-left-color: var(--success);
}

.notification.error {
    border-left-color: var(--error);
}

/* Custom Alert Modal */
.custom-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: alertFadeIn 0.25s ease forwards;
}

.custom-alert {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 380px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    animation: alertScaleIn 0.25s ease forwards;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.custom-alert-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.custom-alert-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.custom-alert-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.custom-alert-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-alert-btn:hover {
    background: var(--primary-dark);
}

.custom-alert-btn.cancel {
    background: var(--text-secondary);
}

.custom-alert-btn.cancel:hover {
    background: #444;
}

.custom-alert-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.rename-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.rename-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(60, 138, 255, 0.15);
}

@keyframes alertFadeIn {
    to { opacity: 1; }
}

@keyframes alertScaleIn {
    to { transform: scale(1); }
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

/* Desktop: квадрантная раскладка */
@media (min-width: 769px) {
    .main-content {
        flex-direction: row;
    }

    .left-column {
        flex: 1;
        min-width: 0;
    }

    .right-column {
        flex: 1;
        border-left: 1px solid var(--border-color);
    }

    .chat-section {
        height: 100%;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .tile-video.has-screen .tile-video-camera {
        width: 25%;
        height: 25%;
    }
}

/* Mobile: одна колонка */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .left-column {
        flex: 1;
        min-height: 0;
    }

    .tiles-grid.tiles-many .user-tile {
        width: calc(50% - 4px);
    }

    .users-list {
        gap: 6px;
        padding: 6px;
    }

    .user-badge {
        padding: 5px 10px;
        font-size: 0.8rem;
        border-radius: 16px;
    }

    .right-column {
        flex: none;
        border-top: 1px solid var(--border-color);
    }

    .network-topology-container {
        flex: none;
        min-height: 100px;
        max-height: 140px;
    }

    .chat-section {
        height: auto;
        min-height: 200px;
    }

    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .role-selector {
        flex-direction: column;
    }

    .login-page .modal {
        padding: 0;
    }

    .login-page .modal-content {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .login-page .modal-header {
        padding: 1rem 0.75rem;
    }

    .login-page .modal-body {
        padding: 0.75rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .tile-name {
        font-size: 0.6rem;
    }

    .tile-icon {
        width: 20px;
        height: 20px;
    }

    .tile-icon img {
        width: 12px;
        height: 12px;
    }

    .user-tile.is-me .tile-icon {
        width: 26px;
        height: 26px;
    }

    .user-tile.is-me .tile-icon img {
        width: 15px;
        height: 15px;
    }

    .modal-header {
        padding: 0.85rem;
    }

    .modal-header h2 {
        font-size: 1.15rem;
    }

    .modal-body {
        padding: 0.85rem;
    }
}

@media (max-height: 740px) {
    .login-page .modal {
        padding: 0.75rem;
    }

    .login-page .modal-header {
        padding: 0.85rem;
    }

    .login-page .modal-header p {
        display: none;
    }

    .login-page .modal-body {
        padding: 0.75rem;
    }

    .login-page .form-group {
        margin-bottom: 0.6rem;
    }

    .login-page .role-desc {
        display: none;
    }
}

@media (max-height: 640px) {
    .login-page .role-option {
        padding: 0.5rem;
    }

    .login-page .role-icon {
        font-size: 1.3rem;
    }
}

/* ===============================
   CONNECTION INDICATOR
   =============================== */
.connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.conn-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.conn-text {
    white-space: nowrap;
}

.connection-indicator.good {
    background: var(--success-light);
    border-color: var(--success);
}

.connection-indicator.good .conn-icon {
    background: var(--success);
}

.connection-indicator.good .conn-text {
    color: var(--success);
}

.connection-indicator.warning {
    background: var(--warn-light);
    border-color: #f59e0b;
    animation: connPulse 2s ease-in-out infinite;
}

.connection-indicator.warning .conn-icon {
    background: #f59e0b;
}

.connection-indicator.warning .conn-text {
    color: #b45309;
}

.connection-indicator.critical {
    background: var(--pink);
    border-color: var(--error);
    animation: connPulse 1s ease-in-out infinite;
}

.connection-indicator.critical .conn-icon {
    background: var(--error);
}

.connection-indicator.critical .conn-text {
    color: var(--error);
}

.connection-indicator.reconnecting {
    background: var(--primary-light);
    border-color: var(--primary);
    animation: connPulse 1.5s ease-in-out infinite;
}

.connection-indicator.reconnecting .conn-icon {
    background: var(--primary);
}

.connection-indicator.reconnecting .conn-text {
    color: var(--primary-dark);
}

@keyframes connPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===============================
   RESERVATION BANNER
   =============================== */
.reservation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warn-light);
    border-bottom: 2px solid var(--warn);
    padding: 0.5rem 1rem;
    z-index: 6000;
}

.reservation-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.reservation-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.reservation-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.reservation-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.reservation-btn:hover {
    opacity: 0.9;
}

.reservation-btn.return {
    background: var(--primary);
    color: #fff;
}

.reservation-btn.close {
    background: var(--error);
    color: #fff;
}

/* Close Room Button (header) */
.close-room-btn {
    background: var(--error);
    color: #fff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.close-room-btn:hover {
    opacity: 0.9;
}

/* Free mic info banner */
.free-mic-info {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.35rem;
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

/* Free mic toggle */
.free-mic-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    user-select: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.free-mic-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.free-mic-toggle input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.free-mic-toggle span {
    white-space: nowrap;
}

/* Host suspended overlay */
.host-suspended-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    color: #fff;
}

.host-suspended-overlay .suspended-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.host-suspended-overlay .suspended-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.host-suspended-overlay .suspended-timer {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
    .reservation-banner-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Host Toolbar (broadcast/webinar) */
.host-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background: #f0f4ff;
    border-bottom: 1px solid #d0d8ef;
}

.host-toolbar-btn {
    padding: 6px 16px;
    border: 1px solid #b0b8d0;
    border-radius: 8px;
    background: #fff;
    color: #0a0e22;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.host-toolbar-btn:hover {
    background: #e8ecf8;
    border-color: #8090c0;
}

.host-toolbar-btn.active {
    background: var(--primary, #4a6cf7);
    color: #fff;
    border-color: var(--primary, #4a6cf7);
}

.host-toolbar-btn.active:hover {
    background: #3a5ce7;
    border-color: #3a5ce7;
}

.host-toolbar-btn.danger {
    color: #d32f2f;
    border-color: #e0a0a0;
}

.host-toolbar-btn.danger:hover {
    background: #fde8e8;
    border-color: #d32f2f;
}

/* Recording button */
#recordBtn.active {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
    animation: recordPulse 1.5s ease-in-out infinite;
}

#recordBtn.active:hover {
    background: #c0392b;
    border-color: #c0392b;
}

@keyframes recordPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.recording-download-btn {
    color: var(--primary, #4a6cf7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.recording-download-btn:hover {
    background: #e8ecf8;
}

/* Print */
@media print {
    .tiles-sidebar,
    .modal,
    .notification {
        display: none !important;
    }
}
