/* v2 builder styles — scoped under .uzv2 (page-level body/:root rules re-scoped to the builder root). Generated; visual scoping polish is Cowork's browser pass. */
/* proto.css — app shell for the interactive prototype. Reuses uz.css tokens &
   component classes (.chip, .barcell, .lanes, .seltools, .modeswitch, …) and
   adds only shell layout, the tab stave, per-line playhead, and transitions. */

.uzv2 { margin: 0; background: linear-gradient(180deg, var(--cream-1), var(--cream-2)); font-family: 'Outfit', sans-serif; color: var(--ink); }
.uzv2.dark-mode { background: linear-gradient(180deg, #1d2027, #16181f); color: #e6e2d8; }

.appwrap { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.apphead { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.apptitle { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; }
.apptitle em { color: var(--gold); font-style: normal; }
.apptitle .badge { font-family: 'Outfit'; font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: #fff; background: var(--ink-btn); border-radius: 10px; padding: 3px 8px; vertical-align: 3px; margin-left: 4px; }
.backlink { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--gold-deep); text-decoration: none; }
.backlink:hover { text-decoration: underline; }

.transport-card { margin: 0 0 16px; }
.t-keysel { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.t-keysel select { font-family: 'Outfit'; font-size: 12.5px; font-weight: 700; color: var(--ink); border: 1px solid var(--input-border); background: var(--surface-2); border-radius: 8px; padding: 5px 8px; }
.t-chip.mini { padding: 6px 10px; cursor: pointer; user-select: none; }
.t-chip.mini.on { background: var(--ink-btn); color: #fff; border-color: var(--ink-btn); }
.bpm-range { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 2px; background: #d8cdb1; outline: none; }
.bpm-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.bpm-range::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--gold); cursor: pointer; }
.sharebar { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sharetoken { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: #877f6f; background: #fbf7ec; border: 1px solid #efe7d4; border-radius: 8px; padding: 7px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark-mode .sharetoken { background: var(--dk-card); border-color: var(--dk-border); color: #9aa0ad; }

.transport-card, .palette, .linecard { transition: background .2s; }
.dark-mode .uzcard { background: var(--dk-card); border-color: var(--dk-border); box-shadow: none; }
.dark-mode .uzlabel { color: #8d93a2; }

/* ---- lines ---- */
.lines { display: flex; flex-direction: column; gap: 14px; margin: 0 0 16px; }
.linecard { background: var(--card); border: 1px solid #eee6d6; border-radius: 12px; box-shadow: 0 1px 3px rgba(90,75,40,0.06); padding: 12px 16px 14px; }
.dark-mode .linecard { background: var(--dk-card); border-color: var(--dk-border); box-shadow: none; }
.linecard.current { box-shadow: 0 0 0 2px var(--gold), 0 1px 3px rgba(90,75,40,0.06); }
.linebody { margin-top: 2px; }
.lineheader { padding: 2px 0 10px; flex-wrap: wrap; gap: 8px; }
.lh-btn { white-space: nowrap; }
.modeswitch span { white-space: nowrap; }
.dark-mode .lineheader, .dark-mode .lh-name { color: #e6e2d8; }
.addline { align-self: flex-end;   /* sits under the line's × controls instead of a confusing full-width-left bar */ font-size: 12.5px; font-weight: 600; color: var(--gold-deep); border: 1px dashed #e0d4b2; border-radius: 14px; padding: 8px 16px; cursor: pointer; background: var(--surface-2); }
.dark-mode .addline { background: var(--dk-btn); border-color: var(--dk-border-soft); }

/* chip interactions */
.chip { cursor: pointer; transition: box-shadow .15s, transform .1s; }
.chip.anatomy3 { gap: 8px; }
/* variant-3 = diagram-first: diagram leads inline-left (override uz.css absolute) */
.chip.anatomy3 .chord-shape-btn { position: static; bottom: auto; right: auto; flex: none; }
.chip.anatomy3 .minidiag { width: 26px; height: 33px; }
.chip.anatomy3 .durbadge { left: auto; right: 6px; }
.chip.short .durbadge { right: auto; left: 6px; }
.chip.short .shapedot { top: 4px; bottom: auto; right: 5px; }
.chip:hover:not(.sel) { box-shadow: 0 2px 8px rgba(80,65,30,0.14); }
.chip .durbadge { cursor: pointer; }
.chip .handle { cursor: ew-resize; touch-action: none; }
.chip.tie { display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(90deg, rgba(200,160,74,0.06) 0 7px, transparent 7px 14px); border-style: dashed; cursor: default; }
.chip.tie .tiemark { font-size: 11px; font-weight: 600; color: var(--gold-deep); opacity: 0.8; }

/* timeline strip */
.tl-strip { flex: 1 1 0%; min-width: 0; height: 60px; border-radius: 0; background: transparent; border: none; background-image: none; }

/* ---- unified lane panel + continuous bar gridlines ---- */
/* R1-4: overflow must NOT be hidden/clip here — it would make .tl-inner the sticky containing block
   and the lane gutters (string/lane labels) would scroll off with the content, looking like the tab
   "drifting". With visible overflow the sticky gutters pin to the single .tl-scroll, so all three
   lanes stay bar-locked and their labels stay put. */
.tl-inner { background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; position: relative; overflow: visible; }
.dark-mode .tl-inner { background: var(--dk-panel); border-color: var(--dk-border); }
.tl-inner .lanerow { position: relative; z-index: 1; }
.tl-grid { position: absolute; left: var(--gut); right: 0; top: 0; bottom: 0; z-index: 0; pointer-events: none; }
.tl-grid span { position: absolute; top: 0; bottom: 0; width: 1px; }
.tl-grid span.beat { background: #efe8d6; }
.tl-grid span.bar { background: #cdc2a6; width: 1.5px; }
.dark-mode .tl-grid span.beat { background: #23262f; }
.dark-mode .tl-grid span.bar { background: #3a3f4c; }
.tl-inner .bigruler { border-bottom: 1px solid #d4cbb2; }

/* ---- empty / blank bars ---- */
.chip.blank { background: transparent; border: 1.5px dashed #ddd3bd; box-shadow: none; flex-direction: column; gap: 1px; color: #b3a98a; }
.chip.blank:hover { border-color: var(--gold); background: rgba(200,160,74,0.04); }
.chip.blank.sel { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200,160,74,0.45); }
.chip.blank .blankplus { font-size: 17px; font-weight: 400; line-height: 1; color: #c5bca3; }
.chip.blank .blanklbl { font-size: 9px; font-weight: 600; letter-spacing: 0.04em; }
.dark-mode .chip.blank { border-color: var(--dk-border-soft); color: #6d7484; }
.barcell.addbar { cursor: pointer; }
.chip.addbarbtn { background: transparent; border: 1.5px dashed #e0d4b2; box-shadow: none; color: var(--gold-deep); font-weight: 700; font-size: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.chip.addbarbtn:hover { background: rgba(200,160,74,0.06); border-color: var(--gold); }

/* ---- timeline zoom + scroll ---- */
.tl-zoombar { display: flex; align-items: center; gap: 8px; padding: 2px 10px; flex-wrap: nowrap; }
.zoomhint { font-size: 11px; color: #b0a78d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoombtn { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--input-border); background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 14px; line-height: 22px; text-align: center; cursor: pointer; user-select: none; }
.zoombtn:hover { background: #faf3e2; }
.zoomval { font: 700 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); min-width: 38px; text-align: center; }
.addbar-btn { flex: none; font-size: 11.5px; font-weight: 600; color: var(--gold-deep); border: 1px dashed #e0d4b2; border-radius: 13px; padding: 5px 12px; cursor: pointer; background: var(--surface-2); }
.addbar-btn:hover { background: rgba(200,160,74,0.06); border-color: var(--gold); }
.dark-mode .zoombtn, .dark-mode .addbar-btn { background: var(--dk-btn); border-color: var(--dk-border-soft); color: #b8bdc9; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.tl-scroll .lane-gutter, .tl-scroll .lane-label { position: sticky; left: 0; z-index: 4; background: var(--surface-1); }
.dark-mode .tl-scroll .lane-gutter, .dark-mode .tl-scroll .lane-label { background: var(--dk-panel); }
.fillhint { font-size: 11px; font-style: italic; color: var(--gold-deep); margin-left: 8px; }

/* tab-note editor + paste/loop chrome */
.tabedit .fretval { font: 700 13px/1 ui-monospace, Menlo, monospace; color: var(--ink); min-width: 18px; text-align: center; }
.dark-mode .tabedit .fretval { color: #e6e2d8; }
.lh-btn.paste { color: var(--gold-deep); border-color: #e3d4ae; background: #fdf8ec; }
.dark-mode .lh-btn.paste { background: #2a2a1f; border-color: #5a4f2f; color: #e0c878; }
.t-chip.mini.loopbtn.on { background: var(--gold); color: #fff; border-color: var(--gold); }

/* per-line playheads */
.stacked-ph { position: absolute; width: 2px; background: var(--red); box-shadow: 0 0 6px rgba(192,57,43,0.45); z-index: 6; pointer-events: none; }
.barcell.activebar { background: rgba(200,160,74,0.06); }

/* derive tag spacing inside lanes already styled in uz.css */
.acceptbtn { cursor: pointer; }

/* floating snap label during resize-drag */
.snaplbl-float { position: fixed; z-index: 999; font: 700 11px/1 'Outfit'; color: #fff; background: var(--ann); border-radius: 8px; padding: 5px 9px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

/* hint + reset + toast */
.hintbar { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 4px 2px 0; }
.hintbar b { color: var(--ink); } .dark-mode .hintbar b { color: #e6e2d8; }
.resetlink { color: var(--gold-deep); font-weight: 600; cursor: pointer; margin-left: 6px; }
.uz-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); background: var(--ink-btn); color: #fff; font-size: 13px; font-weight: 600; padding: 10px 18px; border-radius: 22px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1000; box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
.uz-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* selected editor row spacing */
.seltools { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dark-mode .seltools { border-color: var(--dk-border); }
/* chord editor sits under the header → read it as an attached toolbar */
.linecard > .seltools { margin: 4px 0 2px; padding: 9px 11px; border-top: none; border-radius: 9px;
  background: rgba(200,160,74,0.06); border: 1px solid rgba(200,160,74,0.22); }
.dark-mode .linecard > .seltools { background: rgba(200,160,74,0.10); border-color: rgba(200,160,74,0.28); }
.dark-mode .st-btn { background: var(--dk-btn); border-color: var(--dk-border-soft); color: #b8bdc9; }
.dark-mode .st-btn.on { background: var(--gold); border-color: var(--gold); color: #1d2027; }

/* palette */
.palette { margin-bottom: 14px; }

/* per-line loop toggle + select mode */
.lh-btn.loop.on { background: var(--gold); color: #fff; border-color: var(--gold); }
.t-chip.mini.selbtn.on { background: var(--ann); color: #fff; border-color: var(--ann); }
.select-mode .chip:not(.blank):not(.tie):not(.addbarbtn) { cursor: pointer; }
.select-mode .chip:not(.blank):not(.tie):not(.addbarbtn)::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 13px; height: 13px; border-radius: 4px;
  border: 1.5px solid #c7bda3; background: #fff; z-index: 3; }
.select-mode .chip.sel::after { content: '✓'; background: var(--gold); border-color: var(--gold); color: #fff;
  font: 700 9px/12px 'Outfit', sans-serif; text-align: center; }
.dark-mode.select-mode .chip::after { background: #2a2e38; border-color: #4a4e58; }

/* ============================================================= v3 surfaces */
/* ---- real chord-shape fingering grid on chips ---- */
.shape-grid { position: relative; display: block; width: 34px; height: 42px; flex: none; }
.sd-markers { position: absolute; left: 0; right: 0; top: 0; height: 9px; }
.sd-mk { position: absolute; transform: translateX(-50%); font-size: 8px; line-height: 9px; color: #8a7f63; }
.sd-fb { position: absolute; left: 0; right: 0; top: 10px; bottom: 0; border-top: 2px solid #6b5f44;
  background-image: repeating-linear-gradient(180deg, transparent 0 7.6px, #cabf9f 7.6px 8.6px),
    repeating-linear-gradient(90deg, transparent 0 5.6px, #cabf9f 5.6px 6.6px); }
.sd-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }
.dark-mode .sd-fb { border-color: #cfc6ae; } .dark-mode .sd-dot { background: #e0c878; }
.chord-shape-btn.add { opacity: 0.5; }
.chord-shape-btn.add:hover { opacity: 1; }

/* ---- compact per-lane toolbars (expand on hover/focus) ---- */
.lane-toolbar { position: sticky; left: 0; z-index: 5; display: flex; align-items: center; width: max-content;
  flex-wrap: wrap; padding: 5px 8px; margin: 10px 0 6px; gap: 5px; background: #faf6ec; border: 1px solid var(--line); border-radius: 10px; }
.lane-ico { width: 56px; flex: none; text-align: center; font-size: 13px; color: var(--gold-deep); }
.mel-tb-btn { font: 600 10.5px/1 'Outfit', sans-serif; color: #6f685a; border: 1px solid #e8e1cf; background: var(--surface-2);
  border-radius: 11px; padding: 4px 8px; cursor: pointer; white-space: nowrap; }
.mel-tb-btn:hover { background: #faf3e2; }
.mel-tb-btn.on { background: var(--ink-btn); color: #fff; border-color: var(--ink-btn); }
.dark-mode .mel-tb-btn { background: var(--dk-btn); border-color: var(--dk-border-soft); color: #b8bdc9; }
.dark-mode .mel-tb-btn.on { background: var(--gold); border-color: var(--gold); color: #1d2027; }

/* ---- melody scale-degree grid ---- */
.mel-lane, .tab-lane { position: relative; z-index: 1; }
.mel-gridwrap, .tab-gridwrap { display: flex; align-items: stretch; }
.mel-gutter, .tab-gutter { width: var(--gut); flex: none; position: sticky; left: 0; z-index: 4; background: var(--surface-1); }
.dark-mode .mel-gutter, .dark-mode .tab-gutter { background: var(--dk-panel); }
.mel-rlabel { position: absolute; left: 0; right: 6px; display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  font: 600 9.5px/1 ui-monospace, Menlo, monospace; color: #a39a85; border-bottom: 1px solid #f1ebdb; }
.mel-rlabel .rg-deg { font-weight: 700; color: #b8ad92; min-width: 8px; text-align: center; }
.mel-rlabel .rg-nm { color: #7d7560; }
.mel-rlabel.tonic { color: var(--gold-deep); font-weight: 700; }
.mel-rlabel.tonic .rg-deg, .mel-rlabel.tonic .rg-nm { color: var(--gold-deep); }
.dark-mode .mel-rlabel { color: #8d93a2; border-color: #262a34; } .dark-mode .mel-rlabel.tonic { color: #e0c878; }
.dark-mode .mel-rlabel .rg-nm { color: #9aa0ad; }

/* per-bar chord/scale tone reference pills */
.mel-tones { display: flex; align-items: stretch; margin-top: 4px; }
.mel-tone-gut { width: var(--gut); flex: none; position: sticky; left: 0; z-index: 4; background: var(--surface-1); }
.dark-mode .mel-tone-gut { background: var(--dk-panel); }
.mtone-bar { min-width: 0; border-left: 1px solid #e3dbc8; padding: 4px 8px 4px 6px; display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; overflow: hidden; }
/* R1-5: a bar with 2-3 chords stacks its tone sets compactly (one per row), shrunk to fit */
.mtone-bar.multi { flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; flex-wrap: nowrap; }
.mtone-set { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; min-width: 0; }
.mtone-bar.multi .mtone-set { gap: 2px; }
.mtone-bar.multi b { font-size: 8.5px; margin-right: 2px; }
.mtone-bar.multi .tp { font-size: 8px; padding: 1px 3px; }
.dark-mode .mtone-bar { border-color: #2f3340; }
.mtone-bar b { font: 700 10px/1 'Outfit', sans-serif; color: var(--gold-deep); margin-right: 3px; }
.mtone-bar .tp { font: 700 9px/1 ui-monospace, Menlo, monospace; border-radius: 5px; padding: 2px 5px; }
.mtone-bar .tp.ct { background: rgba(111,207,134,0.28); color: #2f6f43; }
.mtone-bar .tp.sc { background: rgba(232,184,74,0.22); color: #8a6a16; }
.dark-mode .mtone-bar .tp.ct { background: rgba(111,207,134,0.22); color: #8fdba2; }
.dark-mode .mtone-bar .tp.sc { background: rgba(232,184,74,0.18); color: #e8c873; }
.mel-grid { position: relative; flex: 1; min-width: 0; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(180deg, #f1ebdb 1px, transparent 1px); }
.dark-mode .mel-grid { background-image: linear-gradient(180deg, #21242d 1px, transparent 1px); }
.mel-tints { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.mel-tint { position: absolute; }
.mel-tint.ct { background: rgba(94, 200, 120, 0.13); }
.mel-tint.sc { background: rgba(232, 184, 74, 0.10); }
.mel-note { position: absolute; z-index: 2; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font: 700 10px/1 'Outfit', sans-serif; cursor: grab; box-shadow: 0 1px 2px rgba(80,65,30,0.18); border: 1px solid rgba(0,0,0,0.06); }
.mel-note .mel-lbl { pointer-events: none; }
.mel-note .mel-rz { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: ew-resize; border-radius: 0 7px 7px 0; }
.mel-note.tier-chord { background: var(--tier-chord); color: #14361f; }
.mel-note.tier-scale { background: var(--tier-scale); color: #3a2c08; }
.mel-note.tier-outside { background: var(--tier-outside); color: #3a120c; }
.mel-note.tier-passing { background: var(--tier-passing); color: #2a1740; }
.mel-note.offgrid { opacity: 0.55; outline: 1px dashed var(--muted); }
.mel-note.sel { outline: 2px solid var(--ann); outline-offset: 1px; }
/* R1-6/R1-7: marquee box for box-selecting notes */
.mel-marquee, .tab-marquee { position: absolute; z-index: 6; border: 1.5px dashed var(--gold, #c8a04a); background: rgba(200,160,74,0.12); pointer-events: none; border-radius: 3px; }
.mel-note.ghost { background: transparent; border: 1.5px dashed #b3a98a; color: #9a907a; box-shadow: none; cursor: pointer; }
.ghost-actions { display: flex; gap: 6px; align-items: center; margin: 8px 0 0 var(--gut); }
.melnote-edit .fretval, .tabedit .fretval { font: 700 13px/1 ui-monospace, Menlo, monospace; min-width: 16px; text-align: center; color: var(--ink); }
.dark-mode .melnote-edit .fretval { color: #e6e2d8; }

/* ---- tab stave (tier-graded) ---- */
/* F1: override production styles.css's old-tab-editor `.tab-grid { overflow-x:auto }` (class collision)
   and mirror .mel-grid's touch-action:none — otherwise the v2 tab grid is its OWN touch scroll container
   and a swipe on it scrolls the tab independently of the shared .tl-scroll. Now the only horizontal
   scroller in Timeline mode is .tl-scroll; swipes on the tab grid drive note-draw/marquee (like melody). */
.tab-grid { position: relative; flex: 1; min-width: 0; cursor: crosshair; background-repeat: repeat-x; overflow: visible; touch-action: none; }
.dark-mode .tab-grid { background-image: repeating-linear-gradient(180deg, var(--dk-border-soft) 0 1px, transparent 1px 18px) !important; }
.tab-rlabel { position: absolute; left: 0; right: 6px; text-align: right; font: 600 10px/1 ui-monospace, Menlo, monospace; color: #a39a85; display: flex; align-items: center; justify-content: flex-end; }
.tab-mark { position: absolute; transform: translate(-50%, -50%); z-index: 3; font: 700 12px/1 ui-monospace, Menlo, monospace;
  color: #5a5240; background: var(--surface-1); padding: 0 3px; border-radius: 4px; cursor: pointer;
  min-width: 16px; height: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px rgba(120,100,50,0.08); }
.dark-mode .tab-mark { color: #cfc6ae; background: var(--dk-panel); }
.tab-mark:hover { box-shadow: 0 0 0 1.5px var(--gold); }
.tab-mark.ghost { color: #b3a98a; font-style: italic; }
.tab-mark.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.tab-mark.multisel { outline: 2px solid var(--gold); outline-offset: 1px; background: rgba(200,160,74,0.18); }
.tab-mark.tier-chord { color: var(--tier-chord-ink); } .tab-mark.tier-scale { color: var(--tier-scale-ink); }
.tab-mark.tier-outside { color: var(--tier-outside-ink); } .tab-mark.tier-passing { color: var(--tier-passing-ink); }
.tab-mark.offneck { color: var(--tier-outside-ink); opacity: 0.7; }
.tab-mark .artic { font-size: 8px; font-weight: 700; color: var(--gold-deep); }
/* tab hover-to-enter cell */
.tab-hover { position: absolute; transform: translateX(-50%); top: 0; bottom: 0; z-index: 1; pointer-events: none;
  background: rgba(200,160,74,0.16); border-left: 1px solid rgba(200,160,74,0.5); border-right: 1px solid rgba(200,160,74,0.5); }

/* ---- functional palette + mode tabs ---- */
.palette-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.palette-head .uzlabel { flex: 1; }
.pal-group { margin: 0 0 10px; }
.pal-grouplbl { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; color: #b3a98a; text-transform: uppercase; margin: 0 0 6px; }
.pal-hint { font-weight: 600; letter-spacing: 0; text-transform: none; color: #b8ad92; font-style: italic; }
.pal-row { display: flex; gap: 7px; flex-wrap: wrap; }
.pal-btn { border: 1px solid var(--input-border); background: #fff; border-radius: 10px; padding: 7px 12px; font-weight: 700; font-size: 13px; color: var(--gold-deep); cursor: pointer; box-shadow: 0 1px 2px rgba(80,65,30,0.06); white-space: nowrap; }
.pal-btn:hover { border-color: var(--gold); }
.pal-btn .deg { font-size: 9.5px; color: var(--muted); font-weight: 600; margin-left: 5px; }
.dark-mode .pal-btn { background: var(--dk-btn); border-color: var(--dk-border-soft); color: #e0c878; }
.modeswitch.tiny span { font-size: 9.5px; padding: 4px 9px; }
.modeswitch.keymode span { font-size: 11px; padding: 6px 11px; }
.modeswitch.keymode { flex: none; }

/* category tints reuse uz.css; ensure palette buttons echo them */
.pal-btn.cat-secdom { border-style: dashed; }
.pal-btn.cat-lydian { border-color: #b8a0d4; } .pal-btn.cat-mixo { border-color: #a0c4d4; }
.pal-btn.cat-phryg { border-color: #d4a0a0; } .pal-btn.cat-borrowed { border-color: #ccc; }
.pal-btn.cat-dom { border-color: #d4c090; }

/* responsive 390 */
@media (max-width: 560px) {
  .appwrap { padding: 16px 12px 50px; }
  .lineheader { gap: 6px; }
  .modeswitch span { padding: 5px 8px; font-size: 10px; }
  .transport { gap: 8px; }
  .bpm-range { width: 80px; }
  .t-keysel { font-size: 11px; }
}


/* === v2 feedback fixes (13 Jun) === */
/* clearer separation between Chords / Tab / Melody lanes */
/* tab fret marks read as small chips and never clip at the gutter */
.dark-mode .tab-mark { background: #262a34; }
.tab-fret-input { width: 22px; border: none; background: transparent; text-align: center; font: 700 12px/1 ui-monospace, Menlo, monospace; color: inherit; padding: 0; outline: none; -moz-appearance: textfield; }
.tab-fret-input::-webkit-outer-spin-button, .tab-fret-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* === v2 optimisation pass (13 Jun) — structural fixes (override earlier rules) === */
.uzv2 { --gut: 58px; --red: #c0392b; --line-soft: #ece3cf; }

/* ONE shared ruler: chord lane must sit flush on the shared grid like tab/melody —
   kill its padding / border / own gridlines so chords line up with bar lines + notes */
.tl-inner .tl-strip { padding: 0; border: none; background: transparent; background-image: none; }
.lane-ico { width: var(--gut); }

/* timeline playhead — was invisible (no CSS); span all open lanes */
.ph.tl-ph { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--red); z-index: 6; pointer-events: none; box-shadow: 0 0 6px rgba(192,57,43,0.45); }

/* lane separators: solid hairline (not dashed — dashed is reserved for "add") */
.tab-lane, .mel-lane { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.dark-mode .tab-lane, .dark-mode .mel-lane { border-top-color: var(--dk-border); }

/* chip: fingering diagram is now a plain visual; edit moves to a small corner pip */
.chip { position: relative; }
.chip.anatomy3 { min-height: 66px; }
.shape-grid-wrap { flex: none; display: flex; align-items: center; }
.shape-grid-wrap.muted { opacity: 0.4; }
.chip.anatomy3 .chord-shape-btn { position: absolute; top: 3px; right: 4px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; padding: 0; font-size: 14px; line-height: 1; color: #a98432; background: #faf3e2; border: 1px solid #d9c07a; border-radius: 8px; opacity: 0.9; cursor: pointer; z-index: 3; }
.chip.anatomy3 .chord-shape-btn:hover { opacity: 1; color: var(--gold-deep); box-shadow: 0 1px 4px rgba(160,130,50,0.3); }
/* timeline insert cursor — where the next library pick will land */
.tl-insertmark { position: absolute; top: 0; bottom: 0; width: 2px; background: #c8a04a; pointer-events: none; z-index: 2; }
.tl-insertmark .tl-insertplus { position: absolute; top: -4px; left: -9px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; background: #c8a04a; color: #fff; font: 700 13px/1 'Outfit', sans-serif; border-radius: 50%; box-shadow: 0 1px 4px rgba(120,95,30,0.35); }
.tl-strip { cursor: copy; }
.tl-strip .chip-pos { cursor: default; }

/* bigger touch targets (≈44px effective via padding box) */
.chip .durbadge { min-width: 22px; min-height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.chip .acc { min-width: 20px; min-height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.mel-note .mel-rz { width: 12px; }

/* === v2 feedback round 2 (13 Jun) — overrides win (appended last) === */
/* #1 #7 undo the min-height that double-stacked toolbar buttons; hug the text */
.mel-tb-btn, .st-btn, .lh-btn { min-height: 0; line-height: 1.1; }

.mel-slots { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.mel-slots span { position: absolute; top: 0; bottom: 0; width: 1px; background: #efe8d7; }
.mel-slots span.bar { background: #cdc2a6; }
.dark-mode .mel-slots span { background: #23262f; }
.dark-mode .mel-slots span.bar { background: #3a3f4d; }
.mel-grid .mel-tints, .mel-grid .mel-note { position: absolute; }

/* #5 pan arrows sit in the zoom bar like the zoom buttons */
.tl-zoombar .zoomgap { width: 12px; display: inline-block; }

/* #11 share = a normal button */
.share-btn { cursor: pointer; }

/* #9 inline note editor row (under the header, fixed width — not in the scroll) */
.noteed-inline { margin: 6px 0 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; overflow-x: auto; }
.noteed-inline .seltools { flex-wrap: nowrap; }
.dark-mode .noteed-inline { background: var(--dk-card); border-color: var(--dk-border); }

/* #9 compact dropdown for grouped options (articulation) */
.uz-select { border: 1px solid var(--input-border); background: #fdfaf2; border-radius: 8px; padding: 5px 8px; font: 600 12px 'Outfit', sans-serif; color: var(--ink); cursor: pointer; }
.dark-mode .uz-select { background: #262a34; border-color: #3a3f4d; color: #e7e1d2; }

/* === builder-intrinsic gaps (13 Jun) === */
.lh-rename { cursor: pointer; opacity: 0.45; font-size: 12px; margin-left: 2px; padding: 2px 4px; border-radius: 6px; }
.lh-rename:hover { opacity: 1; background: rgba(200,160,74,0.12); }
.lh-name-input { font: 700 16px 'Outfit', sans-serif; color: var(--ink); border: 1px solid var(--gold); border-radius: 8px; padding: 3px 8px; background: var(--surface-2); max-width: 180px; }
.dark-mode .lh-name-input { background: var(--dk-card); color: #ece5d6; }

/* #3 more space around the timeline edges */
.linecard .linebody { padding: 2px 10px 10px; }

/* === free-floating chord model (13 Jun) === */
.chords-abs { position: relative; height: 84px; }
.chip-pos { position: absolute; top: 0; bottom: 0; padding: 0 2px; box-sizing: border-box; }
.chip-pos > .chip { width: 100%; height: 100%; box-sizing: border-box; cursor: grab; }
.chip .handle { position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize; border-radius: 0 9px 9px 0; background: linear-gradient(90deg, transparent, rgba(200,160,74,0.25)); }
.chip-pos > .chip:active { cursor: grabbing; }

/* stacked = positioned chips over a bar grid */
.stacked-scroll { overflow-x: auto; overflow-y: visible; padding-bottom: 2px; }
.stacked-wrap { position: relative; }
.bargrid-bg { display: grid; gap: 0; height: 92px; }
.stacked-wrap .barcell { border: 1px solid var(--line); border-left: none; background: var(--surface-1); position: relative; }
.stacked-wrap .barcell:first-child { border-left: 1px solid var(--line); border-radius: 9px 0 0 9px; }
.stacked-wrap .barcell:last-child { border-radius: 0 9px 9px 0; }
.stacked-wrap .barnum { position: absolute; top: 5px; left: 7px; font: 700 9px 'Outfit', sans-serif; letter-spacing: .08em; color: #b3a98a; }
.chips-abs { position: absolute; left: 0; right: 0; top: 0; height: 92px; }
.chips-abs .chip-pos { top: 18px; bottom: 6px; }
.dark-mode .stacked-wrap .barcell { background: var(--dk-card); border-color: var(--dk-border); }
.stacked-addrow { margin-top: 8px; }

.meter-select { margin-left: 4px; padding: 4px 6px; font-size: 11px; }

/* === feedback round 4 (13 Jun) === */
/* lane toolbars become solid boxes above their lane (were faded floaters) */
.dark-mode .lane-toolbar { background: #23262f; border-color: var(--dk-border); }

/* === unified per-modality toolbars (13 Jun) === */
.lane-tag { font: 700 11px 'Outfit', sans-serif; letter-spacing: .06em; color: var(--gold-deep); text-transform: uppercase; padding-right: 6px; display: inline-flex; align-items: center; white-space: nowrap; }
.tb-div { flex-basis: 100%; height: 0; margin: 5px 0 1px; border-top: 1px dashed var(--line); }
.lane-toolbar .seltools { width: 100%; padding-top: 3px; flex-wrap: wrap; }
.seltools > .lane-tag { margin-right: 4px; }

/* chord-shape fingering editor (inline, under the chord toolbar) */
.shape-editor { margin: 4px 0 2px; padding: 9px 11px; border-radius: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgba(200,160,74,0.06); border: 1px solid rgba(200,160,74,0.22); }
.dark-mode .shape-editor { background: rgba(200,160,74,0.10); border-color: rgba(200,160,74,0.28); }
.shape-editor .lane-tag { margin-right: 4px; }
.shr-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.shr { display: inline-flex; align-items: center; gap: 3px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.shr.muted { opacity: 0.55; }
.shr-lbl { font: 700 10px/1 ui-monospace, Menlo, monospace; color: var(--muted); width: 12px; text-align: center; }
.shr-val { font: 700 12px/1 ui-monospace, Menlo, monospace; color: var(--ink); min-width: 14px; text-align: center; }
.st-btn.mini { padding: 4px 7px; font-size: 11px; min-height: 0; }
.st-btn.mini.mute { color: #a04030; }
.dark-mode .shr { background: var(--dk-btn); border-color: var(--dk-border); }
.dark-mode .shr-val { color: #e6e2d8; }
/* Undercover Zest — chord builder v2 design-session styles.
   Tokens mirror production styles.css: cream gradient, ink #333, gold #c8a04a,
   Outfit/Playfair. Category tints are the exact production values. */

.uzv2 {
  --ink: #333;
  --gold: #c8a04a;
  --gold-deep: #a98432;
  --muted: #8a8378;
  --cream-1: #fbf7ee;
  --cream-2: #f1ead9;
  --line: #e7e0d2;
  --card: #ffffff;
  --red: #c0392b;
  --ann: #4a6fa5;
  --surface-1: #fffdf8;   --surface-2: #fffdf6;
  --tier-chord: #6fcf86;  --tier-scale: #e8b84a;  --tier-outside: #df7d6f;  --tier-passing: #b79ad8;
  --tier-chord-ink: #2f8a4c; --tier-scale-ink: #b3892a; --tier-outside-ink: var(--red); --tier-passing-ink: #7d57b0;
  --dk-panel: #1f222b; --dk-card: #20232c; --dk-btn: #232732; --dk-border: #343845; --dk-border-soft: #3c4150;
  --ink-btn: #2b2b2b; --input-border: #e6dec9;
}

/* ---------- product card chrome ---------- */
.uzcard {
  background: var(--card); border: 1px solid #eee6d6; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(90, 75, 40, 0.06); padding: 14px 16px;
}
.uzlabel {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted);
  text-transform: uppercase; margin: 0 0 10px; white-space: nowrap;
}

/* ---------- transport ---------- */
.transport { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.transport > span { white-space: nowrap; }
.t-loop {
  background: var(--gold); color: #fff; font-weight: 700; font-size: 14px;
  border-radius: 22px; padding: 9px 20px; box-shadow: 0 2px 6px rgba(200, 160, 74, 0.4);
}
.t-loop.stop { background: var(--red); box-shadow: 0 2px 6px rgba(192, 57, 43, 0.35); }
.t-pill { background: var(--ink-btn); color: #fff; font-weight: 600; font-size: 12.5px; border-radius: 18px; padding: 8px 14px; }
.t-chip { background: #faf5e9; color: var(--ink); font-weight: 600; font-size: 12.5px; border: 1px solid #eee4cf; border-radius: 18px; padding: 7px 13px; }
.t-bpm { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.t-slider { position: relative; width: 110px; height: 4px; border-radius: 2px; background: #3a372f; }
.t-slider::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 34%; border-radius: 2px; background: var(--gold); }
.t-slider::after {
  content: ''; position: absolute; left: 34%; top: 50%; width: 12px; height: 12px;
  border-radius: 50%; background: var(--gold); transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---------- line block + header ---------- */
.lineblock { margin: 0 0 18px; }
.lineblock.current { box-shadow: 0 0 0 2px var(--gold); border-radius: 12px; padding: 8px 10px 10px; background: rgba(255, 253, 246, 0.6); }
.lineheader { display: flex; align-items: center; gap: 9px; padding: 2px 2px 8px; }
.lh-grip { color: #c5bca8; font-size: 13px; letter-spacing: -2px; cursor: grab; }
.lh-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.lh-name .caret { color: #cfc7b2; font-weight: 400; }
.lh-bars {
  font-size: 10.5px; font-weight: 700; color: var(--muted); background: #f3eddd;
  border-radius: 10px; padding: 3px 9px; letter-spacing: 0.04em; white-space: nowrap;
}
.lh-spacer { flex: 1; }
.lh-btn {
  font-size: 11.5px; font-weight: 600; color: #6f685a; border: 1px solid #e8e1cf;
  background: var(--surface-2); border-radius: 14px; padding: 4px 10px; cursor: pointer;
}
.lh-btn.on { background: var(--ink-btn); color: #fff; border-color: var(--ink-btn); }

/* ---------- bar grid (stacked layout) ---------- */
.barcell {
  position: relative; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 23px 6px 13px; min-width: 0;
}
.barcell.cmp { padding: 21px 5px 10px; }
.barnum {
  position: absolute; top: 5px; left: 8px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--muted); white-space: nowrap;
}
.barnum.ghostnum { left: calc(50% + 8px); color: #c9c1ad; }

/* playhead */
.ph {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red);
  box-shadow: 0 0 6px rgba(192, 57, 43, 0.45); z-index: 4;
}

/* ---------- chips ---------- */
.chip {
  position: relative; height: 100%; width: 100%; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #fff; border: 1px solid #ddd; border-radius: 9px;
  box-shadow: 0 1px 2px rgba(80, 65, 30, 0.07); cursor: pointer;
}
.chip .chip-id { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 0; }
.chip .nm { font-weight: 700; font-size: 15px; line-height: 1.15; white-space: nowrap; color: var(--gold-deep); }
.chip .rm { font-size: 10.5px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.chip .acc { position: absolute; top: 3px; right: 6px; font-size: 10.5px; color: var(--gold-deep); line-height: 1; }
.chip .shapedot { position: absolute; bottom: 3px; right: 6px; font-size: 11px; color: #b39344; line-height: 1; padding: 4px; cursor: pointer; }
.chip .chord-shape-btn { position: absolute; bottom: 4px; right: 5px; border: none; background: none; padding: 0; line-height: 0; cursor: pointer; }
.cmp .chip .nm, .chip.short .nm { font-size: 13.5px; }
.chip.narrow { gap: 4px; }

.chip.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200, 160, 74, 0.55), 0 2px 8px rgba(200, 160, 74, 0.28); }
.chip .handle {
  position: absolute; right: 3px; top: 22%; bottom: 22%; width: 4px; border-radius: 2px;
  background: var(--gold);
}
/* left-edge handle (R1-3): mirror of the right nub — drags the chord start, end fixed */
.chip .handle-l { left: 3px; right: auto; }
/* widen both handles' touch target without changing the visible nub */
.chip .handle::before { content: ""; position: absolute; top: -22%; bottom: -22%; left: -5px; right: -5px; }
.chip.playing { background: #fdf3df !important; border-color: var(--gold); }
.chip.preglow { box-shadow: 0 0 0 2px rgba(200, 160, 74, 0.28), 0 0 12px rgba(200, 160, 74, 0.35); }
.chip.ghost { opacity: 0.38; border-style: dashed; box-shadow: none; background: transparent; }
.chip.ghost .nm { color: var(--muted); }

/* category tints — exact production values (light) */
.cat-borrowed { border-color: #ccc; background: rgba(200, 200, 210, 0.12); }
.cat-lydian { border-color: #b8a0d4; background: rgba(184, 160, 212, 0.10); }
.cat-mixo { border-color: #a0c4d4; background: rgba(160, 196, 212, 0.10); }
.cat-phryg { border-color: #d4a0a0; background: rgba(212, 160, 160, 0.10); }
.cat-dom { border-color: #d4c090; background: rgba(200, 160, 74, 0.08); }
.cat-secdom { border-color: #ccc; border-style: dashed; background: rgba(200, 200, 210, 0.08); }
.cat-outside { border-color: rgba(255, 120, 80, 0.5); box-shadow: 0 0 8px rgba(255, 120, 80, 0.25); }

/* ---------- dark mode (minor keys) — exact production values ---------- */
.darkwrap {
  background: linear-gradient(180deg, #1d2027, #16181f); color: #e6e2d8;
}
.dark .bargrid, .darkwrap .bargrid { background: var(--dk-panel); border-color: var(--dk-border); }
.dark .barcell, .darkwrap .barcell { border-color: var(--dk-border); }
.dark .barnum, .darkwrap .barnum { color: #8d93a2; }
.dark .ticks, .darkwrap .ticks {
  background-image: linear-gradient(var(--dk-border-soft), var(--dk-border-soft)), linear-gradient(var(--dk-border-soft), var(--dk-border-soft)), linear-gradient(var(--dk-border-soft), var(--dk-border-soft));
}
.dark .chip, .darkwrap .chip { background: #2a2e38; border-color: #4a4e58; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.dark .chip .nm, .darkwrap .chip .nm { color: #e0c878; }
.dark .chip .rm, .darkwrap .chip .rm { color: #9aa0ad; }
.darkwrap .cat-borrowed { border-color: #4a4e58; background: rgba(255, 255, 255, 0.04); }
.darkwrap .cat-lydian { border-color: #5c4080; background: rgba(92, 64, 128, 0.15); }
.darkwrap .cat-mixo { border-color: #2a6070; background: rgba(42, 96, 112, 0.15); }
.darkwrap .cat-phryg { border-color: #803030; background: rgba(128, 48, 48, 0.15); }
.darkwrap .cat-dom { border-color: #6a5520; background: rgba(200, 160, 74, 0.10); }
.darkwrap .cat-secdom { border-color: #4a4e58; border-style: dashed; background: rgba(255, 255, 255, 0.02); }
.darkwrap .cat-outside { border-color: rgba(255, 120, 80, 0.4); box-shadow: 0 0 10px rgba(255, 120, 80, 0.2); }
.darkwrap .lineheader { color: #e6e2d8; }
.darkwrap .lh-name { color: #e6e2d8; }
.darkwrap .lh-bars { background: #2a2e38; color: #9aa0ad; }
.darkwrap .lh-btn { background: var(--dk-btn); border-color: var(--dk-border-soft); color: #b8bdc9; }
.darkwrap .uzcard { background: var(--dk-card); border-color: var(--dk-border); box-shadow: none; }
.darkwrap .uzlabel { color: #8d93a2; }

/* ---------- strip (Direction B) ---------- */
.strip-body {
  position: relative; display: flex; gap: 0; padding: 5px; height: 84px;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px;
  background-image:
    linear-gradient(#eee7d7, #eee7d7), linear-gradient(#eee7d7, #eee7d7), linear-gradient(#eee7d7, #eee7d7);
  background-size: 1px 100%; background-repeat: no-repeat;
  background-position: 25% 0, 50% 0, 75% 0;
}
.strip-body .chipslot { flex: none; padding: 0 1px; }

/* ---------- selected-chip editor row ---------- */
.seltools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.seltools .who { font-weight: 700; font-size: 14px; margin-right: 8px; white-space: nowrap; }
.seltools .lbl { white-space: nowrap; }
.seltools .st-btn { white-space: nowrap; }
.seltools .lbl { color: var(--muted); font-weight: 600; }
.st-btn {
  border: 1px solid var(--input-border); background: #fdfaf2; border-radius: 15px;
  padding: 6px 12px; font-weight: 600; font-size: 12px; color: var(--ink); cursor: pointer;
}
.st-btn.on { background: var(--ink-btn); color: #fff; border-color: var(--ink-btn); }
.st-btn.danger { color: #a04030; background: #faf1ee; border-color: #ecd9d2; }

/* ---------- palette ---------- */
.pal-btn {
  border: 1px solid var(--input-border); background: #fff; border-radius: 10px; padding: 8px 13px;
  font-weight: 700; font-size: 13px; color: var(--gold-deep); cursor: pointer;
  box-shadow: 0 1px 2px rgba(80, 65, 30, 0.06);
}
.pal-btn .deg { font-size: 9.5px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.pal-btn.dashed { border-style: dashed; }
.pal-input { border: 1px solid var(--input-border); background: var(--surface-2); border-radius: 10px; padding: 8px 13px; font-size: 12.5px; color: #b9b09a; min-width: 64px; }

/* ---------- shared-ruler board lanes ---------- */
.lanes { position: relative; }
.lane-gutter { width: var(--gut); flex: none; }
.lanerow { display: flex; align-items: stretch; }
.bigruler {
  flex: 1; display: flex; height: 24px; border-bottom: 2px solid #cfc6ae;
}
.bigruler span {
  flex: 1; border-left: 1px solid #d8d0bc; font-size: 11px; font-weight: 700;
  color: var(--muted); padding: 3px 0 0 7px; letter-spacing: 0.06em; position: relative;
  background-image: linear-gradient(#e4dcc8, #e4dcc8), linear-gradient(#e4dcc8, #e4dcc8), linear-gradient(#e4dcc8, #e4dcc8);
  background-size: 1px 6px; background-repeat: no-repeat;
  background-position: 25% 100%, 50% 100%, 75% 100%;
}
.lane-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: #b0a78d;
  text-transform: uppercase; writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; justify-content: center; width: var(--gut);
}
/* mini chord diagram (renderMiniChordDiagram analogue) */
.minidiag {
  position: relative; width: 26px; height: 32px; flex: none;
  background:
    repeating-linear-gradient(90deg, #b8ad92 0 1px, transparent 1px 8.5px),
    repeating-linear-gradient(180deg, #b8ad92 0 1px, transparent 1px 7.5px);
  background-size: 100% 100%; border-radius: 2px;
}
.minidiag i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink); transform: translate(-50%, -50%);
}
.darkwrap .minidiag i, .dark .minidiag i { background: #e0c878; }

/* underbar duration meter (anatomy variant 2) */
.durbadge {
  position: absolute; bottom: 4px; left: 7px; font: 700 9px/1 ui-monospace, Menlo, monospace;
  color: var(--gold-deep); background: #faf3e2; border-radius: 6px; padding: 2px 5px;
}

/* legend swatch row */
.cat-legend { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- reconciliation board: mode switch + derive states ---------- */
.modeswitch { display: inline-flex; border: 1px solid #e3d9bf; border-radius: 16px; overflow: hidden; }
.modeswitch span { font: 700 11px/1 'Outfit', sans-serif; padding: 6px 13px; color: #8a7f63; background: var(--surface-2); display: flex; align-items: center; gap: 5px; }
.modeswitch span.on { background: var(--gold); color: #fff; }
.derive-tag {
  display: inline-flex; align-items: center; gap: 4px; font: 700 8.5px/1 ui-monospace, Menlo, monospace;
  color: var(--ann); background: #eef2f8; border: 1px solid #d6e0ee; border-radius: 8px; padding: 3px 7px;
}
.acceptbtn { font: 700 10px/1 'Outfit', sans-serif; color: #44603c; background: #eef3ea; border: 1px solid #d2dcc9; border-radius: 10px; padding: 5px 10px; cursor: pointer; }
/* derived/ghost note + fret look (dashed, italic, faint) */
.tabdig.ghost { color: #b3a98a; font-style: italic; }

/* ===== R1-1: shape-overlay (Option A) integration ===== */
/* mismatch badge on the v2 chip (drawn fingering ≠ named chord) */
.chip.uz-chord-mismatch { outline: 1px dashed rgba(224,140,40,0.85); outline-offset: -2px; }
.chip.uz-chord-mismatch::after { content: "⚠️"; position: absolute; top: 2px; right: 16px; font-size: 12px; line-height: 1; pointer-events: none; z-index: 3; filter: drop-shadow(0 0 1px rgba(0,0,0,0.4)); }

/* skin the production #chordShapeOverlay to the v2 prototype look — behaviour unchanged */
.chord-shape-overlay { font-family: 'Outfit', system-ui, sans-serif; }
.chord-shape-overlay .chord-shape-editor { border-radius: 16px; border: 1px solid #e7ddc6; box-shadow: 0 18px 50px rgba(60,48,20,0.28); background: #fbf7ee; }
.chord-shape-overlay .shape-editor-header { border-bottom: 1px solid #ece3cf; }
.chord-shape-overlay .shape-editor-title { font-weight: 800; letter-spacing: .01em; color: #2a2620; }
.chord-shape-overlay button[data-action="saveChordShape"] { background: #c8a04a; color: #1a160c; font-weight: 800; border: none; border-radius: 9px; }
.chord-shape-overlay button[data-action="saveChordShape"]:hover { background: #d8b25e; }
.chord-shape-overlay .shape-best-pill, .chord-shape-overlay .shape-alt-pill { border-radius: 8px; }
.chord-shape-overlay .uz-shape-shift-btn, .chord-shape-overlay .uz-shape-type-go { color: #8a6d27; }
body.dark-mode .chord-shape-overlay .chord-shape-editor { background: #20232c; border-color: #343845; color: #e6e2d8; }
body.dark-mode .chord-shape-overlay .shape-editor-header { border-bottom-color: #343845; }
body.dark-mode .chord-shape-overlay .shape-editor-title { color: #efe9da; }

/* restored "Add chord by name" entry (opens the Chord Picker popup) — the direct trigger was
   lost when the v2 builder took over the desktop layout, leaving the picker reachable only from
   inside the shape editor. */
.chord-section-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.chord-byname-btn { font: 600 13px 'Outfit', sans-serif; color: #a98432; background: #faf3e2; border: 1px solid #d9c07a; border-radius: 10px; padding: 7px 14px; min-height: 38px; cursor: pointer; }
.chord-byname-btn:hover { background: #f5e9c8; border-color: #c8a04a; }
body.dark-mode .chord-byname-btn { color: #e8c86a; background: #2a2620; border-color: #4a4130; }

/* by-name button when inline in the loop stack */
.chord-byname-inline { margin-top: 6px; width: 100%; }

/* in-context Select toggle (line header) */
.lh-btn.lh-select.on { background: var(--ink-btn); color: #fff; border-color: var(--ink-btn); }

/* ---- SHEET view (stacked mode): shapes + lyrics, readable & singable ---- */
.sheetview { padding: 10px 6px 4px; }
.sheet-chords { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.sheet-chord { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 66px; padding: 8px 10px; border: 1px solid #eee6d6; border-radius: 10px; background: var(--card, #fffdf8); cursor: pointer; }
.sheet-chord:hover { border-color: var(--gold); }
.sheet-cn { font: 800 20px 'Outfit', sans-serif; color: var(--gold-deep, #a98432); }
.sheet-rm { font: 600 11px 'Outfit', sans-serif; color: #b0a78d; min-height: 13px; }
.sheet-dgm { transform: scale(1.5); margin: 14px 6px 10px; display: inline-block; }
.sheet-empty { font: 500 13px 'Outfit', sans-serif; color: #b0a78d; }
.sheet-lyrics { border-top: 1px dashed #e0d4b2; padding-top: 10px; display: flex; flex-direction: column; gap: 14px; }
.sheet-lline { font: 500 17px/1.4 'Outfit', sans-serif; color: #3a3630; padding-top: 14px; }
.sheet-w { position: relative; white-space: nowrap; }
.sheet-wch { position: absolute; top: -15px; left: 0; font: 700 12px 'Outfit', sans-serif; color: var(--gold-deep, #a98432); }
.dark-mode .sheet-chord { background: var(--dk-card); border-color: var(--dk-border); }
.dark-mode .sheet-lline { color: #d8d4ca; }

/* ---- 📚 Chord Library overlay (desktop + mobile) — v2 tiered filters ---- */
#uzChordLib { position: fixed; inset: 0; z-index: 11000; display: none; background: rgba(24,20,10,0.55); overflow: hidden; }
#uzChordLib .cl-panel { position: absolute; inset: 3vh 4vw; background: #fbf7ee; border: 1px solid #e7e0d2; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 60px rgba(40,30,10,.45); font-family: 'Outfit', sans-serif; }
#uzChordLib .cl-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 18px 10px; }
#uzChordLib .cl-title { font-weight: 800; font-size: 16px; color: #2b2b2b; }
#uzChordLib .cl-name { font: 800 24px 'Outfit', sans-serif; color: #a98432; }
#uzChordLib .cl-spacer { flex: 1; }
#uzChordLib .cl-lblseg { display: flex; border: 1px solid #e0d4b2; border-radius: 10px; overflow: hidden; }
#uzChordLib .cl-segbtn { min-height: 34px; padding: 6px 12px; border: none; background: #fff; font: 600 12px 'Outfit'; color: #8a8378; cursor: pointer; }
#uzChordLib .cl-segbtn.on { background: #c8a04a; color: #fff; font-weight: 700; }
#uzChordLib .cl-x { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #e7e0d2; background: #fff; font-size: 19px; cursor: pointer; }

/* summary bar (visible only when slim) */
#uzChordLib .cl-summary { display: none; align-items: center; gap: 10px; margin: 0 18px 8px; padding: 8px 14px; border: 1px solid #e0d4b2; border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
#uzChordLib .cl-summary b { font: 800 15px 'Outfit'; color: #a98432; }
#uzChordLib .cl-summary span { font: 500 12px 'Outfit'; color: #8a8378; flex: 1; }
#uzChordLib .cl-summary i { font: 600 11px 'Outfit'; font-style: normal; color: #c8a04a; }
#uzChordLib .cl-panel.slim .cl-summary { display: flex; }
#uzChordLib .cl-panel.slim .cl-filters { display: none; }

/* tiered filters: each level has its own visual form */
#uzChordLib .cl-filters { flex: none; padding: 0 18px 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid #ece3cf; }
#uzChordLib .cl-frow { display: flex; align-items: center; gap: 10px; min-width: 0; }
#uzChordLib .cl-flbl { flex: none; width: 44px; font: 700 9px 'Outfit'; letter-spacing: .12em; color: #b3a98a; }
/* ROOT — round buttons on one scrollable strip */
#uzChordLib .cl-roots { flex: 1; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
#uzChordLib .cl-roots::-webkit-scrollbar { display: none; }
#uzChordLib .cl-root { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid #e7e0d2; background: #fff; font: 700 14px 'Outfit'; color: #2b2b2b; cursor: pointer; }
#uzChordLib .cl-root.on { background: #c8a04a; border-color: #c8a04a; color: #fff; }
/* FAMILY — one connected segmented bar */
#uzChordLib .cl-famseg { flex: 1; display: flex; border: 1px solid #e0d4b2; border-radius: 11px; overflow: hidden; background: #fff; }
#uzChordLib .cl-fseg { flex: 1; min-height: 38px; border: none; border-right: 1px solid #f0e8d5; background: transparent; font: 600 12px 'Outfit'; color: #8a8378; cursor: pointer; white-space: nowrap; padding: 0 6px; }
#uzChordLib .cl-fseg:last-child { border-right: none; }
#uzChordLib .cl-fseg.on { background: #faf3e2; color: #a98432; font-weight: 800; box-shadow: inset 0 -2px 0 #c8a04a; }
/* TYPE — small pills on one scrollable row */
#uzChordLib .cl-sufs { flex: 1; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
#uzChordLib .cl-sufs::-webkit-scrollbar { display: none; }
/* BASS — quiet text chips */
#uzChordLib .cl-invs { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
#uzChordLib .cl-chip { flex: none; min-height: 32px; padding: 5px 11px; border: 1px solid #e7e0d2; border-radius: 999px; background: #fff; font: 600 12px 'Outfit'; color: #6f685a; cursor: pointer; white-space: nowrap; }
#uzChordLib .cl-chip.on { background: #a98432; border-color: #a98432; color: #fff; font-weight: 700; }

#uzChordLib .cl-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
#uzChordLib .cl-sect { font: 700 10px 'Outfit'; letter-spacing: .12em; color: #8a8378; margin: 8px 0; }
#uzChordLib .cl-grid2 { display: flex; flex-wrap: wrap; gap: 14px; }
#uzChordLib .cl-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 12px 10px; border: 1px solid #e7e0d2; border-radius: 12px; background: #fff; }
#uzChordLib .cl-card.feat { border-color: #d9c07a; background: #fffdf6; }
#uzChordLib .cl-feattag { position: absolute; top: 6px; right: 8px; font: 700 9px 'Outfit'; color: #c8a04a; letter-spacing: .06em; }
#uzChordLib .cl-dgm { position: relative; display: block; width: 96px; }
#uzChordLib .cl-mks { display: block; position: relative; height: 22px; }
#uzChordLib .cl-mk { position: absolute; transform: translateX(-50%); font: 600 9px 'Outfit'; color: #8a8378; top: 0; }
#uzChordLib .cl-mk i { display: block; font-style: normal; font-size: 7px; color: #b3a98a; text-align: center; }
#uzChordLib .cl-grid { position: relative; display: block; height: 100px; border-top: 2px solid #cfc6ae; }
#uzChordLib .cl-grid.nut { border-top: 5px solid #6f685a; border-radius: 1px; }
#uzChordLib .cl-str { position: absolute; top: 0; bottom: 0; width: 1px; background: #cfc6ae; transform: translateX(-50%); }
#uzChordLib .cl-fr { position: absolute; left: 0; right: 0; height: 1px; background: #ece3cf; }
#uzChordLib .cl-dot { position: absolute; transform: translate(-50%, -50%); width: 21px; height: 21px; border-radius: 50%; background: #c8a04a; color: #fff; font: 700 9px 'Outfit'; display: flex; align-items: center; justify-content: center; }
#uzChordLib .cl-dot.root { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #a98432; }
/* fret position: paper-chart style — beside the first fret row */
#uzChordLib .cl-fpos { position: absolute; right: -26px; top: 12.5%; transform: translateY(-50%); font: 700 11px 'Outfit'; color: #a98432; }
#uzChordLib .cl-actions { display: flex; gap: 8px; }
#uzChordLib .cl-act { min-height: 36px; padding: 6px 12px; border: 1px solid #e7e0d2; border-radius: 10px; background: #fff; font: 700 12px 'Outfit'; color: #6f685a; cursor: pointer; }
#uzChordLib .cl-act.main { background: #c8a04a; border-color: #c8a04a; color: #fff; }
#uzChordLib .cl-none { font: 500 13px 'Outfit'; color: #8a8378; padding: 12px 0; }
#uzChordLibBtn { font: 600 13px 'Outfit', sans-serif; color: #a98432; background: #faf3e2; border: 1px solid #d9c07a; border-radius: 10px; padding: 7px 13px; min-height: 38px; cursor: pointer; margin-right: 8px; }
#uzChordLibBtn.uz-fixed { position: fixed; right: 22px; bottom: 92px; z-index: 9000; }
@media (max-width: 640px) {
  #uzChordLib .cl-panel { inset: 0; border-radius: 0; }
  #uzChordLib .cl-head { gap: 8px; padding: 10px 14px 8px; }
  #uzChordLib .cl-title { font-size: 13px; white-space: nowrap; }
  #uzChordLib .cl-name { font-size: 19px; }
  #uzChordLib .cl-flbl { width: 36px; }
  #uzChordLib .cl-fseg { font-size: 11px; padding: 0 4px; }
  #uzChordLib .cl-card { width: calc(50% - 8px); box-sizing: border-box; }
  #uzChordLib .cl-dgm { width: 86px; }
}
}
