@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('./assets/fonts/Manrope-Variable.woff2') format('woff2');
}

:root {
    --bg: #0b0f14;
    --panel: #0f1720;
    --card: #121c27;
    --text: #e8eef7;
    --muted: #9ab0c8;
    --border: #223243;
    --accent: #4aa3ff;
    --accent2: #54f0c6;
    --warn: #ffb020;
    --bad: #ff4050;
    --good: #2ee56b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --bg-fade-1: 1600px 900px;
    --bg-fade-2: 1300px 900px;
}

* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    background: radial-gradient(var(--bg-fade-1) at 15% -10%, rgba(74, 163, 255, 0.18), transparent 60%), radial-gradient(var(--bg-fade-2) at 95% 0%, rgba(84, 240, 198, 0.14), transparent 55%), var(--bg);
    background-repeat: no-repeat;
    background-size: 100% 100%, 100% 100%, auto;
    color: var(--text);
    font: 14px/1.4 'Manrope', 'Segoe UI', Tahoma, sans-serif;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 32, 0.75);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.title-text {
    display: flex;
    flex-direction: column;
}
.app-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    flex-shrink: 0;
}

.title h1 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.2px;
}
.subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

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

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 32, 0.65);
    color: var(--muted);
    text-decoration: none;
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-link:hover {
    background: rgba(18, 28, 39, 0.85);
    border-color: #2b4258;
    color: var(--text);
}
.icon-link:active {
    transform: translateY(1px);
}
.icon-link .icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.port-pill {
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: rgba(18, 28, 39, 0.7);
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 14px;
    padding: 14px;
}

.page-footer {
    padding: 0 14px 20px;
}
.imprint-card {
    padding: 12px 14px;
    font-size: 12px;
    color: var(--muted);
}
.imprint-card .card-title {
    margin-bottom: 8px;
}
.imprint-body {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}
.imprint-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}
.imprint-label {
    color: #dfeeff;
    font-weight: 600;
}
.imprint-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.imprint-text a {
    color: var(--text);
    text-decoration: none;
}
.imprint-text a:hover {
    text-decoration: underline;
}

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

.card {
    background: rgba(18, 28, 39, 0.82);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.card-title {
    font-weight: 650;
    font-size: 13px;
    letter-spacing: 0.2px;
    color: #d8e6fb;
    margin-bottom: 12px;
}

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

.status-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
}

.led-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.led-line {
    display: flex;
    align-items: center;
    gap: 8px;
}
.led {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.led.on {
    background: var(--good);
    box-shadow: 0 0 0 3px rgba(46, 229, 107, 0.15);
}
.led.off {
    background: rgba(255, 255, 255, 0.08);
}
.led.warn {
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.15);
}
.led.bad {
    background: var(--bad);
    box-shadow: 0 0 0 3px rgba(255, 64, 80, 0.14);
}

.led-label {
    color: var(--muted);
    font-size: 12px;
}

.kv {
    min-width: 150px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 10px;
    background: rgba(15, 23, 32, 0.55);
}
.kv-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0;
}
.kv-row .k {
    color: var(--muted);
}
.kv-row .v {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.gauge {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gauge-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}
.gauge-value {
    color: #dfeeff;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
.gauge input[type='range'] {
    width: 100%;
}
.gauge-hint {
    color: var(--muted);
    font-size: 12px;
}

.pulse-strip-title {
    color: #dfeeff;
    font-weight: 650;
    margin-bottom: 8px;
}
.pulse-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}
.pulse-dot.on {
    background: var(--accent2);
    box-shadow: 0 0 0 3px rgba(84, 240, 198, 0.12);
}
.pulse-dot.bad {
    background: var(--bad);
    box-shadow: 0 0 0 3px rgba(255, 64, 80, 0.14);
}
.pulse-strip-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: rgba(15, 23, 32, 0.65);
    color: var(--text);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn.small {
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
}
.btn:hover {
    background: rgba(18, 28, 39, 0.85);
    border-color: #2b4258;
}
.btn:active {
    transform: translateY(1px);
}
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    filter: saturate(0.8);
}
.btn.primary {
    border-color: rgba(74, 163, 255, 0.45);
    background: rgba(74, 163, 255, 0.14);
}
.btn.toggle.on {
    border-color: rgba(84, 240, 198, 0.55);
    background: rgba(84, 240, 198, 0.12);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}
.field select {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 32, 0.65);
    color: var(--text);
    min-width: 160px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    user-select: none;
    margin-top: 20px;
}
.check input {
    width: 16px;
    height: 16px;
}
.analysis-row {
    flex-direction: column;
    align-items: stretch;
}
.analysis-row .btn {
    width: 100%;
}

.hint {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 176, 32, 0.55);
    background: rgba(255, 176, 32, 0.1);
    color: #ffe7b5;
}
.analysis-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.diagram-strip {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 6px;
}
.diagram-card {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 32, 0.5);
    padding: 10px;
}
.diagram-placeholder {
    width: 100%;
    padding: 18px;
    border-radius: 14px;
    border: 1px dashed rgba(84, 240, 198, 0.2);
    background: rgba(15, 23, 32, 0.45);
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}
.diagram-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}
.diagram-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.diagram-meta strong {
    color: #dfeeff;
}
.diagram-canvas {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: crisp-edges;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #000;
}

.analysis-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#analysisCanvas {
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 32, 0.55);
}
.table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 32, 0.55);
}
.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    font-variant-numeric: tabular-nums;
}
.table th {
    color: #dfeeff;
    font-weight: 650;
}
.table td {
    color: var(--text);
}
.table tr:last-child td {
    border-bottom: none;
}
.table .muted {
    color: var(--muted);
}

dialog {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(18, 28, 39, 0.95);
    color: var(--text);
    box-shadow: var(--shadow);
    width: min(780px, 92vw);
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}
.dialog-title {
    font-weight: 650;
}
.dialog-body {
    padding: 14px;
    color: var(--text);
}
.dialog-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

@media (max-width: 720px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .title {
        align-items: center;
        gap: 12px;
    }
    .title-text {
        text-align: left;
    }
    .subtitle {
        max-width: 32ch;
    }
    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .header-actions .btn {
        width: 100%;
    }
    .header-actions .icon-link {
        width: 100%;
        grid-column: 1 / -1;
    }
    .header-actions .port-pill {
        grid-column: 1 / -1;
        width: 100%;
        text-align: center;
        max-width: none;
        padding: 10px 12px;
        border-radius: 14px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) and (orientation: portrait) {
    :root {
        --bg-fade-1: 2200px 1500px;
        --bg-fade-2: 1800px 1400px;
    }
}
