.dpt-topology {
  --dpt-ink: #173950;
  --dpt-accent: #0b736b;
  color: var(--dpt-ink);
  background: #fff;
  border: 1px solid #c6d9df;
  border-radius: 14px;
  padding: 18px;
  font: 14px/1.55 system-ui, "Microsoft YaHei", sans-serif;
  min-width: 0;
}
.dpt-topology *, .dpt-topology *::before, .dpt-topology *::after { box-sizing: border-box; }
.dpt-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.dpt-heading strong { font-size: 18px; }
.dpt-heading > span { color: var(--dpt-accent); font-size: 13px; white-space: nowrap; }
.dpt-note, .dpt-vector-note, .dpt-circuit-note { margin: 10px 0; color: #465c69; }
.dpt-circuit-note { font-size:12px; }
.dpt-stage { position: relative; width: 100%; aspect-ratio: 1200 / 820; }
.dpt-circuit-scroll { width:100%;height:100%; }
.dpt-scroll-help { display:none; }
.dpt-svg { display: block; width: 100%; height: 100%; }
.dpt-power-region { fill: #f6fafb; stroke: #e0eaed; }
.dpt-drive-region { fill: #eaf6f3; stroke: #d2e8e2; }
.dpt-wire { fill: none; stroke: var(--dpt-ink); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.dpt-node { fill: var(--dpt-ink); }
.dpt-driver { fill: #fff; stroke: var(--dpt-accent); stroke-width: 2.8; }
.dpt-source-polarity { fill:none;stroke:var(--dpt-accent);stroke-width:2.5;stroke-linecap:round; }
.dpt-mos-arrow { fill:var(--dpt-ink);stroke:none; }
.dpt-label { font-size: 17px; fill: var(--dpt-ink); }
.dpt-small { font-size: 16px; fill: #465c69; }
.dpt-pulse, .dpt-current { fill: none; stroke: var(--dpt-accent); stroke-width: 3; }
.dpt-timing { fill:none;stroke:#5b7184;stroke-width:1.6; }
.dpt-guide-help { display:flex;align-items:center;gap:8px;margin:8px 0;color:#526773;font-size:12px; }
.dpt-guide-key { width:30px;min-width:30px;border-top:2px dashed #64748b; }
.dpt-guide { color:#708295;pointer-events:none; }
.dpt-guide-path { fill:none;stroke:currentColor;stroke-width:1.5;stroke-dasharray:5 5;opacity:.75; }
.dpt-guide-tip { fill:none;stroke:currentColor;stroke-width:1.5; }
.dpt-guide-target { fill:none;stroke:currentColor;stroke-width:1.2;stroke-dasharray:3 3;opacity:0; }
.dpt-guide-marker circle { fill:#fff;stroke:currentColor;stroke-width:1.4; }
.dpt-guide-marker text { fill:currentColor;font:600 13px system-ui,sans-serif;text-anchor:middle; }
.dpt-guide.is-active { color:#2563eb; }
.dpt-guide.is-active .dpt-guide-path { opacity:1;stroke-width:2.5; }
.dpt-guide.is-active .dpt-guide-target { stroke-width:2.2;stroke-dasharray:none;opacity:1; }
.dpt-field-number {display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;min-width:18px;margin-right:5px;border:1px solid #708295;border-radius:50%;font-size:11px;line-height:1;color:#526773;background:#fff;vertical-align:middle}
.dpt-field.is-guided .dpt-field-number {color:#2563eb;border-color:#2563eb;background:#eff6ff}
.dpt-field.is-guided .dpt-field-label {color:#2563eb}
.dpt-field.is-guided input:not([aria-invalid="true"]) {border-color:#2563eb;box-shadow:0 0 0 2px #dbeafe}
.dpt-topology .dpt-field.is-guided input:focus {outline-color:#93c5fd}
.dpt-fields { position: absolute; inset: 0; pointer-events: none; }
.dpt-field { position: absolute; width: 17%; display: flex; flex-direction: column; gap: 3px; pointer-events: auto; }
.dpt-field-label { font-weight: 650; color: var(--dpt-ink); }
.dpt-topology .dpt-field input {
  width: 100%; min-width: 0; height: 36px; padding: 6px 9px;
  border: 1px solid #99b8c2; border-radius: 7px; background: #fff;
  color: #173950; font: inherit; line-height: 1.2;
}
.dpt-topology .dpt-field input:focus { outline: 3px solid #7ed4ca; outline-offset: 2px; border-color: #0b736b; }
.dpt-topology .dpt-field input[aria-invalid="true"] { border-color: #b33c36; }
.dpt-topology .dpt-field input:disabled { background: #edf0f2; color: #586973; }
.dpt-field small { font-size: 11px; color: #526773; }
.dpt-field-error { color: #a62b25 !important; background: #fff; border-radius: 4px; padding: 2px 4px; }
.dpt-field-error[hidden] { display: none; }
.dpt-field-vdc { left: 1%; top: 32.7%; }
.dpt-field-iload { left: 81%; top: 1%; }
.dpt-field-ts { left: 22%; top: 1%; }
.dpt-field-duty { left: 49%; top: 1%; }
.dpt-field-i-rms { left: 76%; top: 79%; width: 23%; }
.dpt-field-vcc { left: 25%; top: 43%; }
.dpt-field-vee { left: 1%; top: 60.9%; }
.dpt-field-rg-on { left: 43%; top: 43%; }
.dpt-field-rg-off { left: 43%; top: 85%; }
.dpt-status { margin: 10px 0 0; padding: 9px 12px; border-radius: 7px; background: #edf6f4; overflow-wrap: anywhere; }
.dpt-status[data-valid="false"] { color: #92382c; background: #fff2ee; }
/* DOM/tab order is VDC, Iload, Ts, D, I_rms, VCC, Vee, Rg on, Rg off.
 * Narrow screens retain the schematic then show that same linear input order. */
@media (max-width: 1050px) {
  .dpt-stage { aspect-ratio: auto; }
  .dpt-circuit-scroll { height:auto;overflow-x:auto;border:1px solid #e0eaed;border-radius:8px; }
  .dpt-scroll-help { display:block;font-size:12px;color:#465c69; }
  .dpt-svg { height: auto; aspect-ratio: 1200 / 820; }
  .dpt-svg { min-width:740px; }
  .dpt-fields { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .dpt-field { position: static; width: auto; }
  .dpt-field small { font-size: 12px; }
  .dpt-guide-path,.dpt-guide-tip { display:none; }
}
@media (max-width: 600px) {
  .dpt-topology { padding: 12px; }
  .dpt-heading { align-items: start; }
  .dpt-heading strong { font-size: 16px; }
  .dpt-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dpt-topology .dpt-field input { min-height: 44px; }
}
@media (forced-colors: active) {
  .dpt-topology { border-color: CanvasText; }
  .dpt-wire, .dpt-driver, .dpt-pulse, .dpt-current { stroke: CanvasText; }
  .dpt-source-polarity { stroke:CanvasText; }
  .dpt-mos-arrow { fill:CanvasText; }
  .dpt-guide,.dpt-guide.is-active { color:CanvasText; }
  .dpt-label, .dpt-small, .dpt-node { fill: CanvasText; }
  .dpt-power-region, .dpt-drive-region, .dpt-driver { fill: Canvas; }
}
