:root {
  --paper: var(--mood-light, #f5f3ee);
  --paper-hi: #fbfaf7;
  --ink: #1d1b18;
  --ink-2: #4a463f;
  --muted: #6b665e;
  --muted-2: #9a9488;
  --muted-3: #8f897d;
  --line: #d6d0c4;
  --line-2: #e2ddd2;
  --key-line: #bdb6a8;
  --sel: #ebe6dc;
  --diag: #ece8e0;
  --accent: oklch(0.56 0.16 35);
  --on-accent: #fff;
  --key-white: #fbfaf7;
  --key-black: #1d1b18;
  --glow: oklch(0.56 0.16 35 / .45);
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
a { color: var(--ink); }
a:hover { color: #8a5a2b; }
input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }

.page {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 40px clamp(16px, 4vw, 56px) 96px;
  display: flex;
  flex-direction: column;
  gap: 56px;
  max-width: 3200px;
  margin: 0 auto;
  transition: background-color 1.6s ease;
  font-variant-numeric: tabular-nums;
}

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }

/* Header */
.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 22px;
}
.header-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.eyebrow-row { display: flex; gap: 16px; align-items: baseline; position: relative; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.chord-name { font-family: var(--serif); font-size: clamp(44px, 6.5vw, 80px); line-height: 1; letter-spacing: -.01em; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.summary { font-family: var(--serif); font-style: italic; font-size: 26px; text-align: right; }
.buttons { display: flex; gap: 8px; }
.btn { padding: 8px 16px; border-radius: 2px; }
.btn-accent { border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-outline { border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.btn-outline:hover { background: var(--sel); }
.link-button { border: none; background: transparent; color: var(--muted); text-decoration: underline; padding: 0; font-size: 11px; }

/* Settings popover */
.settings {
  position: absolute;
  top: 24px;
  left: 0;
  z-index: 10;
  background: var(--paper-hi);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 12px 16px;
  align-items: center;
  min-width: 320px;
}
.settings label { color: var(--muted); font-size: 12px; }
.settings input[type=range] { width: 100%; accent-color: var(--accent); }
.settings .note { grid-column: 1 / -1; color: var(--muted); font-size: 11px; max-width: 44ch; margin: 0; }

/* Sections */
.section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section-head { display: flex; gap: 12px; align-items: baseline; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.section-head .num { color: var(--muted); }
.section-head .rule { flex: 1; border-bottom: 1px solid var(--line); }
.section-head .hint { color: var(--muted); text-transform: none; letter-spacing: 0; }

/* Keyboard */
.keyboard { position: relative; height: 136px; display: flex; user-select: none; border-left: 1px solid var(--key-line); }
.white-key {
  flex: 1; min-width: 0;
  border: 1px solid var(--key-line); border-left: none;
  background: var(--key-white);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6px; font-size: 10px; color: var(--muted-2);
  cursor: pointer; border-radius: 0 0 3px 3px;
}
.white-key.on { background: var(--accent); color: var(--on-accent); }
.black-key {
  position: absolute; top: 0; height: 62%;
  background: var(--key-black); border: 1px solid var(--key-black);
  border-radius: 0 0 3px 3px; cursor: pointer;
}
.black-key.on { background: var(--accent); }

.input-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.note-input {
  flex: 1 1 240px; min-width: 0;
  font: inherit; font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--ink);
  background: var(--paper-hi); color: var(--ink);
  border-radius: 2px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 6px 10px; border: 1px solid var(--key-line); white-space: nowrap; flex-shrink: 0; background: transparent; color: var(--ink); border-radius: 2px; }
.chip.on { background: var(--ink); color: var(--paper); }
.clear { font-size: 12px; padding: 6px 10px; border: 1px solid transparent; background: transparent; color: var(--muted); text-decoration: underline; }

.empty { padding: 48px 0; color: var(--muted); font-family: var(--serif); font-size: 22px; }

/* Analysis grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 56px 48px; }

/* Readings */
.readings { display: flex; flex-direction: column; gap: 2px; }
.reading { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 8px 16px; padding: 12px 14px; cursor: pointer; border-radius: 2px; }
.reading:hover, .reading.on { background: var(--sel); }
.reading-name { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.prob { display: flex; align-items: center; gap: 8px; }
.prob-track { flex: 1; height: 4px; background: var(--line-2); }
.prob-fill { height: 100%; background: var(--accent); }
.prob-pct { width: 38px; text-align: right; }
.tones { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.tone { display: flex; gap: 5px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); flex-shrink: 0; }
.dot-lg { width: 10px; height: 10px; }
.tones .sub { margin-left: auto; color: var(--muted); }
.footnote { margin: 0; color: var(--muted); max-width: 60ch; text-wrap: pretty; }
.identity { margin: 0; color: var(--ink-2); }

/* Interval table */
.scroll-x { overflow-x: auto; }
.iv-table { min-width: 470px; display: grid; grid-template-columns: 72px 52px minmax(0, 1fr) 56px 68px 60px; column-gap: 6px; }
.iv-table .th { padding: 6px 0; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--ink); }
.iv-table .td { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.iv-table .r { text-align: right; }
.iv-table .note { display: flex; align-items: center; gap: 8px; }
.iv-table .deg { font-family: var(--serif); font-size: 17px; line-height: 1.2; }

/* Matrix */
.caption-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.toggle-label { display: flex; gap: 8px; align-items: center; }
.matrix { display: grid; gap: 2px; min-width: 360px; }
.cell { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 2px; }
.cell .t { font-weight: 500; }
.cell .s { font-size: 10px; opacity: .75; }
.legend { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.legend .ramp { flex: 0 1 220px; height: 8px; background: linear-gradient(90deg, oklch(0.97 0.02 35), oklch(0.62 0.14 35)); }
.legend .src { margin-left: auto; }

/* Segmented toggle */
.segmented { display: flex; flex-shrink: 0; border: 1px solid var(--ink); border-radius: 2px; overflow: hidden; }
.segmented button { font-size: 12px; padding: 5px 10px; border: none; white-space: nowrap; flex-shrink: 0; background: transparent; color: var(--ink); }
.segmented button.on { background: var(--ink); color: var(--paper); }

/* Character */
.tags { display: flex; flex-direction: column; }
.tag { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.tag .w { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.2; }
.tag .why { color: var(--ink-2); text-wrap: pretty; }
.character-lower { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; align-items: start; padding-top: 8px; }
.axes { display: flex; flex-direction: column; gap: 9px; }
.axis { display: grid; grid-template-columns: 92px minmax(0, 1fr) 30px; gap: 10px; align-items: center; }
.axis-track { height: 6px; background: var(--line-2); }
.axis-fill { height: 100%; background: var(--ink); }
.axis .v { text-align: right; color: var(--muted); }

.va { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.va-mid { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: center; }
.va-label { font-size: 11px; color: var(--muted); }
.va-box { position: relative; flex: 1 1 auto; max-width: 340px; width: 100%; aspect-ratio: 1; border: 1px solid var(--ink); background: var(--paper-hi); }
.va-v { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.va-h { position: absolute; top: 50%; left: 0; right: 0; border-top: 1px dashed var(--line); }
.ref-dot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.ref-dot .d { width: 6px; height: 6px; border-radius: 50%; background: var(--key-line); }
.ref-dot .l { font-size: 9px; color: var(--muted-3); white-space: nowrap; }
.va-dot {
  position: absolute; width: 14px; height: 14px; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--accent);
  border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--accent);
}

/* Waveform */
.wave-section { display: flex; flex-direction: column; gap: 16px; margin-top: 56px; }
.wave-top { display: flex; flex-wrap: wrap; gap: 24px 40px; align-items: flex-end; justify-content: space-between; }
.stats { display: flex; flex-wrap: wrap; gap: 20px 40px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.toggles { display: flex; gap: 12px; flex-wrap: wrap; }
.plot { width: 100%; display: block; background: var(--paper-hi); border: 1px solid var(--line); }
.plot text { font-family: var(--mono); font-size: 10px; }
.plot .lane { fill: none; stroke: color-mix(in oklch, var(--ink) 75%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plot .base { stroke: var(--line-2); stroke-width: 1; }
.plot .sum-base { stroke: var(--line); stroke-width: 1; }
.plot .sum { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.plot .marker { stroke: color-mix(in oklch, var(--ink) 40%, transparent); stroke-dasharray: 3 4; stroke-width: 1; }
.plot .label { fill: var(--ink); }
.plot .mlabel { fill: var(--muted); }
.wave-caption { margin: 0; color: var(--muted); max-width: 80ch; text-wrap: pretty; }
.settings .segmented { justify-self: start; }

/* Dissonance curve */
.curve-head { display: flex; justify-content: space-between; font-size: 11px; margin-top: 8px; }
.curve { width: 100%; height: auto; display: block; background: var(--paper-hi); border: 1px solid var(--line); }
.curve text, .plot text { font-family: var(--mono); font-size: 10px; }
.curve .curve-line { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.curve .curve-dot { fill: var(--accent); stroke: var(--paper); stroke-width: 1.5; }
.curve .marker, .plot .marker { stroke: color-mix(in oklch, var(--ink) 40%, transparent); stroke-dasharray: 3 4; stroke-width: 1; }
.curve .base { stroke: var(--line); }
.curve .mlabel { fill: var(--muted); }
.grid { stroke: var(--line-2); stroke-width: 1; }

/* Spectrum */
.plot .partial { stroke: var(--ink); stroke-width: 2; }
.plot .join { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 2 2; }
.plot .jlabel { fill: var(--accent); font-size: 9px; }

/* Neighbours */
.nb-table { min-width: 620px; display: grid; grid-template-columns: 84px repeat(4, minmax(0, 1fr)); gap: 2px; }
.nb-table .th { padding: 6px 0; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--ink); }
.nb-table .th.c { text-align: center; }
.nb-table .note { display: flex; align-items: center; gap: 8px; padding: 10px 0; }
.nb-cell { display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: 2px; color: var(--ink); }
.nb-cell:hover { background: var(--sel); }
.nb-cell.empty-cell { color: var(--muted-2); justify-content: center; }
.nb-sym { font-family: var(--serif); font-size: 19px; line-height: 1.1; }
.nb-bar { height: 3px; background: var(--line-2); display: block; }
.nb-fill { height: 100%; background: var(--ink); display: block; }
.nb-delta { font-size: 10px; color: var(--muted); }

.black-key { display: flex; align-items: flex-end; justify-content: center; }
.black-key .klabel { font-size: 8px; color: var(--on-accent); padding-bottom: 4px; letter-spacing: -.02em; white-space: nowrap; }

/* Pitch-class clocks */
.identity-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; align-items: start; }
.identity-row .identity { grid-column: 1 / -1; }
.clock { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.clock svg { width: 100%; max-width: 300px; height: auto; display: block; }
.clock figcaption { font-size: 12px; color: var(--muted); }
.clock-ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.clock-poly { fill: color-mix(in oklch, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 2; }
.clock-label { font-family: var(--mono); font-size: 9px; fill: var(--muted-2); }
.clock-label.on { fill: var(--ink); font-weight: 500; }
.clock-dot { fill: var(--ink); }
.clock-dot.root { fill: var(--accent); }
.clock-bass { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.midi-status { font-size: 12px; color: var(--muted); padding: 6px 4px; }

/* Harmonic entropy overlay */
.curve .he-line { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 2; opacity: .7; }

/* Information */
.info { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 16px 40px; align-items: start; }
@media (max-width: 800px) { .info { grid-template-columns: 1fr; } }
.info-score { display: flex; flex-direction: column; gap: 4px; }
.info-score .k { font-size: 11px; color: var(--muted); }
.info-score .v { font-family: var(--serif); font-size: 56px; line-height: 1; }
.info-score .muted { font-size: 11px; max-width: 32ch; }
.info-rows { display: flex; flex-direction: column; }
.info-row { display: grid; grid-template-columns: 140px minmax(80px, 160px) 130px minmax(0, 1fr); gap: 4px 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
@media (max-width: 800px) { .info-row { grid-template-columns: 120px 1fr 110px; } .info-why { grid-column: 1 / -1; } }
.info-value { text-align: right; }
.info-why { color: var(--muted); font-size: 12px; text-wrap: pretty; }

/* Larger exploration views */
.plot text, .curve text { font-size: 11px; }
.plot .jlabel { font-size: 10px; }
.plot .partial { stroke-width: 3; }
.grid.strong { stroke: var(--line); }
.curve-plot .rough-fill { fill: oklch(0.62 0.14 35 / .10); }
.curve-plot .curve-line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.curve-plot .he-line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 5 3; }
.curve-plot .curve-dot { fill: var(--ink); stroke: var(--paper-hi); stroke-width: 2; }
.curve-plot .he-dot { fill: var(--accent); stroke: var(--paper-hi); stroke-width: 1.5; }
.curve-plot .base { stroke: var(--line); }
.legend .swatch { width: 22px; height: 0; border-top: 2px solid var(--ink); display: inline-block; }
.legend .swatch.dashed { border-top: 2px dashed var(--accent); margin-left: 12px; }
.clock-label { font-size: 15px; }


/* ── Dark theme: follows the system unless the settings force one. ── */
:root[data-theme="dark"] {
  --paper: var(--mood-dark, #161412); --paper-hi: #1e1b18; --ink: #ece6da; --ink-2: #cdc5b7;
  --muted: #9d9588; --muted-2: #756e63; --muted-3: #847c70;
  --line: #3a352f; --line-2: #2b2723; --key-line: #4a443c;
  --sel: #2a2622; --diag: #221f1c;
  --accent: oklch(0.66 0.15 38); --on-accent: #fff;
  --key-white: #d8d1c4; --key-black: #0f0e0d; --glow: oklch(0.7 0.16 38 / .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: var(--mood-dark, #161412); --paper-hi: #1e1b18; --ink: #ece6da; --ink-2: #cdc5b7;
    --muted: #9d9588; --muted-2: #756e63; --muted-3: #847c70;
    --line: #3a352f; --line-2: #2b2723; --key-line: #4a443c;
    --sel: #2a2622; --diag: #221f1c;
    --accent: oklch(0.66 0.15 38); --on-accent: #fff;
    --key-white: #d8d1c4; --key-black: #0f0e0d; --glow: oklch(0.7 0.16 38 / .55);
    color-scheme: dark;
  }
}
body { background: var(--paper); color: var(--ink); transition: background-color 1.6s ease; }

/* Roughness ramp as a function of --r, per theme (used via background: var(--ramp)). */
.cell.rough { --ramp: oklch(calc(0.97 - 0.35 * var(--r)) calc(0.02 + 0.12 * var(--r)) 35); --ramp-fg: #1d1b18; }
.cell.rough.hot { --ramp-fg: #fff; }
:root[data-theme="dark"] .cell.rough { --ramp: oklch(calc(0.27 + 0.36 * var(--r)) calc(0.02 + 0.13 * var(--r)) 35); --ramp-fg: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cell.rough { --ramp: oklch(calc(0.27 + 0.36 * var(--r)) calc(0.02 + 0.13 * var(--r)) 35); --ramp-fg: var(--ink); }
}

/* ── Playable things ── */
.playable, .iv-row, .tag, .ref-dot, .clock-label, .hit, .join-group, .curve-dot, .staff { cursor: pointer; }
.cell.playable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.iv-row { display: contents; }
.iv-row:hover > .td { background: var(--sel); }
.tag { transition: background .12s; border-radius: 2px; }
.tag:hover { background: var(--sel); }
.tag:hover .w { color: var(--accent); }
.ref-dot:hover .d { background: var(--accent); transform: scale(1.5); }
.ref-dot:hover .l { color: var(--ink); }
.clock-label:hover { fill: var(--accent); }
.plot .hit { fill: transparent; }
.plot .hit:hover { fill: color-mix(in oklch, var(--accent) 7%, transparent); }
.join-hit { stroke: transparent; stroke-width: 12; }
.join-group:hover .join { stroke-width: 2.5; }
.join-group:hover .jlabel { font-weight: 600; }
.curve-dot:hover { r: 8; }
.chip:hover:not(.on) { background: var(--sel); }
.nb-cell { transition: background .12s; }

/* Sounding keys glow while a sound plays. */
.white-key, .black-key { transition: box-shadow .15s, background .15s; }
.white-key.sounding, .black-key.sounding { box-shadow: 0 0 0 2px var(--accent), 0 0 18px 4px var(--glow); z-index: 2; }
.white-key.sounding:not(.on) { background: color-mix(in oklch, var(--accent) 35%, var(--key-white)); }
.black-key.sounding:not(.on) { background: color-mix(in oklch, var(--accent) 60%, var(--key-black)); }
.white-key { position: relative; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.kdeg { font-family: var(--serif); font-size: 13px; line-height: 1; }
.white-key.on .kdeg { color: var(--on-accent); }
.black-key .kdeg { font-size: 10px; color: var(--on-accent); margin-bottom: 2px; }
.black-key { flex-direction: column; }

/* ── Staff notation in the header ── */
.header-staff { flex: 0 0 auto; align-self: center; }
.staff { width: 190px; height: auto; display: block; }
.staff:hover .notehead { stroke: var(--accent); }
.staff-line { stroke: var(--muted-2); stroke-width: 1; }
.clef { fill: var(--ink); font-family: 'Noto Music', 'Bravura', 'Apple Symbols', 'Segoe UI Symbol', serif; }
.accidental { fill: var(--ink); font-family: 'Noto Music', var(--serif); font-size: 17px; }
.notehead { fill: none; stroke: var(--ink); stroke-width: 2.4; transition: stroke .15s; }

/* Header polish */
.chord-name { transition: color .2s; }
.header { position: relative; }
.header::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 96px; background: var(--accent);
}


/* ── Responsive: use all the width there is ── */
.wide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 820px), 1fr)); gap: 56px 48px; align-items: start; }
.wide-grid > .wave-section, .wide-grid > .section { margin-top: 0; min-width: 0; }
.keyboard { height: clamp(112px, 8vw, 190px); }
@media (min-width: 2000px) {
  .page { font-size: 14px; }
  .chord-name { font-size: 96px; }
}
@media (max-width: 640px) {
  .page { gap: 40px; padding-top: 24px; }
  .header { gap: 16px; }
  .header-right { align-items: flex-start; }
  .summary { text-align: left; font-size: 22px; }
  .header-staff { order: 3; }
  .staff { width: 150px; }
  .reading { grid-template-columns: minmax(0, 1fr) 96px; padding: 10px; }
  .reading-name { font-size: 22px; }
  .tag { grid-template-columns: 1fr; gap: 2px; }
  .identity-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat .v { font-size: 22px; }
  .settings { min-width: 0; width: calc(100vw - 32px); grid-template-columns: 1fr; }
  .white-key { font-size: 8px; }
  .kdeg { font-size: 10px; }
}


/* ── Pitch-class space ── */
.stack { display: flex; flex-direction: column; gap: 56px; min-width: 0; }
.ps-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.ps-fact { display: flex; flex-direction: column; gap: 2px; }
.ps-fact .k { font-size: 11px; color: var(--muted); }
.ps-fact .v { font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.ps-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px 32px; }
.ps-title { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.bars { display: grid; gap: 4px; height: 150px; }
.bars-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.bars-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: transparent; padding: 0; color: var(--ink); min-width: 0; }
.bar:disabled { cursor: default; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 2px 2px 0 0; overflow: hidden; }
.bar-fill { width: 100%; background: var(--key-line); transition: height .3s ease; }
.bar.present .bar-fill { background: var(--ink); }
.bar.chosen .bar-fill { background: var(--accent); }
.bar:not(:disabled):hover .bar-track { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar-label { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar.present .bar-label, .bar.chosen .bar-label { color: var(--ink); }
.bar-count { font-size: 11px; font-variant-numeric: tabular-nums; }

.readings + .ps-chart .bars { height: 200px; }

.va-label.in { position: absolute; font-size: 10px; color: var(--muted-2); pointer-events: none; }
.va-label.tl { top: 4px; left: 6px; }
.va-label.tr { top: 4px; right: 6px; }
.va-label.bl { bottom: 4px; left: 6px; }
.va-label.br { bottom: 4px; right: 6px; }
