/* Magnetic Forces: its colours, the drawings of charges, wires, fields and paths, the options; the
   general look is in ui.css (shared by the apps). Velocity and current blue, field green, force red. */
:root {
  --mf-v: #1f5fc4; --mf-b: #1f7a3e; --mf-f: #c62828; --mf-e: #b8860b; --mf-traj: #8e44ad;
  --mf-pos: #f2c2bb; --mf-neg: #bcd3f2; --mf-neu: #e4e2dc; --mf-region: rgba(31, 122, 62, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root { --mf-v: #79a8ff; --mf-b: #7fd49a; --mf-f: #ff7b72; --mf-e: #e8c25a; --mf-traj: #c7a6ff; --mf-pos: #7a3e37; --mf-neg: #34507a; --mf-neu: #4a4a46; --mf-region: rgba(127, 212, 154, 0.07); }
}

#prompt p { margin: 6px 0; }
/* a vector: an arrow above the letter */
.vec { position: relative; display: inline-block; }
.vec::before { content: "→"; position: absolute; left: 0; right: 0; top: -0.62em; text-align: center; font-size: 0.7em; font-style: normal; line-height: 1; }
.figs .fig { flex: 1 1 100%; }
.figs svg.mf { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; }
.figs svg.mf.wide { max-width: 560px; }

