/* PNS Streamer v2.7.10 — Основные стили Mini App */
:root {
            --bg: #0b0b0c;
            --bg-soft: #101012;
            --card: #141416;
            --card-2: #18181b;
            --line: rgba(255, 255, 255, 0.08);
            --line-strong: rgba(255, 255, 255, 0.16);
            --text: #f4f4f5;
            --muted: #a1a1a8;
            --dim: #6e6e76;
            --radius: 16px;
            --radius-sm: 12px;

            /* Button skins matching PNS Design System */
            --accent-solid: #ffffff;
            --accent-solid-text: #0b0b0c;

            --font-body: "Segoe UI", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            -webkit-user-select: none;
        }

        body {
            font-family: var(--font-body);
            background-color: var(--bg);
            color: var(--text);
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            position: relative;
            -webkit-font-smoothing: antialiased;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .spinner-icon {
            animation: spin 0.9s linear infinite;
        }

        /* Header Bar */
        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            background: var(--bg-soft);
            border-bottom: 1px solid var(--line);
            z-index: 20;
            flex-shrink: 0;
        }

        .header-brand {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .status-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background-color: var(--dim);
            box-shadow: 0 0 0 2px rgba(110, 110, 118, 0.2);
            transition: all 0.3s ease;
        }

        .status-dot.online {
            background-color: #10b981;
            box-shadow: 0 0 10px #10b981;
        }

        .status-dot.offline {
            background-color: #ef4444;
            box-shadow: 0 0 10px #ef4444;
        }

        .brand-title {
            font-size: 15px;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .version-badge {
            font-size: 10px;
            font-weight: 600;
            padding: 2px 7px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--line);
            color: var(--muted);
            letter-spacing: 0;
        }

        .controls-top {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .session-timer {
            display: none;
            font-size: 12px;
            font-weight: 700;
            color: #34d399;
            background: rgba(16, 185, 129, 0.1);
            padding: 4px 10px;
            border-radius: 20px;
            border: 1px solid rgba(16, 185, 129, 0.25);
            letter-spacing: 0.03em;
        }

        /* Reconnect Top Banner */
        .reconnect-banner {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            background: rgba(245, 158, 11, 0.15);
            border-bottom: 1px solid rgba(245, 158, 11, 0.3);
            color: #fbbf24;
            padding: 8px 16px;
            font-size: 12.5px;
            font-weight: 600;
            z-index: 25;
            flex-shrink: 0;
            transition: all 0.3s ease;
        }

        .reconnect-btn-inline {
            background: var(--accent-solid);
            color: var(--accent-solid-text);
            border: none;
            border-radius: 6px;
            padding: 4px 10px;
            font-size: 11.5px;
            font-weight: 700;
            cursor: pointer;
            transition: opacity 0.2s ease;
        }

        .reconnect-btn-inline:hover {
            opacity: 0.85;
        }

        /* Selector Bar */
        .selector-bar {
            position: relative;
            display: flex;
            flex-direction: column;
            background: var(--card);
            border-bottom: 1px solid var(--line);
            flex-shrink: 0;
            z-index: 19;
            transition: border-color 0.3s ease;
        }

        .selector-bar-content {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 8px 12px;
            max-height: 200px;
            overflow: hidden;
            transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease;
            opacity: 1;
        }

        .selector-bar.collapsed .selector-bar-content {
            max-height: 0;
            padding-top: 0;
            padding-bottom: 0;
            opacity: 0;
            pointer-events: none;
        }

        .selector-bar.collapsed {
            border-bottom-color: transparent;
        }

        .selector-row {
            display: flex;
            gap: 8px;
            width: 100%;
            align-items: center;
        }

        .stop-stream-row-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 0 12px;
            height: 38px;
            border-radius: var(--radius-sm);
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
            box-sizing: border-box;
        }

        /* Кнопка переключения (стрелочка) панели выбора */
        .selector-toggle-btn {
            position: absolute;
            bottom: -16px;
            left: 50%;
            transform: translateX(-50%);
            width: 44px;
            height: 16px;
            background: var(--card);
            border: 1px solid var(--line);
            border-top: none;
            border-radius: 0 0 8px 8px;
            color: var(--muted);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 21;
            transition: all 0.2s ease;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
        }

        .selector-toggle-btn:hover {
            color: #ffffff;
            background: rgba(30, 30, 38, 0.95);
            border-color: var(--line-strong);
        }

        #selectorToggleIcon {
            transition: transform 0.3s ease;
        }

        .selector-bar.collapsed #selectorToggleIcon {
            transform: rotate(180deg);
        }

        .icon-stop-btn {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--line);
            color: var(--dim);
            border-radius: var(--radius-sm);
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: not-allowed;
            flex-shrink: 0;
            transition: all 0.2s ease;
        }

        .icon-stop-btn:disabled {
            opacity: 0.45;
        }

        .icon-stop-btn.stream-stop-active {
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.35);
            color: #f87171;
            cursor: pointer;
            opacity: 1;
        }

        .icon-stop-btn.stream-stop-active:hover {
            background: rgba(239, 68, 68, 0.35);
            color: #ffffff;
            border-color: rgba(239, 68, 68, 0.6);
            transform: scale(1.05);
        }

        .icon-stop-btn:active {
            transform: scale(0.95);
        }

        .select-wrapper {
            position: relative;
            display: flex;
            align-items: center;
        }

        .select-wrapper select {
            width: 100%;
            appearance: none;
            -webkit-appearance: none;
            background: rgba(255, 255, 255, 0.04);
            color: var(--text);
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            padding: 9px 32px 9px 34px;
            font-family: var(--font-body);
            font-size: 13px;
            font-weight: 600;
            outline: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .select-wrapper select:focus {
            border-color: var(--line-strong);
            background: rgba(255, 255, 255, 0.08);
        }

        .select-wrapper select option {
            background: #141416;
            color: #f4f4f5;
        }

        .select-icon-left {
            position: absolute;
            left: 10px;
            pointer-events: none;
            display: flex;
            align-items: center;
            color: var(--muted);
        }

        .select-icon-right {
            position: absolute;
            right: 10px;
            pointer-events: none;
            display: flex;
            align-items: center;
            color: var(--dim);
        }

        /* Main Live Stream Container */
        .main-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: relative;
            background: #000;
            overflow: hidden;
        }

        /* Quick Toolbar Wrapper & Collapse Handle */
        .quick-toolbar-wrapper {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            align-items: center;
            z-index: 20;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .quick-toolbar-wrapper.collapsed {
            transform: translate(calc(100% - 10px), -50%);
        }

        .toolbar-toggle-btn {
            position: absolute;
            left: -20px;
            top: 50%;
            transform: translateY(-50%);
            width: 20px;
            height: 38px;
            background: rgba(18, 18, 22, 0.88);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-right: none;
            border-radius: 8px 0 0 8px;
            color: #a1a1aa;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 21;
            transition: all 0.2s ease;
        }

        .toolbar-toggle-btn:hover {
            color: #ffffff;
            background: rgba(30, 30, 38, 0.95);
        }

        #toolbarToggleIcon {
            transition: transform 0.3s ease;
        }

        /* Stream Quick Toolbar (Right Side Bar) */
        .stream-quick-toolbar {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            background: rgba(18, 18, 22, 0.88);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.14);
            border-radius: 14px;
            padding: 7px 5px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
        }

        .toolbar-section {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        /* Visual Line Divider between Emulator & Scenario controls */
        .toolbar-divider {
            width: 22px;
            height: 2px;
            background: rgba(255, 255, 255, 0.18);
            border-radius: 2px;
            margin: 2px 0;
        }

        .toolbar-btn {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.03);
            color: #71717a;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0.4;
            filter: grayscale(80%);
            pointer-events: none;
            transition: all 0.25s ease;
        }

        .toolbar-btn.btn-utility {
            opacity: 0.85;
            filter: grayscale(0%);
            pointer-events: auto;
            color: #a1a1aa;
            background: rgba(255, 255, 255, 0.06);
            border-color: rgba(255, 255, 255, 0.12);
        }
        .toolbar-btn.btn-utility:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.15);
            transform: scale(1.08);
        }

        .toolbar-btn.is-available {
            opacity: 0.75;
            filter: grayscale(0%);
            pointer-events: auto;
            color: #d4d4d8;
        }

        .toolbar-btn.is-available:hover {
            opacity: 1;
            transform: scale(1.08);
        }

        /* Active Running State (Green) */
        .toolbar-btn.is-active-running {
            opacity: 1 !important;
            filter: grayscale(0%) !important;
            pointer-events: auto !important;
            background: rgba(16, 185, 129, 0.25) !important;
            border-color: #34d399 !important;
            color: #34d399 !important;
            box-shadow: 0 0 10px rgba(52, 211, 153, 0.35);
        }
        .toolbar-btn.is-active-running:hover {
            transform: scale(1.08);
        }
        .select-wrapper {
            position: relative;
            display: flex;
            align-items: center;
        }

        .select-wrapper select {
            width: 100%;
            appearance: none;
            -webkit-appearance: none;
            background: rgba(255, 255, 255, 0.04);
            color: var(--text);
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            padding: 9px 32px 9px 34px;
            font-family: var(--font-body);
            font-size: 13px;
            font-weight: 600;
            outline: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .select-wrapper select:focus {
            border-color: var(--line-strong);
            background: rgba(255, 255, 255, 0.08);
        }

        .select-wrapper select option {
            background: #141416;
            color: #f4f4f5;
        }

        .select-icon-left {
            position: absolute;
            left: 10px;
            pointer-events: none;
            display: flex;
            align-items: center;
            color: var(--muted);
        }

        .select-icon-right {
            position: absolute;
            right: 10px;
            pointer-events: none;
            display: flex;
            align-items: center;
            color: var(--dim);
        }

        /* Main Live Stream Container */
        .main-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: relative;
            background: #000;
            overflow: hidden;
        }

        /* Quick Toolbar Wrapper & Collapse Handle */
        .quick-toolbar-wrapper {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            align-items: center;
            z-index: 20;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .quick-toolbar-wrapper.collapsed {
            transform: translate(calc(100% - 10px), -50%);
        }

        .toolbar-toggle-btn {
            position: absolute;
            left: -20px;
            top: 50%;
            transform: translateY(-50%);
            width: 20px;
            height: 38px;
            background: rgba(18, 18, 22, 0.88);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-right: none;
            border-radius: 8px 0 0 8px;
            color: #a1a1aa;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 21;
            transition: all 0.2s ease;
        }

        .toolbar-toggle-btn:hover {
            color: #ffffff;
            background: rgba(30, 30, 38, 0.95);
        }

        #toolbarToggleIcon {
            transition: transform 0.3s ease;
        }

        /* Stream Quick Toolbar (Right Side Bar) */
        .stream-quick-toolbar {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            background: rgba(18, 18, 22, 0.88);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.14);
            border-radius: 14px;
            padding: 7px 5px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
        }

        .toolbar-section {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        /* Visual Line Divider between Emulator & Scenario controls */
        .toolbar-divider {
            width: 22px;
            height: 2px;
            background: rgba(255, 255, 255, 0.18);
            border-radius: 2px;
            margin: 2px 0;
        }

        .toolbar-btn {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.03);
            color: #71717a;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0.4;
            filter: grayscale(80%);
            pointer-events: none;
            transition: all 0.25s ease;
        }

        .toolbar-btn.btn-utility {
            opacity: 0.85;
            filter: grayscale(0%);
            pointer-events: auto;
            color: #a1a1aa;
            background: rgba(255, 255, 255, 0.06);
            border-color: rgba(255, 255, 255, 0.12);
        }
        .toolbar-btn.btn-utility:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.15);
            transform: scale(1.08);
        }

        .toolbar-btn.is-available {
            opacity: 0.75;
            filter: grayscale(0%);
            pointer-events: auto;
            color: #d4d4d8;
        }

        .toolbar-btn.is-available:hover {
            opacity: 1;
            transform: scale(1.08);
        }

        /* Active Running State (Green) */
        .toolbar-btn.is-active-running {
            opacity: 1 !important;
            filter: grayscale(0%) !important;
            pointer-events: auto !important;
            background: rgba(16, 185, 129, 0.25) !important;
            border-color: #34d399 !important;
            color: #34d399 !important;
            box-shadow: 0 0 10px rgba(52, 211, 153, 0.35);
        }
        .toolbar-btn.is-active-running:hover {
            transform: scale(1.08);
        }

        /* Active Stopped State (Red) */
        .toolbar-btn.is-active-stopped {
            opacity: 1 !important;
            filter: grayscale(0%) !important;
            pointer-events: auto !important;
            background: rgba(239, 68, 68, 0.25) !important;
            border-color: #f87171 !important;
            color: #f87171 !important;
            box-shadow: 0 0 10px rgba(248, 113, 113, 0.35);
        }
        .toolbar-btn.is-active-stopped:hover {
            transform: scale(1.08);
        }

        /* Active Paused State (Yellow) */
        .toolbar-btn.is-active-paused {
            opacity: 1 !important;
            filter: grayscale(0%) !important;
            pointer-events: auto !important;
            background: rgba(245, 158, 11, 0.25) !important;
            border-color: #fbbf24 !important;
            color: #fbbf24 !important;
            box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
        }
        .toolbar-btn.is-active-paused:hover {
            transform: scale(1.08);
        }

        /* Toolbar Header Category Icons */
        .toolbar-header-icon {
            width: 32px;
            height: 28px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: #a1a1aa;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            margin-bottom: 2px;
            transition: all 0.2s ease;
        }

        .toolbar-header-icon:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.16);
            border-color: rgba(255, 255, 255, 0.25);
            transform: scale(1.08);
        }

        /* PNS Help Modal Overlay */
        .pns-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s ease;
            padding: 16px;
        }

        .pns-modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .pns-modal-card {
            background: var(--card);
            border: 1px solid var(--line-strong);
            border-radius: 18px;
            width: 100%;
            max-width: 360px;
            padding: 20px;
            box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
            transform: scale(0.92);
            transition: transform 0.25s ease;
        }

        .pns-modal-overlay.active .pns-modal-card {
            transform: scale(1);
        }

        .pns-modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--line);
        }

        .pns-modal-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--text);
            margin: 0;
        }

        .pns-modal-close {
            background: none;
            border: none;
            color: var(--muted);
            font-size: 22px;
            line-height: 1;
            cursor: pointer;
            padding: 0 4px;
        }
        .pns-modal-close:hover {
            color: #ffffff;
        }

        .pns-modal-body {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 16px;
        }

        .help-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.07);
            border-radius: 12px;
            padding: 10px 12px;
        }

        .help-badge {
            width: 34px;
            height: 34px;
            border-radius: 9px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin-top: 2px;
        }

        .help-badge.badge-green {
            background: rgba(16, 185, 129, 0.15);
            border: 1px solid rgba(16, 185, 129, 0.3);
        }

        .help-badge.badge-red {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
        }

        .help-badge.badge-yellow {
            background: rgba(245, 158, 11, 0.15);
            border: 1px solid rgba(245, 158, 11, 0.3);
        }

        .help-badge.badge-blue {
            background: rgba(59, 130, 246, 0.15);
            border: 1px solid rgba(59, 130, 246, 0.3);
        }

        .help-item strong {
            display: block;
            font-size: 13.5px;
            color: var(--text);
            margin-bottom: 2px;
        }

        .help-item p {
            font-size: 12px;
            color: var(--muted);
            margin: 0;
            line-height: 1.35;
        }

        .pns-modal-footer {
            display: flex;
            justify-content: flex-end;
        }

        .pns-modal-btn {
            background: var(--accent-solid);
            color: var(--accent-solid-text);
            border: none;
            border-radius: var(--radius-sm);
            padding: 9px 22px;
            font-size: 13.5px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .pns-modal-btn:hover {
            background: #e4e4e7;
        }

        /* Pulsating Animations for Start/Stop buttons during 90-sec polling */
        @keyframes emuPulseGreen {
            0% {
                box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
                border-color: #34d399;
            }
            70% {
                box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
                border-color: #059669;
            }
            100% {
                box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
                border-color: #34d399;
            }
        }

        @keyframes emuPulseRed {
            0% {
                box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.7);
                border-color: #f87171;
            }
            70% {
                box-shadow: 0 0 0 10px rgba(248, 113, 113, 0);
                border-color: #dc2626;
            }
            100% {
                box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
                border-color: #f87171;
            }
        }

        .btn-pulsing-start {
            animation: emuPulseGreen 1.4s infinite !important;
            background: rgba(16, 185, 129, 0.35) !important;
            color: #ffffff !important;
            opacity: 1 !important;
        }

        .btn-pulsing-stop {
            animation: emuPulseRed 1.4s infinite !important;
            background: rgba(239, 68, 68, 0.35) !important;
            color: #ffffff !important;
            opacity: 1 !important;
        }

        .canvas-placeholder {
            position: absolute;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 16px;
            color: var(--muted);
            font-size: 14px;
            text-align: center;
            padding: 24px;
            z-index: 5;
        }

        .placeholder-icon-wrap {
            width: 72px;
            height: 72px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--line);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--muted);
        }

        .placeholder-title {
            font-size: 17px;
            font-weight: 700;
            color: var(--text);
        }

        .placeholder-sub {
            font-size: 13px;
            color: var(--muted);
            max-width: 300px;
            line-height: 1.5;
        }

        .request-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            background: var(--accent-solid);
            color: var(--accent-solid-text);
            padding: 13px 24px;
            font-size: 14px;
            font-weight: 700;
            border: none;
            border-radius: var(--radius-sm);
            cursor: pointer;
            box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
            transition: all 0.2s ease;
        }

        .request-btn:hover {
            background: #e4e4e7;
        }

        .request-btn:active {
            transform: scale(0.97);
        }

        #streamCanvas {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            display: none;
            touch-action: none;
        }

        /* Stream Loader Overlay (Reconnection) */
        .stream-loader-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(11, 11, 12, 0.85);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 15;
            padding: 24px;
        }

        .loader-card {
            background: var(--card);
            border: 1px solid var(--line-strong);
            padding: 24px 32px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            text-align: center;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
            max-width: 320px;
            width: 100%;
        }

        .loader-spinner-wrap {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: rgba(245, 158, 11, 0.1);
            border: 1px solid rgba(245, 158, 11, 0.25);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #f59e0b;
        }

        .loader-title {
            font-size: 15px;
            font-weight: 700;
            color: var(--text);
        }

        .loader-sub {
            font-size: 12.5px;
            color: var(--muted);
            line-height: 1.4;
        }

        /* Android Navigation Bar */
        .android-nav {
            display: flex;
            justify-content: space-around;
            align-items: center;
            padding: 8px;
            background: var(--bg-soft);
            border-top: 1px solid var(--line);
            flex-shrink: 0;
            z-index: 10;
        }

        .nav-btn {
            background: none;
            border: none;
            color: var(--muted);
            padding: 8px 28px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s ease, transform 0.1s ease;
        }

        .nav-btn:active {
            color: var(--text);
            transform: scale(0.9);
        }

        /* Tab 2: Control Panel */
        .panel-content {
            display: none;
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            flex-direction: column;
            gap: 14px;
            background: var(--bg);
        }

        .panel-content.active {
            display: flex;
        }

        /* Cards matching PNS design */
        .pns-card {
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: var(--radius);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            transition: border-color 0.25s ease, background 0.25s ease;
        }

        .pns-card:hover {
            border-color: var(--line-strong);
            background: var(--card-2);
        }

        .card-overline {
            font-size: 11px;
            font-weight: 700;
            color: var(--dim);
            letter-spacing: 0.15em;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .pns-btn-sm {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            font-weight: 700;
            padding: 5px 12px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--line);
            color: var(--text);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .pns-btn-sm:hover {
            background: rgba(255, 255, 255, 0.12);
            border-color: var(--line-strong);
        }

        .pns-btn-sm:active {
            transform: scale(0.95);
        }

        /* Scenario & Emulator Status Banners */
        .status-banner {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 14px;
            border-radius: var(--radius-sm);
            font-size: 12.5px;
            font-weight: 700;
            letter-spacing: 0.02em;
            transition: all 0.3s ease;
        }

        .banner-running {
            background: rgba(16, 185, 129, 0.12);
            border: 1px solid rgba(16, 185, 129, 0.3);
            color: #34d399;
        }

        .banner-paused {
            background: rgba(245, 158, 11, 0.12);
            border: 1px solid rgba(245, 158, 11, 0.3);
            color: #fbbf24;
        }

        .banner-stopped {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--line);
            color: var(--muted);
        }

        .status-dot-inline {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
        }

        .dot-running { background-color: #10b981; box-shadow: 0 0 8px #10b981; }
        .dot-paused { background-color: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
        .dot-stopped { background-color: #6e6e76; }

        .btn-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        /* Base PNS Button */
        .pns-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: var(--font-body);
            font-size: 13px;
            font-weight: 600;
            padding: 11px 12px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--line);
            background: rgba(255, 255, 255, 0.04);
            color: var(--text);
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            width: 100%;
        }

        .pns-btn:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--line-strong);
        }

        .pns-btn:active {
            transform: scale(0.97);
        }

        /* Distinct Active Highlighting Button Skins */
        .btn-active-running {
            background: #10b981 !important;
            color: #000000 !important;
            border-color: transparent !important;
            font-weight: 700 !important;
            box-shadow: 0 0 14px rgba(16, 185, 129, 0.4) !important;
        }

        .btn-active-paused {
            background: #f59e0b !important;
            color: #000000 !important;
            border-color: transparent !important;
            font-weight: 700 !important;
            box-shadow: 0 0 14px rgba(245, 158, 11, 0.4) !important;
        }

        .btn-active-stopped {
            background: #ef4444 !important;
            color: #ffffff !important;
            border-color: transparent !important;
            font-weight: 700 !important;
            box-shadow: 0 0 14px rgba(239, 68, 68, 0.4) !important;
        }

        /* Select box inside cards */
        .pns-select {
            width: 100%;
            appearance: none;
            -webkit-appearance: none;
            background: rgba(255, 255, 255, 0.04);
            color: var(--text);
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            padding: 12px 34px 12px 14px;
            font-family: var(--font-body);
            font-size: 14px;
            font-weight: 600;
            outline: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .pns-select:focus {
            border-color: var(--line-strong);
            background: rgba(255, 255, 255, 0.08);
        }

        .pns-select option {
            background: #141416;
            color: #f4f4f5;
        }

        /* Terminal Log Output */
        .log-terminal {
            background: #08080a;
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            padding: 12px;
            font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
            font-size: 11.5px;
            line-height: 1.5;
            color: var(--muted);
            white-space: pre-wrap;
            word-break: break-all;
            max-height: 220px;
            overflow-y: auto;
            margin: 0;
        }

        /* Bottom Navigation Bar */
        .tab-bar-wrapper {
            position: relative;
            background: var(--bg-soft);
            border-top: 1px solid var(--line);
            flex-shrink: 0;
            z-index: 30;
        }

        .tab-bar {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            overflow: hidden;
            max-height: 132px;
            transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
        }

        .tab-bar-wrapper.collapsed {
            border-top-color: transparent;
        }

        .tab-bar-wrapper.collapsed .tab-bar {
            max-height: 0;
            opacity: 0;
            pointer-events: none;
        }

        .bottom-nav-toggle-btn {
            position: absolute;
            top: -16px;
            left: 50%;
            transform: translateX(-50%);
            width: 44px;
            height: 16px;
            padding: 0;
            background: var(--bg-soft);
            border: 1px solid var(--line);
            border-bottom: none;
            border-radius: 8px 8px 0 0;
            color: var(--muted);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 31;
            box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
        }

        .bottom-nav-toggle-btn:hover {
            color: #ffffff;
            background: rgba(30, 30, 38, 0.95);
            border-color: var(--line-strong);
        }

        #bottomNavToggleIcon {
            transition: transform 0.3s ease;
        }

        .tab-bar-wrapper.collapsed #bottomNavToggleIcon {
            transform: rotate(180deg);
        }

        .tab-item {
            flex: 1;
            min-width: 0;
            padding: 10px 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 13.5px;
            font-weight: 700;
            color: var(--muted);
            cursor: pointer;
            border: 1px solid transparent;
            transition: all 0.2s ease;
        }

        .tab-item:hover {
            color: var(--text);
        }

        .tab-item.active {
            color: var(--text);
            border-color: var(--text);
            background: rgba(255, 255, 255, 0.02);
        }

        /* Toast Element */
        #toastEl {
            position: fixed;
            bottom: 142px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(20, 20, 22, 0.95);
            backdrop-filter: blur(10px);
            color: var(--text);
            padding: 10px 20px;
            border-radius: 30px;
            font-size: 13px;
            font-weight: 600;
            z-index: 9999;
            border: 1px solid var(--line-strong);
            box-shadow: 0 8px 30px rgba(0,0,0,0.6);
            transition: opacity 0.3s ease, transform 0.3s ease;
            pointer-events: none;
            opacity: 0;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        /* Unpaired Screen (Pure Instruction View, No Controls) */
        .unpaired-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background: var(--bg);
            overflow-y: auto;
            z-index: 50;
        }

        .instruction-card {
            background: var(--card);
            border: 1px solid var(--line-strong);
            border-radius: var(--radius);
            padding: 24px 20px;
            display: flex;
            flex-direction: column;
            gap: 18px;
            max-width: 380px;
            width: 100%;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
        }

        .instruction-header {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }

        .instruction-icon {
            font-size: 38px;
            line-height: 1;
            margin-bottom: 4px;
        }

        .instruction-title {
            font-size: 18px;
            font-weight: 800;
            color: var(--text);
            letter-spacing: -0.01em;
        }

        .instruction-subtitle {
            font-size: 12.5px;
            color: var(--muted);
            line-height: 1.4;
        }

        .user-id-box {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--line-strong);
            border-radius: var(--radius-sm);
            padding: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
        }

        .user-id-label {
            font-size: 11px;
            font-weight: 700;
            color: var(--dim);
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }

        .user-id-value-wrap {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 8px;
            transition: background 0.2s ease;
        }

        .user-id-value-wrap:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .user-id-value-wrap code {
            font-family: "Cascadia Code", Consolas, monospace;
            font-size: 16px;
            font-weight: 700;
            color: #34d399;
            letter-spacing: 0.05em;
        }

        .copy-badge {
            font-size: 10px;
            font-weight: 700;
            padding: 3px 8px;
            border-radius: 12px;
            background: rgba(52, 211, 153, 0.15);
            border: 1px solid rgba(52, 211, 153, 0.3);
            color: #34d399;
            text-transform: uppercase;
        }

        .steps-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .step-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
        }

        .step-number {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: var(--accent-solid);
            color: var(--accent-solid-text);
            font-size: 12px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin-top: 1px;
        }

        .step-text {
            font-size: 13px;
            color: var(--text);
            line-height: 1.45;
        }

        .step-text b {
            color: #ffffff;
        }
        /* Scenario configuration editor */
        .scenario-config-panel { padding-bottom: 92px; }
        .scenario-editor-fieldset {
            border: 0; padding: 0; margin: 0; min-width: 0;
            display: flex; flex-direction: column; gap: 14px;
        }
        .scenario-editor-fieldset:disabled > * { opacity: 0.58; }
        .scenario-card-heading {
            display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
        }
        .scenario-floating-actions {
            position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px);
            z-index: 24; display: flex; justify-content: flex-end; gap: 8px;
            height: 42px; margin: 0 4px 8px; pointer-events: none;
        }
        .scenario-icon-action {
            pointer-events: auto; width: 42px; height: 42px; padding: 0;
            display: inline-flex; align-items: center; justify-content: center;
            border: 1px solid var(--line-strong); border-radius: 12px;
            background: rgba(20, 20, 22, 0.94); color: #dbeafe;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
            backdrop-filter: blur(12px); cursor: pointer;
        }
        .scenario-icon-action svg {
            width: 21px; height: 21px; fill: none; stroke: currentColor;
            stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
        }
        .scenario-icon-action:active { transform: translateY(1px) scale(0.97); }
        .scenario-icon-action:disabled { opacity: 0.42; cursor: default; }
        .scenario-refresh-action { color: #93c5fd; }
        .scenario-refresh-action.is-loading svg { animation: scenario-refresh-spin 0.85s linear infinite; }
        @keyframes scenario-refresh-spin { to { transform: rotate(360deg); } }
        .scenario-save-action {
            color: #34d399; border-color: rgba(52, 211, 153, 0.42);
        }
        .scenario-save-action.is-saving svg { animation: scenario-action-pulse 0.8s ease-in-out infinite alternate; }
        @keyframes scenario-action-pulse {
            to { opacity: 0.45; transform: scale(0.9); }
        }

        .scenario-instance-name {
            margin-top: 5px; color: var(--text); font-size: 16px; font-weight: 750;
            overflow-wrap: anywhere;
        }
        .scenario-config-banner {
            border-radius: var(--radius-sm); padding: 10px 12px;
            font-size: 12.5px; line-height: 1.4; font-weight: 650;
        }
        .scenario-config-banner.is-ok {
            color: #34d399; background: rgba(16, 185, 129, 0.11);
            border: 1px solid rgba(16, 185, 129, 0.28);
        }
        .scenario-config-banner.is-loading {
            color: #93c5fd; background: rgba(59, 130, 246, 0.1);
            border: 1px solid rgba(59, 130, 246, 0.25);
        }
        .scenario-config-banner.is-locked {
            color: #fbbf24; background: rgba(245, 158, 11, 0.11);
            border: 1px solid rgba(245, 158, 11, 0.28);
        }
        .scenario-config-banner.is-error {
            color: #fca5a5; background: rgba(239, 68, 68, 0.11);
            border: 1px solid rgba(239, 68, 68, 0.28);
        }
        .scenario-config-note, .scenario-save-hint, .scenario-profile-note {
            color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 0;
        }
        .scenario-switch-row {
            display: flex; align-items: center; justify-content: space-between;
            gap: 12px; color: var(--text); font-size: 13px;
        }
        .scenario-switch-row input[type="checkbox"] {
            width: 19px; height: 19px; accent-color: #10b981; flex-shrink: 0;
        }
        .scenario-form-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
        }
        .scenario-form-grid.is-muted { opacity: 0.5; }
        .scenario-form-grid label, .scenario-profile-select {
            display: flex; flex-direction: column; gap: 6px;
            color: var(--muted); font-size: 11px;
        }
        .scenario-form-wide { grid-column: 1 / -1; }
        .scenario-form-grid input, .scenario-search, .scenario-param-field input,
        .scenario-param-field textarea {
            width: 100%; box-sizing: border-box; background: rgba(255, 255, 255, 0.04);
            color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
            padding: 11px 12px; font: inherit; outline: none;
        }
        .scenario-form-grid input:focus, .scenario-search:focus,
        .scenario-param-field input:focus, .scenario-param-field textarea:focus {
            border-color: rgba(96, 165, 250, 0.55);
        }
        .scenario-count-badge {
            min-width: 25px; height: 25px; padding: 0 7px; display: inline-flex;
            align-items: center; justify-content: center; border-radius: 999px;
            background: rgba(255, 255, 255, 0.07); color: var(--muted);
            font-size: 11px; font-weight: 750;
        }
        .scenario-queue-list, .scenario-mandatory-list {
            display: flex; flex-direction: column; gap: 9px;
        }
        .scenario-queue-item {
            display: grid; grid-template-columns: 28px minmax(0, 1fr) 34px;
            gap: 9px; align-items: stretch; padding: 10px; border-radius: 12px;
            border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025);
        }
        .scenario-queue-item.is-restricted { border-color: rgba(245, 158, 11, 0.32); }
        .scenario-order-number {
            width: 25px; height: 25px; display: flex; align-items: center;
            justify-content: center; border-radius: 8px; color: #93c5fd;
            background: rgba(59, 130, 246, 0.12); font-size: 11px; font-weight: 800;
        }
        .scenario-queue-main { min-width: 0; }
        .scenario-queue-title {
            color: var(--text); font-size: 13px; font-weight: 700;
            line-height: 1.3; overflow-wrap: anywhere;
        }
        .scenario-queue-meta {
            color: var(--dim); font-size: 10.5px; margin-top: 3px; overflow-wrap: anywhere;
        }
        .scenario-queue-profile { margin-top: 7px; }
        .scenario-profile-badge {
            display: inline-flex; max-width: 100%; padding: 4px 8px;
            border-radius: 999px; font-size: 10px; font-weight: 700;
            line-height: 1.25; overflow-wrap: anywhere;
        }
        .scenario-profile-badge.is-unique {
            color: #bfdbfe; border: 1px solid rgba(96, 165, 250, 0.3);
            background: rgba(59, 130, 246, 0.12);
        }
        .scenario-profile-badge.is-common {
            color: var(--muted); border: 1px solid var(--line);
            background: rgba(255, 255, 255, 0.035);
        }

        .scenario-queue-actions {
            display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 9px;
        }
        .scenario-queue-actions button, .scenario-order-actions button,
        .scenario-priority-editor button {
            min-width: 29px; min-height: 29px; border: 1px solid var(--line);
            border-radius: 8px; background: rgba(255, 255, 255, 0.04);
            color: var(--text); font: inherit; cursor: pointer;
        }
        .scenario-queue-actions button {
            padding: 5px 8px; color: #93c5fd; font-size: 10.5px;
        }
        .scenario-order-actions {
            display: flex; flex-direction: column; gap: 4px;
        }
        .scenario-order-actions button:disabled, .scenario-priority-editor button:disabled {
            opacity: 0.25; cursor: default;
        }
        .scenario-order-actions .scenario-remove-btn { color: #fca5a5; }
        .scenario-empty {
            padding: 18px 10px; text-align: center; color: var(--dim); font-size: 12px;
            border: 1px dashed var(--line); border-radius: 12px;
        }
        .scenario-mandatory-item {
            padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
        }
        .scenario-mandatory-item span {
            display: flex; flex-direction: column; gap: 3px;
        }
        .scenario-mandatory-item small { color: var(--dim); font-size: 10px; }
        .scenario-add-row {
            display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
        }
        .scenario-add-btn { width: auto; }
        .scenario-unique-list {
            display: flex; flex-wrap: wrap; gap: 7px; min-height: 24px;
        }
        .scenario-unique-chip {
            display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
            padding: 6px 7px 6px 10px; border: 1px solid rgba(96, 165, 250, 0.28);
            border-radius: 999px; background: rgba(59, 130, 246, 0.1);
            color: #bfdbfe; font-size: 11px; overflow-wrap: anywhere;
        }
        .scenario-unique-chip button {
            width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
            background: rgba(255, 255, 255, 0.08); color: #fca5a5; cursor: pointer;
        }
        .scenario-params-card {
            max-width: 520px; max-height: calc(100vh - 24px); display: flex;
            flex-direction: column; padding: 16px;
        }
        .scenario-profile-controls {
            display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px;
            margin-bottom: 12px; border-bottom: 1px solid var(--line);
        }
        .scenario-params-body {
            overflow-y: auto; overscroll-behavior: contain; padding-right: 3px;
        }
        .scenario-param-field {
            display: flex; flex-direction: column; gap: 6px; padding: 11px;
            border-radius: 11px; border: 1px solid var(--line);
            background: rgba(255, 255, 255, 0.025); color: var(--text); font-size: 12px;
        }
        .scenario-param-field small {
            color: var(--dim); font-size: 10.5px; line-height: 1.4;
        }
        .scenario-param-field textarea { min-height: 86px; resize: vertical; }
        .scenario-param-field.is-readonly { opacity: 0.72; }
        .scenario-readonly-note { color: #fbbf24; font-size: 10.5px; }
        .scenario-priority-editor {
            display: flex; flex-direction: column; gap: 6px;
        }
        .scenario-priority-item, .scenario-priority-add {
            display: flex; align-items: center; justify-content: space-between;
            gap: 8px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 8px;
        }
        .scenario-priority-item > span { min-width: 0; overflow-wrap: anywhere; }
        .scenario-priority-item > div { display: flex; gap: 3px; }
        .scenario-priority-add .pns-select { padding-top: 8px; padding-bottom: 8px; }
        .scenario-modal-actions {
            display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
        }
        .scenario-secondary-btn {
            color: var(--muted); background: rgba(255, 255, 255, 0.04);
        }
        .scenario-action-row { grid-template-columns: 1fr 1fr; }
        .scenario-preset-btn { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.35); }
        .scenario-picker-card { max-width: 620px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; padding: 16px; }
        .scenario-picker-subtitle { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
        .scenario-picker-toolbar { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
        .scenario-category-select { width: 100%; min-height: 38px; }
        .scenario-catalog-body, .scenario-presets-list { overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; }
        .scenario-catalog-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
        .scenario-catalog-group-heading { display: flex; align-items: center; justify-content: space-between; color: #bfdbfe; font-size: 12px; font-weight: 750; padding: 4px 2px; }
        .scenario-catalog-group-heading small { color: var(--dim); font-weight: 600; margin-left: 4px; }
        .scenario-catalog-group-heading input, .scenario-catalog-item input { width: 18px; height: 18px; accent-color: #10b981; flex-shrink: 0; }
        .scenario-catalog-items { display: flex; flex-direction: column; gap: 6px; }
        .scenario-catalog-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); color: var(--text); cursor: pointer; }
        .scenario-catalog-item:has(input:checked) { border-color: rgba(52,211,153,.42); background: rgba(16,185,129,.08); }
        .scenario-catalog-item span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
        .scenario-catalog-item b { font-size: 12px; overflow-wrap: anywhere; }
        .scenario-catalog-item small { color: var(--dim); font-size: 10.5px; line-height: 1.35; }
        .scenario-preset-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 10px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); }
        .scenario-preset-item > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
        .scenario-preset-item b { font-size: 13px; overflow-wrap: anywhere; }
        .scenario-preset-item small { color: var(--dim); font-size: 10.5px; }
        .scenario-preset-load-btn { min-width: 112px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
        .scenario-preset-load-btn.is-loading { cursor: wait; opacity: .78; }
        .scenario-inline-spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.32); border-top-color: currentColor; border-radius: 50%; animation: scenario-inline-spin .75s linear infinite; }
        @keyframes scenario-inline-spin { to { transform: rotate(360deg); } }
        @media (max-width: 420px) {
            .tab-item { padding: 9px 5px; gap: 5px; font-size: 11.5px; }
            .scenario-add-row, .scenario-action-row { grid-template-columns: 1fr; }
            .scenario-add-btn { width: 100%; }
        }
