/* Phase 1 设备控制面 */

.device-overview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.device-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.device-summary-card {
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.28);
}

.device-summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #60a5fa;
}

.device-summary-label {
    font-size: 0.875rem;
    color: var(--text-muted, #6b7280);
}

.device-summary-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    line-height: 1.4;
}

.device-summary-tip {
    margin: 0;
    padding: 0.65rem 0.85rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 8px;
}

.device-summary-tip.hidden {
    display: none;
}

.device-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.device-search {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
}

.device-search::placeholder {
    color: var(--text-muted);
}

.device-filter-online,
.device-filter-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    white-space: nowrap;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}

.device-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.device-filter-chip:has(input:checked) {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.device-filter-chip input {
    margin: 0;
}

.device-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.device-status-badge--online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.device-status-badge--offline {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

.device-row--online {
    border-left: 3px solid #22c55e;
}

.device-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
}

/* 详情侧栏 */
.device-detail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
}

.device-detail-backdrop.open {
    display: block;
}

.device-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background: rgba(12, 20, 36, 0.96);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.45);
    z-index: 901;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

.device-detail-drawer.open {
    transform: translateX(0);
}

.device-detail-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.device-detail-drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.device-detail-actions {
    margin-top: 1.5rem;
}

/* 工作台 */
.device-workbench {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
    gap: 0;
}

.device-workbench-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 1rem;
}

.device-workbench-header-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1;
    align-items: center;
    font-size: 0.875rem;
}

.device-workbench-header-item.code {
    font-family: monospace;
    font-size: 0.75rem;
    opacity: 0.85;
}

.device-workbench-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.device-workbench--phase1 .device-workbench-body {
    /* Phase 3 将改为 grid 三栏 */
}

.device-workbench-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    padding-bottom: 0.5rem;
}

.device-workbench-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted, #6b7280);
}

.device-workbench-tab.active {
    background: var(--primary, #6366f1);
    color: #fff;
    font-weight: 600;
}

.device-workbench-tab-panel {
    flex: 1;
    min-height: 320px;
}

.device-workbench-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, #e5e7eb);
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

/* Horizon 双屏控制台 */
.horizon-console {
    gap: 0.5rem;
    --horizon-left-col: auto;
    --horizon-right-col: 1fr;
    --horizon-phone-gap: 4.75rem;
    --horizon-bridge-gap-from-phone: 0.65rem;
    --horizon-phone-height: min(
        calc(100vh - 150px),
        calc((100vw - 22rem) * 9 / 16)
    );
}

.horizon-console .device-workbench-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.625rem;
}

/* 独立控制窗口：?device=xxx 新窗口打开，隐藏侧栏 */
body.workbench-standalone .sidebar,
body.workbench-standalone .sidebar-overlay,
body.workbench-standalone .mobile-menu-btn {
    display: none !important;
}

body.workbench-standalone .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.workbench-standalone #page-device-workbench {
    min-height: calc(100vh - 1.5rem);
}

.horizon-main {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.horizon-upper {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 0.5rem;
    align-items: stretch;
    min-height: calc(100vh - 136px);
}

.horizon-visual-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    width: fit-content;
    max-width: 100%;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0.125rem 0 0;
}

.horizon-dual-phone--popup-cast {
    width: fit-content;
    max-width: 100%;
    min-height: auto;
}

.horizon-dual-phone--popup-cast .horizon-phone-cast--detached {
    display: none !important;
}

.horizon-cast-popup {
    position: fixed;
    z-index: 10050;
    width: min(360px, calc(100vw - 24px));
    background: linear-gradient(180deg, #1e2433 0%, #141820 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    touch-action: none;
}

.horizon-cast-popup.hidden {
    display: none !important;
}

.horizon-cast-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    background: rgba(0, 0, 0, 0.25);
    cursor: move;
    user-select: none;
}

.horizon-cast-popup-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e8ecf4;
}

.horizon-cast-popup-close {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.horizon-cast-popup-close:hover {
    background: rgba(255, 80, 80, 0.35);
}

.horizon-cast-popup-body {
    padding: 0.5rem;
}

.horizon-cast-popup-body .horizon-phone-frame {
    width: 100%;
    height: auto;
    max-height: min(72vh, 640px);
    margin: 0 auto;
}

.horizon-cast-popup-body .horizon-phone-caption {
    margin-top: 0.35rem;
    text-align: center;
    font-size: 0.75rem;
    color: #9aa3b5;
}

.horizon-cast-popup-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.horizon-cast-popup-tools .horizon-phone-nav {
    width: 100%;
    justify-content: center;
}

#reading-cast-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.horizon-tool-btn--cast {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: transparent;
}

.horizon-tool-btn--cast:not(:disabled):hover {
    filter: brightness(1.08);
}

