/* Bass Chord Trainer. Everything is scoped under .chords-app so it never touches the rest of the site.
   Fonts are bundled in ./fonts so the tool works with no network. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-style: normal; font-display: swap; src: url('./fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-style: normal; font-display: swap; src: url('./fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-style: normal; font-display: swap; src: url('./fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; font-style: normal; font-display: swap; src: url('./fonts/barlow-semi-condensed-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url('./fonts/barlow-semi-condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('./fonts/ibm-plex-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url('./fonts/ibm-plex-mono-500.woff2') format('woff2'); }

.chords-app {
  --bg: #F2F3F5;
  --panel: #FFFFFF;
  --ink: #0F1217;
  --mute: #5A6270;
  --rule: #2A3039;
  --hair: #D5D9E0;
  --cur-bg: #FFDD55;
  --cur-fg: #0F1217;
  --loop-bg: #E3E9F6;
  --accent: #0E7C7B;
  --on-accent: #FFFFFF;
  --f-chord: 'Barlow Semi Condensed', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --f-ui: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --hdr: 64px; /* site header height, set from the page */

  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: max(480px, calc(100dvh - var(--hdr)));
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.35 var(--f-ui);
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  .chords-app:not([data-theme="light"]) {
    --bg: #0B0D11; --panel: #14171D; --ink: #F1F3F6; --mute: #9AA2AF; --rule: #C9CED7; --hair: #2A2F38;
    --cur-bg: #F7C948; --cur-fg: #0B0D11; --loop-bg: #1A2232; --accent: #34D3CD; --on-accent: #06201F;
    color-scheme: dark;
  }
}
.chords-app[data-theme="dark"] {
  --bg: #0B0D11; --panel: #14171D; --ink: #F1F3F6; --mute: #9AA2AF; --rule: #C9CED7; --hair: #2A2F38;
  --cur-bg: #F7C948; --cur-fg: #0B0D11; --loop-bg: #1A2232; --accent: #34D3CD; --on-accent: #06201F;
  color-scheme: dark;
}

.chords-app *, .chords-app *::before, .chords-app *::after { box-sizing: border-box; }
.chords-app button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; text-transform: none; letter-spacing: normal; box-shadow: none; }
.chords-app button:focus-visible, .chords-app select:focus-visible, .chords-app input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chords-app [hidden] { display: none !important; }

