:root {
    --bg: #070A0D;
    --bg-grid: #10161C;
    --panel: #0B1015;
    --panel-2: #0F151B;
    --line: #1B242D;
    --line-2: #28333E;
    --fg: #D9E1E8;
    --fg-muted: #8A97A4;
    --fg-dim: #5B6874;
    --green: #5BF08A;
    --green-dim: #2C7A48;
    --amber: #F5B84A;
    --cyan: #5CC8FF;
    --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --gutter: clamp(16px, 4vw, 48px);
    --max: 1200px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--fg);
    background-color: var(--bg);
    background-image: radial-gradient(var(--bg-grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 12px 12px;
}

h1, h2 {
    margin: 0;
    font-family: var(--mono);
    font-weight: 700;
    line-height: 1;
}

p {
    margin: 0;
}

a {
    color: var(--green);
}

ul, ol, dl, dd {
    margin: 0;
    padding: 0;
}

ul, ol {
    list-style: none;
}

.statusbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 44px;
    padding: 0 var(--gutter);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--fg-muted);
    background: rgba(7, 10, 13, 0.85);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.statusbar-left,
.statusbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.statusbar-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg);
    text-decoration: none;
}

.statusbar-back:hover {
    color: var(--green);
}

.statusbar-path {
    color: var(--fg-dim);
}

.statusbar-right b {
    font-weight: 600;
    color: var(--fg);
}

.statusbar-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--green);
}

.statusbar-live i,
.live {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 0 rgba(91, 240, 138, 0.5);
    animation: ping 2s ease-out infinite;
}

@keyframes ping {
    0% { box-shadow: 0 0 0 0 rgba(91, 240, 138, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(91, 240, 138, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 240, 138, 0); }
}

.hero {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(56px, 8vw, 120px) var(--gutter) clamp(40px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.prompt {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--fg-muted);
}

.ps1 {
    color: var(--green);
}

.ps1-sep {
    color: var(--fg-dim);
}

.ps1-path {
    color: var(--cyan);
}

.cursor {
    display: inline-block;
    width: 9px;
    height: 16px;
    margin-left: 6px;
    vertical-align: -3px;
    background: var(--green);
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero h1 {
    font-size: clamp(56px, 11vw, 150px);
    line-height: 0.92;
    letter-spacing: -0.04em;
    color: #fff;
}

.hero h1 span {
    color: var(--green);
}

.lede {
    max-width: 680px;
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.6;
    color: var(--fg-muted);
}

.kv {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 13px;
}

.kv > div {
    display: flex;
    gap: 12px;
    padding: 14px 24px 14px 0;
    margin-right: 24px;
    border-right: 1px solid var(--line);
}

.kv > div:last-child {
    border-right: 0;
    margin-right: 0;
    padding-right: 0;
}

.kv dt {
    color: var(--amber);
}

.kv dt::after {
    content: ":";
    color: var(--fg-dim);
}

.kv dd {
    color: var(--fg);
}

main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter) clamp(56px, 6vw, 96px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
    padding: 0 16px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
}

.panel-title {
    color: var(--fg);
    font-weight: 600;
}

.panel-title::before {
    content: "// ";
    color: var(--fg-dim);
    font-weight: 400;
}

.panel-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-dim);
}

.panel-meta .live {
    animation-duration: 2s;
}

.panel-body {
    padding: 24px;
}

.panel-body-flush {
    padding: 0;
}

.topo {
    padding: 20px 16px 12px;
}

.topo svg {
    display: block;
    width: 100%;
    height: auto;
    font-family: var(--mono);
}

.topo-group rect {
    fill: none;
    stroke: var(--line-2);
    stroke-dasharray: 4 4;
}

.topo-group text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    fill: var(--fg-muted);
}

.topo-group .topo-dim {
    fill: var(--fg-dim);
    letter-spacing: 0.04em;
    font-weight: 400;
}

.topo-links path,
.topo-legend line {
    fill: none;
    stroke: var(--green-dim);
    stroke-width: 1.5;
}

.topo-links path {
    stroke-dasharray: 6 6;
    animation: flow 1.6s linear infinite;
}

.topo-links .link-wan,
.topo-legend .link-wan {
    stroke: var(--amber);
}

.topo-links .link-overlay,
.topo-legend .link-overlay {
    stroke: var(--cyan);
    stroke-dasharray: 2 5;
}

@keyframes flow {
    to { stroke-dashoffset: -24; }
}

