/* Watch Me Do - shadcn 风格（无框架版） */

:root {
    /* shadcn-ish tokens (直接使用颜色，便于纯 CSS 项目复用) */
    --background: hsl(0 0% 100%);
    --foreground: hsl(222.2 84% 4.9%);
    --card-bg: hsl(0 0% 100%);
    --card-foreground: hsl(222.2 84% 4.9%);
    --muted: hsl(210 40% 96.1%);
    --muted-foreground: hsl(215.4 16.3% 46.9%);
    --primary: hsl(221.2 83.2% 53.3%);
    --primary-foreground: hsl(210 40% 98%);
    --border-color: hsl(214.3 31.8% 91.4%);
    --ring: hsl(221.2 83.2% 53.3%);
    --destructive: hsl(0 84.2% 60.2%);
    --destructive-foreground: hsl(210 40% 98%);
    --success: hsl(142.1 76.2% 36.3%);
    --warning-color: hsl(47.9 95.8% 53.1%);
    --info: hsl(199.9 89.2% 48.4%);
    --radius: 14px;

    /* legacy 变量映射（尽量不改 HTML/JS 的 class 体系） */
    --bg: var(--background);
    --panel: var(--muted);
    --card: var(--card-bg);
    --text: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --accent: var(--primary);
    --accent-2: var(--success);
    --accent-3: var(--info);
    --warning: var(--warning-color);
    --danger: var(--destructive);
    --border: var(--border-color);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.12);
    --muted-card: hsl(210 40% 96.1% / 0.7);
    --table-stripe: hsl(210 40% 96.1% / 0.7);

    --header-bg: hsl(0 0% 100% / 0.78);
    --header-border: hsl(214.3 31.8% 91.4% / 0.7);
}

/* 通用工具类 */
.hidden {
    display: none !important;
}

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

body.dark {
    --background: hsl(222.2 84% 4.9%);
    --foreground: hsl(210 40% 98%);
    --card-bg: hsl(222.2 84% 5.4%);
    --card-foreground: hsl(210 40% 98%);
    --muted: hsl(217.2 32.6% 17.5%);
    --muted-foreground: hsl(215 20.2% 65.1%);
    --primary: hsl(217.2 91.2% 59.8%);
    --primary-foreground: hsl(222.2 84% 4.9%);
    --border-color: hsl(217.2 32.6% 17.5%);
    --ring: hsl(217.2 91.2% 59.8%);
    --destructive: hsl(0 62.8% 30.6%);
    --destructive-foreground: hsl(210 40% 98%);
    --success: hsl(142.1 70.6% 45.3%);
    --warning-color: hsl(47.9 95.8% 53.1%);
    --info: hsl(199.9 89.2% 58.4%);

    --bg: var(--background);
    --panel: var(--muted);
    --card: var(--card-bg);
    --text: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --accent: var(--primary);
    --accent-2: var(--success);
    --accent-3: var(--info);
    --warning: var(--warning-color);
    --danger: var(--destructive);
    --border: var(--border-color);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.45);
    --muted-card: hsl(217.2 32.6% 17.5% / 0.72);
    --table-stripe: hsl(217.2 32.6% 17.5% / 0.6);

    --header-bg: hsl(222.2 84% 4.9% / 0.72);
    --header-border: hsl(217.2 32.6% 17.5% / 0.7);
}

* {
    box-sizing: border-box;
}

.icon-svg {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
    color: currentColor;
}

.icon-svg path,
.icon-svg circle,
.icon-svg rect,
.icon-svg line,
.icon-svg polyline,
.icon-svg polygon {
    stroke: currentColor;
}

:where(button, [role="button"]):focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Poppins', 'Noto Sans SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.04) 0%, rgba(2, 6, 23, 0) 42%),
        linear-gradient(120deg, rgba(59, 130, 246, 0.10) 0%, rgba(34, 197, 94, 0.08) 40%, rgba(2, 6, 23, 0) 72%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    transition: background 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
}

.page-shell {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: 18px 18px 44px;
}

.bg-dots {
    display: none !important;
}

body.dark .bg-dots {
    display: none !important;
}