/* drawings */
svg.mf text { font-family: var(--serif); }
svg.mf .bg { fill: var(--card); }
svg.mf .bg.chamber { fill: color-mix(in srgb, var(--card) 85%, var(--mf-neg)); stroke: var(--line); }
svg.mf .region { fill: var(--mf-region); stroke: var(--mf-b); stroke-width: 1; stroke-dasharray: 5 4; }
svg.mf .lbl { fill: var(--ink); font-size: 15px; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
svg.mf .it { font-style: italic; }
svg.mf .sub { font-size: 10px; font-style: normal; }
svg.mf .sign { fill: var(--ink); font: 700 15px system-ui, sans-serif; }
svg.mf .sign.big { font-size: 20px; }
svg.mf .particle { stroke: var(--ink); stroke-width: 1.3; }
svg.mf .particle.pos { fill: var(--mf-pos); }
svg.mf .particle.neg { fill: var(--mf-neg); }
svg.mf .particle.neu { fill: var(--mf-neu); }
svg.mf .particle.named { fill: var(--card); stroke-width: 1.6; }
svg.mf .sign.long { font-size: 10px; }
svg.mf .pt { fill: var(--ink); }
svg.mf :is(.v-vel, .v-wire, .v-dir) { stroke: var(--mf-v); fill: none; }
svg.mf :is(.v-vel-head, .v-wire-head, .v-dir-head) { fill: var(--mf-v); }
svg.mf .v-wire { stroke-width: 4; stroke-linecap: round; }
svg.mf .v-force { stroke: var(--mf-f); fill: none; }
svg.mf .v-force-head { fill: var(--mf-f); }
svg.mf .v-field { stroke: var(--mf-b); fill: none; stroke-width: 1.4; }
svg.mf .v-field-head { fill: var(--mf-b); }
svg.mf .v-efield { stroke: var(--mf-e); fill: none; }
svg.mf .v-efield-head { fill: var(--mf-e); }
svg.mf .sym { stroke-width: 2; fill: var(--card); }
svg.mf .faint { opacity: 0.45; }
svg.mf .c-vel { fill: var(--mf-v); }
svg.mf .c-force { fill: var(--mf-f); }
svg.mf .c-field { fill: var(--mf-b); }
svg.mf .c-efield { fill: var(--mf-e); }
svg.mf .traj { fill: none; stroke: var(--mf-traj); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
svg.mf .traj-head { fill: var(--mf-traj); }
svg.mf .traj.back { opacity: 0.35; stroke-width: 2; }
svg.mf .cyl { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
svg.mf .dimline { stroke: var(--muted); stroke-width: 1.2; fill: none; }
svg.mf .lbl.small { font-size: 13px; }
svg.mf .track { fill: none; stroke: var(--ink); stroke-width: 1.8; }
svg.mf .plate { fill: var(--muted); }

/* direction tiles: one, or all that fit */
.ask { font-weight: 600; margin: 12px 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.tile { position: relative; display: block; border: 2px solid var(--line); border-radius: 10px; background: var(--card); padding: 6px 10px; cursor: pointer; }
.tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile:hover { border-color: var(--accent); }
.tile:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.tile:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.tiles[role="group"] .tile:has(input:checked)::after { content: "✓"; position: absolute; top: 4px; right: 8px; color: var(--accent); font-weight: 700; }
.tile.ok { border-color: var(--ok); background: var(--ok-bg); }
.tile.bad { border-color: var(--bad); background: var(--bad-bg); }
.tile.miss { border-color: var(--ok); border-style: dashed; }
.dtile { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.dtile svg.icon { width: 40px; height: 40px; flex: none; }
.qfb { color: var(--bad); margin: 0 0 12px; padding-left: 1.2em; }
.qfb:empty { display: none; }
.qfb li { margin: 3px 0; }

/* drawings to choose from */
.cands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0; }
.cand { position: relative; display: block; border: 2px solid var(--line); border-radius: 10px; background: var(--card); padding: 4px; cursor: pointer; }
.cand svg { display: block; width: 100%; height: auto; }
.cand input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cand .letter { position: absolute; left: 10px; top: 6px; font-weight: 700; color: var(--accent); }
.cand:hover { border-color: var(--accent); }
.cand:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.cand:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.cand.ok { border-color: var(--ok); background: var(--ok-bg); }
.cand.bad { border-color: var(--bad); background: var(--bad-bg); }
@media (max-width: 560px) { .cands { grid-template-columns: minmax(0, 1fr); } }

/* answers: a row of options per question; statements to tick */
#fields .field { display: grid; gap: 6px; margin-bottom: 14px; }
.field .what { font-weight: 600; }
.field .fb { font-size: 0.9rem; }
.field .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.ok input:checked + span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.field.bad input:checked + span { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.field.ok .fb { color: var(--ok); }
.stmts { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 8px; }
.stmts li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--card); }
.stmts label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.stmts input { flex: none; transform: translateY(1px); }
.stmts li.ok { border-color: var(--ok); background: var(--ok-bg); }
.stmts li.bad { border-color: var(--bad); background: var(--bad-bg); }
.stmts .fb { display: block; font-size: 0.9rem; margin: 4px 0 0 26px; }
.stmts .fb:empty { display: none; }

/* the pictures of the problems */
svg.tb .mf-fieldline { fill: none; stroke: var(--mf-b); stroke-width: 1.2; opacity: 0.7; }
svg.tb .mf-traj { fill: none; stroke: var(--mf-traj); stroke-width: 2; }
svg.tb .mf-traj2 { fill: none; stroke: var(--mf-f); stroke-width: 2; }
svg.tb .mf-glow { fill: none; stroke: #4fbf6f; stroke-width: 6; opacity: 0.6; stroke-linecap: round; }
svg.tb .mf-arrow line { stroke: var(--motion); stroke-width: 2; }
svg.tb .mf-arrow polygon { fill: var(--motion); }
svg.tb .mf-region { fill: var(--mf-region); stroke: var(--mf-b); stroke-dasharray: 5 4; }
svg.tb .mf-coil { fill: none; stroke: #b5651d; stroke-width: 6; opacity: 0.8; }
svg.tb .mf-beam { fill: none; stroke: #4fa8e0; stroke-width: 3; }
svg.tb .mf-track { fill: none; stroke: var(--ink); stroke-width: 1.6; }
svg.tb .mf-cable { fill: #555c63; stroke: var(--ink); stroke-width: 1.2; }

/* arcade: manim's colours */
#arcade { --mf-v: #58c4dd; --mf-b: #83c167; --mf-f: #fc6255; --mf-traj: #c59df5; --mf-pos: #7a3e37; --mf-neg: #34507a; --mf-neu: #444; --mf-region: rgba(131, 193, 103, 0.08); }
#arcade svg.mf .bg { fill: #000; }
#arcade svg.mf .lbl { stroke: #000; }
#arcade .ar-opt .val svg.mf:not(.icon) { width: 100%; max-width: 260px; }
#arcade .ar-opt .val svg.icon { width: 48px; height: 48px; }
#arcade .ar-opt .dtile { justify-content: center; }
.ar-hero .figs .fig svg { width: 320px; }