.topo-node rect {
    fill: var(--panel-2);
    stroke: var(--line-2);
    stroke-width: 1;
}

.topo-node text {
    font-size: 13px;
    font-weight: 600;
    fill: var(--fg);
}

.topo-node .topo-sub {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.04em;
    fill: var(--fg-dim);
}

.topo-node-wan rect {
    fill: var(--bg);
    stroke: var(--amber);
}

.topo-node-edge rect {
    stroke: var(--green);
}

.topo-node-edge text {
    fill: var(--green);
}

.topo-node-edge .topo-sub {
    fill: var(--fg-muted);
}

.topo-node-overlay rect {
    stroke: var(--cyan);
}

.topo-node-remote rect {
    fill: var(--bg);
    stroke-dasharray: 3 3;
}

.topo-legend text {
    font-size: 10px;
    letter-spacing: 0.06em;
    fill: var(--fg-dim);
}

.proc {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.proc th,
.proc td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

.proc th {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.proc tbody tr:last-child td {
    border-bottom: 0;
}

.proc tbody tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

.proc td:nth-child(1),
.proc td:nth-child(2) {
    font-family: var(--mono);
    font-size: 13px;
    white-space: nowrap;
}

.proc td:nth-child(1) {
    color: var(--amber);
}

.proc td:nth-child(3) {
    color: var(--fg-muted);
}

.proc td:nth-child(4) {
    width: 1%;
    white-space: nowrap;
}

.dim {
    color: var(--fg-dim);
}

.state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--green);
}

.state::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

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

.node {
    display: flex;
    flex-direction: column;
}

.node .panel-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.node h2 {
    font-size: 24px;
    letter-spacing: -0.02em;
    color: #fff;
}

.node p {
    font-size: 15px;
    color: var(--fg-muted);
}

.tag {
    padding: 2px 8px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    color: var(--fg-muted);
}

.node-kv {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.node-kv dt {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-family: var(--mono);
    font-size: 12px;
}

.tags li {
    padding: 4px 9px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    color: var(--fg);
}

.log {
    counter-reset: line;
    font-size: 14px;
}

.log li {
    counter-increment: line;
    display: grid;
    grid-template-columns: 44px 120px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 16px 14px 0;
    border-bottom: 1px solid var(--line);
}

.log li:last-child {
    border-bottom: 0;
}

.log li::before {
    content: counter(line, decimal-leading-zero);
    font-family: var(--mono);
    font-size: 12px;
    text-align: right;
    color: var(--fg-dim);
    padding-top: 2px;
}

.log-tag {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--amber);
    padding-top: 1px;
}

.log-tag::before {
    content: "[";
    color: var(--fg-dim);
}

.log-tag::after {
    content: "]";
    color: var(--fg-dim);
}

.log-msg {
    color: var(--fg-muted);
}

.log-overlay {
    background: rgba(92, 200, 255, 0.03);
}

.log-overlay .log-tag {
    color: var(--cyan);
}

.yaml {
    margin: 0;
    padding: 20px 24px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.9;
    color: var(--fg-dim);
}

.y-key {
    color: var(--amber);
}

.y-str {
    color: var(--fg);
}

.site-footer {
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px var(--gutter) 48px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 32px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--fg-dim);
}

.footer-eof {
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--fg-muted);
}

.site-footer p {
    max-width: 520px;
    text-align: right;
}

@media (prefers-reduced-motion: reduce) {
    .statusbar-live i,
    .live,
    .cursor,
    .topo-links path {
        animation: none;
    }
}

@media only screen and (max-width: 992px) {
    .nodes {
        grid-template-columns: minmax(0, 1fr);
    }

    .proc th:nth-child(3),
    .proc td:nth-child(3) {
        display: none;
    }
}

@media only screen and (max-width: 640px) {
    .statusbar-path,
    .statusbar-right li:not(.statusbar-live) {
        display: none;
    }

    .kv {
        flex-direction: column;
    }

    .kv > div {
        margin: 0;
        padding: 10px 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .kv > div:last-child {
        border-bottom: 0;
    }

    .topo {
        padding: 12px 8px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .topo svg {
        min-width: 760px;
    }

    .proc th:nth-child(2),
    .proc td:nth-child(2) {
        display: none;
    }

    .log li {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .log-msg {
        grid-column: 2;
    }

    .site-footer {
        flex-direction: column;
        gap: 12px;
    }

    .site-footer p {
        text-align: left;
    }
}