/* ---------- top bar ---------- */
.chords-app .top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-block: 10px; border-bottom: 1px solid var(--hair); position: relative; }
#openBtn { order: 1; }
.chords-app .song { order: 2; display: flex; align-items: baseline; gap: 12px; flex: 1 1 0; min-width: 0; }
.chords-app .view { order: 3; }
#optsBtn { order: 4; }
.chords-app .sheet { order: 5; }
.chords-app .title { font: 600 18px/1.2 var(--f-ui); color: var(--ink); text-transform: none; letter-spacing: normal; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .meta { font: 400 13px var(--f-mono); color: var(--mute); white-space: nowrap; }
.chords-app .btn { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--hair); background: var(--panel); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chords-app .btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.chords-app .btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chords-app .sc { display: inline-flex; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; background: var(--panel); }
.chords-app .sc button { padding: 8px 16px; font-weight: 600; font-size: 14px; min-height: 40px; }
.chords-app .sc button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- stage ---------- */
.chords-app .stage-wrap { position: relative; min-height: 0; }
.chords-app #stage { height: 100%; overflow-y: auto; overflow-x: hidden; padding-block: 14px 45vh; overscroll-behavior: contain; }

.chords-app .empty { display: grid; place-items: center; text-align: center; gap: 14px; padding: 8vh 16px; margin-top: 4vh; border: 2px dashed var(--hair); border-radius: 16px; background: var(--panel); }
.chords-app .empty h2 { font: 700 28px/1.15 var(--f-chord); margin: 0; }
.chords-app .empty p { margin: 0; color: var(--mute); max-width: 46ch; line-height: 1.5; }
.chords-app.dragging .empty, .chords-app.dragging #chart { outline: 3px dashed var(--accent); outline-offset: -6px; }
.chords-app .err { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid #C0392B; background: color-mix(in srgb, #C0392B 10%, var(--panel)); color: var(--ink); }

/* ---------- chord sheet ---------- */
.chords-app #chart {
  container-type: inline-size;
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  background: var(--panel); border: 1px solid var(--hair); border-radius: 12px; overflow: hidden;
}
.chords-app .bar {
  container-type: inline-size;
  position: relative; display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100cqw / var(--cols, 4) * .4);
  padding: 24px 6px 20px; border-top: 1px solid var(--hair); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chords-app .bar::before { content: ""; position: absolute; left: 0; top: 14%; bottom: 14%; width: 2px; background: var(--rule); border-radius: 1px; }
.chords-app .bar.eor::after, .chords-app .bar.last::after { content: ""; position: absolute; right: 0; top: 14%; bottom: 14%; width: 2px; background: var(--rule); border-radius: 1px; }
.chords-app .bar.last::after { width: 6px; }
.chords-app .bar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chords-app .bar .tag { position: absolute; top: 5px; right: 7px; max-width: calc(100% - 52px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 10px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 9px; background: var(--accent); color: var(--on-accent); }
.chords-app .bar .num { position: absolute; top: 7px; left: 12px; font: 400 11px var(--f-mono); color: var(--mute); }
.chords-app .bar .segs { display: flex; align-items: center; flex: 1; }
.chords-app .seg { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; white-space: nowrap; font: 700 1em/1 var(--f-chord); letter-spacing: -.005em; }
.chords-app .seg.held { opacity: .36; font-weight: 500; }
/* The pieces of one chord name (note, ♯, m) sit on one text line, so the small "m" shares the note's baseline. */
/* Transpose: the row in Options and the badge on the Options button. */
.chords-app #optsBtn { position: relative; }
.chords-app #optsBtn .trb { position: absolute; top: -5px; right: -6px; min-width: 24px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font: 600 11px/18px var(--f-mono); text-align: center; letter-spacing: 0; pointer-events: none; }
.chords-app #optsBtn .trb[hidden] { display: none; }
.chords-app .trrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chords-app .trrow .sc button { min-width: 44px; }
.chords-app .trrow .sc .val { min-width: 60px; font-weight: 600; cursor: default; }
.chords-app .trrow .btn { height: 36px; }
.chords-app .trrow .btn:disabled { opacity: .45; }
.chords-app .seg .nm { white-space: nowrap; }
.chords-app .seg .nm .acc { top: -.65em; }
.chords-app .seg .nm .q-dim { top: -.55em; }
.chords-app .f-seg .acc, .chords-app .ucard .acc { top: -.56em; }
.chords-app .n1 .seg { font-size: clamp(22px, 26cqw, 96px); }
.chords-app .n2 .seg { font-size: clamp(18px, 19cqw, 72px); }
.chords-app .n3 .seg { font-size: clamp(15px, 14cqw, 54px); }
.chords-app .n4 .seg { font-size: clamp(13px, 11cqw, 42px); }
.chords-app .acc { font-size: .55em; line-height: 0; position: relative; top: -.42em; margin-left: .03em; font-weight: 600; }
.chords-app .q { font-size: .66em; font-weight: 600; margin-left: .05em; }
.chords-app .q-long { font-size: .5em; }
.chords-app .q-dim { position: relative; top: -.3em; font-size: .6em; }
.chords-app .slash { font-size: .55em; font-weight: 600; margin-left: .08em; opacity: .85; }
.chords-app .none { opacity: .45; font-weight: 400; }
.chords-app .ticks { position: absolute; left: 12%; right: 12%; bottom: 7px; display: flex; gap: 5px; opacity: 0; }
.chords-app .ticks i { flex: 1; height: 4px; border-radius: 2px; background: currentColor; opacity: .22; }
.chords-app .ticks i.on { opacity: 1; }
.chords-app .bar.cur { background: var(--cur-bg); color: var(--cur-fg); }
.chords-app .bar.cur .num { color: inherit; opacity: .65; }
.chords-app .bar.cur .ticks { opacity: 1; }
.chords-app .bar.inloop:not(.cur) { background: var(--loop-bg); }
.chords-app .cntnum {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--cur-bg); color: var(--cur-fg); font: 700 clamp(40px, 30cqw, 120px)/1 var(--f-chord);
}
.chords-app .cntnum small { font: 500 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-top: 4px; }

/* ---------- focus view ---------- */
/* The yellow card is the whole bar: every chord side by side, as wide as it lasts, the one playing lit. The beat dots sit under it in equal
   cells, so a dot is always under the beat it counts. The three cards look ahead to the next chord changes after this bar, with the count in
   words. Number, unit and bar label have fixed columns and there are always three slots, so nothing moves as the count changes. */
.chords-app #stage.is-focus { padding-block: 14px; overflow: hidden; }
.chords-app .focus { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; height: 100%; }
.chords-app .f-main { container-type: size; position: relative; background: var(--cur-bg); color: var(--cur-fg); border-radius: 14px; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.chords-app .f-bar { position: absolute; top: 8px; left: 10px; padding: 6px 8px; z-index: 2; text-align: left; cursor: pointer; color: inherit; font: 500 14px var(--f-mono); opacity: .7; }
.chords-app .f-chord { width: 100%; padding-inline: 1.5cqw; letter-spacing: -.01em; white-space: nowrap; }
.chords-app .f-segs { display: flex; align-items: center; }
.chords-app .f-seg { min-width: 0; display: flex; justify-content: center; align-items: center; opacity: .3; font: 700 min(32cqw, 56cqh, calc(var(--w) * 58cqw))/1 var(--f-chord); }
.chords-app .f-seg.on { opacity: 1; }
.chords-app .f-chord .count { display: block; text-align: center; font: 700 min(29cqw, 50cqh)/1 var(--f-chord); }
.chords-app .f-sub { position: absolute; bottom: 48px; left: 0; right: 0; text-align: center; font: 500 13px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; opacity: .7; min-height: 1em; }
.chords-app .f-dots { position: absolute; bottom: 18px; left: 1.5cqw; right: 1.5cqw; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); justify-items: center; }
.chords-app .f-dots i { width: 18px; height: 18px; border-radius: 50%; background: currentColor; opacity: .2; }
.chords-app .f-dots i.on { opacity: 1; }

.chords-app .f-up { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px; min-height: 0; }
.chords-app .ucard { background: var(--panel); border: 1px solid var(--hair); border-radius: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 0 18px; min-width: 0; }
.chords-app .ucard.first { border: 2px solid var(--ink); padding: 0 17px; }
.chords-app .ucard:not(.first) .chord { opacity: .8; }
.chords-app .ucard .chord { font: 700 clamp(40px, 5.2vw, 88px)/1 var(--f-chord); white-space: nowrap; }
.chords-app .ucard .chord { display: flex; align-items: center; gap: .35em; }
.chords-app .ucard .chord.n2 { font-size: clamp(30px, 3.9vw, 66px); }
.chords-app .ucard .chord.n3 { font-size: clamp(24px, 2.9vw, 50px); }
.chords-app .ucard .chord.n4 { font-size: clamp(18px, 2.2vw, 38px); gap: .3em; }
.chords-app .ucard .when { justify-self: end; }
.chords-app .ucard .txt { display: grid; gap: 2px; justify-items: start; width: 10.8ch; font: 600 clamp(11px, 1.15vw, 15px) var(--f-mono); color: var(--ink); }
.chords-app .ucard .in { display: inline-grid; grid-template-columns: 2ch 2.4ch 5ch; column-gap: .6ch; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chords-app .ucard .in .n { text-align: right; }
.chords-app .ucard .at { font-weight: 400; font-size: .8em; color: var(--mute); white-space: nowrap; }
.chords-app .ucard.end { color: var(--mute); }
.chords-app .ucard.end .chord { font-size: 22px; letter-spacing: .08em; opacity: 1; }
.chords-app .ucard.blank { visibility: hidden; }

/* ---------- transport ---------- */
.chords-app .transport { position: relative; border-top: 1px solid var(--hair); padding-block: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 22px; }
.chords-app .grp { display: flex; align-items: center; gap: 10px; }
.chords-app .ibtn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--hair); background: var(--panel); }
.chords-app .ibtn svg { width: 20px; height: 20px; fill: currentColor; }
.chords-app .ibtn.play { width: 62px; height: 62px; background: var(--accent); color: var(--on-accent); border-color: transparent; }
.chords-app .ibtn.play svg { width: 26px; height: 26px; }
.chords-app .tempo { display: flex; align-items: center; gap: 10px; }
.chords-app .tstep, .chords-app .slrow { display: flex; align-items: center; gap: 10px; }
.chords-app #openBtn .sn, .chords-app #openBtn .car, .chords-app #optsBtn .og, .chords-app .back { display: none; }
.chords-app .back { font-weight: 600; font-size: 14px; color: var(--ink); text-decoration: none; }
.chords-app .tempo .ibtn { width: 38px; height: 38px; font: 600 20px/1 var(--f-ui); }
.chords-app .bpm { cursor: default; }
.chords-app .bpm { font: 500 24px/1 var(--f-mono); text-align: center; min-width: 5.5ch; }
.chords-app .bpm small { display: block; font: 400 11px/1.3 var(--f-ui); color: var(--mute); margin-top: 3px; white-space: nowrap; }
.chords-app input[type=range] { width: min(200px, 34vw); accent-color: var(--accent); }
.chords-app .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chords-app .chip { height: 38px; padding: 0 15px; border-radius: 19px; border: 1px solid var(--hair); background: var(--panel); font-weight: 600; font-size: 14px; }
.chords-app .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chords-app .chip:disabled { opacity: .4; cursor: default; }