.horizon-tool-btn--cast.horizon-tool-btn--cast-on {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

#workbench-cast-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.horizon-dual-phone {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    min-height: 0;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
}

.horizon-phone-screen-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--horizon-bridge-gap-from-phone);
    width: 100%;
}

.horizon-phone-screen-row .horizon-phone-frame {
    flex: none;
}

.horizon-phone-bridge {
    flex: none;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.45rem;
    width: var(--horizon-phone-gap);
    min-height: var(--horizon-phone-height);
    margin: 0;
    padding: 0.45rem 0.28rem 0.35rem;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.72) 100%);
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 8px 22px rgba(79, 70, 229, 0.08);
}

.horizon-phone-reading {
    flex: none;
}

.horizon-phone-cast {
    flex: none;
    margin-left: 0.75rem;
}

.horizon-control-rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.42rem;
    width: 100%;
    padding: 0.35rem 0.15rem 0.15rem;
}

.horizon-rail-cmd {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-height: 2.85rem;
    padding: 0.45rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.02em;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.78);
    color: #cbd5e1;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 8px 18px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    text-align: center;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.horizon-rail-cmd-icon {
    display: block;
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.92;
}

.horizon-rail-cmd-label {
    display: block;
}

.horizon-rail-cmd-state {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    color: #94a3b8;
    min-height: 0.875rem;
}

.horizon-rail-cmd[data-state="on"] {
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(59, 130, 246, 0.18);
    color: #e0e7ff;
    box-shadow:
        0 0 0 1px rgba(147, 197, 253, 0.12) inset,
        0 4px 12px rgba(59, 130, 246, 0.22),
        0 10px 22px rgba(59, 130, 246, 0.14);
}

.horizon-rail-cmd[data-state="on"] .horizon-rail-cmd-state {
    color: #93c5fd;
}

.horizon-cast-device-badge {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    font-size: 0.6875rem;
    font-weight: 600;
}

.horizon-cast-body {
    position: relative;
    overflow: hidden;
}

.horizon-reading-body.horizon-reading-body--mirror {
    box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.horizon-mirror-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #0b1220;
}

.horizon-mirror-banner {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.72rem;
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.35);
    border-bottom: 1px solid rgba(56, 189, 248, 0.35);
    text-align: center;
    pointer-events: none;
}

.horizon-mirror-viewport {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
    padding: 0;
}

.horizon-mirror-scaler {
    position: absolute;
    inset: 0;
}

.horizon-reading-mirror-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none !important;
}

.horizon-mirror-pattern-grid {
    position: absolute;
    z-index: 8;
    pointer-events: none;
    border: 1px dashed rgba(56, 189, 248, 0.55);
    border-radius: 10px;
    box-sizing: border-box;
    background: rgba(14, 116, 144, 0.12);
}

.horizon-mirror-pattern-dot {
    position: absolute;
    width: 22%;
    height: 22%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(125, 211, 252, 0.9);
    background: rgba(30, 58, 138, 0.55);
    color: #f0f9ff;
    font-size: clamp(10px, 42%, 15px);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}

.horizon-reading-body.horizon-reading-body--lock-mirror {
    box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.horizon-reading-content.horizon-reading-content--mirror-hidden {
    display: none !important;
}

.horizon-reading-lock-mirror-wrap {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    background: #0b1220;
}

.horizon-reading-lock-mirror-wrap.hidden {
    display: none;
}

.horizon-reading-lock-mirror-banner {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.72rem;
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.35);
    border-bottom: 1px solid rgba(56, 189, 248, 0.35);
    text-align: center;
    pointer-events: none;
}

.horizon-reading-lock-mirror-viewport {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: hidden;
}

.horizon-reading-lock-mirror-scaler {
    position: relative;
    flex: 0 0 auto;
}

.horizon-reading-lock-mirror-stage {
    position: relative;
    overflow: visible;
}

.horizon-reading-mirror-stage {
    position: relative;
    background: linear-gradient(180deg, #0f172a 0%, #111827 42%, #0b1220 100%);
    transform-origin: top left;
}

.horizon-reading-lock-mirror-stage .horizon-reading-block--shell,
.horizon-reading-mirror-stage .horizon-reading-block--shell {
    display: none;
}

.horizon-reading-lock-mirror-stage .horizon-reading-block--pattern,
.horizon-reading-mirror-stage .horizon-reading-block--pattern {
    display: block !important;
    border-color: rgba(56, 189, 248, 0.72);
    background: rgba(14, 116, 144, 0.22);
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.25);
}

.horizon-reading-pattern-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.horizon-reading-mirror-stage .horizon-reading-block--pattern .horizon-mirror-pattern-dot {
    position: absolute;
    width: 18%;
    height: 18%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(125, 211, 252, 0.95);
    background: rgba(30, 58, 138, 0.65);
    color: #f0f9ff;
    font-size: clamp(9px, 36%, 14px);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}

