.emi-shell { width: min(1220px, calc(100% - 40px)); }
.emi-hero { grid-template-columns: 1.08fr .92fr; }
.emi-workspace { grid-template-columns: 282px minmax(0, 1fr); }
.emi-stage { padding-bottom: 24px; }

.mode-control { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 20px; border: 1px solid var(--line); }
.mode-option { min-width: 0; border: 0; }
.mode-option + .mode-option { border-left: 1px solid var(--line); }
.mode-option.active { color: #08211f; background: var(--cyan); }

.circuit-status { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--line); color: #c9d8d5; font-size: 12px; }
.circuit-status strong { color: var(--orange); font: 500 12px "DM Mono", monospace; }

.circuit-board { overflow: hidden; border: 1px solid var(--line-soft); background: var(--panel-deep); }
.emi-scene { display: block; width: 100%; height: auto; min-height: 400px; }
.rail { stroke: var(--cyan); stroke-width: 3; stroke-linecap: square; }
.resistor { fill: #173238; stroke: var(--orange); stroke-width: 2.5; }
.rod { stroke: var(--orange); stroke-width: 6; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255, 173, 104, .5)); }
.rod-label { fill: var(--orange); font: 500 15px "DM Mono", monospace; paint-order: stroke; stroke: var(--panel-deep); stroke-width: 5px; }
.field-symbol { fill: #2f5158; font: 15px "DM Mono", monospace; }
.component-label, .current-label { fill: #c9d8d5; font: 500 13px "DM Mono", monospace; paint-order: stroke; stroke: var(--panel-deep); stroke-width: 5px; }
.current-label { fill: var(--cyan); font-size: 12px; }
.cur-flow { stroke: var(--cyan); stroke-width: 2; }
.vel-vec { stroke: var(--orange); stroke-width: 2.6; }
.amp-vec { stroke: var(--red); stroke-width: 2.6; }
.ext-vec { stroke: var(--yellow); stroke-width: 2.6; }
.vec-label { font: 500 12px "DM Mono", monospace; paint-order: stroke; stroke: var(--panel-deep); stroke-width: 5px; }
.vec-label.vel { fill: var(--orange); }
.vec-label.amp { fill: var(--red); }
.vec-label.ext { fill: var(--yellow); }
.current-dot { fill: #d8fff6; stroke: var(--cyan); stroke-width: 2; filter: drop-shadow(0 0 5px rgba(101, 230, 209, .8)); }

.emi-graphs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 16px; }
.emi-graph { min-width: 0; margin: 0; border: 1px solid var(--line-soft); background: var(--panel-deep); }
.emi-graph figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 11px 13px 8px; border-bottom: 1px solid rgba(41, 66, 71, .7); }
.emi-graph figcaption b { color: var(--ink); font-size: 13px; font-weight: 600; }
.emi-graph figcaption span { padding-top: 2px; color: var(--muted); font: 10px "DM Mono", monospace; }
.emi-graph svg { display: block; width: 100%; height: auto; }
.emi-line { stroke: var(--cyan); stroke-width: 2.5; }
.emi-point { fill: var(--orange); stroke: #fff1d8; stroke-width: 1.6; filter: drop-shadow(0 0 6px rgba(255, 173, 104, .65)); }

.emi-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.emi-metrics .metric:nth-child(n+5) { margin-top: 13px; padding-top: 17px; border-top: 1px solid var(--line); }
.emi-metrics .metric:nth-child(5) { padding-left: 0; border-left: 0; }
.emi-metrics .metric-value { font-size: 19px; }

@media (max-width: 900px) { .emi-workspace { grid-template-columns: 260px minmax(0, 1fr); } }

@media (max-width: 820px) {
  .emi-shell { width: min(calc(100% - 24px), 650px); }
  .emi-hero { grid-template-columns: 1fr; }
  .emi-workspace { grid-template-columns: 1fr; }
  .emi-graphs { grid-template-columns: 1fr; }
  .emi-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emi-metrics .metric:nth-child(n) { margin-top: 0; padding: 13px 12px 13px 0; border: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .circuit-status { display: block; }
  .circuit-status span { display: block; margin-top: 5px; }
  .emi-scene { min-height: 300px; }
  .emi-scene .component-label { font-size: 24px; }
  .emi-scene .current-label { font-size: 21px; }
  .emi-scene .rod-label { font-size: 26px; }
  .emi-scene .vec-label { font-size: 22px; }
  .emi-scene .field-symbol { font-size: 18px; }
  .emi-scene .rail { stroke-width: 4; }
  .emi-scene .rod { stroke-width: 9; }
  .emi-graph svg .tick { font-size: 11px; }
  .emi-graph svg .axis-label { font-size: 12px; }
  .emi-graph svg .annotation { font-size: 12px; }
  .emi-metrics { grid-template-columns: 1fr; }
  .emi-metrics .metric:last-child { border-bottom: 0; }
}
