/* Concert Pitch Part: a rehearsal-room stand. Cool white paper, navy ink, chord names in brass, condensed headings
   like the labels on a band folder, and the chart itself in a fixed-width face so chords stay over their words.
   Print: black ink on white, one part per page, chord lines kept with their words. */
[hidden] { display: none !important; }
:root {
  --bg: #f6f7f9;
  --paper: #ffffff;
  --ink: #161b26;
  --muted: #485164;
  --line: #d3d8e1;
  --edge: #8c95a6;
  --accent: #8a4f00;
  --accent-soft: #fbf1df;
  --btn: #1d2a45;
  --btn-ink: #ffffff;
  --focus: #c26a00;
  --warn: #7a3d00;
  --head: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --r: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --paper: #171b22;
    --ink: #e8eaee;
    --muted: #aeb6c4;
    --line: #2e3542;
    --edge: #6c7587;
    --accent: #e8b04e;
    --accent-soft: #2b2416;
    --btn: #e8b04e;
    --btn-ink: #15120b;
    --focus: #f0c06a;
    --warn: #f3c27a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 5; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top { padding: 18px 0 8px; }
.brand { margin: 0; font: 700 15px/1.2 var(--head); letter-spacing: .02em; color: var(--accent); }
h1 { font: 700 clamp(28px, 4.4vw, 42px)/1.08 var(--head); margin: 6px 0 8px; max-width: 22ch; }
.lede { margin: 0 0 6px; max-width: 62ch; color: var(--muted); }
h2 { font: 700 26px/1.2 var(--head); margin: 32px 0 10px; }
h3 { font: 700 20px/1.25 var(--head); margin: 20px 0 6px; }

/* ---------- tool ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 14px 0 8px; }
@media (min-width: 960px) { .tool { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
label { font-weight: 600; }
select, input[type=text], textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 8px 10px; max-width: 100%;
}
select { padding-right: 28px; }
#inst { font-size: 18px; font-weight: 600; width: 100%; }
textarea { width: 100%; display: block; font-family: var(--mono); font-size: 16px; line-height: 1.45; resize: vertical; margin-top: 4px; }
#chart { min-height: 10em; height: 12em; white-space: pre; overflow-x: auto; }
@media (min-width: 960px) { #chart { height: 17em; } }
.inputs, .result, .panel { min-width: 0; }
.custom { border: 0; padding: 0; margin: -6px 0 14px; }
.custom legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.custom .row, .under { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.custom label, .inline { font-weight: 400; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.custom select, .inline select { color: var(--ink); }
.under { margin-top: 10px; }
.under .ghost { margin-left: auto; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 16px; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 4px 0 12px; }
.tabs [role=tab] {
  font: 700 17px/1 var(--head); background: none; border: 0; color: var(--muted); padding: 12px 12px 10px;
  min-height: 44px; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap;
}
@media (max-width: 380px) { .tabs [role=tab] { padding: 12px 8px 10px; font-size: 16px; } }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.band { border: 0; margin: 0; padding: 0; }
.band legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.checks .wide { grid-column: 1 / -1; margin: 2px 0 6px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

button {
  font: 600 16px/1.2 var(--sans); min-height: 44px; padding: 10px 16px; border-radius: var(--r); cursor: pointer;
  background: var(--btn); color: var(--btn-ink); border: 1px solid var(--btn);
}
button.ghost { background: transparent; color: var(--ink); border-color: var(--edge); }
button.small { min-height: 36px; padding: 6px 10px; font-size: 15px; }

/* the one card: the written part */
.result { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
@media (min-width: 960px) { .result { position: sticky; top: 12px; } }
.res-head h2 { margin: 0 0 4px; font-size: 24px; }
.res-key { margin: 0 0 12px; color: var(--muted); }
.res-key strong { color: var(--ink); }
.out { min-height: 120px; }
.empty { color: var(--muted); }
.chart-wrap { position: relative; }
.chart { font-family: var(--mono); font-size: 16px; line-height: 1.35; overflow-x: auto; padding-bottom: 4px; }
.chart-wrap::before, .chart-wrap::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.chart-wrap::before { left: 0; background: linear-gradient(to right, var(--paper), transparent); }
.chart-wrap::after { right: 0; background: linear-gradient(to left, var(--paper) 15%, transparent); box-shadow: inset -2px 0 0 var(--accent); }
.chart-wrap.more-l::before, .chart-wrap.more-r::after { opacity: 1; }
.chart .mk { color: var(--warn); font-weight: 700; }
.chart .unread { background: var(--accent-soft); }
.chart .blk { margin-bottom: .3em; }
.chart .gap { height: .7em; }
.chart .ln { white-space: pre; }
.chart .ch { color: var(--accent); font-weight: 700; }
.chart .lab { color: var(--muted); font-weight: 700; }
.staff { width: 100%; height: auto; display: block; }
.staff .sl, .staff .lg, .staff .bar, .staff .stem { stroke: var(--ink); stroke-width: 1; }
.staff .sl { stroke: var(--muted); }
.staff .gl, .staff .beam, .staff .flag, .staff .dot, .staff .bar-end { fill: var(--ink); }
.staff .gl-s { stroke: var(--ink); }
.staff .ts { font: 700 21px/1 Georgia, serif; fill: var(--ink); }
.staff .bn { font: 10px var(--sans); fill: var(--muted); }
.notes p { margin: 10px 0 0; color: var(--warn); overflow-wrap: anywhere; }
.notes p.info { color: var(--muted); }
.actions { margin-top: 16px; display: grid; gap: 12px; }
.title-field { display: grid; gap: 4px; font-weight: 400; color: var(--muted); }
.title-field input { color: var(--ink); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.earlier { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.earlier summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.earlier ul { list-style: none; margin: 0; padding: 0; }
.earlier li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.earlier .et { flex: 1 1 12em; overflow-wrap: anywhere; }
.earlier .ed { color: var(--muted); }

/* whole band keys */
.keys { list-style: none; margin: 0; padding: 0; }
.krow { padding: 10px 0; border-top: 1px solid var(--line); }
.krow:first-child { border-top: 0; }
.kname { font: 700 19px/1.3 var(--head); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.kn { color: var(--muted); min-width: 1.6em; }
.krow.top .kname { color: var(--accent); }
.kw { font: 400 16px/1.3 var(--sans); color: var(--muted); }
.parts { list-style: none; margin: 4px 0 0; padding: 0 0 0 calc(1.6em + 10px); display: flex; flex-wrap: wrap; gap: 2px 18px; }
.parts li { font-size: 16px; }
@media (max-width: 520px) { .parts { padding-left: 0; } }
.parts .pi { color: var(--muted); }
.parts .worst .pk { font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--btn); color: var(--btn-ink);
  padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); z-index: 10; display: flex; gap: 12px; align-items: center; }
.toast button { background: transparent; color: inherit; border-color: currentColor; min-height: 36px; padding: 4px 12px; }

/* ---------- reading ---------- */
.explain { max-width: 72ch; margin-bottom: 40px; }
.explain p { margin: 0 0 12px; }
.faq h3 { font-size: 19px; }
.table-wrap { overflow-x: auto; }
.ref { border-collapse: collapse; width: 100%; font-size: 16px; }
.ref th, .ref td { text-align: left; padding: 6px 10px 6px 0; line-height: 1.35; border-bottom: 1px solid var(--line); vertical-align: top; }
.ref th { font: 700 16px/1.2 var(--head); }
.sources { color: var(--muted); font-size: 16px; overflow-wrap: anywhere; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 30px; color: var(--muted); font-size: 16px; }
.sb-footer p { margin: 0 0 8px; }
.sb-more a, .sb-privacy a { color: var(--muted); }
.sb-credit a { color: var(--accent); }

.print-root { display: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- paper ---------- */
@page { margin: 14mm 15mm; }
@media print {
  :root { --ink: #000; --muted: #333; --accent: #000; --line: #999; }
  body { background: #fff; color: #000; font-size: 11pt; }
  body > :not(.print-root) { display: none !important; }
  .print-root { display: block; }
  .sheet { break-after: page; }
  .sheet:last-child { break-after: auto; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; gap: 12pt; border-bottom: 1.2pt solid #000; padding-bottom: 3pt; }
  .ph p { margin: 0; }
  .pt { font: 700 17pt/1.2 var(--head); }
  .ph .pi { font: 700 12pt/1.2 var(--head); text-align: right; }
  .sheet > .pk { margin: 4pt 0 12pt; font-size: 10.5pt; }
  .chart { font-family: var(--mono); line-height: 1.3; overflow: visible; }
  .chart-wrap::before, .chart-wrap::after { display: none; }
  .chart .ln.long { white-space: pre-wrap; }
  .chart .mk { font-weight: 700; }
  .pwarn { margin: 12pt 0 0; font-weight: 700; border-top: 1pt solid #000; padding-top: 4pt; }
  .pwarn + .pwarn { margin-top: 0; border-top: 0; padding-top: 2pt; }
  .pwarn .nw { white-space: nowrap; }
  .chart .blk { break-inside: avoid; margin-bottom: .6em; }
  .chart .ln { white-space: pre; }
  .chart .ch { font-weight: 700; }
  .staff { width: 100%; height: auto; }
  .staff .sl, .staff .lg, .staff .bar, .staff .stem { stroke: #000; }
  .staff .gl, .staff .beam, .staff .flag, .staff .dot, .staff .bar-end { fill: #000; }
  .staff .gl-s { stroke: #000; }
  .staff .ts { fill: #000; }
  .keys .krow { break-inside: avoid; }
  .kname { font-size: 13pt; }
  .kw, .parts li { font-size: 10.5pt; }
}