.horizon-reading-lock-mirror-stage .horizon-reading-block,
.horizon-reading-mirror-stage .horizon-reading-block {
    border-color: rgba(100, 116, 139, 0.5);
    background: rgba(30, 41, 59, 0.78);
}

.horizon-reading-lock-mirror-stage .horizon-reading-block--fab,
.horizon-reading-mirror-stage .horizon-reading-block--fab {
    background: rgba(51, 65, 85, 0.88);
    border-color: rgba(148, 163, 184, 0.55);
}

.horizon-reading-lock-mirror-stage .horizon-reading-block-label,
.horizon-reading-mirror-stage .horizon-reading-block-label {
    display: block;
    font-size: clamp(10px, 38%, 15px);
    line-height: 1.15;
    font-weight: 700;
    opacity: 1;
    white-space: normal;
    word-break: break-word;
    padding: 1px 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.horizon-reading-lock-mirror-stage .horizon-reading-overflow,
.horizon-reading-mirror-stage .horizon-reading-overflow {
    font-size: 0.55rem;
    bottom: 2px;
    right: 2px;
}

.horizon-cast-body.horizon-cast-body--lock-mirror {
    box-shadow: none;
}

.horizon-cast-lock-mirror-wrap {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    background: #0b1220;
    pointer-events: none;
}

.horizon-cast-lock-mirror-wrap.hidden {
    display: none;
}

.horizon-cast-lock-mirror-banner {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.72rem;
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.35);
    border-bottom: 1px solid rgba(56, 189, 248, 0.35);
    text-align: center;
}

.horizon-cast-lock-mirror-viewport {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: hidden;
}

.horizon-cast-lock-mirror-stage {
    position: relative;
    width: 100%;
    max-height: 100%;
    aspect-ratio: 9 / 16;
    background: #111827;
    border-radius: 8px;
    overflow: hidden;
}

.horizon-cast-lock-mirror-stage .horizon-reading-block {
    pointer-events: none;
}

.horizon-cast-body.horizon-cast-body--remote-black {
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.45);
}

.horizon-cmd-result {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
}

.horizon-cmd-result--error {
    border-color: #fecaca;
    background: #fef2f2;
}

.horizon-cmd-result-json {
    margin: 0;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.horizon-rail-cmd:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-color: rgba(99, 102, 241, 0.42);
    box-shadow:
        0 2px 8px rgba(99, 102, 241, 0.1),
        0 6px 16px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.horizon-rail-cmd:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.horizon-phone-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    width: 100%;
    padding: 0;
}

.horizon-bridge-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.42rem;
    margin-top: auto;
    padding: 0.55rem 0.15rem 0.35rem;
    border-top: 1px solid rgba(99, 102, 241, 0.14);
}

.horizon-bridge-nav .horizon-nav-key {
    flex: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 2.55rem;
    padding: 0.42rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(15, 23, 42, 0.78);
    color: #cbd5e1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 8px 18px rgba(0, 0, 0, 0.25);
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.horizon-bridge-nav .horizon-nav-key::before {
    display: block;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.9;
}

.horizon-bridge-nav .horizon-nav-key[data-nav="back"]::before { content: "←"; }
.horizon-bridge-nav .horizon-nav-key[data-nav="home"]::before { content: "⌂"; }
.horizon-bridge-nav .horizon-nav-key[data-nav="recent"]::before { content: "▦"; }

.horizon-bridge-nav .horizon-nav-key:hover {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.18);
    transform: translateY(-1px);
}

.horizon-bridge-nav--popup {
    flex-direction: row;
    flex-wrap: wrap;
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.horizon-bridge-nav--popup .horizon-nav-key {
    flex: 1 1 auto;
    width: auto;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #e8ecf4;
}

.horizon-bridge-nav--popup .horizon-nav-key:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
}

.horizon-nav-key {
    flex: 1 1 auto;
    min-width: 2.5rem;
    padding: 0.35rem 0.4rem;
    font-size: 0.6875rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.65);
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.horizon-nav-key:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.horizon-right-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100vh - 136px);
    max-height: calc(100vh - 136px);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    margin-left: 0;
}

.horizon-feature-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0 0.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border, #e5e7eb);
    overflow-x: auto;
    flex-shrink: 0;
}

