/* The charts and their controls (chart.js), on the home page and the mic pages. The pages bring their own
   colours (--page, --surface, --ink, --ink-2, --muted, --border, --accent); these are the chart's own. */
:root {
  --grid: #e1e0d9; --grid-minor: #efeee9; --axis: #c3c2b7;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grid: #2c2c2a; --grid-minor: #222221; --axis: #383835;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  --grid: #2c2c2a; --grid-minor: #222221; --axis: #383835;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

/* Angle and Distance: a small drawing at the right of the label, and scale marks under the slider. */
.field-pos .cap { display: flex; align-items: center; min-height: 36px; }
.field-pos .cap .cap-val { margin-left: 0.35em; }
.pos-viz { width: 40px; height: 38px; margin-left: auto; flex: none; overflow: visible; }
#distViz { width: 168px; height: 31px; flex: 0 1 168px; min-width: 70px; } .field-pos .cap .cap-val { white-space: nowrap; }
.pos-track input { display: block; }
/* The angle's drawing sits at the right, beside both the label and the slider. */
#angleField { position: relative; } .angle-row { padding-right: 82px; }
.pos-viz.angle-viz { position: absolute; right: 0; top: -2px; width: 74px; height: 70px; margin: 0; }
.pv-pattern { fill: var(--accent); fill-opacity: 0.08; stroke: var(--accent); stroke-opacity: 0.35; stroke-width: 0.6; }
.pv-mic { fill: var(--ink-2); } .pv-grille { fill: var(--muted); }
.pv-src { fill: var(--accent); } .pv-wave { stroke: var(--accent); stroke-width: 1; fill: none; stroke-linecap: round; opacity: 0.6; }
.pv-ring { fill: none; stroke: var(--muted); stroke-width: 0.6; stroke-dasharray: 1.5 2; opacity: 0.6; }
.pv-arc { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0.5; }
.pv-line { stroke: var(--muted); stroke-width: 0.7; stroke-dasharray: 1.5 2; opacity: 0.7; } .pv-tick { stroke: var(--muted); stroke-width: 0.8; opacity: 0.7; }
/* Marks sit under the thumb's path: it travels from 8px to (100% − 8px). */
.pos-ticks { position: relative; height: 14px; margin-top: 4px; font-size: 0.66rem; color: var(--muted); pointer-events: none; }
.pos-ticks span { position: absolute; top: 0; white-space: nowrap; line-height: 1; }
.pos-ticks span:first-child { left: 0; } .pos-ticks span:last-child { right: 0; }
.pos-ticks .pos-mark { left: calc(8px + (100% - 16px) * var(--at)); transform: translateX(-50%); }
.dist-reset { border: none; background: none; padding: 0 3px; margin: 0 0 0 2px; min-height: 0; height: auto; color: var(--accent); font-size: 1.15em; line-height: 1; vertical-align: baseline; cursor: pointer; text-transform: none; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--page); }
.seg button { border: none; background: none; border-radius: 6px; padding: 3px 12px; font-size: 0.85rem; color: var(--ink-2); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg.small { margin: 0; align-self: start; }
.seg.small button { padding: 2px 12px; }
.field input[type=range] { width: 100%; height: 30px; margin: 0; accent-color: var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--muted); margin-top: -4px; padding: 0 2px; font-variant-numeric: tabular-nums; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dots { display: flex; align-items: center; justify-content: space-between; height: 30px; max-width: 190px; }
.dot-btn { width: 30px; height: 30px; padding: 0; border: none; background: none; display: grid; place-items: center; border-radius: 50%; }
.dot-btn span { display: block; border-radius: 50%; border: 1.5px solid var(--muted); box-sizing: border-box; }
.dot-btn.on span { background: var(--accent); border-color: var(--accent); }
.dot-btn:hover span { border-color: var(--ink-2); }
.cap-val { text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.tip .prox { font-size: 0.72rem; color: var(--muted); text-align: right; margin-top: -2px; }
.field .cap { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field select { width: 100%; height: 30px; }
.field .row { display: flex; gap: 6px; align-items: center; color: var(--ink-2); font-size: 0.9rem; }
.field .row select { flex: 1; min-width: 0; }
.chart-wrap { position: relative; }
.chart-wrap > svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
svg text { font: 11px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg .inlabel { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
svg .direct { font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 0.8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); white-space: nowrap; display: none; z-index: 2;
}
.tip .f { font-weight: 600; margin-bottom: 4px; }
.tip.below { left: 8px; right: 8px; white-space: normal; z-index: 5; pointer-events: auto; cursor: pointer; }
.tip.below::after { content: '×'; position: absolute; top: 5px; right: 10px; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.tip.below .f { padding-right: 20px; }
.tip.below .row > span:first-child { min-width: 0; }
.tip .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip .v { font-variant-numeric: tabular-nums; color: var(--ink); }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; flex: none; }
svg .ot-num { fill: var(--muted); font-size: 9.5px; }
/* The chart's less-used settings sit behind a button, so the chart comes first. */
.settings-btn { margin-left: auto; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 15px; background: var(--surface); color: var(--ink-2); font-size: 0.85rem; cursor: pointer; }
.settings-btn::after { content: '▾'; font-size: 1em; line-height: 1; color: var(--muted); }
.settings-btn[aria-expanded="true"]::after { content: '▴'; }
.settings-btn.changed::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.settings-btn { display: inline-flex; }
/* The nearest note in the readout: a tag in the note's colour (chart.js, noteColor), and the cents off it. */
.tip .note { white-space: nowrap; color: #fff; padding: 1px 6px 2px; border-radius: 5px; }
.tip .cents { font-weight: 400; font-size: 0.7rem; color: var(--muted); }
sub.oct { font-size: 0.72em; vertical-align: -0.08em; line-height: 0; }
svg tspan.oct { font-size: 0.75em; }
