/* Rhythm strip (report 08 §4). Everything is in em of the strip's font size: 12 px in the header,
   the song font × 0.72 per part, 14 px in the theory panel. */

.rhythm-strip {
  display: inline-flex; align-items: flex-start; gap: .5em; vertical-align: top;
  background: var(--tabbg); border: 1px solid var(--edge); border-radius: 2px; padding: 8px 10px;
  color: var(--tx); line-height: 1;
}
.rhythm-strip.rs-headless { background: none; border: 0; padding: 0; }
.rs-bars { display: inline-flex; align-items: flex-start; }
.rs-bar { display: inline-flex; align-items: flex-start; }
.rs-bar + .rs-bar { border-left: 1px solid var(--tx3); }
.rs-pick .rs-bar { flex-direction: column; }
.rs-part { font: 600 .62em/1.6 var(--font-ui); color: var(--tx2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }

/* Strumming: one cell per step, accent row · symbol · count. */
.rs-cell { display: inline-flex; flex-direction: column; align-items: center; width: 1.35em; }
.rs-cell.rs-beat { border-left: 1px solid var(--edge); }
.rs-acc { height: .62em; display: flex; align-items: flex-end; justify-content: center; }
.rs-acc b { font: 700 .62em/1 var(--font-ui); color: var(--acct); }
.rs-sym { width: 1em; height: 1em; overflow: visible; display: block; }
.rs-stroke { fill: none; stroke: var(--tx); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rs-stroke.rs-accented { stroke: var(--acct); stroke-width: 2.6; }
.rs-tie-arc { fill: none; stroke: var(--tx2); stroke-width: 1.5; stroke-linecap: round; }
.rs-rest { fill: var(--tx3); }

/* Count row, shared by both kinds. */
.rs-cnt { font: .55em/1.6 var(--font-mono); color: var(--tx3); text-align: center; white-space: nowrap; font-variant-ligatures: none; }
.rs-cnt.rs-num { color: var(--tx2); }
.rs-cell .rs-cnt { width: calc(1.35em / .55); }
.rs-counts { display: inline-flex; }
.rs-counts .rs-cnt { width: calc(1.35em / .55); }
.rs-counts .rs-cnt.rs-beat { border-left: 1px solid var(--edge); }

/* Fingerpicking, notation (a): mini strings. */
.rs-strings { display: block; overflow: visible; }
.rs-string { stroke: var(--string); stroke-width: .8; vector-effect: non-scaling-stroke; }
.rs-beatline { stroke: var(--edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rs-note circle { stroke: none; }
.rs-note text { font: 700 7px var(--font-ui); text-anchor: middle; dominant-baseline: central; }
.rs-thumb circle { fill: var(--tx); }
.rs-thumb text { fill: var(--bg2); }
.rs-finger circle { fill: var(--acc); }
.rs-finger text { fill: var(--onacc); }

/* Narrow header: drop the count row, then keep only the first bar (report 08 §3 A). */
.rs-no-count .rs-cnt { display: none; }
.rs-one-bar .rs-bar + .rs-bar { display: none; }

/* ── Placements (report 08 §3) ─────────────────────────────────────────────── */

/* A · header: the Ritmo chip in row 1 … */
.rhythm-chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11px; background: none; cursor: default; }
button.rhythm-chip { cursor: pointer; }
button.rhythm-chip:hover { background: var(--hl); color: var(--tx); }
.rc-icon { display: inline-flex; font-size: 12px; }
.rc-icon svg { width: 1em; height: 1em; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rc-icon circle { fill: currentColor; stroke: none; }
.rc-sug { font-style: italic; opacity: .85; }
.rc-caret { color: var(--tx3); }
/* … and the strip in row 2, fixed 12 px, beside the structure strip; it shrinks after the structure strip does. */
.head-rhythm { flex: 0 1 auto; min-width: 0; height: 30px; overflow: hidden; display: flex; align-items: center; margin-left: auto;
  padding: 0; background: none; border: 0; border-radius: var(--r-ctl); color: inherit; font: inherit; }
button.head-rhythm { cursor: pointer; }
button.head-rhythm:hover { background: var(--hl); }
.head-rhythm .rs-holder, .head-rhythm > .rhythm-strip { display: inline-flex; }
.head-rhythm .rhythm-strip { align-items: center; }
.rs-compact .rs-cnt { display: none; } /* a compact fingerpicking strip has no room for its count row */

/* B · per part: above the part's first line, 0.72 × the song font (zooms with the song). */
.rhythm-part { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 10px; margin: 0 0 .5em; padding: 0; font-size: .72em;
  background: none; border: 0; color: inherit; text-align: left; }
button.rhythm-part { cursor: pointer; }
.rp-text { display: flex; flex-direction: column; min-width: 12em; font: 1em/1.4 var(--font-ui); padding-bottom: 4px; }
.rp-name { font-weight: 600; color: var(--tx); }
.rp-note { color: var(--tx3); }

/* Partitura: the strip once per part, then a chip for parts that repeat a pattern. */
.pt-rhythm { display: block; margin: 0 0 .45em; padding: 0; font-size: .72em; background: none; border: 0; color: inherit; }
button.pt-rhythm, button.pt-rhythm-chip { cursor: pointer; }
.pt-rhythm-chip { display: inline-block; margin: 0 0 .45em; font: 600 .62em/1.6 var(--font-ui); color: var(--tx2);
  border: 1px solid var(--edge); border-radius: var(--r-ctl); padding: 0 .5em; background: none; }

/* C · theory panel "Ritmo" block. */
.th-rhythm-name { font-weight: 600; margin-bottom: 6px; }
.th-rhythm-name em { font-weight: 400; color: var(--tx2); }
.th-rhythm-ts { font-weight: 400; color: var(--tx3); font-family: var(--font-mono); font-size: 11px; }
.th-rhythm-strip { display: block; padding: 0; margin: 0 0 8px; background: none; border: 0; color: inherit; }
button.th-rhythm-strip { cursor: pointer; }
.th-rhythm-hint { margin-top: 6px; }

/* ── Rhythm options (picker), report 08 §5 ────────────────────────────────── */
.menu.rhythm-picker { width: 400px; max-width: calc(100vw - 8px); min-width: 0; max-height: min(80vh, 640px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.rpk-sug { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.rpk-sug-head { font: 600 10px/1.6 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); margin-bottom: 6px; }
.rpk-sug-strip { margin-bottom: 6px; }
.rpk-sug-name { font-weight: 600; }
.rpk-sug-why, .rpk-sug-hint { color: var(--tx2); margin-top: 2px; }
.rpk-sug-actions { display: flex; gap: 8px; margin-top: 8px; }
.rpk-search { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.rpk-search-input { flex: 1; min-width: 0; height: 24px; padding: 0 8px; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx); font: inherit; }
.rpk-only { display: flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--tx2); }
.rpk-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 0; min-height: 60px; }
.rpk-group { font: 600 10px/1.6 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); padding: 6px 12px 2px; }
.rpk-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 12px; background: none; border: 0; color: var(--tx); font: inherit; text-align: left; cursor: pointer; }
.rpk-row:hover, .rpk-row:focus-visible { background: var(--hl); outline: none; }
.rpk-row.on { background: var(--sel); color: var(--seltx); }
.rpk-row.dim { opacity: .45; }
.rpk-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpk-ts { font-family: var(--font-mono); font-size: 11px; color: inherit; opacity: .75; }
.rpk-note { min-width: 52px; text-align: right; font-size: 11px; font-style: italic; opacity: .7; }
.rpk-empty { margin: 10px 12px; color: var(--tx2); }
.rpk-apply { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.rpk-label { font: 600 10px/1.6 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--tx3); }
.rpk-radio, .rpk-part { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rpk-parts { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.rpk-help { color: var(--tx3); font-size: 11px; }
.rpk-actions { display: flex; gap: 16px; padding: 8px 12px; border-top: 1px solid var(--line); }
.rhythm-picker input[type="radio"], .rhythm-picker input[type="checkbox"] { accent-color: var(--acc); }

/* ── Pattern editor dialog (report 08 §6) ──────────────────────────────────── */
.dialog.rhythm-editor { width: min(920px, calc(100vw - 40px)); max-width: none; display: flex; flex-direction: column; gap: 12px; }
.rpe-head { display: flex; align-items: center; gap: 14px; }
.rpe-title { margin: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpe-close { width: 24px; height: 24px; padding: 0; font-size: 16px; line-height: 1; }
.rpe-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.rpe-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--tx2); }
.rpe-field.rpe-grow { flex: 1 1 160px; }
.rpe-field.rpe-inline { flex-direction: row; align-items: center; gap: 8px; }
.rpe-name { width: 100%; }
.rpe-warn { color: var(--acct); font-size: 12px; }
.rpe-warn[hidden] { display: none; }
.rpe-preview-row { display: flex; align-items: center; gap: 12px; min-height: 40px; overflow-x: auto; }
.rpe-label, .rpe-fingers-label { font-size: 11px; color: var(--tx2); }
.rpe-fingers { align-self: flex-start; align-items: center; }
.rpe-fingers[hidden] { display: none; }
.rpe-fingers .rpe-fingers-label { padding: 0 8px; background: var(--bg2); border-right: 1px solid var(--edge); line-height: 24px; }
.rpe-fingers button { min-width: 32px; font: 700 12px var(--font-ui); }

/* Grids scroll sideways when a pattern is wider than the dialog (16ths, two bars). */
.rpe-grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.rpe-grid { display: flex; }
.rpe-col { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 2px; }
.rpe-beat { border-left: 1px solid var(--edge); }
.rpe-acc { width: 44px; height: 18px; padding: 0; border: 1px dashed var(--edge); border-radius: var(--r-ctl); background: none; color: var(--tx3); font: 700 11px/1 var(--font-ui); cursor: pointer; }
.rpe-acc.on { border-style: solid; border-color: var(--acc); background: var(--acc); color: var(--onacc); }
.rpe-step { width: 44px; height: 48px; padding: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--edge); border-radius: var(--r-ctl); background: var(--tabbg); color: var(--tx); cursor: pointer; }
.rpe-step:hover, .rpe-acc:hover { border-color: var(--tx3); }
.rpe-sym { font-size: 26px; display: inline-flex; }
.rpe-sym .rs-sym { width: 1em; height: 1em; }
.rpe-cnt { width: 44px; text-align: center; font: 11px/1.6 var(--font-mono); color: var(--tx3); }
.rpe-cnt.num { color: var(--tx2); }

.rpe-pick { display: flex; flex-direction: column; }
.rpe-row { display: flex; align-items: center; }
.rpe-string-name { width: 18px; flex: none; font: 11px var(--font-mono); color: var(--tx2); }
.rpe-cell { position: relative; width: 44px; height: 26px; flex: none; padding: 0; border: 0; margin: 0 2px; cursor: pointer;
  background: linear-gradient(var(--string), var(--string)) center / 100% 1px no-repeat; }
.rpe-cell:hover { background-color: var(--hl); }
.rpe-cell.rpe-beat { border-left: 1px solid var(--edge); }
.rpe-counts .rpe-cnt { margin: 0 2px; }
.rpe-dot { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font: 700 11px/1 var(--font-ui); }
.rpe-dot.thumb { background: var(--tx); color: var(--bg2); }
.rpe-dot.finger { background: var(--acc); color: var(--onacc); }

.rpe-help { margin: 0; font-size: 11px; color: var(--tx3); }
.rpe-hint { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-ctl); font-size: 12px; color: var(--tx2); }
.rpe-hint b { color: var(--tx); font-weight: 600; }
.rpe-footer { align-items: center; flex-wrap: wrap; }
.rpe-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.rhythm-editor input[type="checkbox"] { accent-color: var(--acc); }
