/* Potential in a Circuit: its colours, the circuit diagrams, the potential plot and the choices;
   the general look is in ui.css (shared by the apps). */
:root {
  --cur: #1f5fd6;
  --phi: #1f7a3e;
  --grid: #e3dfd6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cur: #74a7ff;
    --phi: #7fd49a;
    --grid: #3a3f46;
  }
}

#prompt { margin: 6px 0; }

/* circuit drawing (circuit.js) */
svg text { font-family: var(--serif); font-size: 14px; }
svg .w { stroke: var(--ink); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg .w.thick { stroke-width: 4.5; stroke-linecap: butt; }
svg .c { stroke: var(--ink); stroke-width: 1.8; fill: var(--card); }
svg .dot { fill: var(--ink); }
svg .lbl { fill: var(--ink); }
svg .lbl.pt { font-weight: 600; }
svg .small { font-size: 12px; }
svg .cur { stroke: var(--cur); stroke-width: 1.8; fill: none; }
svg .cur-h, svg .cur-t { fill: var(--cur); }
svg .new { font-weight: 700; }
svg .mark { fill: var(--mark); }
svg text.ask { fill: var(--accent); font-weight: 700; }
.k-new { background: var(--mark); border-radius: 3px; padding: 0 3px; font-weight: 600; }

/* the potential around the loop (plot in loop.js) */
.fig svg.plot { max-width: min(100%, 380px); }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .grid.zero { stroke: var(--muted); }
svg .axis { stroke: var(--ink); stroke-width: 1.4; fill: none; }
svg .tick { fill: var(--muted); font: 12px system-ui, sans-serif; }
svg .ptl { fill: var(--ink); font: 600 13px var(--serif); }
svg .axl { fill: var(--ink); font: 14px var(--serif); }
svg .it { font-style: italic; }
svg .phi { fill: none; stroke: var(--phi); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
svg .phi.right { stroke: var(--muted); stroke-width: 1.8; stroke-dasharray: 5 4; }
svg .phi.bad { stroke: var(--bad); stroke-width: 3.4; }

/* sketching the potential (sketch.js, sketch.css; the drawing is loop.js's sketchBody): a press
   anywhere sets the nearest point */
.fig svg.sketch-plot { max-width: 100%; cursor: crosshair; }
svg .col { stroke: var(--phi); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.45; }
svg .handle { fill: var(--phi); stroke: var(--card); stroke-width: 1.5; }
svg .handle.active { stroke: var(--ink); stroke-width: 1.5; }
svg .fixed { fill: var(--ink); }
svg .wrongband { fill: var(--bad); opacity: 0.14; }
svg .readout { fill: var(--phi); font: 600 12px system-ui, sans-serif; paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
.sketch-how { margin: 4px 0 6px; }
#sketch-area .linklike { display: block; margin: 2px 0 0; }
.sketch-fb { margin: 6px 0 2px; font-size: 0.95rem; }
.sketch-fb:empty { display: none; }
.sketch-fb p { margin: 0; }
.sketch-fb.ok { color: var(--ok); }
.sketch-fb.bad > p { color: var(--bad); }
.sketch-fb ul { margin: 4px 0 0; padding-left: 1.3em; }
.sketch-fb li { margin: 2px 0; }
.t-draw .actions { margin-top: 8px; align-items: center; }

/* answers: a row of options (find the error) */
.field.choice { display: grid; gap: 6px; grid-column: 1 / -1; margin-bottom: 8px; }
.field.choice .what { font-weight: 600; color: var(--ink); font-size: 1rem; }
.field.choice .fb:empty { display: none; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts label { position: relative; }
.opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opts span { display: block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.opts label:hover span { border-color: var(--accent); }
.opts input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field.choice.ok input:checked + span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.field.choice.bad input:checked + span { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
