:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-dim: #6d28d9;
    --danger: #ef4444;
    --ok: #22c55e;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }

.view { min-height: 100vh; }

/* ========== 登录页（对齐 APK LoginScreen） ========== */
.login-screen {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 100px;
    overflow: hidden;
}

.login-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(8px);
    transform: scale(1.06);
}

.login-scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.login-column {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo {
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

.login-app-title {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}

.login-tagline {
    margin: 8px 0 48px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

.login-form-main {
    width: 100%;
}

.login-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 4px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-row:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
}

.login-input-icon {
    color: rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
    display: flex;
}

.login-input-row input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 16px;
    padding: 14px 0;
    outline: none;
}

.login-input-row input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.login-pw-toggle {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-shrink: 0;
}

.login-pw-toggle .eye-off.hidden,
.login-pw-toggle .eye-open.hidden {
    display: none;
}

.login-submit-btn {
    width: 100%;
    margin-top: 8px;
    height: 56px;
    border: none;
    border-radius: 12px;
    background: #6366f1;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.login-error-banner {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-size: 14px;
    width: 100%;
}

.login-settings-link {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 15px;
    cursor: pointer;
    padding: 8px 12px;
}

.login-settings-link:hover {
    color: #fff;
}

.login-deploy-hint {
    margin-top: 24px;
    font-size: 11px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    max-width: 340px;
}

.login-deploy-hint code {
    font-size: 10px;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 服务器设置弹窗（对齐 APK ServerSettingsDialog） */
.server-dialog {
    border: none;
    padding: 0;
    max-width: calc(100vw - 32px);
    width: 440px;
    border-radius: 16px;
    background: transparent;
}

.server-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.server-dialog-card {
    background: #1e1e2d;
    color: #e6e6e6;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #334155;
}

.server-dialog-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.server-dialog-desc {
    margin: 0 0 20px;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.5;
}

.server-field {
    margin-bottom: 14px;
}

.server-field label {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.server-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #475569;
    background: #14141e;
    color: #fff;
    font-size: 14px;
}

.server-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--muted);
}

.field input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.field .hint {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.4;
}

.field .hint code {
    font-size: 11px;
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 4px;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    color: #fff;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.btn-sm { padding: 7px 12px; font-size: 12px; }

.btn-block { width: 100%; }

.error-text {
    color: #fca5a5;
    font-size: 13px;
    margin-top: 12px;
    min-height: 1.2em;
}

/* App shell */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 92px;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(18px);
}

.header-left strong { margin-right: 8px; }

.muted { color: var(--muted); }

.small { font-size: 12px; }

.badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.badge-off { background: #451a1a; color: #fca5a5; }

.badge-on { background: #14532d; color: #86efac; }

.app-main {
    min-height: calc(100vh - 54px);
    padding: 28px 34px 34px 126px;
    max-width: none;
    margin: 0;
}

.panel { display: none; }

.panel.active { display: block; }

/* ========== 浅色主题（Settings · theme-light） ========== */
html.theme-light {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
}

html.theme-light .badge-off {
    background: #fee2e2;
    color: #b91c1c;
}

html.theme-light .badge-on {
    background: #dcfce7;
    color: #166534;
}

html.theme-light .login-scrim {
    background: rgba(255, 255, 255, 0.35);
}

html.theme-light .bn-tab.active {
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary-dim);
}

/* ========== 设备列表 · 动态背景 ========== */
.devices-panel {
    position: relative;
    overflow: visible;
    border-radius: 14px;
    min-height: calc(100vh - 116px);
}

.devices-bg-layer {
    position: fixed;
    left: 92px;
    top: 54px;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.devices-bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.42;
    transform: scale(1.03);
}

.devices-bg-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.72) 0%,
        rgba(15, 23, 42, 0.55) 40%,
        rgba(15, 23, 42, 0.85) 100%
    );
}

html.theme-light .devices-bg-scrim {
    background: linear-gradient(
        180deg,
        rgba(248, 250, 252, 0.92) 0%,
        rgba(248, 250, 252, 0.78) 45%,
        rgba(241, 245, 249, 0.94) 100%
    );
}

.devices-page-front {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 116px);
}

.devices-panel .device-card {
    background: rgba(30, 41, 59, 0.92);
    backdrop-filter: blur(8px);
}

html.theme-light .devices-panel .device-card {
    background: rgba(255, 255, 255, 0.94);
}