.hero {
    position: relative;
    z-index: 1;
    padding: 16px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero__left h1 {
    margin: 6px 0 12px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0 0 14px;
    color: var(--text-secondary);
}

.eyebrow {
    display: inline-block;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    border-color: hsl(142.1 76.2% 36.3% / 0.35);
    box-shadow: var(--shadow);
    color: var(--text);
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.status-pill.disconnected {
    border-color: hsl(0 84.2% 60.2% / 0.45);
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35); }
    70% { box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.refresh-btn:hover {
    background: var(--panel);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn .icon-svg {
    width: 18px;
    height: 18px;
}

.refresh-btn.spinning .icon-svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.layout-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    margin-top: 16px;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.view-panel {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.view-panel.is-hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
    pointer-events: none;
}

.side-column {
    order: -1;
}

.side-card {
    position: static;
}

.device-menu {
    width: 100%;
    padding: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.device-menu__header {
    display: none;
}

.device-menu.side-card .device-menu__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.device-title {
    font-weight: 600;
}

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

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

.device-menu__chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.device-chip {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1), border-color 220ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.device-chip:hover {
    background: var(--card);
}

.device-chip.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
    transform: translateY(-1px);
}

.device-chip.ghost {
    background: transparent;
    border-style: dashed;
    color: var(--text-secondary);
}

.chip-title {
    font-weight: 600;
}

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

.chip-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chip-meta > * + * {
    margin-top: 6px;
}

.chip-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: nowrap;
}

.chip-status > * + * {
    margin-left: 6px;
}

.chip-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.chip-status-dot.on {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.chip-status-dot.off {
    background: var(--text-secondary);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

.chip-status-dot.unknown {
    background: var(--border);
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.08);
}

.chip-status-dot.danger {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.battery-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.battery-chip .icon-svg {
    width: 18px;
    height: 18px;
}

.phone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 6px;
}

.phone-grid--wide {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.phone-stat {
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
}

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

.phone-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.phone-stat-value.strong {
    font-weight: 800;
    font-size: 1.25rem;
}

.phone-stat-value.accent {
    color: #16a34a;
}

.phone-stat-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phone-stat-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--accent);
    font-size: 14px;
}

.phone-stat-icon .icon-svg {
    width: 18px;
    height: 18px;
}

#zhioug-view .phone-stat-icon {
    color: var(--accent);
    background: rgba(59, 130, 246, 0.14);
    opacity: 1;
}

#zhioug-view .phone-stat-icon .icon-svg,
#zhioug-view .phone-stat-icon .icon-svg * {
    color: inherit;
    stroke: currentColor;
}

#zhioug-view .phone-stat-icon .icon-svg .battery-level {
    fill: currentColor;
}

.phone-stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phone-stat-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.screen-on {
    color: #16a34a;
}

.screen-off {
    color: #ef4444;
}

.phone-battery-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--border);
    overflow: hidden;
}

.phone-battery-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--accent-2);
    transition: width 0.35s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.phone-battery-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.78) 42%, rgba(255, 255, 255, 0.18) 60%, transparent 100%);
    background-size: 200% 100%;
    background-position: -200% 0;
    opacity: 0;
    pointer-events: none;
}

.phone-battery-fill.is-charging::after {
    opacity: 0.85;
    animation: charging-sheen 1.6s linear infinite;
}