.horizon-feature-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.horizon-feature-tab:hover {
    color: var(--primary, #6366f1);
}

.horizon-feature-tab.active {
    color: var(--primary, #6366f1);
    border-bottom-color: var(--primary, #6366f1);
    font-weight: 600;
}

.horizon-feature-tab--reserved {
    opacity: 0.88;
}

.horizon-feature-tab-tag {
    font-size: 0.625rem;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    background: #f3f4f6;
    color: #9ca3af;
    font-weight: 500;
}

.horizon-feature-tab.active .horizon-feature-tab-tag {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary, #6366f1);
}

.horizon-phone-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: none;
    min-width: 0;
    width: auto;
    justify-content: flex-start;
}

.horizon-phone-panel--focus .horizon-phone-frame {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.55);
}

.horizon-phone-panel--locked .horizon-phone-caption {
    color: #fbbf24;
}

.horizon-bridge-focus {
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.horizon-focus-hint {
    display: block;
    font-size: 0.625rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.35;
}

.horizon-input-preview {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #4338ca;
    text-align: center;
    line-height: 1.35;
    min-height: 1rem;
    word-break: break-all;
}

.horizon-input-preview.hidden {
    display: none;
}

.horizon-reading-block--active {
    outline: 2px solid rgba(99, 102, 241, 0.85);
    outline-offset: -1px;
    background: rgba(99, 102, 241, 0.12);
}

.horizon-reading-screen-off {
    width: 100%;
    height: 100%;
    min-height: 12rem;
    background: #000;
}

.horizon-kbd-capture {
    position: fixed;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
    white-space: pre-wrap;
}

.horizon-cast-body:focus-visible,
.horizon-reading-body:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.45);
    outline-offset: -2px;
}

.horizon-phone-panel--on .horizon-phone-frame {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.horizon-phone-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0 0 0.5rem;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.horizon-tool-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.horizon-tool-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.horizon-tool-btn:disabled,
.horizon-tool-btn--muted {
    opacity: 0.55;
    cursor: not-allowed;
}

.horizon-cast-mode-btn--active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1d4ed8;
    font-weight: 600;
}

.horizon-tool-toggle {
    font-weight: 600;
    min-width: 2.5rem;
}