.devices-panel .toolbar-small.card {
    background: rgba(30, 41, 59, 0.88);
    backdrop-filter: blur(8px);
}

html.theme-light .devices-panel .toolbar-small.card {
    background: rgba(255, 255, 255, 0.92);
}

.devices-panel .toolbar .panel-title {
    margin: 0;
    flex: 1;
    min-width: 120px;
}

/* ========== 关于页 ========== */
.about-page-panel .about-hero {
    text-align: center;
    margin-bottom: 16px;
}

.about-brand {
    margin: 8px 0 4px;
    font-size: 1.75rem;
}

.about-tagline {
    margin: 0;
    color: var(--muted);
}

.about-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

.about-feature-list,
.about-advantage-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.65;
}

.about-footer {
    margin-top: 20px;
}

/* ========== 设置页 ========== */
.settings-main-title {
    margin: 0 0 16px;
    font-size: 1.35rem;
}

.settings-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 18px 0 8px 10px;
}

.settings-account-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-username-line {
    font-weight: 700;
    font-size: 1rem;
}

.ok-text {
    color: var(--ok);
    font-size: 13px;
    margin-top: 4px;
}

.settings-stack {
    padding: 0;
    overflow: hidden;
}

.settings-row-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.settings-row-btn:hover {
    background: rgba(139, 92, 246, 0.06);
}

.settings-row-btn.danger-row:hover {
    background: rgba(239, 68, 68, 0.08);
}

.settings-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.settings-row-icon.purple {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
}

