.nte-root {
    --nte-bg: #09111a;
    --nte-panel: rgba(12, 23, 38, 0.9);
    --nte-panel-2: rgba(17, 31, 51, 0.94);
    --nte-border: rgba(128, 173, 255, 0.15);
    --nte-text: #e8f0ff;
    --nte-text-soft: #98aac5;
    --nte-accent: #67d0ff;
    --nte-accent-2: #79ffcc;
    --nte-warning: #ffd46b;
    --nte-danger: #ff7d7d;
    --nte-glow: 0 0 0 1px rgba(119, 185, 255, 0.08), 0 18px 50px rgba(0, 0, 0, 0.35);
    color: var(--nte-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nte-root *,
.nte-root *::before,
.nte-root *::after {
    box-sizing: border-box;
}

.nte-shell {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid var(--nte-border);
    background:
        radial-gradient(circle at top right, rgba(79, 139, 255, 0.18), transparent 28%),
        radial-gradient(circle at bottom left, rgba(39, 226, 170, 0.12), transparent 24%),
        linear-gradient(180deg, rgba(10, 19, 33, 0.96), rgba(7, 13, 24, 0.96));
    box-shadow: var(--nte-glow);
    padding: 24px;
}

.nte-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 1) 30%, rgba(0, 0, 0, 0.55));
}

.nte-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.nte-kicker {
    margin: 0 0 6px;
    color: var(--nte-accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 700;
}

.nte-title {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.1;
    color: #ffffff;
}

.nte-subtitle {
    margin: 10px 0 0;
    max-width: 720px;
    color: var(--nte-text-soft);
    line-height: 1.55;
}

.nte-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.nte-badges span,
.nte-panel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(115, 176, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: #c9dcff;
    font-size: 12px;
    letter-spacing: 0.03em;
}

.nte-topology-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.nte-topology-button,
.nte-tool-button {
    appearance: none;
    border: 1px solid rgba(114, 159, 234, 0.2);
    background: rgba(255, 255, 255, 0.045);
    color: var(--nte-text);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.nte-topology-button {
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 600;
    line-height: 1;
    min-height: 44px;
}

.nte-tool-button {
    min-width: 42px;
    min-height: 40px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 14px;
}

.nte-topology-button:hover,
.nte-tool-button:hover,
.nte-topology-button:focus-visible,
.nte-tool-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(127, 188, 255, 0.5);
    background: rgba(103, 208, 255, 0.11);
    box-shadow: 0 0 0 3px rgba(100, 170, 255, 0.08);
    outline: none;
}

.nte-topology-button.is-active,
.nte-tool-button.is-toggled {
    background: linear-gradient(180deg, rgba(87, 180, 255, 0.25), rgba(69, 97, 191, 0.22));
    border-color: rgba(122, 195, 255, 0.6);
    box-shadow: 0 0 0 1px rgba(135, 202, 255, 0.22) inset, 0 12px 25px rgba(21, 75, 148, 0.22);
}

.nte-main-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
    align-items: start;
}

.nte-stage-card,
.nte-panel {
    position: relative;
    border: 1px solid rgba(126, 165, 230, 0.14);
    background: linear-gradient(180deg, rgba(13, 24, 39, 0.96), rgba(10, 18, 29, 0.98));
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
}

.nte-stage-card {
    padding: 16px;
}

.nte-panel {
    padding: 18px;
}

.nte-sidebar {
    display: grid;
    gap: 16px;
}

.nte-panel-heading,
.nte-stage-toolbar,
.nte-stage-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nte-panel-heading h4 {
    margin: 0;
    font-size: 15px;
    color: #ffffff;
}

.nte-stage-toolbar {
    margin-bottom: 12px;
}

.nte-stage-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #d6ebff;
    font-size: 13px;
}

.nte-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--nte-accent-2);
    box-shadow: 0 0 0 6px rgba(121, 255, 204, 0.12), 0 0 18px rgba(121, 255, 204, 0.8);
    animation: ntePulse 1.8s ease-in-out infinite;
}

.nte-stage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.nte-stage-viewport {
    position: relative;
    height: var(--nte-stage-height, 680px);
    min-height: 420px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(122, 169, 236, 0.16);
    background:
        radial-gradient(circle at 50% 0%, rgba(103, 208, 255, 0.08), transparent 30%),
        linear-gradient(180deg, rgba(13, 24, 38, 0.98), rgba(7, 13, 24, 0.98));
    cursor: grab;
}

.nte-stage-viewport.is-dragging {
    cursor: grabbing;
}

.nte-stage {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    touch-action: none;
}

.nte-stage-footer {
    margin-top: 12px;
}

.nte-stage-caption {
    color: var(--nte-text-soft);
    font-size: 13px;
}

.nte-summary,
.nte-stats,
.nte-inspector,
.nte-legend {
    margin-top: 14px;
}

.nte-summary p,
.nte-inspector p {
    margin: 0;
    color: var(--nte-text-soft);
    line-height: 1.6;
}

.nte-summary-grid,
.nte-inspector-grid,
.nte-stats-grid {
    display: grid;
    gap: 10px;
}