/* ---------- options sheet ---------- */
.chords-app .sheet { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(400px, 100%); background: var(--panel); border: 1px solid var(--hair); border-radius: 14px; padding: 16px; display: grid; gap: 14px; box-shadow: 0 10px 34px rgba(0, 0, 0, .22); max-height: 70vh; overflow-y: auto; }
.chords-app .sheet .row { display: grid; gap: 6px; }
.chords-app .sheet .lbl { font: 500 12px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.chords-app .sheet .note { font-size: 13px; color: var(--mute); line-height: 1.45; margin: 0; }
.chords-app .sheet .note b { color: var(--ink); }
.chords-app .sheet ul.note { padding-left: 18px; }
.chords-app .sheet.songs { right: auto; left: 0; }
.chords-app .mlist { display: flex; flex-wrap: wrap; gap: 8px; }
.chords-app .mk { display: grid; gap: 1px; text-align: left; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--accent); background: var(--bg); min-width: 0; max-width: 100%; }
.chords-app .mk b { font: 600 14px var(--f-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .mk small { font: 400 11px var(--f-mono); color: var(--mute); }
.chords-app .f-bar .sec { font-weight: 500; text-transform: uppercase; letter-spacing: .06em; background: var(--cur-fg); color: var(--cur-bg); padding: 1px 7px; border-radius: 8px; font-size: 11px; margin-right: 6px; }
.chords-app .ucard .txt { min-width: 0; max-width: 100%; }
.chords-app .ucard .at { max-width: 100%; min-width: 0; overflow: hidden; }
.chords-app .ucard .at .ctag { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .ctag { font-style: normal; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; font-size: .85em; }

/* ---------- marker sheet ---------- */
.chords-app .mscrim { position: absolute; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); }
.chords-app .msheet { position: absolute; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 480px); max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid var(--hair); border-radius: 18px 18px 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; box-shadow: 0 -10px 34px rgba(0, 0, 0, .3); }
.chords-app .mh { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chords-app .mh b { font: 600 16px var(--f-ui); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .mx { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--hair); background: var(--bg); font-size: 20px; line-height: 1; flex: none; }
.chords-app .mkrow { display: flex; flex-wrap: wrap; gap: 8px; }
.chords-app .mkpc { height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--hair); background: var(--bg); font-weight: 600; font-size: 14px; }
.chords-app .mkpc.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chords-app .mcust { display: flex; gap: 8px; }
.chords-app .mcust input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid var(--hair); background: var(--bg); color: var(--ink); padding: 0 12px; font: 500 16px var(--f-ui); }
.chords-app .mkadd { height: 40px; padding: 0 20px; border-radius: 20px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; }
.chords-app .mnote { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink); }
.chords-app .mchk { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14px; line-height: 1.35; }
.chords-app .mchk input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.chords-app .mkghost { flex: 1; height: 40px; border-radius: 20px; border: 1px solid var(--hair); background: transparent; font-weight: 600; font-size: 14px; }
.chords-app .mkadd.acc { flex: 1; background: var(--accent); color: var(--on-accent); }
.chords-app .mkpc.plain { cursor: default; height: auto; padding: 6px 12px; }
.chords-app .mkpc.plain small { font: 400 10px var(--f-mono); opacity: .7; margin-left: 4px; }
.chords-app .addpdf { height: 40px; border-radius: 20px; border: 1px solid var(--accent); background: transparent; font-weight: 600; font-size: 14px; }
.chords-app .mkrm { height: 38px; border-radius: 19px; border: 1px solid var(--hair); background: transparent; color: var(--mute); font-weight: 600; font-size: 14px; }
@media (min-width: 641px) and (min-height: 521px) { .chords-app .msheet { bottom: 24px; border-radius: 18px; } }
/* ---------- help guide (a sheet of short sections) ---------- */
#helpBtn { order: 4; }
.chords-app .hbtn { width: 40px; padding: 0; display: grid; place-items: center; font-size: 17px; flex: none; }
.chords-app .help { max-height: min(100%, 640px); }
.chords-app .hlist { display: grid; }
.chords-app .hlist details { border-top: 1px solid var(--hair); padding: 2px 0; }
.chords-app .hlist details:first-child { border-top: 0; }
.chords-app .hlist summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; font: 600 15px var(--f-ui); }
.chords-app .hlist summary::-webkit-details-marker { display: none; }
.chords-app .hlist summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--mute); border-bottom: 2px solid var(--mute); transform: rotate(45deg); margin: 0 4px 3px 0; flex: none; transition: transform .15s; }
.chords-app .hlist details[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.chords-app .hlist details > p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--mute); }
.chords-app .hlist details > p b { color: var(--ink); font-weight: 600; }
.chords-app .hlist summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
/* ---------- fix a chord (a tab in the same sheet) ---------- */
.chords-app .mpane { display: grid; gap: 12px; }
.chords-app .fx-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); border: 1px solid var(--hair); border-radius: 14px; padding: 3px; }
.chords-app .fx-tabs button { height: 34px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--mute); }
.chords-app .fx-tabs button.on { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--hair); }
.chords-app .fx-lab { margin: 0 0 -4px; font: 500 10px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.chords-app .fx-roots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.chords-app .fx-types { display: flex; flex-wrap: wrap; gap: 6px; }
.chords-app .fx-roots .mkpc, .chords-app .fx-types .mkpc { height: 34px; padding: 0; border-radius: 17px; font-size: 14px; font-family: var(--f-chord); }
.chords-app .fx-types .mkpc { padding: 0 12px; }
.chords-app .fx-bass { display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 38px; border: 1px solid var(--hair); border-radius: 12px; background: var(--bg); padding: 0 8px 0 12px; font-size: 14px; }
.chords-app .fx-bass span { color: var(--mute); }
.chords-app .fx-bass select { min-width: 0; height: 34px; border: 0; background: transparent; color: var(--ink); font: 600 14px var(--f-ui); text-align: right; }
.chords-app .fx-bass select option { background: var(--panel); color: var(--ink); }
.chords-app .fx-prev { display: flex; align-items: baseline; gap: 10px; min-height: 26px; font: 700 26px/1 var(--f-chord); }
.chords-app .fx-prev i { font: 400 12px var(--f-mono); color: var(--mute); font-style: normal; }
.chords-app .fx-prev .old { opacity: .45; text-decoration: line-through; text-decoration-thickness: 2px; }
.chords-app .fx-scope { display: grid; gap: 6px; }
.chords-app .fx-scope button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--hair); background: var(--bg); font-weight: 600; font-size: 14px; text-align: left; }
.chords-app .fx-scope button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chords-app .fx-scope button b { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--hair); flex: none; }
.chords-app .fx-scope button.on b { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }
.chords-app .fx-fixed { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.chords-app .fx-fixed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.chords-app .fx-fixed > span:nth-child(2) { flex: 1; min-width: 0; }
.chords-app .fx-fixed .mkrm { height: 34px; padding: 0 14px; flex: none; }
.chords-app .mkadd:disabled { opacity: .4; }
.chords-app .bar .fxdot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chords-app .bar.cur .fxdot { background: var(--on-accent, #0B0D11); }
.chords-app .upd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chords-app .upd .btn { height: 36px; }
.chords-app .slist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.chords-app .slist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.chords-app .slist .pick { display: grid; gap: 2px; text-align: left; padding: 8px 12px; border: 1px solid var(--hair); border-radius: 10px; background: var(--bg); min-width: 0; }
.chords-app .slist .pick:hover { border-color: var(--accent); }
.chords-app .slist .pick.on { border: 2px solid var(--ink); padding: 7px 11px; }
.chords-app .slist .t { font: 600 15px/1.25 var(--f-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .slist .m { font: 400 12px var(--f-mono); color: var(--mute); }
.chords-app .slist li { grid-template-columns: minmax(0, 1fr) auto auto; }
.chords-app .slist .g { font: 400 11px var(--f-mono); color: var(--accent); }
.chords-app .slist .ren { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--hair); background: var(--panel); color: var(--mute); display: grid; place-items: center; }
.chords-app .slist .ren svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chords-app .slist .ren:hover { color: var(--ink); border-color: var(--ink); }
.chords-app .sfind { display: grid; gap: 6px; }
.chords-app .sfind input { height: 38px; border-radius: 12px; border: 1px solid var(--hair); background: var(--bg); color: var(--ink); padding: 0 12px; font: 500 16px var(--f-ui); min-width: 0; width: 100%; }
.chords-app .sfind .sc { display: flex; }
.chords-app .sfind .sc button { flex: 1; min-height: 34px; }
.chords-app .mnote.mute { color: var(--mute); font-size: 13px; }
.chords-app .slist .del { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--hair); background: var(--panel); color: var(--mute); font-size: 18px; line-height: 1; }
.chords-app .slist .del:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 640px) and (min-height: 521px) {
  .chords-app .focus { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .chords-app .f-up { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: 128px; gap: 8px; }
  .chords-app .ucard { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; text-align: center; gap: 4px; padding: 10px 4px; border-radius: 10px; }
  .chords-app .ucard.first { padding: 9px 3px; }
  .chords-app .ucard .chord { font-size: clamp(42px, 14.5vw, 58px); justify-content: center; height: 62px; max-width: 100%; }
  /* Names too long for one row even when shrunk a little: two rows, larger, instead of tiny type (set by the app). */
  .chords-app .ucard .chord.wrap { flex-wrap: wrap; align-content: center; row-gap: .04em; }
  .chords-app .ucard .chord.n2 { font-size: clamp(32px, 10.8vw, 44px); gap: .3em; }
  .chords-app .ucard .chord.n3 { font-size: clamp(24px, 8vw, 32px); gap: .25em; }
  .chords-app .ucard .chord.n4 { font-size: clamp(18px, 6.2vw, 24px); gap: .2em; }
  .chords-app .ucard.end .chord { font-size: 14px; }
  .chords-app .ucard .when { justify-self: center; }
  .chords-app .ucard .txt { justify-items: center; width: auto; font-size: 11px; }
  .chords-app .ucard .at { min-width: 7ch; text-align: center; }
  .chords-app .sheet { left: 0; width: auto; }
}
/* ---------- phone mode: a narrow screen, or a short one (a phone held sideways) ----------
   The site menu is hidden, the top bar is one row (Songs shows the song name; Options is a gear), and the controls take two rows
   (one row when held sideways). Tapping the tempo number shows the slider and Reset. */
@media (max-width: 640px), (max-height: 520px) {
  html body .site-header { display: none !important; }
  .chords-app { height: 100dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .chords-app .top { flex-wrap: nowrap; gap: 8px; padding-block: 6px; min-height: 52px; }
  .chords-app .song { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .chords-app #openBtn { flex: 0 1 auto; min-width: 0; max-width: 210px; height: 38px; padding: 0 14px; display: flex; align-items: center; gap: 8px; }
  .chords-app.has-song #openBtn .sl { display: none; }
  .chords-app.has-song #openBtn .sn { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .chords-app.has-song #openBtn .car { display: inline; font-size: 12px; flex: none; }
  .chords-app .view { margin-left: auto; flex: none; }
  .chords-app .sc button { padding: 0 clamp(9px, 3vw, 13px); min-height: 36px; }
  .chords-app #optsBtn { width: 38px; height: 38px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
  .chords-app .hbtn { width: 38px; height: 38px; }
  .chords-app #optsBtn .ot { display: none; }
  .chords-app #optsBtn .og { display: block; width: 20px; height: 20px; fill: currentColor; }
  .chords-app .back { display: inline-block; }
  .chords-app #openBtn { padding: 0 clamp(11px, 3.6vw, 14px); }
  .chords-app .sheet { left: 0; width: auto; }

  .chords-app .transport { flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-block: 8px 10px; }
  .chords-app .tempo { display: contents; }
  .chords-app .grp { gap: 6px; }
  .chords-app .ibtn { width: clamp(32px, 10.6vw, 40px); height: clamp(32px, 10.6vw, 40px); }
  .chords-app .ibtn.play { width: clamp(46px, 14.5vw, 56px); height: clamp(46px, 14.5vw, 56px); }
  .chords-app .tempo .ibtn { width: clamp(30px, 9.4vw, 36px); height: clamp(30px, 9.4vw, 36px); }
  .chords-app .tstep { gap: 4px; margin-left: auto; }
  .chords-app .bpm { cursor: pointer; min-width: clamp(44px, 13.5vw, 52px); font-size: 24px; border-bottom: 1px dashed var(--mute); padding-bottom: 2px; }
  .chords-app .bpm small { font-size: 10px; }
  .chords-app .bpm .of { display: none; }
  .chords-app .slrow { order: 2; flex: 1 1 100%; display: none; }
  .chords-app .transport.open .slrow { display: flex; }
  .chords-app input[type=range] { width: auto; flex: 1 1 60px; min-width: 0; }
  .chords-app .chips { order: 3; flex: 1 1 100%; flex-wrap: nowrap; gap: 8px; }
  .chords-app .chips .chip { flex: 1; height: 36px; padding: 0 4px; font-size: 13px; white-space: nowrap; min-width: 0; }
  .chords-app .sheet.songs { max-height: calc(100dvh - 96px); }
  .chords-app .sheet.songs .slist { max-height: 34vh; }
}
@media (max-height: 520px) and (min-width: 560px) {
  .chords-app .top { min-height: 44px; padding-block: 4px; }
  .chords-app #openBtn { max-width: 300px; height: 34px; }
  .chords-app .sc button { min-height: 32px; }
  .chords-app #optsBtn, .chords-app .hbtn { width: 34px; height: 34px; }
  .chords-app .transport { padding-block: 6px; }
  .chords-app .tstep { margin-left: 0; }
  .chords-app .chips { order: 1; flex: 0 0 auto; }
  .chords-app .chips .chip { flex: none; height: 32px; padding: 0 11px; font-size: 12px; }
  .chords-app .ibtn { width: 36px; height: 36px; }
  .chords-app .ibtn.play { width: 46px; height: 46px; }
  .chords-app .tempo .ibtn { width: 32px; height: 32px; }
  .chords-app .bpm { min-width: 52px; }
}
@media (prefers-reduced-motion: reduce) { .chords-app * { scroll-behavior: auto !important; } }

/* ---------- loop: choice sheet, picking banner, range tag ---------- */
.chords-app .lpchoice button { min-height: 52px; font-size: 15px; padding: 8px 14px; gap: 12px; }
.chords-app .lpchoice button small { display: block; font-weight: 400; color: var(--mute); font-size: 12px; margin-top: 2px; }
.chords-app .lpchoice button svg { width: 22px; height: 22px; flex: none; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chords-app .lp-banner { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 20; display: flex; align-items: center; gap: 10px; background: var(--accent); color: var(--on-accent); border-radius: 14px; padding: 6px 6px 6px 14px; font-weight: 700; font-size: 15px; box-shadow: 0 6px 22px rgba(0, 0, 0, .45); }
.chords-app .lp-banner span { flex: 1; min-width: 0; }
.chords-app .lp-banner button { height: 32px; padding: 0 14px; border-radius: 16px; background: rgba(11, 13, 17, .15); color: inherit; font-weight: 700; font-size: 14px; flex: none; }
.chords-app .bar.lp-start { box-shadow: inset 0 0 0 3px var(--accent); }
.chords-app .f-bar .lptag { margin-left: 8px; padding: 1px 7px; border: 1.5px solid currentColor; border-radius: 10px; font-size: 11px; font-weight: 600; vertical-align: middle; }

/* ---------- backup ---------- */
.chords-app .bk-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.chords-app .bk-btns .btn { height: 36px; }
.chords-app .bk-btns .btn:disabled { opacity: .45; }
.chords-app .bk-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; max-height: 38vh; overflow-y: auto; }
.chords-app .bk-list li { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--hair); border-radius: 12px; background: var(--bg); padding: 8px 12px; }
.chords-app .bk-list li b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chords-app .bk-list li span { color: var(--mute); font: 500 12px var(--f-mono); align-self: center; white-space: nowrap; }

/* ---------- bar notes ---------- */
.chords-app .fx-tabs { grid-template-columns: repeat(3, 1fr); }
.chords-app #noteText { width: 100%; border-radius: 12px; border: 1px solid var(--hair); background: var(--bg); color: var(--ink); padding: 10px 12px; font: 500 16px/1.3 var(--f-ui); resize: none; }
.chords-app .nrow { display: flex; justify-content: space-between; gap: 10px; color: var(--mute); font: 500 12px var(--f-mono); }
.chords-app .mcust .mkrm { flex: none; padding: 0 16px; }
/* The note sits under the chords. Its size follows the bar's width (10.5 px on a phone, about 14 px on a laptop). */
.chords-app .bar.hasnote { padding-bottom: calc(20px + 2.5 * clamp(10.5px, calc(100cqw / var(--cols, 4) * .048), 15px)); }
.chords-app .bar .bnote { position: absolute; left: 9px; right: 9px; bottom: 14px; max-height: 2.3em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: center; font: 500 clamp(10.5px, 4.8cqw, 15px)/1.15 var(--f-ui); color: var(--mute); white-space: normal; overflow-wrap: anywhere; }
.chords-app .bar.cur .bnote { color: var(--cur-fg); opacity: .8; }
.chords-app .f-note { position: absolute; left: 18px; right: 18px; bottom: 48px; text-align: center; font: 600 clamp(16px, 4.6cqw, 26px)/1.25 var(--f-ui); opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.chords-app .f-main.has-note { padding-bottom: 16cqh; }
.chords-app .f-main.has-note .f-seg { font-size: min(32cqw, 40cqh, calc(var(--w) * 58cqw)); }
