/* ---------- Head ---------- */
.ch-head { justify-content: space-between; }
.ch-title { font-family: var(--font-mono); font-size: var(--fs-lg); margin-top: var(--sp-1); }
.ch-title b { color: var(--accent); font-weight: 500; }
.ch-title .muted { font-family: var(--font-sans); font-size: var(--fs-sm); }
.ch-controls { display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: end; }

/* Shared with other tool pages; duplicated so this page needs only one stylesheet. */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg__btn { background: transparent; border: 0; padding: 0.35rem 0.7rem; font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); cursor: pointer; line-height: 1.3; }
.seg__btn + .seg__btn { border-left: 1px solid var(--line); }
.seg__btn:hover { background: var(--paper-2); color: var(--ink); }
.seg__btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.linklike { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* ---------- Tabs ---------- */
.ch-tabs { display: flex; gap: var(--sp-5); border-bottom: var(--rule); }
.ch-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: var(--sp-2) 0; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.ch-tab:hover { color: var(--ink); }
.ch-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Chord tones strip ---------- */
.ch-tones {
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 7.5rem));
  margin-top: var(--sp-5); border-top: 2px solid var(--ink); border-left: var(--rule); width: max-content; max-width: 100%;
}
.ch-tone { display: grid; gap: 2px; padding: var(--sp-3); border-right: var(--rule); border-bottom: var(--rule); }
.ch-tone__label { font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-lg); line-height: 1; }
.ch-tone__note { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-2); }
.ch-tone__name { font-size: var(--fs-xs); color: var(--ink-3); }
.ch-tone.is-root .ch-tone__label { color: var(--accent); }

/* ---------- Board ---------- */
.ch-board { padding: var(--sp-5) 0 var(--sp-2); }
.ch-caption { font-size: var(--fs-sm); color: var(--ink-2); min-height: 1.5em; margin-top: var(--sp-2); }
.ch-caption b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.ch-board .fb-marker:not(.is-new) circle { animation: none; }
.ch-board--build .fb-marker { cursor: pointer; }

/* ---------- Filters ---------- */
.ch-filters {
  display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-5); align-items: end;
  padding-top: var(--sp-3); border-top: var(--rule);
}
.ch-options { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; margin-left: auto; padding-bottom: 0.3rem; }
.ch-count { font-size: var(--fs-sm); margin: var(--sp-4) 0 var(--sp-2); }

/* ---------- Shape cards ---------- */
.ch-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr)); border-top: 2px solid var(--ink); border-left: var(--rule); }
.ch-shape {
  display: grid; justify-items: center; gap: var(--sp-1); padding: var(--sp-3) var(--sp-2) var(--sp-2);
  background: transparent; border: 0; border-right: var(--rule); border-bottom: var(--rule); cursor: pointer; text-align: center;
}
.ch-shape:hover { background: var(--paper-2); }
.ch-shape[aria-selected="true"] { background: var(--paper-2); box-shadow: inset 0 -3px 0 var(--accent); }
.ch-shape .chord-diagram { width: 100%; max-width: 7.25rem; }
.ch-shape__inv { font-size: var(--fs-xs); font-weight: 500; }
.ch-shape__tab { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); }
.ch-more { margin-top: var(--sp-4); }
.ch-keys { font-size: var(--fs-xs); margin-top: var(--sp-3); }

/* ---------- Chord box ---------- */
.chord-diagram { display: block; height: auto; overflow: visible; }
.cd-fret { stroke: var(--ink-3); stroke-width: 1; }
.cd-string { stroke: var(--ink-2); stroke-width: 1; }
.cd-nut { fill: var(--ink); }
.cd-pos { fill: var(--ink-3); font-family: var(--font-mono); font-size: 9px; text-anchor: end; dominant-baseline: central; }
.cd-open { fill: none; stroke: var(--ink-2); stroke-width: 1.3; }
.cd-open.is-root { stroke: var(--accent); stroke-width: 1.8; }
.cd-mute { fill: var(--ink-3); font-size: 11px; text-anchor: middle; dominant-baseline: central; }
.cd-barre { fill: var(--ink); }
.cd-dot { fill: var(--ink); }
.cd-dot.is-root { fill: var(--accent); }
.cd-finger { fill: var(--paper); font-family: var(--font-mono); font-size: 8.5px; font-weight: 500; text-anchor: middle; dominant-baseline: central; }
.cd-finger.is-root { fill: var(--accent-ink); }
.cd-label { fill: var(--ink-2); font-family: var(--font-mono); font-size: 8px; text-anchor: middle; dominant-baseline: central; }
.cd-label.is-root { fill: var(--accent); }

/* ---------- Name a chord ---------- */
.ch-result { padding: var(--sp-5) 0 0; min-height: 8.5rem; }
.ch-result__name { font-family: var(--font-mono); font-size: var(--fs-xxl); font-weight: 500; line-height: 1.05; }
.ch-result__name .muted { font-size: var(--fs-lg); }
.ch-result__desc { color: var(--ink-2); margin-top: var(--sp-2); }
.ch-result__notes { font-family: var(--font-mono); font-size: var(--fs-sm); margin-top: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); }
.ch-result__notes span { display: inline-grid; }
.ch-result__notes i { font-style: normal; color: var(--ink-3); font-size: var(--fs-xs); }
.ch-result__alt { font-size: var(--fs-sm); color: var(--ink-2); margin-top: var(--sp-3); }
.ch-result__alt a { font-family: var(--font-mono); color: var(--ink); text-decoration-color: var(--accent); }
.ch-result__actions { margin-top: var(--sp-3); }
.ch-result__empty { color: var(--ink-3); font-size: var(--fs-lg); }
.ch-build-hint { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; font-size: var(--fs-sm); padding-top: var(--sp-3); border-top: var(--rule); }

@media (max-width: 640px) {
  .ch-tones { width: 100%; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
  .ch-options { margin-left: 0; }
  .ch-keys, .ch-build-hint kbd { display: none; }
  .ch-shapes { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
}
