:root {
    color-scheme: light;
    --bg: #f3f5fb;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-solid: #ffffff;
    --text: #121826;
    --muted: #667085;
    --subtle: #8a94a6;
    --border: rgba(17, 24, 39, 0.08);
    --border-strong: rgba(17, 24, 39, 0.14);
    --track: rgba(17, 24, 39, 0.08);
    --shadow: 0 24px 60px rgba(20, 30, 60, 0.09), 0 2px 8px rgba(20, 30, 60, 0.04);
    --cpu: #6d5dfc;
    --cpu-soft: rgba(109, 93, 252, 0.12);
    --memory: #0ea5e9;
    --memory-soft: rgba(14, 165, 233, 0.12);
    --storage: #f59e0b;
    --storage-soft: rgba(245, 158, 11, 0.14);
    --success: #17b26a;
    --danger: #ef4444;
    --warning: #d97706;
    --ambient-one: rgba(109, 93, 252, 0.16);
    --ambient-two: rgba(34, 211, 238, 0.13);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070a12;
    --surface: rgba(15, 20, 34, 0.74);
    --surface-solid: #101624;
    --text: #f2f5fb;
    --muted: #98a2b3;
    --subtle: #7b8496;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --track: rgba(255, 255, 255, 0.09);
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.42), 0 2px 10px rgba(0, 0, 0, 0.2);
    --cpu: #8b7cff;
    --cpu-soft: rgba(139, 124, 255, 0.16);
    --memory: #38bdf8;
    --memory-soft: rgba(56, 189, 248, 0.14);
    --storage: #fbbf24;
    --storage-soft: rgba(251, 191, 36, 0.16);
    --success: #32d583;
    --ambient-one: rgba(109, 93, 252, 0.22);
    --ambient-two: rgba(34, 211, 238, 0.12);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        color-scheme: dark;
        --bg: #070a12;
        --surface: rgba(15, 20, 34, 0.74);
        --surface-solid: #101624;
        --text: #f2f5fb;
        --muted: #98a2b3;
        --subtle: #7b8496;
        --border: rgba(255, 255, 255, 0.08);
        --border-strong: rgba(255, 255, 255, 0.14);
        --track: rgba(255, 255, 255, 0.09);
        --shadow: 0 28px 70px rgba(0, 0, 0, 0.42), 0 2px 10px rgba(0, 0, 0, 0.2);
        --cpu: #8b7cff;
        --cpu-soft: rgba(139, 124, 255, 0.16);
        --memory: #38bdf8;
        --memory-soft: rgba(56, 189, 248, 0.14);
        --storage: #fbbf24;
        --storage-soft: rgba(251, 191, 36, 0.16);
        --success: #32d583;
        --ambient-one: rgba(109, 93, 252, 0.22);
        --ambient-two: rgba(34, 211, 238, 0.12);
    }
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, var(--ambient-one), transparent 34rem),
        radial-gradient(circle at 92% 10%, var(--ambient-two), transparent 30rem),
        var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[hidden] {
    display: none !important;
}

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.ambient::before,
.ambient::after {
    position: absolute;
    width: 34rem;
    height: 34rem;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    content: "";
}

.ambient::before {
    top: -16rem;
    left: -12rem;
    background: var(--ambient-one);
}

.ambient::after {
    right: -14rem;
    bottom: -18rem;
    background: var(--ambient-two);
}

.shell {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 0 34px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: clamp(32px, 6vw, 68px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    border-radius: 14px;
}

.brand-mark {
    display: block;
    width: 38px;
    height: 38px;
    filter: drop-shadow(0 8px 18px rgba(109, 93, 252, 0.28));
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
}

.brand-text strong {
    font-size: 1.08rem;
    letter-spacing: 0.02em;
}

.brand-text small {
    margin-top: 4px;
    color: var(--subtle);
    font-size: 0.58rem;
    font-weight: 650;
    letter-spacing: 0.18em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(20, 30, 60, 0.04);
    backdrop-filter: blur(14px);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 16%, transparent);
    animation: breathe 2.4s ease-in-out infinite;
}

.live-pill.is-error .live-dot {
    background: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent);
    animation: none;
}

.live-pill.is-paused .live-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 16%, transparent);
    animation: none;
}

.icon-button {
    display: inline-grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
    backdrop-filter: blur(14px);
}

.icon-button:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.icon-moon {
    display: none;
}

html[data-theme="dark"] .icon-sun {
    display: none;
}

html[data-theme="dark"] .icon-moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .icon-sun {
        display: none;
    }

    html[data-theme="auto"] .icon-moon {
        display: block;
    }
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--subtle);
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.2em;
}

.hero h1 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: clamp(2rem, 4.6vw, 3.35rem);
    font-weight: 720;
    letter-spacing: -0.045em;
    line-height: 1.04;
}

.hero-sub {
    max-width: 42rem;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, auto));
    gap: 0;
    padding: 12px 4px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(20, 30, 60, 0.04);
    backdrop-filter: blur(16px);
}

.meta-item {
    display: flex;
    min-width: 92px;
    padding: 0 16px;
    flex-direction: column;
    gap: 3px;
    border-left: 1px solid var(--border);
}

.meta-item:first-child {
    border-left: 0;
}

.meta-item span {
    color: var(--subtle);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.08em;
}

