/* Wave Propagation: its colours, the graphs of the rope, the animations, the options and the
   drawing; the general look is in ui.css (shared by the apps). */
:root {
  --wv: #1f5fc4; --wv-in: #1f7a3e; --wv-ref: #c2620c; --wv-drawn: #8e44ad;
  --grid: #e7e3da; --grid-major: #cfc9bd; --virtual: rgba(120, 120, 120, 0.1);
}
@media (prefers-color-scheme: dark) {
  :root { --wv: #79a8ff; --wv-in: #7fd49a; --wv-ref: #ffb36b; --wv-drawn: #c7a6ff; --grid: #2a2e33; --grid-major: #3d4248; --virtual: rgba(255, 255, 255, 0.06); }
}

#prompt p { margin: 6px 0; }

/* graphs of the rope */
.figs svg.wave { display: block; width: 100%; max-width: 640px; height: auto; }
.figs .fig { flex: 1 1 100%; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .grid.major { stroke: var(--grid-major); }
svg .virtual { fill: var(--virtual); }
svg .ax { stroke: var(--ink); stroke-width: 1.4; fill: none; }
svg .axhead { fill: var(--ink); }
svg .tick { fill: var(--muted); font: 12px system-ui, sans-serif; }
svg .axl { fill: var(--ink); font: 14px var(--serif); }
svg .it { font-style: italic; }
svg .glabel { fill: var(--ink); font: 600 13px system-ui, sans-serif; }
svg [class^="c-"] { fill: none; stroke-linejoin: round; stroke-linecap: round; }
svg .c-main { stroke: var(--wv); stroke-width: 2.6; }
svg .c-part { stroke: var(--wv-in); stroke-width: 2; stroke-dasharray: 7 5; }
svg .c-part2 { stroke: var(--wv-ref); stroke-width: 2; stroke-dasharray: 7 5; }
svg .c-ref { stroke: var(--wv); stroke-width: 2.6; opacity: 0.25; }
svg .c-virt { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
svg .c-drawn { stroke: var(--wv-drawn); stroke-width: 2.6; }
svg .wall { stroke: var(--ink); stroke-width: 3; }
svg .hatch { stroke: var(--ink); stroke-width: 1.2; }
svg .freeend { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 7 5; }
svg .ring { fill: var(--card); stroke: var(--ink); stroke-width: 1.8; }
svg .mark { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
svg .mlabel { fill: var(--accent); font: 600 12px system-ui, sans-serif; }
svg .varrow { stroke: var(--ink); stroke-width: 2; }
svg .varrowhead { fill: var(--ink); }
svg .vlabel { fill: var(--ink); font: 13px system-ui, sans-serif; }
svg .dot { fill: var(--accent); stroke: var(--card); stroke-width: 1.5; }
svg .dlabel { fill: var(--ink); font: 600 14px var(--serif); }
svg .col { stroke: var(--grid-major); stroke-width: 6; opacity: 0; }
svg.drawing { cursor: crosshair; touch-action: manipulation; }
svg.drawing .col { opacity: 0.25; }
svg .handle { fill: var(--wv-drawn); }
svg .handle.set { stroke: var(--card); stroke-width: 1.5; }
svg .wrongcol { fill: var(--bad); opacity: 0.18; }
.legend { font-size: 0.9rem; margin: 4px 0 0; }
.k-main { color: var(--wv); font-weight: 600; } .k-part { color: var(--wv-in); font-weight: 600; } .k-part2 { color: var(--wv-ref); font-weight: 600; }

/* animations */
.anim { width: 100%; max-width: 640px; margin: 0 auto; }
.anim .frames { display: grid; gap: 6px; }
.anim-bar { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.anim-bar .play { min-width: 2.6em; }
.anim-bar input[type="range"] { flex: 1; accent-color: var(--accent); }
.anim-split { flex: 1; display: grid; gap: 4px; }
.anim-split label { display: flex; align-items: center; gap: 8px; }
.anim-split span { width: 1.2em; text-align: center; font-size: 1.1rem; }

/* options: four graphs */
.cands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0; }
.cand { position: relative; display: block; border: 1px solid var(--line); border-radius: 8px; 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; bottom: 6px; font-weight: 700; color: var(--accent); } /* clear of the axis names at the top */
.cand:hover { border-color: var(--accent); }
.cand:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cand:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cand.ok { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.cand.bad { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.qfb { color: var(--bad); margin: 0 0 10px; }
.qfb:empty { display: none; }
@media (max-width: 560px) { .cands { grid-template-columns: minmax(0, 1fr); } }

/* answers: a row of options per question */
#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); }
#draw-area .linklike { display: block; margin: 4px auto 0; }

/* the pictures of the problems */
svg.tb .wv-rope { fill: none; stroke: var(--wv); stroke-width: 2.6; stroke-linejoin: round; }
svg.tb .wv-arrow { fill: none; stroke: var(--ink); stroke-width: 2; }
svg.tb .wv-arrowhead { fill: var(--ink); }

/* arcade: manim's colours */
#arcade { --wv: #58c4dd; --wv-in: #83c167; --wv-ref: #f0ac5f; --grid: #1c1c1c; --grid-major: #333; }
#arcade .ar-opt .val svg.wave { width: 100%; max-width: 300px; }