.nte-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.nte-stat-card,
.nte-summary-card,
.nte-inspector-card {
    border: 1px solid rgba(132, 176, 241, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    padding: 14px;
}

.nte-stat-label,
.nte-summary-label,
.nte-inspector-label {
    display: block;
    color: #87a2c7;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
}

.nte-stat-value,
.nte-inspector-value {
    display: block;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
}

.nte-summary-value {
    display: block;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
}

.nte-inspector-title {
    margin: 0 0 6px;
    color: #ffffff;
    font-size: 18px;
}

.nte-inspector-subtitle {
    margin: 0 0 14px;
    color: var(--nte-accent);
    font-size: 13px;
    letter-spacing: 0.04em;
}

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

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

.nte-legend {
    display: grid;
    gap: 10px;
}

.nte-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d9e6ff;
    font-size: 14px;
}

.nte-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.08);
}

.nte-swatch-router {
    background: linear-gradient(135deg, #67d0ff, #4c7dff);
}

.nte-swatch-switch {
    background: linear-gradient(135deg, #79ffcc, #27d89d);
}

.nte-swatch-server {
    background: linear-gradient(135deg, #ffd46b, #ff9f67);
}

.nte-swatch-client {
    background: linear-gradient(135deg, #b190ff, #7d78ff);
}

.nte-swatch-link {
    background: linear-gradient(135deg, #58bfff, #85fbff);
}

.nte-tooltip {
    position: absolute;
    z-index: 30;
    max-width: 280px;
    pointer-events: none;
    border-radius: 14px;
    border: 1px solid rgba(130, 188, 255, 0.22);
    background: rgba(7, 14, 23, 0.94);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
    padding: 12px 14px;
    color: #f1f6ff;
    font-size: 13px;
    line-height: 1.45;
    backdrop-filter: blur(10px);
}

.nte-tooltip strong {
    display: block;
    margin-bottom: 4px;
    color: #ffffff;
}

.nte-tooltip small {
    color: var(--nte-accent);
}

.nte-topology-note {
    margin-top: 14px;
    padding: 12px 14px;
    border-left: 3px solid rgba(103, 208, 255, 0.8);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #d9ecff;
    line-height: 1.55;
}

.nte-world {
    transform-origin: 0 0;
}

.nte-link-underlay {
    fill: none;
    stroke: rgba(26, 50, 76, 0.95);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nte-link-main {
    fill: none;
    stroke: rgba(97, 195, 255, 0.78);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 12;
    animation: nteDash 10s linear infinite;
}

.nte-link-hit {
    fill: none;
    stroke: rgba(255, 255, 255, 0.001);
    stroke-linecap: round;
    cursor: pointer;
}

.nte-link-group.is-dimmed {
    opacity: 0.18;
}

.nte-link-group.is-selected .nte-link-main,
.nte-link-group:hover .nte-link-main {
    stroke: rgba(121, 255, 204, 0.95);
    filter: drop-shadow(0 0 10px rgba(121, 255, 204, 0.35));
}

.nte-link-group.is-selected .nte-link-underlay,
.nte-link-group:hover .nte-link-underlay {
    stroke: rgba(50, 92, 115, 1);
}

.nte-link-label {
    font-size: 11px;
    letter-spacing: 0.05em;
    fill: #c7e4ff;
}

.nte-link-label-box {
    fill: rgba(11, 23, 38, 0.85);
    stroke: rgba(139, 194, 255, 0.15);
}

.nte-node {
    cursor: pointer;
}

.nte-node.is-dimmed {
    opacity: 0.22;
}

.nte-node.is-selected .nte-node-core,
.nte-node:hover .nte-node-core {
    filter: drop-shadow(0 0 14px rgba(121, 255, 204, 0.32));
}

.nte-node .nte-node-glow {
    opacity: 0.18;
}

.nte-node:hover .nte-node-glow,
.nte-node.is-selected .nte-node-glow {
    opacity: 0.4;
}

.nte-node-status {
    animation: ntePulse 2s ease-in-out infinite;
}

.nte-node-label-box {
    fill: rgba(9, 18, 30, 0.86);
    stroke: rgba(132, 182, 255, 0.18);
}

.nte-node-label {
    fill: #f4f8ff;
    font-size: 13px;
    font-weight: 600;
}

.nte-node-sub-label {
    fill: #8fb1d9;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.nte-node-terminator {
    pointer-events: none;
}

.nte-node-terminator .nte-node-core-primary {
    fill: rgba(199, 221, 255, 0.35);
}

.nte-node-shadow {
    fill: rgba(0, 0, 0, 0.35);
}

.nte-packet {
    fill: #9ffff2;
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 1;
    filter: drop-shadow(0 0 8px rgba(121, 255, 204, 0.7));
}

.nte-root.is-traffic-off .nte-packet,
.nte-root.is-traffic-off .nte-link-main {
    animation-play-state: paused;
}

.nte-root.is-traffic-off .nte-packet {
    opacity: 0;
}

@keyframes nteDash {
    from {
        stroke-dashoffset: 0;
    }
    to {
        stroke-dashoffset: -180;
    }
}

@keyframes ntePulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.95;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.72;
    }
}

@media (max-width: 1180px) {
    .nte-main-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 820px) {
    .nte-shell {
        padding: 18px;
        border-radius: 20px;
    }

    .nte-header,
    .nte-panel-heading,
    .nte-stage-toolbar,
    .nte-stage-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .nte-badges,
    .nte-stage-actions {
        justify-content: flex-start;
    }

    .nte-sidebar,
    .nte-summary-grid,
    .nte-stats-grid,
    .nte-inspector-grid {
        grid-template-columns: 1fr;
    }

    .nte-stage-viewport {
        min-height: 380px;
    }
}