.settings-row-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.settings-row-icon.indigo {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.settings-row-icon.pink {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.settings-row-icon.green {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.settings-row-icon.teal {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
}

.settings-row-icon.red {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.settings-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-row-body strong {
    font-size: 15px;
}

.settings-row-chevron {
    color: var(--muted);
    font-size: 18px;
    flex-shrink: 0;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 0 16px;
}

.settings-switch-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
}

.settings-switch-input {
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.settings-details summary {
    cursor: pointer;
    font-weight: 600;
    padding: 12px 16px;
}

.settings-details .kv {
    padding: 0 16px 16px;
}

.settings-version {
    margin-top: 24px;
}

/* ========== Dialog（退出 / 语言） ========== */
.cw-dialog {
    border: none;
    padding: 0;
    background: transparent;
    max-width: min(420px, 92vw);
}

.cw-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.cw-dialog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.cw-dialog-title {
    margin: 0 0 12px;
    font-size: 1.15rem;
}

.cw-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.lang-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}

.lang-choice input {
    accent-color: var(--primary);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.device-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.device-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}

.device-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.tag-online {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 700;
}

.tag-online.on { background: rgba(34, 197, 94, 0.2); color: var(--ok); }

.tag-online.off { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.did {
    font-size: 11px;
    word-break: break-all;
    color: var(--muted);
    font-family: ui-monospace, monospace;
}

.device-meta {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

.card h3 { margin-top: 0; }

.bullet-list {
    color: var(--muted);
    line-height: 1.65;
    padding-left: 18px;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.kv {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.kv span {
    flex: 0 0 88px;
    color: var(--muted);
}

.kv code {
    flex: 1;
    word-break: break-all;
    font-size: 11px;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 6px;
}

.empty-hint {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.bottom-nav {
    position: fixed;
    left: 14px;
    top: 14px;
    bottom: 14px;
    width: 72px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background:
        linear-gradient(180deg, rgba(99, 102, 241, 0.96), rgba(88, 28, 135, 0.96)),
        var(--surface);
    border: 1px solid rgba(196, 181, 253, 0.26);
    border-radius: 24px;
    padding: 14px 9px;
    justify-content: flex-start;
    box-shadow: 0 26px 70px rgba(76, 29, 149, 0.38);
}

.bottom-nav::before {
    content: "龙";
    width: 42px;
    height: 42px;
    margin-bottom: 8px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.bn-tab {
    flex: 0 0 auto;
    width: 100%;
    min-height: 62px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    padding: 8px 4px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.16s, color 0.16s, transform 0.16s;
}

.bn-tab::before {
    content: "";
    width: 22px;
    height: 22px;
    display: block;
    background: currentColor;
    opacity: 0.95;
    -webkit-mask: var(--nav-icon) center / contain no-repeat;
    mask: var(--nav-icon) center / contain no-repeat;
}

.bn-tab[data-tab="devices"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 11L12 3l9 8v10a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1V11z'/%3E%3C/svg%3E");
}

.bn-tab[data-tab="build"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm1 4v10h8V6H8zm3 13h2v-1h-2v1z'/%3E%3C/svg%3E");
}

.bn-tab[data-tab="about"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 0 0 20a10 10 0 0 0 0-20zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

.bn-tab[data-tab="settings"] {
    margin-top: auto;
    --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.43 12.98c.04-.32.07-.65.07-.98s-.02-.66-.07-.98l2.11-1.65a.5.5 0 0 0 .12-.64l-2-3.46a.5.5 0 0 0-.6-.22l-2.49 1a7.3 7.3 0 0 0-1.69-.98L14.5 2.4A.5.5 0 0 0 14 2h-4a.5.5 0 0 0-.5.4L9.12 5.07c-.61.24-1.18.56-1.69.98l-2.49-1a.5.5 0 0 0-.6.22l-2 3.46a.5.5 0 0 0 .12.64l2.11 1.65c-.04.32-.07.65-.07.98s.02.66.07.98l-2.11 1.65a.5.5 0 0 0-.12.64l2 3.46c.14.24.42.34.68.22l2.49-1c.51.4 1.08.73 1.69.98l.38 2.67c.04.23.25.4.5.4h4c.25 0 .46-.17.5-.4l.38-2.67c.61-.24 1.18-.56 1.69-.98l2.49 1c.25.1.54.02.68-.22l2-3.46a.5.5 0 0 0-.12-.64l-2.11-1.65zM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5z'/%3E%3C/svg%3E");
}

.bn-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.bn-tab.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

html.theme-light .app-header {
    background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 760px) {
    .app-header {
        margin-left: 0;
        padding: 12px 16px;
    }

    .app-main {
        padding: 16px;
        padding-bottom: 92px;
    }

    .devices-panel,
    .devices-page-front {
        min-height: calc(100vh - 160px);
    }

    .devices-bg-layer {
        left: 0;
        top: 0;
        bottom: 72px;
    }

    .bottom-nav {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: auto;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        border-radius: 18px 18px 0 0;
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    }

    .bottom-nav::before {
        display: none;
    }

    .bn-tab {
        min-height: 54px;
        flex: 1;
        border-radius: 12px;
    }

    .bn-tab[data-tab="settings"] {
        margin-top: 0;
    }

    .bn-tab:hover {
        transform: none;
    }
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.modal-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 92vh;
    overflow: auto;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 16px 18px 28px;
    border: 1px solid var(--border);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 { margin: 0; font-size: 18px; }

.icon-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.device-id-line {
    font-size: 13px;
    color: var(--muted);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 0;
}

.feature-btn {
    border: none;
    border-radius: 18px;
    min-height: 112px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 18px;
    line-height: 1.25;
    text-align: left;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: hidden;
    transition: transform 0.16s, filter 0.16s, box-shadow 0.16s;
}

.feature-btn::after {
    content: "";
    position: absolute;
    inset: auto 14px 14px auto;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.feature-btn:hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.32);
}

.adv-details {
    margin: 14px 0;
    font-size: 13px;
    color: var(--muted);
}

.adv-details textarea {
    width: 100%;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    padding: 8px;
}

.log-label {
    font-size: 12px;
    color: var(--muted);
}

.session-log {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 10px;
    max-height: 160px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.toast {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    z-index: 100;
}

.toast.ok { border-color: var(--ok); color: #86efac; }

.toast.err { border-color: var(--danger); color: #fca5a5; }

.device-help {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(51, 65, 85, 0.35);
    border: 1px solid var(--border);
    line-height: 1.5;
}

.device-submeta {
    font-size: 12px;
    margin-bottom: 10px;
}

.device-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.build-section + .build-section {
    margin-top: 14px;
}

/* ========== 被控 APK 构建（对齐 ApkBuilderScreen 卡片布局） ========== */
.apk-builder-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
}

.build-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px 16px;
}

.build-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.build-card-icon {
    font-size: 14px;
    opacity: 0.85;
    width: 22px;
    text-align: center;
}

.build-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.build-card-hint {
    margin: 0 0 12px;
}

.bf-hint {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
    margin-top: 2px;
    margin-bottom: 4px;
}

.pkg-inline {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.pkg-inline input {
    flex: 1;
    min-width: 0;
}

.hide-mode-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hide-mode-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.hide-mode-option:hover {
    border-color: var(--primary);
}

.hide-mode-option.selected {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
}

.hide-mode-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: transparent;
}

.hide-mode-option.selected .hide-mode-check {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.hide-mode-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hide-mode-body strong {
    font-size: 14px;
}

.adv-disclaimer {
    margin: 0 0 12px;
}

.adv-switch-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}

.adv-switch-row:last-of-type {
    border-bottom: none;
}

.adv-switch-row input {
    margin-top: 3px;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.adv-switch-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adv-switch-text strong {
    font-size: 14px;
    font-weight: 600;
}

.build-form {
    margin-top: 14px;
}

.build-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
}

.bf-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.bf-field em {
    color: #f87171;
    font-style: normal;
}

.bf-field input,
.bf-field textarea,
.bf-field select {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
}

.bf-field textarea {
    resize: vertical;
    min-height: 52px;
}

.bf-span2 {
    grid-column: span 2;
}

@media (max-width: 560px) {
    .build-grid {
        grid-template-columns: 1fr;
    }
    .bf-span2 {
        grid-column: span 1;
    }
}

.build-active {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.build-progress-label {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 8px;
}

.build-active-status {
    font-size: 13px;
    margin-bottom: 10px;
}

.build-list-wrap {
    margin-top: 18px;
}

.build-list-title {
    margin-bottom: 8px;
}

.build-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.build-row {
    display: grid;
    grid-template-columns: 72px 88px 44px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.build-row-msg {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.build-row-dl {
    color: #86efac;
    font-weight: 600;
    text-decoration: none;
}

.build-row-dl:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .build-row {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: auto;
    }
    .build-row-msg {
        grid-column: 1 / -1;
        white-space: normal;
    }
}

@media (max-width: 520px) {
    .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 380px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 设备面板扩展（对齐 APK 全功能） ========== */
.modal-sheet-wide {
    top: 24px;
    bottom: 24px;
    left: 24px;
    right: 24px;
    max-width: min(1480px, calc(100vw - 48px));
    width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 0%, rgba(139, 92, 246, 0.18), transparent 34%),
        linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 0;
}

.modal-sheet-wide .modal-head {
    grid-column: 1 / -1;
    padding: 22px 28px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(18px);
}

.modal-sheet-wide .modal-head h3 {
    font-size: 22px;
    letter-spacing: 0.02em;
}

.modal-sheet-wide .device-id-line {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0 28px 18px;
    background: rgba(15, 23, 42, 0.58);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.modal-sheet-wide .device-id-line strong {
    color: #c4b5fd;
    font-family: ui-monospace, monospace;
    letter-spacing: 0.02em;
}

.modal-section-tabs {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 22px 16px;
    overflow: auto;
    min-height: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.28);
}

.mstab {
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.62);
    color: var(--muted);
    border-radius: 16px;
    padding: 13px 14px;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s, border-color 0.16s, background 0.16s, color 0.16s;
}

.mstab:hover {
    transform: translateX(2px);
    border-color: rgba(167, 139, 250, 0.6);
    color: #e9d5ff;
}

.mstab.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.38), rgba(59, 130, 246, 0.18));
    color: #fff;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #a78bfa, 0 12px 30px rgba(59, 130, 246, 0.12);
}

.mstab-panel {
    display: none;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    /* 网格 1fr 行内必须可收缩，否则内容顶开高度后被 .modal-sheet-wide overflow:hidden 裁切且无滚动条 */
    min-height: 0;
    margin: 0;
    padding: 24px 28px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.mstab-panel.active {
    display: block;
}

.modal-sheet-wide > .adv-details,
.modal-sheet-wide > .log-label,
.modal-sheet-wide > .session-log {
    grid-column: 1 / -1;
    margin-left: 24px;
    margin-right: 24px;
}

.modal-sheet-wide > .adv-details {
    margin-top: 0;
    margin-bottom: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 10px;
}

.modal-sheet-wide > .session-log {
    max-height: 96px;
    margin-bottom: 18px;
}

.groups-toolbar.card.toolbar-small {
    padding: 12px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.group-filter-select {
    min-width: 140px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}

.device-card-grp {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dev-grp-sel {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}

.chip-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.48);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.chip-label {
    flex-basis: 100%;
    font-size: 12px;
    color: #c4b5fd;
    margin: 0 0 2px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.rc-mini {
    font-size: 12px;
    padding-left: 12px;
    padding-right: 12px;
}

#mstab-remote > #unlock-feedback {
    margin: 0 0 8px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.34);
}

#mstab-remote.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    min-height: 0;
}

#mstab-remote.active .chip-actions {
    padding: 10px 12px;
    gap: 8px;
}

/* 默认折起长指令区，少占垂直空间，避免右侧整页大滚动条抢滚轮 */
.remote-extra-cmd {
    flex: 0 0 auto;
    margin: 0;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.42);
}

.remote-extra-summary {
    cursor: pointer;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    list-style: none;
    user-select: none;
}

.remote-extra-summary::-webkit-details-marker {
    display: none;
}

.remote-extra-cmd[open] {
    max-height: min(38vh, 340px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.remote-apk-blurb {
    margin: 0 14px 10px;
    line-height: 1.45;
}

.remote-extra-cmd .chip-actions {
    margin: 0 10px 8px;
}

.remote-extra-cmd .touch-json-row {
    margin: 0 10px 10px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.48);
}

#mstab-remote > .h264-preview-block {
    flex: 0 0 auto;
    margin-top: 0;
}

#mstab-remote .h264-preview-block {
    padding: 20px;
}

#mstab-remote > .chip-actions {
    flex: 0 0 auto;
}

.touch-json-row textarea {
    width: 100%;
    margin-top: 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 12px;
    padding: 8px;
}

.browse-block {
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.42);
}

.browse-block:last-child {
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.browse-title {
    margin: 0 0 10px;
    font-size: 14px;
}

.browse-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.modal-input {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.sms-send-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.sms-body {
    flex: 2;
    min-width: 160px;
}

.data-table-host {
    margin-top: 10px;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.data-table thead {
    background: rgba(51, 65, 85, 0.72);
    position: sticky;
    top: 0;
    z-index: 1;
}

tr.fb-dir td:first-child {
    cursor: pointer;
    color: #a78bfa;
}

.gl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.gl-cell {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    padding: 6px;
    cursor: pointer;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.gl-cell img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 6px;
}

.gl-ph {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.65);
    font-size: 11px;
    padding: 4px;
}

.gl-cap {
    font-size: 10px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gl-preview {
    margin-top: 12px;
}

.gl-preview img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.dt-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.dt-tab {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--muted);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
}

.dt-tab.active {
    border-color: var(--primary);
    color: #ddd6fe;
    font-weight: 700;
}

.dt-host {
    max-height: calc(100vh - 280px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.5);
}

.pre-plain {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    line-height: 1.45;
}

.json-preview {
    display: block;
    max-height: 34vh;
    overflow: auto;
    background: rgba(15, 23, 42, 0.5);
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    font-size: 11px;
    margin: 14px 0;
}

.mono {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    word-break: break-all;
}

.app-act-cell {
    white-space: normal;
}

.app-act-cell .btn {
    margin-right: 6px;
    margin-bottom: 4px;
}

.flex-wrap {
    flex-wrap: wrap;
}

@media (max-width: 520px) {
    .modal-sheet-wide {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        display: block;
        overflow: auto;
        padding: 16px 18px 28px;
    }
    .modal-sheet-wide .modal-head,
    .modal-sheet-wide .device-id-line {
        padding-left: 0;
        padding-right: 0;
        background: transparent;
    }
    .modal-section-tabs {
        flex-direction: row;
        padding: 0;
        margin: 12px 0 8px;
        border-right: none;
        background: transparent;
    }
    .mstab {
        text-align: center;
        border-radius: 999px;
        padding: 8px 12px;
    }
    .mstab-panel {
        padding: 0;
    }
    .chip-actions {
        gap: 6px;
        padding: 10px;
    }
    #mstab-remote.active {
        display: flex;
        flex-direction: column;
        min-height: 0;
        gap: 8px;
    }
}

.unlock-feedback-line {
    min-height: 1.25em;
    margin: 4px 0 10px;
}

.hint-span {
    flex-basis: 100%;
    margin-top: 4px;
}

.black-select {
    max-width: 200px;
    font-size: 13px;
}

.keylog-toolbar {
    margin-top: 10px;
}

.keylog-date-inp {
    max-width: 220px;
}

.h264-preview-block {
    margin-top: 0;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 22px;
    background: rgba(2, 6, 23, 0.36);
}

.remote-float-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.remote-float-head strong {
    display: block;
    margin-bottom: 2px;
}

.remote-float-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.h264-preview-block.remote-float {
    position: fixed;
    z-index: 80;
    left: var(--remote-float-left, 210px);
    top: var(--remote-float-top, 58px);
    width: min(92vw, 1180px);
    max-height: calc(100vh - 84px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: rgba(2, 6, 23, 0.94);
    border-color: rgba(167, 139, 250, 0.42);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(14px);
}

.h264-preview-block.remote-float .remote-float-head {
    cursor: move;
    user-select: none;
}

.h264-preview-block.remote-float .h264-preview-cell {
    min-height: 0;
}

.h264-preview-block.remote-float .h264-phone-frame {
    flex: 1 1 auto;
    min-height: 0;
    /* 画布在 flex 分栏里可能比分配高度更长时，允许在浮层内纵向滚动看清整幅画面（父 .remote-float 已 overflow:auto）*/
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.h264-preview-block.remote-float .h264-canvas-main:not(.h264-hidden-canvas),
.h264-preview-block.remote-float #h264-video-scr {
    min-height: min(280px, 36vh);
    max-height: min(56vh, calc(100vh - 340px));
}

.h264-preview-block.remote-float .remote-kb-row {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin-top: auto;
    padding-bottom: 2px;
    background: linear-gradient(to top, rgba(2, 6, 23, 0.98) 55%, transparent);
}

.h264-preview-block.remote-float .h264-preview-secondary {
    display: none;
}

.h264-preview-block.remote-float .h264-canvas,
.h264-preview-block.remote-float .h264-video {
    max-height: min(56vh, calc(100vh - 340px));
}

.h264-status-line {
    min-height: 1.25em;
    margin-bottom: 8px;
}

.h264-preview-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.h264-preview-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.h264-preview-cell > span {
    color: #cbd5e1;
    font-weight: 700;
}

.h264-phone-frame {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    background: #020617;
    border-radius: 18px;
}

.remote-scroll-pad {
    position: absolute;
    right: 14px;
    top: 50%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    transform: translateY(-50%);
    width: auto;
    margin: 0;
    padding: 10px 8px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.remote-scroll-btn {
    pointer-events: auto;
    width: 62px;
    height: 58px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
}

.remote-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.remote-scroll-btn:active {
    transform: scale(0.96);
}

.remote-scroll-btn span:first-child {
    width: 18px;
    height: 18px;
    border-left: 4px solid currentColor;
    border-top: 4px solid currentColor;
}

.remote-scroll-up span:first-child {
    transform: translateY(4px) rotate(45deg);
}

.remote-scroll-down span:first-child {
    transform: translateY(-4px) rotate(225deg);
}

.h264-canvas {
    width: 100%;
    height: auto;
    max-height: min(68vh, 760px);
    background: #020617;
    border-radius: 18px;
    border: 1px solid var(--border);
    image-rendering: auto;
}

.h264-video {
    width: 100%;
    height: auto;
    max-height: min(68vh, 760px);
    background: #020617;
    border-radius: 18px;
    border: 1px solid var(--border);
    display: block;
    object-fit: contain;
    image-rendering: auto;
}

.h264-hidden-canvas {
    display: none;
}

#h264-canvas-scr,
#h264-video-scr {
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

#h264-canvas-scr:active,
#h264-video-scr:active {
    cursor: grabbing;
}

.h264-canvas-main,
#h264-video-scr {
    min-height: 420px;
}

.h264-preview-secondary {
    opacity: 0.82;
}

.h264-preview-secondary .h264-canvas,
.h264-preview-secondary .h264-video {
    max-height: 180px;
}

.remote-nav-bar {
    align-self: center;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    gap: clamp(26px, 7vw, 72px);
    width: min(520px, 78%);
    margin: 12px auto 0;
    padding: 12px 28px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.remote-nav-btn {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: 999px;
}

.remote-nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.remote-nav-back span:first-child {
    width: 25px;
    height: 25px;
    border-left: 5px solid currentColor;
    border-bottom: 5px solid currentColor;
    transform: rotate(45deg);
    margin-left: 10px;
}

.remote-nav-home span:first-child {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.42);
}

.remote-nav-recents span:first-child {
    width: 30px;
    height: 30px;
    border: 5px solid currentColor;
    border-radius: 6px;
}

.remote-kb-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(520px, 92%);
    align-self: center;
    margin: 14px auto 0;
    cursor: text;
}

.remote-kb-row .remote-kb-label {
    align-self: flex-start;
    font-size: 0.82rem;
}

.remote-kb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.remote-kb-input {
    width: 100%;
    font-size: 0.94rem;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e5e7eb;
}

.remote-kb-input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: 1px;
    border-color: rgba(96, 165, 250, 0.5);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