@keyframes charging-sheen {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.battery-icon {
    color: var(--text-secondary);
    --battery-level: 0;
}

.battery-icon .battery-outline,
.battery-icon .battery-cap {
    stroke: rgba(148, 163, 184, 0.85);
}

body.dark .battery-icon .battery-outline,
body.dark .battery-icon .battery-cap {
    stroke: rgba(148, 163, 184, 0.55);
}

.battery-icon .battery-level {
    transform-box: fill-box;
    transform-origin: left center;
    transform: scaleX(var(--battery-level, 0));
    transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chip-battery-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    min-width: 32px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    line-height: 1;
    color: var(--text);
    white-space: nowrap;
}

.chip-battery-text.danger {
    color: var(--danger);
}

.phone-card {
    padding: 18px 20px 20px;
}

.phone-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.phone-pill {
    background: rgba(91, 141, 239, 0.12);
    color: var(--text);
    font-weight: 600;
}

.time-card {
    align-items: flex-start;
    justify-content: space-between;
}

.mobile-device-menu {
    display: none;
}

@media (max-width: 768px) {
    .hero {
        position: static;
        top: auto;
        margin-top: 0;
        padding: 14px 14px;
    }

    .hero__left h1 {
        font-size: 1.4rem;
        margin: 2px 0 10px;
        line-height: 1.15;
    }

    .subtitle {
        margin: 0 0 10px;
        font-size: 0.95rem;
    }

    .status-pill {
        padding: 9px 12px;
    }

    .theme-toggle {
        padding: 9px 12px;
    }

    .theme-toggle span {
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .refresh-btn {
        padding: 9px 10px;
        gap: 6px;
    }

    .refresh-btn span {
        font-size: 0.9rem;
    }

    .refresh-btn .icon-svg {
        width: 16px;
        height: 16px;
    }

    .icon-svg {
        width: 16px;
        height: 16px;
    }

    .focus-icon .icon-svg {
        width: 22px;
        height: 22px;
    }

    .resource-icon .icon-svg {
        width: 18px;
        height: 18px;
    }

    .mobile-device-menu {
        display: block;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 40;
        padding: 10px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-radius: calc(var(--radius) + 4px);
        box-shadow: var(--shadow-lg);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1), 
                    padding 300ms cubic-bezier(0.4, 0, 0.2, 1), 
                    max-height 450ms cubic-bezier(0.4, 0, 0.2, 1), 
                    transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 500px;
        overflow: hidden;
    }
    .mobile-device-menu.collapsed {
        padding: 8px 10px;
        opacity: 0.95;
        max-height: 70px;
        overflow: hidden;
        transform: translateY(0);
    }
    .mobile-device-menu.collapsed .device-menu__chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .mobile-device-menu.collapsed .device-chip:nth-child(n+3) {
        opacity: 0.6;
        pointer-events: none;
        transform: translateY(0);
        filter: blur(0.5px);
    }
    .mobile-device-menu .device-menu__chips {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
        transition: opacity 200ms ease;
    }
    .mobile-device-menu.collapsed .device-menu__chips {
        display: grid;
        opacity: 0.8;
    }
    .mobile-device-menu .device-menu__header {
        display: none;
    }
    .mobile-device-menu .mobile-menu-toggle {
        width: 100%;
        border: 1px solid rgba(148, 163, 184, 0.6);
        background: rgba(255, 255, 255, 0.95);
        color: var(--text);
        border-radius: 12px;
        padding: 10px 12px;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        font-weight: 700;
        letter-spacing: 0.01em;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    }
    .mobile-device-menu .mobile-menu-toggle .toggle-icon {
        display: inline-block;
        transition: transform 220ms ease;
    }
    .mobile-device-menu:not(.collapsed) .mobile-menu-toggle .toggle-icon {
        transform: rotate(180deg);
    }
    .mobile-device-menu.collapsed .mobile-menu-toggle {
        background: rgba(248, 250, 252, 0.95);
    }
    .mobile-device-menu .chip-meta {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex-wrap: nowrap;
    }
    .mobile-device-menu .chip-meta > * + * {
        margin-top: 0;
        margin-left: 0;
    }
    .mobile-device-menu .chip-battery-text {
        display: none;
    }
    .mobile-device-menu .chip-status-text,
    .mobile-device-menu .chip-sub {
        display: none;
    }
    .mobile-device-menu .device-chip {
        justify-content: center;
        padding: 11px 6px;
        min-width: 0;
        gap: 6px;
        transition: opacity 220ms ease, transform 220ms ease, box-shadow 220ms ease;
    }
    .mobile-device-menu .chip-title {
        font-size: clamp(12px, 3.3vw, 14px);
        font-weight: 700;
        letter-spacing: -0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-device-menu .collapsed-hint {
        display: none;
        margin-top: 6px;
        text-align: center;
        color: var(--text-secondary);
        font-size: 12px;
        letter-spacing: 0.01em;
        transition: opacity 200ms ease, transform 200ms ease;
    }
    .mobile-device-menu.collapsed .collapsed-hint {
        display: block;
        opacity: 0.95;
        transform: translateY(2px);
    }
    .side-column {
        display: none !important;
    }
    .page-shell {
        padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) {
    body.dark .mobile-device-menu {
        background: rgba(2, 6, 23, 0.68);
        border-color: rgba(51, 65, 85, 0.55);
    }
    body.dark .mobile-device-menu .mobile-menu-toggle {
        background: rgba(2, 6, 23, 0.82);
        border-color: rgba(51, 65, 85, 0.55);
        color: var(--text);
    }
}

.meta-cards {
    position: relative;
    z-index: 1;
    padding: 0 0 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.meta-card {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.meta-label {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meta-value {
    margin: 4px 0 0;
    font-weight: 600;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

#dashboard.hidden {
    animation: none;
}

#dashboard:not(.hidden) {
    animation: dashboard-in 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dashboard-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-accent {
    background:
        radial-gradient(600px circle at 20% -10%, rgba(59, 130, 246, 0.16), transparent 45%),
        radial-gradient(600px circle at 90% 0%, rgba(34, 197, 94, 0.12), transparent 45%),
        var(--card);
}

/* 合并卡片容器 */
.combined-card-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    border-radius: 999px;
    box-shadow: var(--shadow);
}

.section-header {
    margin-bottom: 14px;
}

.focus-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.focus-left {
    display: flex;
    gap: 14px;
    align-items: center;
}

.focus-icon-wrapper {
    flex-shrink: 0;
}

.focus-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.focus-icon .icon-svg {
    width: 26px;
    height: 26px;
}

.focus-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.focus-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 2px 0 4px;
    line-height: 1.3;
}

.focus-pid {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.focus-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.focus-window-title {
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 100%;
    overflow: hidden;
}

.focus-window-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.focus-window-text {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    word-break: break-word;
}

.focus-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.focus-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.focus-stat-icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: var(--accent);
    flex-shrink: 0;
}

.focus-stat-icon .icon-svg {
    width: 18px;
    height: 18px;
}

.focus-stat-content {
    flex: 1;
}

.focus-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.focus-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

/* 系统资源合并卡片 */
.system-resources {
    grid-column: span 2;
}

.system-resources:hover {
    transform: translateY(-2px);
}

.resources-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: start;
}

.resource-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.resource-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
}

.resource-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: var(--accent);
}

.resource-icon .icon-svg {
    width: 20px;
    height: 20px;
}

.resource-title {
    font-weight: 600;
    font-size: 1.05rem;
}

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

.resource-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.resource-divider {
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

.cpu-total-bar {
    height: 14px;
    border-radius: 999px;
    background: var(--panel);
    overflow: hidden;
}

.cpu-total-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    width: 0%;
    transition: width 0.35s ease;
}

.memory-visual-compact {
    display: flex;
    gap: 16px;
    align-items: center;
}

.memory-ring-compact {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.memory-ring-compact svg {
    transform: rotate(-90deg);
}

.memory-ring-text-compact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.memory-percent-compact {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

.memory-details-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-stat-compact {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.memory-stat-compact:last-child {
    border-bottom: none;
}

.cpu-total-bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.cpu-total-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    width: 0%;
    transition: width 0.35s ease;
}

.card-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-body {
    padding: 14px 20px 20px;
}

.metric-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.metric-sub {
    color: var(--text-secondary);
    margin-top: 2px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
}

/* legacy CPU 样式已移除 */

.memory-container {
    display: flex;
    gap: 18px;
    align-items: center;
}

.memory-visual {
    display: flex;
    gap: 18px;
    align-items: center;
    width: 100%;
}

.memory-ring {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.memory-ring svg {
    transform: rotate(-90deg);
}

.memory-ring-bg {
    fill: none;
    stroke: var(--panel);
    stroke-width: 10;
}

.memory-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.memory-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

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

.memory-percent {
    font-size: 1.6rem;
    font-weight: 700;
}

.memory-details {
    flex: 1;
}

.memory-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.memory-stat:last-child {
    border-bottom: none;
}

.memory-stat-label {
    color: var(--text-secondary);
}

.disk-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.disk-item {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.disk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    min-width: 0;
}

.disk-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.disk-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.disk-space {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-size: 0.9rem;
}

.disk-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--panel);
    overflow: hidden;
}

.disk-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.disk-stats {
    display: flex;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
}

.disk-stat-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.disk-stat-item strong {
    color: var(--text);
    font-weight: 600;
}

.network-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.network-item {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.network-name {
    font-weight: 600;
}

.network-stats {
    display: flex;
    gap: 14px;
}

.network-stat {
    display: flex;
    gap: 6px;
    align-items: center;
}

.network-stat.download {
    color: var(--accent-2);
}

.network-stat.upload {
    color: var(--accent);
}

.process-table-container {
    overflow-x: auto;
}

.process-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.process-table th,
.process-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.process-table th {
    background: var(--panel);
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.process-table tbody tr {
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.process-table tbody tr:nth-child(odd) {
    background: var(--table-stripe);
}

.process-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.10);
}

.process-table tbody tr.focused {
    background: rgba(34, 197, 94, 0.10);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
}

.process-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.process-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: var(--card);
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
}

.process-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.focus-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: var(--accent-2);
    font-weight: 700;
    font-size: 0.8rem;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(2, 6, 23, 0.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: overlay-fade 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#loading-overlay {
    display: flex;
}

.overlay-card {
    width: min(680px, 100%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-lg);
    animation: overlay-card-in 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.overlay-card--danger {
    border-color: rgba(239, 68, 68, 0.40);
}

#error-overlay .overlay-card {
    flex-direction: column;
    text-align: center;
    color: var(--danger);
}

#error-overlay .retry-btn {
    margin-top: 6px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--text-secondary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-icon {
    font-size: 2rem;
}

@keyframes overlay-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes overlay-card-in {
    from { transform: translateY(10px) scale(0.985); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.retry-btn {
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 10px;
    background: var(--accent);
    color: var(--primary-foreground);
    cursor: pointer;
    transition: box-shadow 0.15s ease, filter 0.15s ease;
}

.retry-btn:hover {
    box-shadow: var(--shadow-lg);
}

.process-list-wrapper {
    max-height: 440px;
    overflow-y: auto;
}

.text-green { color: var(--accent-2); }
.text-yellow { color: var(--warning); }
.text-red { color: var(--danger); }
.text-blue { color: var(--accent); }

.bg-green { background: var(--accent-2); }
.bg-yellow { background: var(--warning); }
.bg-red { background: var(--danger); }
.bg-blue { background: var(--accent); }

.page-footer {
    text-align: center;
    color: var(--text-secondary);
    padding: 18px 12px 28px;
    font-size: 0.9rem;
}

.compact-card {
    max-width: 520px;
    margin: 0 auto;
}

.subdued {
    opacity: 0.93;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--panel);
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (min-width: 900px) {
    #dashboard {
        grid-template-columns: 1.25fr 1fr;
        align-items: start;
    }

    #dashboard .system-resources {
        grid-column: 1 / -1;
    }

    #dashboard .card--disk {
        grid-column: 1;
    }

    #dashboard .card--network {
        grid-column: 2;
    }

    #dashboard .card--process {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero__right {
        justify-content: flex-start;
    }

    .theme-toggle {
        width: auto;
        justify-content: space-between;
    }

    .device-menu__chips {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .meta-cards {
        padding-top: 4px;
    }

    .layout-grid {
        gap: 14px;
        margin-top: 14px;
    }

    .focus-wrapper {
        gap: 14px;
    }

    .combined-card-wrapper {
        padding: 18px;
        gap: 18px;
    }

    .resources-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .resource-divider {
        display: none;
    }

    .system-resources {
        grid-column: span 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (max-width: 640px) {
    .hero__right {
        gap: 8px;
        flex-wrap: wrap;
    }

    .refresh-btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .refresh-btn .icon-svg {
        width: 14px;
        height: 14px;
    }

    .theme-toggle {
        padding: 8px 10px;
    }

    .icon-svg {
        width: 14px;
        height: 14px;
    }

    .focus-icon {
        width: 48px;
        height: 48px;
    }

    .focus-icon .icon-svg {
        width: 20px;
        height: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .combined-card-wrapper {
        padding: 16px;
        gap: 16px;
    }

    .focus-left {
        flex-direction: column;
        align-items: flex-start;
    }

    .focus-stats {
        grid-template-columns: 1fr;
    }

    .memory-visual-compact {
        flex-direction: column;
        align-items: flex-start;
    }

    .process-title {
        max-width: 150px;
    }
}
