        :root {
            --chat-own: rgba(108, 99, 255, 0.35);
            --chat-other: rgba(255, 255, 255, 0.1);
            --seek-track: rgba(255, 255, 255, 0.2);
            --seek-fill: #6c63ff;
        }

        [data-theme="light"] {
            --chat-own: rgba(108, 99, 255, 0.2);
            --chat-other: rgba(0, 0, 0, 0.06);
            --seek-track: rgba(0, 0, 0, 0.12);
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        .theme-toggle {
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 8px 12px;
            border-radius: 10px;
            font-size: 18px;
            line-height: 1;
            cursor: pointer;
            transition: transform 0.2s, background 0.2s;
        }

        .theme-toggle:hover {
            transform: scale(1.05);
            background: var(--primary-soft);
        }

        /* Главная */
        .home-hero {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 24px;
        }

        .home-hero h1 {
            font-size: 32px;
            font-weight: 800;
            letter-spacing: -0.5px;
        }

        .home-hero p {
            color: var(--text-muted);
            margin-top: 4px;
        }

        .home-hero-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .home-link {
            padding: 8px 14px;
            border-radius: 10px;
            text-decoration: none;
            font-size: 14px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            transition: background 0.2s;
        }

        .home-link:hover {
            background: var(--primary-soft);
        }

        .home-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 24px;
        }

        .home-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 20px;
            padding: 24px;
            backdrop-filter: blur(10px);
            box-shadow: var(--shadow);
            transition: transform 0.25s ease, box-shadow 0.25s ease;
        }

        .home-card:hover {
            transform: translateY(-2px);
        }

        .home-card h2 {
            font-size: 20px;
            margin-bottom: 16px;
        }

        .shared-name-bar {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 16px 20px;
            margin-bottom: 20px;
        }
        
        .form-group {
            margin-bottom: 15px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: var(--text-soft);
            font-size: 14px;
        }

        .room-type-toggle {
            display: flex;
            gap: 8px;
        }

        .room-type-btn {
            flex: 1;
            padding: 10px 14px;
            background: var(--surface);
            border: 2px solid var(--border);
            color: var(--text-soft);
            font-size: 14px;
            border-radius: 10px;
            transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
        }

        .room-type-btn:hover:not(.active):not(:disabled) {
            border-color: var(--primary);
            background: var(--primary-soft);
            transform: none;
            box-shadow: none;
        }

        .room-type-btn.active {
            background: var(--primary-soft);
            border-color: var(--primary);
            color: var(--primary);
            font-weight: 600;
            box-shadow: 0 0 0 3px var(--primary-soft);
        }
        
        input, select {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--border);
            border-radius: 10px;
            background: var(--input-bg);
            color: var(--text);
            font-size: 16px;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        input:focus, select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-soft);
        }
        
        input::placeholder {
            color: var(--text-muted);
            opacity: 0.7;
        }
        
        button {
            background: var(--primary);
            color: #fff;
            border: none;
            padding: 12px 30px;
            border-radius: 10px;
            font-size: 16px;
            cursor: pointer;
            transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
        }
        
        button:hover:not(:disabled) {
            background: var(--primary-hover);
            transform: translateY(-2px);
            box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35);
        }
        
        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }
        
        /* Комната просмотра */
        .room-view {
            display: grid;
            grid-template-columns: 1fr 340px;
            gap: 20px;
            animation: room-enter 0.45s ease;
        }

        @keyframes room-enter {
            from { opacity: 0; transform: translateY(12px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .room-left,
        .room-right {
            min-width: 0;
        }

        .room-header {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 18px;
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: 16px;
            margin-bottom: 14px;
            flex-wrap: wrap;
        }

        .room-header-center {
            flex: 1;
            min-width: 0;
        }

        .room-header-center h2 {
            font-size: 17px;
            font-weight: 700;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .room-header-meta {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 4px;
            font-size: 12px;
            color: var(--text-muted);
        }

        .status-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
        }

        .status-badge.status-live {
            background: rgba(76, 175, 80, 0.25);
            color: #81c784;
        }

        .status-badge.status-live .live-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #4caf50;
            animation: live-pulse 1.4s ease infinite;
        }

        @keyframes live-pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.5; transform: scale(0.85); }
        }

        .status-badge.status-paused {
            background: rgba(255, 152, 0, 0.2);
            color: var(--warn);
        }

        .conn-status {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
        }

        .conn-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #4caf50;
            transition: background 0.3s;
        }

        .conn-status.reconnecting .conn-dot {
            background: var(--warn);
            animation: live-pulse 0.8s ease infinite;
        }

        .conn-status.offline .conn-dot {
            background: #e53935;
        }

        .role-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            cursor: help;
        }

        .role-badge.moderator {
            background: rgba(255, 193, 7, 0.25);
            color: #ffc107;
            border: 1px solid rgba(255, 193, 7, 0.4);
        }

        [data-theme="light"] .role-badge.moderator {
            color: #b8860b;
        }

        .role-badge.viewer {
            background: var(--surface);
            color: var(--text-soft);
            border: 1px solid var(--border);
        }

        .room-header-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .mobile-tabs {
            display: none;
            gap: 6px;
            margin-bottom: 12px;
            background: var(--surface);
            padding: 6px;
            border-radius: 12px;
            border: 1px solid var(--border);
        }

        .mobile-tab {
            flex: 1;
            padding: 10px 8px;
            font-size: 14px;
            background: transparent;
            color: var(--text-muted);
            border-radius: 8px;
        }

        .mobile-tab.active {
            background: var(--primary);
            color: #fff;
        }

        .mobile-tab:hover:not(.active) {
            background: var(--primary-soft);
            transform: none;
        }
        
        .video-section {
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: 20px;
            padding: 20px;
        }

        .player-panel {
            margin-top: 14px;
            padding: 14px;
            background: var(--surface-3);
            border: 1px solid var(--border);
            border-radius: 14px;
        }
        
        .video-wrapper {
            position: relative;
            padding-bottom: 56.25%;
            height: 0;
            overflow: hidden;
            border-radius: 12px;
        }
        
        .video-wrapper iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: none;
        }
        
        .player-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-top: 12px;
            flex-wrap: wrap;
        }

        .player-toolbar-left,
        .player-toolbar-right {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        .video-controls button,
        .player-toolbar button {
            background: var(--primary);
            padding: 8px 16px;
            font-size: 14px;
        }

        .btn-sync {
            background: var(--warn) !important;
        }
        
        .leave-btn {
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 8px 14px;
            font-size: 13px;
            flex-shrink: 0;
        }
        
        .leave-btn:hover:not(:disabled) {
            background: var(--danger-soft);
            transform: none;
        }
        
        .seek-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
        }

        .seek-track-wrap {
            flex: 1;
            position: relative;
            height: 6px;
            background: var(--seek-track);
            border-radius: 3px;
            cursor: pointer;
        }

        .seek-track-fill {
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            background: var(--seek-fill);
            border-radius: 3px;
            pointer-events: none;
            width: 0%;
            transition: width 0.05s linear;
        }
        
        .seek-bar input[type="range"] {
            position: absolute;
            inset: 0;
            width: 100%;
            margin: 0;
            padding: 0;
            height: 6px;
            cursor: pointer;
            -webkit-appearance: none;
            appearance: none;
            background: transparent;
        }

        .seek-bar input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--seek-fill);
            border: 2px solid #fff;
            box-shadow: 0 1px 4px rgba(0,0,0,0.3);
        }

        .seek-bar input[type="range"]::-moz-range-thumb {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--seek-fill);
            border: 2px solid #fff;
        }
        
        .seek-bar input[type="range"]:disabled {
            opacity: 0.55;
            cursor: default;
        }
        
        .seek-bar .time-label {
            font-size: 12px;
            color: var(--text-muted);
            min-width: 42px;
            text-align: center;
            font-variant-numeric: tabular-nums;
        }

        .volume-control {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
        }

        .volume-track-wrap {
            position: relative;
            width: 88px;
            height: 6px;
            background: var(--seek-track);
            border-radius: 3px;
            flex-shrink: 0;
        }

        .volume-track-fill {
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            background: var(--seek-fill);
            border-radius: 3px;
            pointer-events: none;
            width: 100%;
            transition: width 0.05s linear;
        }

        .volume-control input[type="range"] {
            position: absolute;
            inset: 0;
            width: 100%;
            margin: 0;
            padding: 0;
            height: 6px;
            cursor: pointer;
            -webkit-appearance: none;
            appearance: none;
            background: transparent;
        }

        .volume-control input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--seek-fill);
            border: 2px solid #fff;
            box-shadow: 0 1px 3px rgba(0,0,0,0.3);
        }

        .volume-control input[type="range"]::-moz-range-thumb {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--seek-fill);
            border: 2px solid #fff;
        }

        .btn-mute {
            background: var(--surface) !important;
            border: 1px solid var(--border);
            padding: 8px 10px !important;
            font-size: 16px !important;
            line-height: 1;
        }
        
        .video-url-input {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }
        
        .video-url-input input {
            flex: 1;
        }
        
        /* Чат */
        .chat-section {
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: 20px;
            display: flex;
            flex-direction: column;
            height: calc(100vh - 60px);
            max-height: 720px;
            min-height: 400px;
            position: relative;
        }
        
        .chat-header {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            padding: 15px;
            border-bottom: 1px solid var(--border);
            font-weight: bold;
            font-size: 15px;
        }

        .participants-list {
            padding: 12px 15px;
            border-bottom: 1px solid var(--border);
            max-height: 200px;
            overflow-y: auto;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .chat-messages-wrap {
            flex: 1;
            position: relative;
            min-height: 0;
            display: flex;
            flex-direction: column;
        }

        .chat-scroll-btn {
            position: absolute;
            bottom: 12px;
            right: 12px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            padding: 0;
            font-size: 18px;
            background: var(--primary);
            box-shadow: var(--shadow);
            z-index: 5;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s;
        }

        .chat-scroll-btn.visible {
            opacity: 1;
            pointer-events: auto;
        }
        
        .chat-message {
            max-width: 85%;
            display: flex;
            align-items: flex-end;
            gap: 8px;
            animation: msg-in 0.2s ease;
        }

        .chat-message .chat-bubble {
            padding: 8px 12px;
            border-radius: 14px;
            word-break: break-word;
            font-size: 14px;
            line-height: 1.45;
            flex: 1;
            min-width: 0;
        }

        .chat-avatar {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            flex-shrink: 0;
            object-fit: cover;
        }

        .chat-avatar-fallback {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            font-weight: 700;
            color: #fff;
        }

        @keyframes msg-in {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .chat-message.incoming {
            align-self: flex-start;
        }

        .chat-message.incoming .chat-bubble {
            background: var(--chat-other);
            border-bottom-left-radius: 4px;
        }

        .chat-message.outgoing {
            align-self: flex-end;
            flex-direction: row-reverse;
        }

        .chat-message.outgoing .chat-bubble {
            background: var(--chat-own);
            border-bottom-right-radius: 4px;
        }
        
        .chat-message.system-compact {
            align-self: center;
            max-width: 95%;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 12px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 20px;
            font-size: 12px;
            color: var(--text-muted);
        }

        .chat-message.system-compact .system-icon {
            flex-shrink: 0;
            font-size: 14px;
        }
        
        .chat-message .name {
            color: var(--primary);
            font-weight: 600;
            font-size: 12px;
            display: block;
            margin-bottom: 2px;
        }

        .chat-message.outgoing .name {
            text-align: right;
        }
        
        .chat-message .time {
            color: var(--text-muted);
            font-size: 10px;
            opacity: 0;
            transition: opacity 0.2s;
            display: block;
            margin-top: 4px;
        }

        .chat-message:hover .time {
            opacity: 1;
        }
        
        .chat-input {
            display: flex;
            padding: 15px;
            gap: 10px;
            border-top: 1px solid rgba(255,255,255,0.1);
        }
        
        .chat-input input {
            flex: 1;
            background: rgba(255,255,255,0.2);
        }
        
        .participants-title {
            font-size: 12px;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 10px;
        }
        
        .participant {
            padding: 8px 10px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-radius: 10px;
            transition: background 0.2s;
        }

        .participant:hover {
            background: var(--surface);
        }

        .participant.is-self {
            background: var(--primary-soft);
            border: 1px solid rgba(108, 99, 255, 0.3);
        }

        .participant.is-moderator {
            border-left: 3px solid #ffc107;
        }

        .participant-avatar img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
        }

        .participant-avatar {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
        }

        .participant.is-moderator .participant-avatar {
            box-shadow: 0 0 0 2px #ffc107;
        }

        .participant-info {
            flex: 1;
            min-width: 0;
        }

        .participant-name {
            font-size: 14px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .participant-you {
            font-size: 11px;
            color: var(--primary);
            font-weight: 500;
        }
        
        .moderator-badge {
            background: #ffc107;
            color: #1a1a2e;
            font-size: 10px;
            padding: 2px 7px;
            border-radius: 10px;
            font-weight: 600;
        }
        
        .viewer-badge {
            background: var(--surface);
            color: var(--text-soft);
            font-size: 10px;
            padding: 2px 7px;
            border-radius: 10px;
        }
        
        .video-wrapper.viewer-mode {
            pointer-events: none;
        }
        
        /* Блокируем клики по встроенному плееру — управление только кнопками сервиса */
        .video-wrapper.playback-locked #videoContainer,
        .video-wrapper.playback-locked #videoContainer iframe,
        .video-wrapper.playback-locked #videoContainer > div {
            pointer-events: none;
        }
        
        .player-shield {
            position: absolute;
            inset: 0;
            z-index: 10;
            background: transparent;
            cursor: default;
        }

        .player-paused-cover {
            position: absolute;
            inset: 0;
            z-index: 12;
            background: rgba(0, 0, 0, 0.45);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            display: flex;
            align-items: center;
            justify-content: center;
            pointer-events: auto;
            cursor: default;
            transition: opacity 0.25s ease;
        }

        .player-paused-cover.hidden {
            display: none;
        }

        .player-paused-cover .paused-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            text-align: center;
        }

        .player-paused-cover .paused-logo {
            font-size: 32px;
            opacity: 0.85;
            user-select: none;
        }

        .player-paused-cover .paused-icon {
            font-size: 48px;
            opacity: 0.7;
            user-select: none;
        }

        .player-paused-cover .paused-label {
            font-size: 13px;
            color: rgba(255, 255, 255, 0.75);
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        .player-toolbar .btn-icon {
            background: var(--surface);
            border: 1px solid var(--border);
        }

        .video-fullscreen-target {
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        .video-fullscreen-target:fullscreen,
        .video-fullscreen-target:-webkit-full-screen {
            width: 100vw;
            height: 100vh;
            background: #000;
            padding: 0;
            gap: 0;
            overflow: hidden;
        }

        .video-fullscreen-target:fullscreen .video-wrapper,
        .video-fullscreen-target:-webkit-full-screen .video-wrapper {
            flex: 1;
            min-height: 0;
            padding-bottom: 0;
            height: auto;
            border-radius: 0;
        }

        .video-fullscreen-target:fullscreen .player-panel,
        .video-fullscreen-target:-webkit-full-screen .player-panel {
            flex-shrink: 0;
            margin-top: 0;
            border-radius: 0;
            border: none;
            border-top: 1px solid rgba(255, 255, 255, 0.12);
            background: rgba(0, 0, 0, 0.85);
            transition: transform 0.35s ease, opacity 0.35s ease;
        }

        .video-fullscreen-target.fs-ui-hidden:fullscreen .player-panel,
        .video-fullscreen-target.fs-ui-hidden:-webkit-full-screen .player-panel {
            transform: translateY(100%);
            opacity: 0;
            pointer-events: none;
        }

        .btn-fullscreen {
            background: var(--surface) !important;
            border: 1px solid var(--border);
            padding: 8px 14px !important;
            font-size: 14px !important;
        }

        .btn-fullscreen:hover:not(:disabled) {
            background: var(--primary-soft) !important;
        }
        
        .video-wrapper.viewer-mode::after {
            content: 'Управление у модератора';
            position: absolute;
            bottom: 8px;
            right: 8px;
            background: rgba(0,0,0,0.7);
            color: #fff;
            font-size: 11px;
            padding: 4px 8px;
            border-radius: 6px;
            pointer-events: none;
            z-index: 2;
        }
        
        .sync-overlay {
            position: absolute;
            inset: 0;
            z-index: 20;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 10px;
            background: rgba(0, 0, 0, 0.75);
            pointer-events: auto;
        }
        
        .sync-overlay.hidden {
            display: none;
        }
        
        .sync-overlay button {
            font-size: 18px;
            padding: 14px 28px;
        }
        
        .sync-overlay p {
            color: #ccc;
            font-size: 13px;
            margin: 0;
        }
        
        #videoContainer {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        
        #videoContainer #videoPlayer {
            width: 100%;
            height: 100%;
        }
        
        .make-moderator {
            background: none;
            border: 1px solid var(--primary);
            color: var(--primary);
            padding: 4px 10px;
            font-size: 11px;
            flex-shrink: 0;
        }

        .make-moderator:hover:not(:disabled) {
            background: var(--primary-soft);
            transform: none;
        }
        
        .divider {
            text-align: center;
            margin: 24px 0;
            color: #888;
            position: relative;
        }
        
        .divider::before,
        .divider::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 40%;
            height: 1px;
            background: rgba(255,255,255,0.2);
        }
        
        .divider::before { left: 0; }
        .divider::after { right: 0; }
        
        .join-section {
            margin-top: 8px;
        }
        
        .join-section.highlight {
            padding: 16px;
            border-radius: 12px;
            background: rgba(108, 99, 255, 0.15);
            border: 1px solid rgba(108, 99, 255, 0.4);
        }
        
        .rooms-list-section {
            margin: 20px 0;
            padding: 16px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: var(--shadow);
        }
        
        .rooms-list-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
        }
        
        .rooms-list-header h3 {
            margin: 0;
            font-size: 18px;
        }
        
        #refreshRoomsBtn {
            padding: 6px 14px;
            font-size: 14px;
            background: rgba(255, 255, 255, 0.15);
        }
        
        .rooms-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 280px;
            overflow-y: auto;
        }
        
        .room-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 12px 14px;
            background: var(--surface-3);
            border-radius: 12px;
            border: 1px solid var(--border);
            transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
        }

        .room-card:hover {
            transform: translateX(4px);
            border-color: var(--primary);
            box-shadow: 0 4px 16px rgba(108, 99, 255, 0.15);
        }

        .room-card-gone {
            opacity: 0.65;
        }

        .room-card-icon {
            width: 42px;
            height: 42px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            font-weight: 800;
            flex-shrink: 0;
            color: #fff;
        }

        .room-card-icon.src-yt { background: #ff0000; }
        .room-card-icon.src-ru { background: #00c4ff; }
        .room-card-icon.src-vk { background: #0077ff; }
        .room-card-icon.src-none { background: var(--text-muted); }

        .room-card-cover {
            width: 64px;
            height: 36px;
            border-radius: 6px;
            object-fit: cover;
            flex-shrink: 0;
            background: var(--surface-2);
        }

        .room-card-body {
            display: flex;
            align-items: center;
            gap: 12px;
            flex: 1;
            min-width: 0;
        }

        .form-hint {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 4px;
        }

        .room-status-pill {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 11px;
            padding: 2px 8px;
            border-radius: 10px;
            margin-right: 6px;
        }

        .room-status-pill.live {
            background: rgba(76, 175, 80, 0.2);
            color: #81c784;
        }

        .room-status-pill.paused {
            background: rgba(255, 152, 0, 0.15);
            color: var(--warn);
        }
        
        .room-card-info {
            flex: 1;
            min-width: 0;
        }
        
        .room-card-info strong {
            display: block;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .room-card-meta {
            font-size: 12px;
            color: #aaa;
        }
        
        .room-join-btn {
            padding: 8px 16px;
            font-size: 14px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        
        .room-join-btn:disabled {
            opacity: 0.45;
        }
        
        .rooms-empty {
            color: #888;
            font-size: 14px;
            text-align: center;
            padding: 16px 0;
            margin: 0;
        }
        
        .share-box {
            margin-top: 12px;
            padding: 12px;
            background: var(--surface-3);
            border: 1px solid var(--border);
            border-radius: 12px;
        }
        
        .share-box label {
            display: block;
            font-size: 13px;
            color: #ccc;
            margin-bottom: 8px;
        }
        
        .share-row {
            display: flex;
            gap: 8px;
        }
        
        .share-row input {
            flex: 1;
            font-size: 13px;
            padding: 10px;
        }
        
        .share-row button {
            white-space: nowrap;
            padding: 10px 16px;
        }
        
        .hidden {
            display: none;
        }
        
        .playlist-section {
            margin-top: 14px;
            padding: 12px;
            background: var(--surface-3);
            border: 1px solid var(--border);
            border-radius: 12px;
        }
        
        .playlist-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 14px;
        }
        
        .playlist-header button {
            padding: 6px 12px;
            font-size: 13px;
        }
        
        #playlistList {
            list-style: none;
            max-height: 140px;
            overflow-y: auto;
            margin: 0 0 8px;
            padding: 0;
        }
        
        #playlistList li {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 8px;
            border-radius: 8px;
            font-size: 12px;
            cursor: pointer;
        }
        
        #playlistList li.active {
            background: rgba(108,99,255,0.35);
        }
        
        #playlistList li .pl-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        #playlistList li button {
            padding: 2px 8px;
            font-size: 11px;
            background: rgba(255,80,80,0.5);
        }
        
        .playlist-add {
            display: flex;
            gap: 8px;
        }
        
        .playlist-add input { flex: 1; font-size: 13px; padding: 8px; }
        .playlist-add button { padding: 8px 14px; }
        
        .reconnect-banner {
            background: rgba(255,152,0,0.25);
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 13px;
            margin-bottom: 10px;
        }
        
        #toastContainer {
            position: fixed;
            top: 16px;
            right: 16px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-width: min(360px, calc(100vw - 32px));
            pointer-events: none;
        }
        
        .toast {
            pointer-events: auto;
            padding: 12px 16px;
            border-radius: 10px;
            font-size: 14px;
            line-height: 1.4;
            color: #fff;
            box-shadow: 0 4px 20px rgba(0,0,0,0.35);
            animation: toast-in 0.3s ease;
        }

        .toast.toast-out {
            animation: toast-out 0.35s ease forwards;
        }
        
        .toast.error { background: #c62828; }
        .toast.success { background: #2e7d32; }
        .toast.info { background: #455a64; }
        .toast.warn { background: #e65100; }
        
        @keyframes toast-in {
            from { opacity: 0; transform: translateX(24px) scale(0.95); }
            to { opacity: 1; transform: translateX(0) scale(1); }
        }

        @keyframes toast-out {
            from { opacity: 1; transform: translateX(0); }
            to { opacity: 0; transform: translateX(24px); }
        }

        .panel-queue {
            margin-top: 0;
        }

        .video-placeholder {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
            background: #000;
            color: var(--text-muted);
            gap: 8px;
            font-size: 14px;
        }

        .video-placeholder span {
            font-size: 36px;
            opacity: 0.5;
        }
        
        @media (max-width: 900px) {
            .home-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            .container {
                padding: 12px;
                padding-left: max(12px, env(safe-area-inset-left));
                padding-right: max(12px, env(safe-area-inset-right));
                padding-bottom: max(12px, env(safe-area-inset-bottom));
            }

            .room-view {
                grid-template-columns: 1fr;
            }

            .mobile-tabs {
                display: flex;
            }

            .mobile-tab {
                min-height: 44px;
                padding: 12px 8px;
            }

            .room-left .panel-video,
            .room-left .panel-queue,
            .room-right {
                display: none;
            }

            .room-left .panel-video.mobile-active,
            .room-left .panel-queue.mobile-active,
            .room-right.mobile-active {
                display: flex;
            }

            .room-left .panel-video.mobile-active,
            .room-left .panel-queue.mobile-active {
                display: block;
            }

            .room-header {
                flex-direction: column;
                align-items: stretch;
                gap: 10px;
            }

            .room-header-actions {
                justify-content: space-between;
            }

            .leave-btn,
            .role-badge,
            .theme-toggle,
            #syncBtn,
            .chat-send-btn,
            .player-controls button {
                min-height: 44px;
            }

            .chat-input-row input,
            .chat-input-row button {
                min-height: 44px;
                font-size: 16px;
            }

            .video-section {
                padding: 12px;
                border-radius: 16px;
            }

            .chat-section {
                height: min(55vh, calc(100dvh - 220px));
                max-height: none;
                min-height: 260px;
            }

            .room-right.mobile-active .chat-section {
                display: flex;
                flex-direction: column;
            }
        }

        @media (max-width: 480px) {
            .home-hero h1 {
                font-size: 24px;
            }

            .home-card {
                padding: 14px;
            }

            .mobile-tab {
                font-size: 13px;
            }

            .chat-section {
                min-height: 240px;
                height: min(50vh, calc(100dvh - 200px));
            }
        }

        @media (min-width: 769px) {
            .room-left .panel-video,
            .room-left .panel-queue {
                display: block !important;
            }
            .room-right {
                display: block !important;
            }
        }