.horizon-tool-toggle--on {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.horizon-tool-toggle--on:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.horizon-phone-caption {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.5rem 0 0;
    width: 100%;
}

/* 1080×1920 竖屏比例 9:16，填满左侧红框区域 */
.horizon-phone-frame {
    width: min(100%, calc(var(--horizon-phone-height) * 9 / 16));
    height: var(--horizon-phone-height);
    aspect-ratio: 9 / 16;
    margin: 0;
    padding: 7px 6px;
    border-radius: 18px;
    background: #111827;
    border: 1.5px solid #374151;
    box-shadow: inset 0 0 0 1px #1f2937, 0 8px 24px rgba(0, 0, 0, 0.15);
    flex: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.horizon-phone-body {
    flex: 1;
    min-height: 0;
    width: 100%;
    border-radius: 9px;
    overflow: hidden;
    background: #000;
    position: relative;
}

.horizon-reading-body--cast-locked {
    pointer-events: none;
    opacity: 0.55;
    position: relative;
}

.horizon-reading-cast-lock {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 12px 16px;
    text-align: center;
    color: #f5d565;
    background: rgba(8, 12, 20, 0.72);
    font-size: 13px;
    pointer-events: none;
}

.horizon-reading-cast-lock.hidden {
    display: none;
}

.horizon-phone-panel--cast-locked .horizon-reading-body {
    filter: grayscale(0.15);
}

    background: #0a0a0a;
}

.horizon-reading-body {
    position: relative;
}

.horizon-reading-body[data-state="waiting"] {
    background: #1e293b;
}

.horizon-reading-body[data-state="connected"] {
    background: #0f172a;
}

.horizon-reading-banner--wait {
    color: #94a3b8;
    font-weight: 600;
}

.horizon-reading-body[data-state="idle"] {
    background: #0f0f0f;
}

.horizon-reading-content {
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-size: 100%;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.horizon-reading-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.horizon-reading-viewport {
    position: relative;
    width: 100%;
    flex: 1 1 100%;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    contain: layout style paint;
}

.horizon-reading-page-ghost {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    transform: translate3d(100%, 0, 0);
    pointer-events: none;
}

.horizon-reading-page-ghost.hidden {
    display: none;
}

.horizon-reading-page-ghost--pager {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.horizon-reading-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    background: linear-gradient(180deg, #0f172a 0%, #111827 42%, #0b1220 100%);
    min-height: 120px;
    contain: layout paint style;
}

.horizon-reading-stage--dragging,
.horizon-reading-stage--pager {
    will-change: transform;
}

.horizon-reading-stage--pager {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.horizon-reading-stage--dragging {
    transition: none;
}

.horizon-reading-stage--enter {
    animation: none;
}

.horizon-reading-stage--optimistic {
    transition: transform 0.12s ease-out;
}

.horizon-reading-focus {
    padding: 0.4rem 0.5rem;
    font-size: 0.6875rem;
    color: #94a3b8;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.horizon-reading-touch-ripple {
    position: absolute;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.85);
    background: rgba(59, 130, 246, 0.25);
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transform: scale(0.35);
}

.horizon-reading-touch-ripple--active {
    animation: horizon-reading-ripple 0.45s ease-out forwards;
}

@keyframes horizon-reading-ripple {
    0% { opacity: 0.95; transform: scale(0.35); }
    100% { opacity: 0; transform: scale(2.2); }
}

.horizon-reading-overflow {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 2px 6px;
    font-size: 0.625rem;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.horizon-reading-shell-hint {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 2px 6px;
    font-size: 0.5625rem;
    color: #64748b;
    background: rgba(15, 23, 42, 0.75);
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.horizon-reading-sync-overlay {
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    max-width: calc(100% - 16px);
    padding: 4px 10px;
    font-size: 0.6875rem;
    color: #e2e8f0;
    background: rgba(30, 64, 175, 0.88);
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 6px;
    pointer-events: none;
    z-index: 8;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.horizon-reading-sync-overlay--visible {
    opacity: 1;
}

#horizon-reading-content {
    position: relative;
}

.horizon-reading-block {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid rgba(99, 102, 241, 0.55);
    background: rgba(30, 41, 59, 0.55);
    border-radius: 2px;
    overflow: visible;
    display: flex;
    align-items: flex-start;
    padding: 0;
    content-visibility: auto;
    contain-intrinsic-size: 16px 12px;
    pointer-events: auto;
    cursor: crosshair;
}

.horizon-reading-block:hover,
.horizon-reading-block--active {
    border-color: rgba(250, 204, 21, 0.95);
    background: rgba(30, 58, 95, 0.72);
    z-index: 6;
}

.horizon-reading-block--shell:hover {
    background: transparent;
}

.horizon-reading-block--shell {
    background: transparent;
    border-style: dashed;
    border-color: rgba(100, 116, 139, 0.35);
    pointer-events: none;
}

.horizon-reading-block--leaf {
    border-width: 1px;
    background: rgba(30, 41, 59, 0.42);
}

.horizon-reading-block--tiny {
    border-color: rgba(129, 140, 248, 0.5);
    background: rgba(30, 41, 59, 0.35);
}

.horizon-reading-block-center {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #facc15;
    border: 1px solid #0f172a;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.45);
    pointer-events: none;
    z-index: 3;
}

.horizon-reading-nodelist {
    display: none !important;
}

.horizon-reading-nodelist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.625rem;
    color: #94a3b8;
    background: #111827;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.horizon-reading-nodelist-count {
    color: #64748b;
}

.horizon-reading-nodelist-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 0;
}

.horizon-reading-nodelist-item {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 6px;
    align-items: center;
    width: 100%;
    padding: 5px 8px;
    border: none;
    border-bottom: 1px solid #1e293b;
    background: transparent;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
    font: inherit;
    content-visibility: auto;
    contain-intrinsic-size: 28px;
}

.horizon-reading-nodelist-item:hover,
.horizon-reading-nodelist-item--active {
    background: rgba(37, 99, 235, 0.18);
}

.horizon-reading-nodelist-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #facc15;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.horizon-reading-nodelist-name {
    font-size: 0.6875rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.horizon-reading-nodelist-meta {
    font-size: 0.5625rem;
    color: #64748b;
    white-space: nowrap;
}

.horizon-reading-nodelist-empty {
    padding: 10px 8px;
    font-size: 0.6875rem;
    color: #64748b;
    text-align: center;
}

.horizon-reading-viewport .horizon-reading-touch-ripple {
    position: absolute;
}

.horizon-reading-block--image {
    background: rgba(51, 65, 85, 0.65);
    border-style: dashed;
    border-color: rgba(148, 163, 184, 0.45);
}

.horizon-reading-block--toolbar {
    border-color: rgba(96, 165, 250, 0.75);
    background: rgba(30, 58, 95, 0.62);
    z-index: 4;
}

.horizon-reading-block--fab {
    border-color: rgba(74, 222, 128, 0.8);
    background: rgba(6, 78, 59, 0.55);
    border-radius: 12px;
    z-index: 5;
}

.horizon-reading-block--row {
    border-color: rgba(129, 140, 248, 0.55);
    background: rgba(30, 41, 59, 0.38);
}

.horizon-reading-meta-hint {
    padding: 0.25rem 0.5rem 0.35rem;
    font-size: 0.625rem;
    color: #94a3b8;
    text-align: center;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.horizon-reading-content-gap {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
    border-left: 1px dashed rgba(100, 116, 139, 0.35);
    border-right: 1px dashed rgba(100, 116, 139, 0.35);
    background: rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

.horizon-reading-content-gap-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        180deg,
        rgba(51, 65, 85, 0.18) 0,
        rgba(51, 65, 85, 0.18) 1px,
        transparent 1px,
        transparent 44px
    );
}

.horizon-reading-content-gap-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 88%;
    padding: 10px 12px;
    text-align: center;
    font-size: 0.6875rem;
    line-height: 1.45;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(100, 116, 139, 0.45);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.35);
}

.horizon-reading-content-gap-label span {
    display: block;
    margin-top: 4px;
    font-size: 0.625rem;
    color: #94a3b8;
}

.horizon-reading-block-label {
    font-size: 0.5625rem;
    line-height: 1.2;
    color: #e2e8f0;
    word-break: break-all;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.horizon-reading-off-title,
.horizon-reading-banner {
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
    margin: 1.25rem 0 0.75rem;
    line-height: 1.45;
    padding: 0 0.75rem;
}

.horizon-reading-off-hint,
.horizon-reading-tree-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.5;
    margin: 0.5rem 0;
    padding: 0 0.75rem;
}

.horizon-reading-meta {
    margin: 0.75rem 0;
    padding: 0.5rem 0.625rem;
    background: #1e293b;
    border-radius: 8px;
    font-size: 0.75rem;
}

.horizon-reading-meta div {
    display: flex;
    gap: 0.5rem;
    padding: 0.2rem 0;
    color: #cbd5e1;
}

.horizon-reading-meta .k {
    color: #64748b;
    min-width: 2.5rem;
}

.horizon-reading-meta .v {
    flex: 1;
    word-break: break-all;
}

.horizon-reading-tree {
    border-top: 1px solid #334155;
    padding-top: 0.625rem;
    margin-top: 0.5rem;
}

.horizon-reading-node {
    padding: 0.25rem 0;
    font-size: 0.75rem;
    color: #e2e8f0;
    border-bottom: 1px solid #1e293b;
}

.horizon-cast-body[data-state="off"] {
    background: #000;
}

.horizon-cast-body[data-state="waiting"],
.horizon-cast-body[data-state="disconnected"] {
    background: linear-gradient(160deg, #1e293b, #0f172a);
}

.horizon-cast-body[data-state="connected"] {
    background: #000;
}

.horizon-cast-body[data-state="loading"] {
    background: linear-gradient(160deg, #1e293b, #0f172a);
}

.horizon-cast-body[data-state="error"] {
    background: linear-gradient(160deg, #450a0a, #1c1917);
}

.horizon-cast-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1.25rem 1rem;
    text-align: center;
    box-sizing: border-box;
}

.horizon-cast-title {
    margin: 0;
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.horizon-cast-hint {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    max-width: 85%;
    padding: 0 0.5rem;
}

.horizon-cast-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 2;
    pointer-events: none;
}

.horizon-cast-video.hidden {
    display: none;
}

.horizon-cast-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    pointer-events: none;
}

.horizon-cast-canvas.hidden {
    display: none;
}

.horizon-cast-stack {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.horizon-cast-stack.hidden {
    display: none;
}

.horizon-cast-video-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
}

.horizon-cast-lock-mask {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.horizon-cast-lock-panel {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 92%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.horizon-cast-lock-mask--manual {
    background: rgba(37, 99, 235, 0.18);
}

.horizon-cast-lock-hint {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.6875rem;
    line-height: 1.45;
    text-align: center;
}

.horizon-pattern-manual-banner {
    margin: 0 0.5rem 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #bfdbfe;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.horizon-pattern-manual-banner.hidden {
    display: none;
}

.tab-passwords-unlock-msg--pattern {
    color: #93c5fd;
    font-weight: 600;
}

.horizon-pattern-manual-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.horizon-pattern-manual-btn:hover {
    filter: brightness(1.08);
}

.horizon-cast-lock-mask.hidden {
    display: none;
}

/* 图文区图案九宫格 — 锁屏无 a11y 节点时手动/自动画线 */
.horizon-pattern-grid {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0.35rem;
    pointer-events: auto;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.55) 55%, transparent 100%);
}

.horizon-pattern-grid.hidden {
    display: none;
}

.horizon-pattern-grid-panel {
    width: 100%;
    max-width: min(92%, 280px);
    padding: 0.55rem;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.35);
    text-align: center;
}

.horizon-pattern-grid-title {
    display: block;
    font-size: 0.68rem;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.horizon-pattern-grid-dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.45rem;
    touch-action: none;
}

.horizon-pattern-grid-dot {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.65);
    background: rgba(15, 23, 42, 0.8);
    color: #93c5fd;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: crosshair;
    user-select: none;
}

