.rlc-layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.78fr);
    align-items: stretch;
}

.rlc-stage {
    position: relative;
    padding: 0;
    overflow: hidden;
    min-height: 560px;
    height: calc(100vh - 210px);
    background: #0c0c10;
    transition: box-shadow 0.35s ease;
}

.rlc-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.rlc-stage.resonant {
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.55), 0 0 42px rgba(251, 191, 36, 0.2);
    animation: resonance-pulse 1.8s ease-in-out infinite;
}

@keyframes resonance-pulse {
    0%,
    100% {
        box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.4), 0 0 28px rgba(251, 191, 36, 0.12);
    }

    50% {
        box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.85), 0 0 56px rgba(251, 191, 36, 0.28);
    }
}

.rlc-status,
.rlc-badge,
.rlc-legend,
.rlc-scale,
.rlc-live {
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.rlc-status,
.rlc-badge {
    top: 14px;
    left: 16px;
    color: var(--text-main);
    background: rgba(12, 12, 16, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    font-size: 0.85rem;
}

.rlc-badge {
    font-weight: 600;
}

.rlc-badge.at,
.rlc-badge.near {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(62, 42, 8, 0.82);
}

.rlc-legend {
    top: 14px;
    right: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
    margin: 0;
    padding: 8px 10px;
    list-style: none;
    background: rgba(12, 12, 16, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 600;
}

.rlc-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.swatch {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}

.swatch-vr { background: #f5c16c; }
.swatch-vl { background: #22d3ee; }
.swatch-vc { background: #f472b6; }
.swatch-vs { background: #fafafa; }
.swatch-i { background: #a5b4fc; }

.rlc-scale,
.rlc-live {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.rlc-scale {
    left: 16px;
    bottom: 14px;
    max-width: 46%;
}

.rlc-live {
    right: 16px;
    bottom: 14px;
    text-align: right;
}

.rlc-stage,
.rlc-panel {
    min-height: 0;
}

.rlc-panel {
    max-height: calc(100vh - 180px);
    overflow: auto;
    padding: 16px 16px 12px;
}

.rlc-panel h2 {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 18px 0 10px;
}

.readout-main {
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 2px 0 2px;
}

.z-angle {
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.88rem;
}

.rlc-panel .result-list {
    grid-template-columns: 1fr 1fr;
    column-gap: 14px;
    row-gap: 0;
    margin-top: 14px;
}

.rlc-panel .result-list div {
    padding-bottom: 4px;
    gap: 6px;
}

.rlc-panel .result-list dt,
.rlc-panel .result-list dd {
    font-size: 0.82rem;
}

.region-at,
.region-near {
    color: #fbbf24;
}

.region-above {
    color: #22d3ee;
}

.region-below {
    color: #f472b6;
}

#vl-row.hot dd,
#vc-row.hot dd {
    color: #fde68a;
}

.schematic {
    width: auto;
    height: 76px;
    max-width: 100%;
    display: block;
    margin: 0 auto 2px;
}

.schematic .wire,
.schematic .sym-v,
.schematic .sym-r,
.schematic .sym-l,
.schematic .sym-c,
.schematic .sym-i {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.schematic .wire { stroke: #71717a; stroke-width: 1.7; }
.schematic .sym-v { stroke: #fafafa; stroke-width: 1.8; }
.schematic .sym-r { stroke: #f5c16c; stroke-width: 1.8; }
.schematic .sym-l { stroke: #22d3ee; stroke-width: 1.8; }
.schematic .sym-c { stroke: #f472b6; stroke-width: 2.2; }
.schematic .sym-i { stroke: #a5b4fc; stroke-width: 1.6; }
.schematic #i-arrow path,
.schematic .sym-i-label { fill: #a5b4fc; }
.schematic text {
    font-family: Inter, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
}
.schematic .tag-v { fill: #fafafa; }
.schematic .tag-r { fill: #f5c16c; }
.schematic .tag-l { fill: #22d3ee; }
.schematic .tag-c { fill: #f472b6; }
.schematic .sym-i-label { font-size: 11px; }

.schematic.resonant .sym-l,
.schematic.resonant .sym-c {
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.95));
}

.seg {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.seg button,
.rlc-actions button {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}

.seg button.active,
.rlc-actions button:hover,
.seg button:hover {
    color: var(--text-main);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.control {
    display: grid;
    gap: 4px;
    margin-top: 8px;
}

.control-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.control-head span {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.control-head strong {
    font-size: 0.92rem;
    color: var(--text-main);
    text-align: right;
}

.control input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
}

.check-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 0.92rem;
}

.rlc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

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

    .rlc-stage {
        height: 68vh;
        min-height: 420px;
    }

    .rlc-panel {
        max-height: none;
    }

    .rlc-scale,
    .rlc-live {
        max-width: 70%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rlc-stage.resonant {
        animation: none;
    }
}
