.ohm-sweep {
  display: grid;
  gap: 16px;
  margin-top: 14px;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: linear-gradient(145deg, var(--panel), var(--panel-soft));
}

.ohm-sweep[hidden],
.ohm-lab[hidden],
.ohm-feedback[hidden],
.ohm-sweep [hidden] {
  display: none;
}

.ohm-sweep.is-enhanced .ohm-js-note {
  display: none;
}

.ohm-predict-form,
.ohm-predict-field,
.ohm-reasons {
  display: grid;
  gap: 10px;
}

.ohm-predict-form {
  margin: 0;
}

.ohm-predict-field,
.ohm-reasons {
  margin: 0;
  padding: 0;
  border: 0;
}

.ohm-predict-field > legend,
.ohm-reasons > legend {
  padding: 0;
  font-weight: 700;
  color: var(--text);
}

.ohm-prediction-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ohm-endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ohm-endpoint {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: color-mix(in srgb, var(--bg) 50%, transparent);
}

.ohm-endpoint label {
  color: var(--text);
  font-weight: 700;
}

.ohm-prediction-line input {
  width: min(100%, 11rem);
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--panel-soft);
  color: var(--text);
  font: 600 1rem var(--mono);
}

.ohm-reason {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}

.ohm-reason:hover {
  border-color: var(--border);
  background: var(--panel-soft);
}

.ohm-reason input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.ohm-predict-form .button {
  justify-self: start;
}

.ohm-predict-form .button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ohm-sweep :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ohm-feedback {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border-left: 4px solid var(--warn);
  background: var(--panel-soft);
}

.ohm-feedback.is-correct {
  border-left-color: var(--ok);
}

.ohm-feedback.is-incorrect {
  border-left-color: var(--verm);
}

.ohm-feedback p {
  margin: 0;
}

.ohm-verdict,
.ohm-expected {
  font-weight: 700;
}

.ohm-reasoning {
  color: var(--muted);
}

.ohm-lab {
  display: grid;
  gap: 16px;
}

.ohm-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: stretch;
}

.ohm-circuit,
.ohm-plot-wrap,
.ohm-controls,
.ohm-meter {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: color-mix(in srgb, var(--bg) 66%, transparent);
}

.ohm-circuit,
.ohm-plot-wrap {
  padding: 10px;
}

.ohm-circuit svg,
.ohm-plot {
  display: block;
  width: 100%;
  height: auto;
}

.ohm-wire,
.ohm-resistor,
.ohm-axis,
.ohm-grid,
.ohm-flow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ohm-wire {
  stroke: var(--text);
  stroke-width: 4;
}

.ohm-resistor {
  stroke: var(--accent);
  stroke-width: 5;
}

.ohm-source {
  stroke: var(--warn);
  stroke-width: 5;
}

.ohm-flow {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-dasharray: 2 22;
  animation: ohm-current-flow var(--ohm-flow-duration, 1.1s) linear infinite;
}

.ohm-circuit text,
.ohm-plot text {
  fill: var(--muted);
  font: 12px var(--mono);
}

.ohm-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.ohm-axis {
  stroke: var(--muted);
  stroke-width: 1.5;
}

.ohm-curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
}

.ohm-point {
  fill: var(--verm);
  stroke: var(--bg);
  stroke-width: 3;
  transition: cx 160ms ease, cy 160ms ease;
}

.ohm-point-label {
  fill: var(--text) !important;
  font-weight: 700 !important;
}

.ohm-source-label {
  fill: var(--muted);
}

.ohm-controls {
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.ohm-control-head label {
  font-weight: 700;
}

.ohm-control-head output {
  color: var(--accent);
  font: 700 1rem var(--mono);
}

.ohm-range {
  width: 100%;
  min-height: 44px;
  accent-color: var(--accent);
}

.ohm-range-ends {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font: 0.82rem var(--mono);
}

.ohm-meter {
  display: grid;
  gap: 3px;
  padding: 14px;
}

.ohm-meter-label {
  color: var(--muted);
  font: 0.8rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ohm-current {
  color: var(--accent);
  font: 700 clamp(1.7rem, 6vw, 2.7rem) var(--mono);
}

.ohm-formula {
  color: var(--muted);
  font: 0.92rem var(--mono);
  overflow-wrap: anywhere;
}

.ohm-table-wrap {
  overflow-x: auto;
}

.ohm-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

.ohm-table caption {
  padding: 0 0 8px;
  color: var(--muted);
  text-align: left;
}

.ohm-table th,
.ohm-table td {
  padding: 9px 10px;
  border: 1px solid var(--border);
  text-align: right;
}

.ohm-table th:first-child,
.ohm-table td:first-child {
  text-align: left;
}

@keyframes ohm-current-flow {
  to { stroke-dashoffset: -48; }
}

@media (max-width: 720px) {
  .ohm-stage,
  .ohm-endpoint-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ohm-sweep *,
  .ohm-sweep *::before,
  .ohm-sweep *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