.horizon-pattern-grid-dot--on {
    background: rgba(37, 99, 235, 0.85);
    color: #fff;
}

.horizon-pattern-grid-auto {
    margin-right: 0.35rem;
}

.horizon-reading-body {
    position: relative;
}

.horizon-cast-lock-mask-label {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
}

.horizon-input-bar {
    display: none;
}

.horizon-input-field {
    flex: none;
    width: 100%;
    min-width: 0;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.9);
    color: #f1f5f9;
    font-size: 0.75rem;
}

.horizon-input-field:focus {
    outline: none;
    border-color: #3b82f6;
}

.horizon-input-btn {
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(30, 41, 59, 0.95);
    color: #e2e8f0;
    font-size: 0.6875rem;
    cursor: pointer;
    white-space: nowrap;
}

.horizon-input-btn--primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.horizon-input-btn:hover {
    filter: brightness(1.08);
}

.horizon-screen-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem 0.375rem;
}

.horizon-screen-a-badge {
    font-size: 0.6875rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.horizon-screen-a-badge--idle { background: #374151; color: #9ca3af; }
.horizon-screen-a-badge--loading { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.horizon-screen-a-badge--success { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.horizon-screen-a-badge--error { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.horizon-screen-a-badge--connected { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }

.horizon-screen-a-body {
    border-radius: 20px;
    overflow: hidden;
    min-height: 300px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.horizon-screen-a-body[data-state="loading"] {
    background: linear-gradient(160deg, #1e293b, #0f172a);
}

.horizon-screen-a-body[data-state="error"] {
    background: linear-gradient(160deg, #450a0a, #1c1917);
}

.horizon-screen-a-placeholder {
    text-align: center;
    padding: 1rem;
    color: #64748b;
}

.horizon-screen-a-title {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.9375rem;
    font-weight: 600;
}

.horizon-screen-a-hint {
    margin: 0.625rem 0 0;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
    max-width: 240px;
    margin-left: auto;
    margin-right: auto;
}

.horizon-screen-a-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.horizon-screen-a-video.hidden {
    display: none;
}

.horizon-action-rail {
    display: none;
}

.horizon-screen-a,
.horizon-screen-b {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.horizon-screen-b {
    min-height: 200px;
}

.horizon-screen-b-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    padding: 0.4rem 1rem 0.35rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
}

.horizon-screen-b-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.horizon-screen-b-subtitle {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--text-muted, #6b7280);
    line-height: 1.3;
}

.horizon-screen-b-content {
    flex: 1;
    padding: 0.65rem 1rem 1rem;
    overflow: auto;
    min-height: 160px;
}

.horizon-screen-b-content .table-container {
    overflow-x: auto;
}

.apps-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(560px, 62vh);
    overflow-y: auto;
}

.apps-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.apps-list-item:hover {
    background: #f1f5f9;
}

.apps-list-icon {
    flex-shrink: 0;
}

.apps-list-icon-ph {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e2e8f0;
}

.apps-list-body {
    flex: 1;
    min-width: 0;
}

.apps-list-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #0f172a;
}

.apps-list-pack {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-list-pack code {
    background: transparent;
    padding: 0;
    font-size: 0.75rem;
}

.apps-list-ver {
    margin-top: 0.1rem;
    font-size: 0.6875rem;
    color: #64748b;
}

.tab-passwords-toolbar {
    flex-wrap: wrap;
}

.tab-passwords-stored {
    margin: -0.25rem 0 0.5rem;
    font-size: 0.8125rem;
    color: #475569;
}

.tab-passwords-unlock-msg {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    min-height: 1.25rem;
}

.tab-passwords-unlock-msg--active {
    color: #15803d;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.horizon-screen-b-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted, #6b7280);
}

.horizon-screen-b-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.horizon-cmd-log-panel {
    border: none;
    border-top: 1px solid var(--border, #e5e7eb);
    border-radius: 0;
    background: #0f172a;
    overflow: hidden;
    flex-shrink: 0;
}

.horizon-cmd-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.8125rem;
    font-weight: 600;
}

.horizon-cmd-log-header .btn {
    color: #94a3b8;
    border-color: #475569;
    font-size: 0.75rem;
}

.horizon-cmd-log {
    max-height: 108px;
    overflow-y: auto;
    padding: 0.5rem 0.875rem;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.6;
}

.horizon-log-line--info { color: #94a3b8; }
.horizon-log-line--send { color: #60a5fa; }
.horizon-log-line--ok { color: #4ade80; }
.horizon-log-line--err { color: #f87171; }
.horizon-log-line--warn { color: #fbbf24; }

.control-tab-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.control-tab-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.device-info-section {
    margin-bottom: 1.5rem;
}

.device-info-section h4 {
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-muted, #6b7280);
}

.device-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.device-info-grid .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 0.15rem;
}

.control-loading,
.control-empty-state,
.control-error-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted, #6b7280);
}

.control-error-state {
    color: #dc2626;
}

.control-empty-state-hint {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted, #9ca3af);
}

.control-empty-state--apps p:first-child,
.control-empty-state--sms p:first-child {
    margin: 0;
    font-weight: 500;
}

.apps-table-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.perm-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 480px;
}

.perm-section {
    margin-bottom: 1rem;
}

.perm-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
}

.perm-summary {
    margin-bottom: 1rem;
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.perm-summary--ok {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.perm-summary--warn {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.perm-hint {
    margin-left: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    font-weight: 400;
}

.perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--surface, #fff);
}

.perm-label {
    font-size: 0.9375rem;
}

.perm-badge {
    font-size: 0.8125rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 500;
}

.perm-badge--ok {
    background: #dcfce7;
    color: #166534;
}

.perm-badge--no {
    background: #fee2e2;
    color: #991b1b;
}

.control-tab-hint {
    margin-top: 0;
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
}

.tab-files-path {
    margin-top: 0;
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
    color: var(--text-muted, #6b7280);
}

.location-grid-full {
    grid-column: 1 / -1;
}

.cell-wrap {
    max-width: 320px;
    word-break: break-word;
}

@media (max-width: 960px) {
    .horizon-console {
        --horizon-left-col: 100%;
        --horizon-right-col: 100%;
        --horizon-phone-height: min(calc(100vh - 280px), 560px);
    }

    .horizon-dual-phone {
        flex-direction: column;
        width: 100%;
    }

    .horizon-phone-screen-row {
        flex-direction: column;
        align-items: stretch;
    }

    .horizon-phone-bridge {
        width: 100%;
        min-height: 0;
        margin-top: 0.5rem;
        padding: 0.5rem;
    }

    .horizon-dual-phone--popup-cast .horizon-phone-bridge {
        margin-top: 0;
        margin-left: 0;
    }

    .horizon-bridge-nav {
        flex-direction: row;
        flex-wrap: wrap;
        border-top: 1px solid #e5e7eb;
        padding-top: 0.5rem;
    }

    .horizon-bridge-nav .horizon-nav-key {
        flex: 1 1 calc(33% - 0.35rem);
        width: auto;
    }

    .horizon-control-rail {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .horizon-rail-cmd {
        flex: 1 1 calc(33% - 0.5rem);
        min-width: 4rem;
    }

    .horizon-phone-panel {
        max-width: 100%;
        height: auto;
    }

    .horizon-upper {
        grid-template-columns: 1fr;
    }

    .horizon-right-panel {
        min-height: auto;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .horizon-feature-tabs {
        flex-wrap: nowrap;
    }

    .horizon-right-panel {
        max-height: none;
    }

    .device-workbench-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .device-workbench-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

.tab-live-status {
    font-size: 0.75rem;
    color: #15803d;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #dcfce7;
}

.tab-live-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(520px, 60vh);
    overflow-y: auto;
}

.tab-live-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.tab-live-row--pwd {
    border-color: #fecaca;
    background: #fef2f2;
}

.tab-live-row-icon {
    flex-shrink: 0;
}

.tab-live-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

.tab-live-icon-placeholder--sys {
    background: #fee2e2;
    color: #b91c1c;
}

.tab-live-row-body {
    flex: 1;
    min-width: 0;
}

.tab-live-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.tab-live-row-meta strong {
    color: #0f172a;
}

.tab-live-row-text {
    font-size: 0.9375rem;
    word-break: break-all;
    line-height: 1.45;
    color: #1e293b;
}

.tab-live-row-text--pwd {
    font-family: ui-monospace, monospace;
    color: #b91c1c;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.12em;
    flex: 1;
    min-width: 0;
}

.tab-live-row-pwd-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-pwd-unlock-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
}

.tab-pwd-unlock-btn--confirm {
    font-weight: 600;
}

.tab-live-row-sub {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.tab-live-tag {
    font-size: 0.6875rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.tab-live-tag--pwd {
    background: #fee2e2;
    color: #b91c1c;
}

.tab-live-tag--ok {
    background: #dcfce7;
    color: #15803d;
}

.tab-files-path {
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
    margin-top: -0.5rem;
}

.tab-files-row--dir {
    cursor: pointer;
}

.tab-files-row--dir:hover {
    background: rgba(96, 165, 250, 0.08);
}

.tab-files-drop {
    position: relative;
    min-height: 160px;
    border: 1px dashed transparent;
    border-radius: 8px;
    padding: 0.25rem;
    transition: border-color 0.15s, background 0.15s;
}

.tab-files-drop--active {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
}

.tab-files-drop-hint {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.tab-files-upload-status {
    margin: 0 0 0.5rem;
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: #f1f5f9;
    color: #334155;
}

.tab-files-upload-status--ok {
    background: #dcfce7;
    color: #15803d;
}

.tab-files-upload-status--err {
    background: #fee2e2;
    color: #b91c1c;
}

.tab-apps-open-btn {
    white-space: nowrap;
}