.meta-item strong {
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dashboard {
    transition: opacity 220ms ease;
}

.dashboard[aria-busy="true"] {
    opacity: 0.74;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background:
        linear-gradient(150deg, color-mix(in srgb, var(--surface-solid) 84%, transparent), var(--surface));
    box-shadow: var(--shadow);
}

.metric-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--metric), transparent);
    opacity: 0.8;
    content: "";
}

.metric-cpu {
    --metric: var(--cpu);
    --metric-soft: var(--cpu-soft);
}

.metric-memory {
    --metric: var(--memory);
    --metric-soft: var(--memory-soft);
}

.metric-storage {
    --metric: var(--storage);
    --metric-soft: var(--storage-soft);
}

.metric-head,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.metric-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 650;
}

.metric-icon {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--metric);
    border-radius: 10px;
    background: var(--metric-soft);
}

.metric-icon .icon,
.metric-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.metric-tag {
    color: var(--subtle);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.metric-body {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 22px 0 18px;
}

.gauge {
    --value: 0;
    position: relative;
    display: grid;
    width: 116px;
    height: 116px;
    flex: 0 0 116px;
    place-items: center;
}

.gauge-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--metric) calc(var(--value) * 1%), var(--track) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
    transition: background 420ms ease;
}

.gauge-center {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1px;
    font-variant-numeric: tabular-nums;
}

.gauge-center span {
    font-size: 1.72rem;
    font-weight: 720;
    letter-spacing: -0.05em;
}

.gauge-center small {
    color: var(--subtle);
    font-size: 0.7rem;
    font-weight: 650;
}

.metric-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.metric-info strong {
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-info span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--track);
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--metric);
    transition: width 420ms ease;
}

.notice {
    margin-top: 16px;
    padding: 12px 16px;
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--warning) 9%, transparent);
    font-size: 0.78rem;
    font-weight: 600;
}

.panel {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.panel h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 680;
    letter-spacing: -0.02em;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
}

.legend-item::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--legend, var(--cpu));
    content: "";
}

.legend-item.cpu {
    --legend: var(--cpu);
}

.legend-item.memory {
    --legend: var(--memory);
}

.legend-item.storage {
    --legend: var(--storage);
}

.chart-wrap {
    position: relative;
    height: 220px;
    margin-top: 16px;
}

.chart-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--subtle);
    font-size: 0.78rem;
    pointer-events: none;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}

.detail-cell {
    display: flex;
    min-width: 0;
    padding: 16px 18px 4px 0;
    flex-direction: column;
    gap: 3px;
}

.detail-cell:nth-child(3n + 2),
.detail-cell:nth-child(3n + 3) {
    padding-left: 18px;
    border-left: 1px solid var(--border);
}

.detail-cell span {
    color: var(--subtle);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.08em;
}

.detail-cell strong {
    overflow: hidden;
    font-size: 0.86rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-cell small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.state-panel {
    display: flex;
    max-width: 560px;
    margin: 56px auto;
    padding: 38px 30px;
    align-items: center;
    flex-direction: column;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.state-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    place-items: center;
    color: var(--cpu);
    border-radius: 18px;
    background: var(--cpu-soft);
}

.state-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.state-panel h2 {
    margin: 0;
    font-size: 1.18rem;
    letter-spacing: -0.02em;
}

.state-panel p {
    max-width: 30rem;
    margin: 8px 0 20px;
    color: var(--muted);
    font-size: 0.84rem;
}

.button {
    display: inline-flex;
    min-height: 40px;
    padding: 0 18px;
    align-items: center;
    justify-content: center;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-solid);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #6d5dfc, #4f46e5);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
}

.button:focus-visible,
.icon-button:focus-visible,
.brand:focus-visible,
.footer a:focus-visible {
    outline: 2px solid var(--cpu);
    outline-offset: 3px;
}

.footer {
    display: flex;
    margin-top: 26px;
    padding: 0 4px;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--subtle);
    font-size: 0.7rem;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-sep {
    opacity: 0.5;
}

.noscript {
    position: fixed;
    right: 20px;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    padding: 14px 18px;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    text-align: center;
    font-size: 0.82rem;
}

@keyframes breathe {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.82);
        opacity: 0.7;
    }
}

@media (max-width: 1040px) {
    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-storage {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 28px, 1240px);
        padding-top: 18px;
    }

    .topbar {
        margin-bottom: 38px;
    }

    .hero-meta {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .meta-item {
        min-width: 0;
        padding: 0 10px;
    }

    .meta-item strong {
        overflow: hidden;
        text-overflow: ellipsis;
    }

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

    .metric-storage {
        grid-column: auto;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-cell:nth-child(3n + 2),
    .detail-cell:nth-child(3n + 3) {
        padding-left: 0;
        border-left: 0;
    }

    .detail-cell:nth-child(even) {
        padding-left: 16px;
        border-left: 1px solid var(--border);
    }

    .chart-wrap {
        height: 190px;
    }
}

@media (max-width: 480px) {
    .brand-text small {
        display: none;
    }

    .live-pill {
        padding: 0 11px;
    }

    .metric-card,
    .panel {
        padding: 18px;
        border-radius: 22px;
    }

    .metric-body {
        gap: 14px;
    }

    .gauge {
        width: 100px;
        height: 100px;
        flex-basis: 100px;
    }

    .gauge-center span {
        font-size: 1.45rem;
    }

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

    .detail-cell:nth-child(even) {
        padding-left: 0;
        border-left: 0;
    }

    .state-panel {
        margin: 32px auto;
        padding: 30px 22px;
    }
}

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