/* Topology cluster chrome (VR switching lessons) */

.control-loops-series-nav--top .series-progress,
.control-loops-series-nav--top .series-nav-tagline { display: none; }
.control-loops-series-nav--top { padding-top: 4px; padding-bottom: 4px; }

.mt-lesson-hero { padding: 6px 20px 2px; }
.mt-lesson-hero h1 { font-size: 1.32rem; margin-bottom: 4px; }
.mt-lesson-hero p { font-size: 0.86rem; }
.mt-lesson-split { margin-top: 4px; }
.mt-lesson-lab .im-panel-head { margin-bottom: 4px; }
.mt-lesson-lab .im-panel-sub { display: none; }

.topo-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 4px auto 8px;
    max-width: 720px;
    padding: 0 16px;
}

.topo-cluster a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--ai-gray-200);
    background: #fff;
    color: var(--ai-blue-700);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.topo-cluster a:hover { border-color: #93c5fd; background: #eff6ff; }

.topo-cluster a.is-current {
    background: #003087;
    border-color: #003087;
    color: #fff;
}

.topo-cluster .topo-n {
    font-size: 0.72rem;
    opacity: 0.8;
}

.topo-schematic-wrap {
    border: 1px solid var(--ai-gray-200);
    border-radius: var(--ai-radius-md);
    background: #fff;
    overflow: hidden;
    margin: 0;
}

.topo-schematic-wrap svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
}

.topo-work {
    display: grid;
    grid-template-columns: minmax(200px, 0.85fr) minmax(280px, 1.25fr);
    gap: 8px 12px;
    align-items: start;
    margin: 0 0 8px;
}

.topo-work .im-chart-stack {
    gap: 6px;
    margin: 0;
}

.topo-work .im-chart-label {
    margin: 0 0 2px;
    font-size: 0.7rem;
}

.topo-work .im-canvas-wrap {
    margin-bottom: 0;
}

.topo-transport {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    padding: 6px 8px;
    background: #f8fafc;
    border: 1px solid var(--ai-gray-200);
    border-radius: var(--ai-radius-md);
}

.topo-transport button {
    flex-shrink: 0;
    min-width: 4.4rem;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid #003087;
    background: #003087;
    color: #fff;
    cursor: pointer;
}

.topo-transport button.is-paused {
    background: #fff;
    color: #003087;
}

.topo-transport input[type="range"] {
    flex: 1;
    accent-color: #2563eb;
}

.topo-transport .topo-tlabel {
    flex-shrink: 0;
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ai-blue-800);
    min-width: 6.5rem;
    text-align: right;
}

.topo-knobs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px 10px;
    margin: 0 0 8px;
    align-items: end;
}

.topo-knobs[data-n="2"] { grid-template-columns: repeat(2, minmax(140px, 220px)); }
.topo-knobs[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.topo-knobs[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.topo-knobs[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.topo-knobs[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.topo-knobs[data-n="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.topo-knob {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ai-gray-600);
}

.topo-knob-name {
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ai-gray-500);
    line-height: 1.2;
}

.topo-knob-u {
    font-weight: 600;
    text-transform: none;
    color: var(--ai-gray-400);
    letter-spacing: 0;
}

.topo-knob-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3.5rem;
    gap: 6px;
    align-items: center;
}

.topo-knob-row input[type="range"] {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.topo-knob-row input[type="number"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 4px;
    border: 1px solid var(--ai-gray-200);
    border-radius: 4px;
}

.topo-knob.accent-blue input[type="range"] { accent-color: #2563eb; }
.topo-knob.accent-emerald input[type="range"] { accent-color: #059669; }
.topo-knob.accent-violet input[type="range"] { accent-color: #7c3aed; }
.topo-knob.accent-amber input[type="range"] { accent-color: #d97706; }
.topo-knob.accent-rose input[type="range"] { accent-color: #e11d48; }
.topo-knob.accent-teal input[type="range"] { accent-color: #0d9488; }

.topo-opts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    min-height: 0;
    margin: 0 0 8px;
}

.topo-opts:empty { display: none; margin: 0; }

.topo-opts .topo-check {
    margin: 0;
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px solid var(--ai-gray-200);
    border-radius: 999px;
    font-size: 0.78rem;
}

.mt-lesson-lab .im-readouts {
    margin: 6px 0 4px;
    gap: 6px;
}

.mt-lesson-lab .im-panel-head {
    margin-bottom: 8px;
}

.topo-phase {
    margin: 0;
    font-size: 0.75rem;
    padding: 4px 8px;
}

.topo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 8px;
}

.topo-phase {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--ai-radius-md);
    background: #eff6ff;
    border: 1px solid #93c5fd;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ai-blue-800);
    margin: 0 0 10px;
}

.topo-phase.is-off {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.topo-fit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 8px 0 12px;
}

.topo-fit-table th,
.topo-fit-table td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ai-gray-200);
}

.topo-fit-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ai-gray-500);
}

.topo-fit-table tr.is-self td { background: #eff6ff; }

.topo-chip {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
}

.topo-chip.yes { background: #dcfce7; color: #166534; }
.topo-chip.no { background: #fee2e2; color: #991b1b; }
.topo-chip.overkill { background: #fef3c7; color: #92400e; }
.topo-chip.rectified { background: #ffe4e6; color: #e11d48; }
.topo-chip.continuous { background: #d1fae5; color: #047857; }

.topo-score {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 0 0 12px;
}

.topo-score div {
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid var(--ai-gray-200);
    border-radius: var(--ai-radius-md);
}

.topo-score dt {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ai-gray-500);
    margin: 0 0 2px;
}

.topo-score dd {
    margin: 0;
    font-weight: 700;
    color: var(--ai-blue-800);
    font-size: 0.88rem;
}

.topo-warn,
.topo-info,
.topo-mode-dcm {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: var(--ai-radius-md);
    font-size: 0.82rem;
    line-height: 1.4;
}

.topo-warn {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.topo-info {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.topo-mode-dcm {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
}

.topo-warn[hidden],
.topo-lab-block[hidden],
#turnsWrap[hidden],
#recWrap[hidden],
#capstone[hidden],
#fitNote[hidden],
#dcmWarn[hidden] {
    display: none !important;
}

.topo-opts:not(:has(:not([hidden]))) {
    display: none !important;
    margin: 0;
}

.topo-mode-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}

.topo-mode-btns button {
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--ai-gray-300);
    background: #fff;
    color: var(--ai-blue-800);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.topo-mode-btns button.is-current {
    background: #003087;
    border-color: #003087;
    color: #fff;
}

.topo-mode-btns button.is-warn {
    background: #9f1239;
    border-color: #9f1239;
    color: #fff;
}

.im-canvas-wrap--lab canvas {
    display: block;
    width: 100%;
    height: 320px;
}

/* Flyback-xfmr: Q1 chip and N² note must not reflow when the Q1 label changes. */
.topo-row--xf {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 8px;
}
.topo-row--xf .topo-phase,
.topo-row--xf .topo-info {
    margin: 0;
    box-sizing: border-box;
    min-height: 2.35rem;
    display: flex;
    align-items: center;
}
.topo-row--xf .topo-phase {
    flex: 0 0 26ch;
    justify-content: flex-start;
    white-space: nowrap;
}
.topo-row--xf .topo-info {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}

.im-canvas-wrap--lab-tall canvas {
    height: 360px;
}

.xf-calc {
    margin: 14px 0 0;
    padding: 14px 14px 12px;
    background: #f8fafc;
    border: 1px solid var(--ai-gray-200);
    border-radius: var(--ai-radius-md);
}
.xf-calc-head h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--ai-blue-800);
}
.xf-calc-head p {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--ai-gray-600);
    line-height: 1.4;
}
.xf-calc-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
    margin: 0 0 10px;
}
.xf-calc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ai-gray-500);
}
.xf-calc-u {
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ai-gray-400);
}
.xf-calc-field input {
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, monospace;
    font-size: 0.92rem;
    font-weight: 650;
    padding: 7px 8px;
    border: 1px solid var(--ai-gray-200);
    border-radius: 6px;
    background: #fff;
    color: var(--ai-blue-800);
}
.xf-calc-field input:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}
.xf-calc-field.is-given input {
    border-color: #003087;
    box-shadow: inset 0 0 0 1px #003087;
}
.xf-calc-field.is-solved input {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}
.xf-calc-field.is-conflict input {
    background: #fff1f2;
    border-color: #fda4af;
    color: #9f1239;
}
.xf-calc-status {
    min-height: 2.6em;
    margin: 0 0 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--ai-gray-700);
}
.xf-calc-status.is-ok { color: #065f46; }
.xf-calc-status.is-bad { color: #9f1239; }
.xf-calc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.xf-calc-actions button {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #003087;
    background: #003087;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.xf-calc-actions button.is-ghost {
    background: #fff;
    color: #003087;
}

.topo-cap-call {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.topo-cap-call span {
    flex: 1;
    min-width: 180px;
    padding: 8px 10px;
    border-radius: var(--ai-radius-md);
    font-size: 0.82rem;
    line-height: 1.4;
    border: 1px solid var(--ai-gray-200);
    background: #f8fafc;
    color: var(--ai-gray-700);
}

.topo-cap-call span.is-hot {
    background: #fff1f2;
    border-color: #fda4af;
    color: #9f1239;
}

.topo-family-link {
    font-size: 0.78rem;
}

.topo-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ai-gray-700);
    margin: 0 0 10px;
}
