/* CHORD ANATOMY — コードの仕組み */
:root {
  --paper: #f4efe5;
  --paper-2: #ece5d7;
  --card: #fdfbf6;
  --ink: #2a2420;
  --ink-2: #4a4038;
  --mist: #7a6d5f;
  --faint: #b3a692;
  --line: rgba(42, 36, 32, .09);
  --line-2: rgba(42, 36, 32, .16);
  --accent: #b5523a;
  --gold: #a8802f;
  /* one colour per shelf: soft enough for beginners, distinct enough to tell apart */
  --c-root: #d49526;
  --c-third: #d4573f;
  --c-fifth: #23897c;
  --c-seventh: #7358c4;
  --c-ninth: #4a8c30;
  --c-eleventh: #2b74b6;
  --c-thirteenth: #c34a8d;
  --c-bass: #8b7f70;
  --serif: "Fraunces", "Shippori Mincho", Georgia, serif;
  --mincho: "Shippori Mincho", "Fraunces", serif;
  --sans: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --acc: "Noto Music", "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", serif;
  --shadow: 0 18px 40px -26px rgba(70, 50, 30, .45);
  --shadow-sm: 0 6px 16px -10px rgba(70, 50, 30, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --top: 60px;
  --lib-w: 312px;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.75; font-weight: 500; -webkit-font-smoothing: antialiased; }
body::before { /* paper grain, as in THE MODAL EARTH */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .32 0 0 0 0 .22 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.acc { font-family: var(--acc); font-weight: 400; font-size: 1.02em; line-height: 1; position: relative; top: -.16em; margin: 0 -.04em 0 .01em; }

/* ── header ─────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 24px; background: rgba(244, 239, 229, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-family: var(--serif); font-weight: 500; font-size: 18px; letter-spacing: .16em; font-variation-settings: 'SOFT' 100, 'opsz' 36; white-space: nowrap; }
.brand-sub { font-family: var(--mincho); font-weight: 600; font-size: 11.5px; letter-spacing: .22em; color: var(--mist); }
.top-nav { display: flex; gap: 8px; align-items: center; flex: none; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(253, 251, 246, .7); font-size: 12.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
.chip:hover { border-color: rgba(42, 36, 32, .32); background: var(--card); }
.chip-icon { width: 34px; padding: 0; }
.chip-icon .mute { display: none; }
.chip-icon[aria-pressed="false"] .wave { display: none; }
.chip-icon[aria-pressed="false"] .mute { display: inline; }
.chip-icon[aria-pressed="false"] { color: var(--mist); }
.chip-lang { font-family: var(--serif); letter-spacing: .14em; min-width: 46px; }

/* ── layout ───────────────────────────────────────────── */
.app { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--lib-w); max-width: 1480px; margin: 0 auto; }
.bench { min-width: 0; padding: 18px 28px 26px; display: flex; flex-direction: column; }
.bench-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* roots: twelve note buttons, the black-key ones dark like the keys */
.roots { display: flex; gap: 4px; flex-wrap: nowrap; }
.root { position: relative; min-width: 40px; height: 36px; padding: 0 6px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-family: var(--serif); font-size: 15px; font-weight: 500; cursor: pointer; transition: transform .15s var(--ease), background .2s, box-shadow .2s, color .2s; font-variation-settings: 'opsz' 24; box-shadow: 0 1px 0 rgba(42, 36, 32, .06); }
.root.blk { background: #3a332d; color: #f4efe5; border-color: #3a332d; }
.root:hover { transform: translateY(-1px); }
.root[aria-checked="true"] { background: var(--c-root); color: #fff; border-color: var(--c-root); box-shadow: 0 0 0 3px rgba(212, 149, 38, .22), 0 6px 16px -8px rgba(212, 149, 38, .8); }
.root .acc { font-size: .92em; margin-left: 1px; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(253, 251, 246, .7); }
.seg button { border: 0; background: none; height: 30px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; cursor: pointer; color: var(--mist); white-space: nowrap; transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--card); }
.seg-sm button { height: 26px; padding: 0 11px; font-size: 11.5px; }
.seg-label { display: inline-flex; align-items: center; padding: 0 8px 0 10px; font-size: 11px; color: var(--mist); white-space: nowrap; }
#notation button { font-family: var(--serif); font-size: 13px; color: var(--ink-2); }
#notation button[aria-checked="true"] { color: var(--card); }

/* ── the name card ─────────────────────────────────────── */
.namecard { position: relative; margin-top: 16px; display: grid; grid-template-columns: minmax(250px, auto) 1fr; gap: 10px 34px; align-items: start; padding: 22px 28px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.name-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.symbol { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 84px; line-height: 1; letter-spacing: -.01em; font-variation-settings: 'SOFT' 50, 'opsz' 144; white-space: nowrap; min-height: 88px; display: flex; align-items: flex-start; color: var(--ink); }
.symbol .tk { position: relative; border-radius: 6px; transition: color .25s; cursor: default; }
.symbol .tk[data-slots] { cursor: pointer; }
.symbol .tk-root { font-weight: 500; }
.symbol .tk-q { font-size: .66em; margin-top: .3em; margin-left: .02em; }
.symbol .tk-sup { font-size: .4em; margin-top: .14em; letter-spacing: .01em; }
.symbol .tk-bass { font-size: .56em; margin-top: .42em; margin-left: .04em; color: var(--mist); }
.symbol .tk-root .acc { font-size: .62em; vertical-align: .55em; margin-left: .02em; }
.symbol .tk-q .acc, .symbol .tk-sup .acc, .symbol .tk-bass .acc { font-size: .86em; }
.symbol .tk.lit { color: var(--tc); }
.symbol .tk.flash { animation: flash .8s var(--ease); }
@keyframes flash { 0% { color: var(--tc, var(--accent)); } 100% { color: inherit; } }
.symbol.long { font-size: 64px; }
.symbol.xlong { font-size: 50px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 13px; cursor: pointer; transition: background .2s, border-color .2s, transform .15s; white-space: nowrap; }
.btn:hover { background: #fff; border-color: rgba(42, 36, 32, .32); }
.btn:active { transform: scale(.97); }
.btn-play { background: var(--ink); color: var(--card); border-color: var(--ink); }
.btn-play:hover { background: #000; border-color: #000; }
.btn[aria-pressed="true"] { background: rgba(181, 82, 58, .1); border-color: rgba(181, 82, 58, .55); color: var(--accent); }

.name-info { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.reading { margin: 0; font-size: 13px; color: var(--mist); letter-spacing: .04em; }
.formula { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.f-tone { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: 5px 8px 4px; border-radius: 11px; background: color-mix(in srgb, var(--tc) 11%, #fff); border: 1px solid color-mix(in srgb, var(--tc) 32%, transparent); cursor: pointer; transition: transform .15s var(--ease), background .2s; line-height: 1.2; }
.f-tone:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--tc) 18%, #fff); }
.f-tone span { white-space: nowrap; }
.f-tone .deg { font-family: var(--serif); font-size: 13px; color: var(--tc); font-weight: 600; }
.f-tone .nm { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.f-tone .sol { font-size: 10px; color: var(--mist); letter-spacing: .02em; }
.f-tone.hit { transform: translateY(-2px) scale(1.06); background: color-mix(in srgb, var(--tc) 26%, #fff); }
.char { margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.char .base-sym { display: inline-block; margin-right: 8px; padding: 0 7px; border-radius: 6px; background: var(--paper-2); font-family: var(--serif); font-weight: 600; font-size: 13px; color: var(--ink); }
.char .warn { display: flex; gap: 6px; align-items: baseline; margin-top: 6px; padding: 6px 10px; border-radius: 9px; background: rgba(181, 82, 58, .07); font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.char .warn b { flex: none; font-family: var(--serif); color: var(--tc); }
.char .tens-row { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 3px; }
.char .tens { display: inline-flex; gap: 5px; align-items: baseline; font-size: 12px; color: var(--mist); white-space: nowrap; }
.char .tens b { font-family: var(--serif); font-weight: 600; color: var(--tc); }
.also { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--mist); }
.also:empty { display: none; }
.also > span { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.also em { font-style: normal; color: var(--mist); letter-spacing: .04em; }
.also .alias { font-family: var(--serif); font-size: 14px; color: var(--ink); }
.also .link { font-family: var(--serif); font-size: 14px; color: var(--accent); border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(181, 82, 58, .35); text-underline-offset: 3px; }
.also .link:hover { text-decoration-color: var(--accent); }
.details { display: none; }

/* ── compare ───────────────────────────────────────────── */
.compare { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 11px 16px; border-radius: 14px; border: 1px dashed rgba(181, 82, 58, .45); background: rgba(181, 82, 58, .05); font-size: 13px; }
.compare[hidden] { display: none; }
.cmp-pair { display: inline-flex; align-items: center; gap: 8px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-family: var(--serif); font-size: 15px; }
.cmp-chip:hover { background: #fff; }
.cmp-chip .tag { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-family: var(--sans); font-size: 10.5px; background: var(--paper-2); color: var(--mist); }
.cmp-chip.is-b .tag { background: var(--ink); color: var(--card); }
.cmp-chip.playing { box-shadow: 0 0 0 3px rgba(181, 82, 58, .25); }
.cmp-arrow { color: var(--faint); }
.cmp-diff { display: flex; flex-wrap: wrap; gap: 4px 12px; flex: 1; min-width: 200px; color: var(--ink); }
.cmp-diff .d { white-space: nowrap; }
.cmp-diff .d b { font-weight: 700; color: var(--tc); }
.cmp-diff .muted { color: var(--mist); }
.cmp-tools { display: inline-flex; gap: 6px; margin-left: auto; }
.ico { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; color: var(--mist); }
.ico:hover:not(:disabled) { color: var(--ink); border-color: rgba(42, 36, 32, .34); }
.ico:disabled { opacity: .35; cursor: default; }
.cmp-legend { width: 100%; display: flex; gap: 14px; font-size: 11px; color: var(--mist); }
.cmp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.cmp-legend .lg-shared { background: var(--ink-2); }
.cmp-legend .lg-a { border: 1.5px dashed var(--mist); }
.cmp-legend .lg-new { background: var(--ink-2); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--accent); }

/* ── shelves ───────────────────────────────────────────── */
.shelves { margin-top: 14px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.shelf { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: background .2s, border-color .2s, transform .15s var(--ease), box-shadow .2s; min-width: 0; box-shadow: 0 1px 0 rgba(42, 36, 32, .05); }
.shelf:hover { border-color: var(--line-2); }
.shelf .sl { font-size: 11px; color: var(--mist); letter-spacing: .04em; white-space: nowrap; }
.shelf .sv { font-family: var(--serif); font-size: 21px; line-height: 1.15; font-weight: 600; color: var(--tc); min-height: 24px; white-space: nowrap; }
.shelf .sn { font-family: var(--serif); font-size: 12px; color: var(--ink-2); min-height: 15px; white-space: nowrap; }
.shelf.off { background: transparent; border-style: dashed; border-color: var(--line-2); box-shadow: none; }
.shelf.off .sv { color: var(--faint); font-weight: 400; font-family: var(--sans); }
.shelf::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--tc); opacity: 0; transition: opacity .2s; }
.shelf[aria-selected="true"] { border-color: color-mix(in srgb, var(--tc) 55%, transparent); background: color-mix(in srgb, var(--tc) 9%, #fff); border-style: solid; box-shadow: var(--shadow-sm); }
.shelf[aria-selected="true"]::after { opacity: 1; }
.shelf.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: translateY(-3px); } }

.options { margin-top: 8px; padding: 10px 14px 11px; border-radius: 14px; background: color-mix(in srgb, var(--tc) 5%, var(--card)); border: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.opt-title { font-family: var(--mincho); font-weight: 700; font-size: 15px; color: var(--tc); letter-spacing: .04em; white-space: nowrap; }
.opt-hint { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--mist); line-height: 1.6; }
.opt-row { display: flex; flex-wrap: wrap; gap: 5px; }
.opt-row:empty { display: none; }
.opt { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.opt b { font-family: var(--serif); font-weight: 600; font-size: 15px; }
.opt small { font-family: var(--serif); font-size: 11.5px; color: var(--mist); }
.opt:hover:not([aria-disabled="true"]) { background: #fff; border-color: rgba(42, 36, 32, .3); }
.opt[aria-pressed="true"] { background: var(--tc); border-color: var(--tc); color: #fff; }
.opt[aria-pressed="true"] small { color: rgba(255, 255, 255, .82); }
.opt[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.opt-select { height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit; font-size: 12.5px; }

/* ── instrument ────────────────────────────────────────── */
.instrument { margin-top: 14px; padding: 12px 14px 10px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.inst-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.inst-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.forms { display: inline-flex; align-items: center; gap: 6px; }
.forms[hidden] { display: none; }
.form-label { font-size: 12px; color: var(--mist); min-width: 120px; text-align: center; white-space: nowrap; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mist); cursor: pointer; user-select: none; }
.toggle[hidden] { display: none; }
.toggle input { accent-color: var(--accent); }
.keys, .fret { position: relative; }
.keys svg, .fret svg { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.fret[hidden], .keys[hidden] { display: none; }
.inst-note { margin: 8px 2px 0; min-height: 18px; font-size: 12px; color: var(--mist); }
.inst-note:empty { display: none; }

/* keyboard */
.k { cursor: pointer; transition: fill .25s; }
.k-w { fill: #fffdf8; stroke: #cfc4b2; stroke-width: 1; }
.k-b { fill: #3a332d; stroke: #2a2420; stroke-width: 1; }
.k-w:hover { fill: #fff6e6; }
.k-b:hover { fill: #4d453e; }
.k-on.k-w { fill: color-mix(in srgb, var(--tc) 22%, #fffdf8); }
.k-on.k-b { fill: color-mix(in srgb, var(--tc) 72%, #2a2420); }
.k-dot { pointer-events: none; transition: transform .3s var(--ease); transform-box: fill-box; transform-origin: center; }
.k-lab { pointer-events: none; font-family: var(--serif); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.k-oct { pointer-events: none; font-family: var(--serif); font-size: 10px; fill: #a99a85; text-anchor: middle; }
.k-dot.hit { transform: scale(1.18); }
.k-pop { animation: kpop .55s var(--ease); }
@keyframes kpop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.k-ghost { fill: none; stroke: var(--mist); stroke-width: 1.6; stroke-dasharray: 3 3; pointer-events: none; }
.k-gone { animation: kgone .7s var(--ease) forwards; pointer-events: none; }
@keyframes kgone { 0% { opacity: .8; } 100% { opacity: 0; transform: scale(.6); } }
.k-new { fill: none; stroke: var(--accent); stroke-width: 2; pointer-events: none; }
.k-guide { animation: guide 1.1s ease-in-out infinite; }
@keyframes guide { 50% { fill: #e9a03b; } }
.k-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

/* fretboard: a light maple neck */
.fb-wood { fill: #efe3cb; }
.fb-fret { stroke: #b8a685; stroke-width: 1.6; }
.fb-nut { stroke: #3a332d; stroke-width: 5; stroke-linecap: round; }
.fb-str { stroke: #8c7d68; }
.fb-inlay { fill: #dccbaa; }
.fb-num { font-family: var(--serif); font-size: 11px; fill: var(--mist); text-anchor: middle; }
.fb-num.on { fill: var(--ink); font-weight: 600; }
.fb-mark { font-family: var(--sans); font-size: 12px; fill: var(--mist); text-anchor: middle; dominant-baseline: central; }
.fb-dot { cursor: pointer; }
.fb-dot circle { transition: transform .3s var(--ease); transform-box: fill-box; transform-origin: center; }
.fb-dot.hit circle { transform: scale(1.22); }
.fb-dot text { pointer-events: none; font-family: var(--serif); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.fb-ghost { pointer-events: none; }
.fb-barre { fill: rgba(42, 36, 32, .12); stroke: rgba(42, 36, 32, .2); }
.fb-cell { fill: transparent; cursor: pointer; }
.fb-cell:hover { fill: rgba(255, 255, 255, .35); }

.toast { position: fixed; left: 50%; top: calc(var(--top) + 14px); transform: translate(-50%, -8px); z-index: 60; margin: 0; max-width: min(560px, calc(100vw - 32px)); padding: 9px 16px; border-radius: 12px; background: var(--ink); color: var(--card); box-shadow: 0 14px 34px -14px rgba(42, 36, 32, .6); font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── library ───────────────────────────────────────────── */
.library { position: sticky; top: var(--top); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: linear-gradient(var(--paper), rgba(236, 229, 215, .6)); min-width: 0; }
.lib-head { display: none; align-items: center; justify-content: space-between; padding: 14px 18px 0; }
.lib-title { font-family: var(--mincho); font-weight: 700; font-size: 16px; letter-spacing: .08em; }
.search { position: relative; margin: 18px 18px 6px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--mist); }
.search:focus-within { border-color: rgba(181, 82, 58, .55); box-shadow: 0 0 0 3px rgba(181, 82, 58, .1); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-family: var(--serif); font-size: 15px; }
.search input::placeholder { font-family: var(--sans); font-size: 12px; color: var(--faint); }
.search-miss { margin: 0 20px 4px; font-size: 11.5px; color: var(--accent); }
.search-miss[hidden] { display: none; }
.lib-groups { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 18px 30px; scrollbar-width: thin; }
.lib-group h3 { margin: 16px 0 8px; font-family: var(--mincho); font-weight: 700; font-size: 12.5px; letter-spacing: .1em; color: var(--mist); }
.lib-items { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-item { height: 34px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-family: var(--serif); font-size: 14.5px; white-space: nowrap; transition: background .15s, border-color .15s; }
.lib-item:hover { background: #fff; border-color: var(--line-2); }
.lib-item[aria-current="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.lib-item .acc { font-size: .9em; }
.scrim { display: none; }

/* ── grammar ───────────────────────────────────────────── */
.grammar { position: relative; max-width: 1480px; margin: 0 auto; padding: 46px 28px 30px; border-top: 1px solid var(--line); }
.grammar h2 { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 26px; letter-spacing: .08em; }
.grammar-lead { margin: 6px 0 22px; color: var(--mist); font-size: 13.5px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-sm); }
.card-n { font-family: var(--serif); font-size: 12px; letter-spacing: .14em; color: var(--accent); }
.card h3 { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 17px; line-height: 1.5; letter-spacing: .03em; }
.card p { margin: 0; font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.card-ex { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.ex { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-family: var(--serif); font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s; }
.ex:hover { background: #fff; border-color: rgba(42, 36, 32, .34); }
.ex-seq { font-family: var(--sans); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; border-color: rgba(181, 82, 58, .5); color: var(--accent); background: rgba(181, 82, 58, .05); }
.ex-seq.playing { background: rgba(181, 82, 58, .14); }

/* ── footer & seo ───────────────────────────────────── */
.foot { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 1480px; margin: 0 auto; padding: 22px 28px 30px; border-top: 1px solid var(--line); font-size: 11px; color: var(--mist); }
.foot small a { text-decoration: none; }
.playground { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .32em; font-size: 11px; text-decoration: none; background: linear-gradient(90deg, #8a6a32, #c09346); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar { display: none; }

/* ── modal ─────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(42, 36, 32, .38); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(680px, 100%); max-height: min(86vh, 860px); overflow-y: auto; padding: 30px 34px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(42, 36, 32, .55); }
.modal-card h2 { margin: 0 0 10px; font-family: var(--mincho); font-weight: 700; font-size: 21px; letter-spacing: .04em; padding-right: 30px; }
.modal-card h3 { margin: 22px 0 6px; font-family: var(--mincho); font-weight: 700; font-size: 14.5px; color: var(--accent); letter-spacing: .06em; }
.modal-card p, .modal-card li { font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.modal-card p { margin: 0 0 8px; }
.modal-card ul { margin: 0; padding-left: 1.2em; }
.modal-card .lead { font-size: 14px; color: var(--ink); }
.modal-card .sister { margin-top: 18px; font-size: 12px; color: var(--mist); }
.x { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; color: var(--mist); }
.x:hover { color: var(--ink); }

/* ── tour ──────────────────────────────────────────────── */
.tour { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.tour[hidden] { display: none; }
.tour-spot { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(42, 36, 32, .42); outline: 2px solid rgba(255, 255, 255, .9); outline-offset: 2px; transition: all .4s var(--ease); }
.tour-tip { position: fixed; width: min(340px, calc(100vw - 32px)); padding: 16px 18px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 24px 50px -18px rgba(42, 36, 32, .55); pointer-events: auto; transition: top .4s var(--ease), left .4s var(--ease); }
.tour-tip p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.8; }
.tour-tip p b { color: var(--accent); font-weight: 700; }
.tour-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tour-foot .count, .tour-foot .skip { white-space: nowrap; }
.tour-foot .count { font-family: var(--serif); font-size: 11.5px; color: var(--mist); margin-right: auto; }
.tour-foot .skip { border: 0; background: none; color: var(--mist); font-size: 12px; cursor: pointer; padding: 6px 4px; }
.tour-foot .skip:hover { color: var(--ink); }
.tour-foot .btn { height: 34px; font-size: 12.5px; }

/* ── responsive ────────────────────────────────────────── */
@media (min-width: 1041px) and (max-height: 940px) {
  .bench { padding-top: 12px; }
  .namecard { margin-top: 10px; padding: 14px 22px; }
  .symbol { font-size: 68px; min-height: 70px; }
  .symbol.long { font-size: 54px; } .symbol.xlong { font-size: 42px; }
  .name-main { gap: 10px; }
  .name-info { gap: 7px; }
  .shelves { margin-top: 10px; }
  .shelf { padding: 5px 4px 6px; }
  .shelf .sv { font-size: 19px; }
  .options { padding: 8px 14px 9px; }
  .instrument { margin-top: 10px; padding-top: 10px; }
}
@media (max-width: 1240px) {
  :root { --lib-w: 280px; }
  .root { min-width: 34px; font-size: 14px; }
  .symbol { font-size: 72px; }
}
@media (max-width: 1040px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .library { position: fixed; z-index: 75; top: auto; bottom: 0; left: 0; right: 0; height: min(72vh, 620px); border-left: 0; border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; background: var(--paper); box-shadow: 0 -24px 60px -20px rgba(42, 36, 32, .45); transform: translateY(105%); transition: transform .35s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .library.open { transform: none; }
  .lib-head { display: flex; }
  .lib-head .x { position: static; }
  .search { margin-top: 12px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 74; background: rgba(42, 36, 32, .3); }
  .scrim[hidden] { display: none; }
  .bar { display: flex; position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 4px; padding: 6px; border-radius: 20px; background: rgba(253, 251, 246, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line-2); box-shadow: 0 16px 40px -14px rgba(42, 36, 32, .45); max-width: 560px; margin: 0 auto; }
  .bar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px; border: 0; border-radius: 14px; background: none; font-size: 10.5px; color: var(--mist); cursor: pointer; }
  .bar button svg { color: var(--ink); }
  .bar button:first-child { background: var(--ink); color: var(--card); }
  .bar button:first-child svg { color: var(--card); }
  .bar button[aria-pressed="true"] { color: var(--accent); background: rgba(181, 82, 58, .1); }
  .bar button[aria-pressed="true"] svg { color: var(--accent); }
  .actions { display: none; }
  .foot { padding-bottom: 100px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* phones: the name and the instrument share the first screen; shelves and details follow */
@media (max-width: 760px) {
  :root { --top: 50px; --r: 14px; }
  .top { padding: 0 12px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-title { font-size: 13.5px; letter-spacing: .12em; }
  .brand-sub { font-size: 10px; letter-spacing: .14em; }
  .top-nav { gap: 5px; }
  .chip { height: 30px; padding: 0 10px; font-size: 11.5px; }
  #btn-about { display: none; }
  .chip-icon { width: 30px; }
  .chip-lang { min-width: 38px; }
  .bench { padding: 10px 12px 16px; }
  .bench-top { order: 1; gap: 10px; }
  .namecard { order: 2; }
  .compare { order: 3; }
  .instrument { order: 4; }
  .shelves { order: 5; }
  .options { order: 6; }
  .details { order: 7; }
  .toast { order: 8; }
  .roots { width: 100%; gap: 3px; }
  .root { flex: 1; min-width: 0; height: 34px; padding: 0; font-size: 13px; border-radius: 8px; }
  .namecard { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px 12px; margin-top: 10px; box-shadow: var(--shadow-sm); }
  .name-main { gap: 0; }
  .symbol { font-size: 54px; min-height: 56px; }
  .symbol.long { font-size: 42px; min-height: 50px; }
  .symbol.xlong { font-size: 32px; min-height: 40px; }
  .name-info { gap: 6px; padding-top: 0; }
  .reading { font-size: 11.5px; }
  .formula { gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .formula::-webkit-scrollbar { display: none; }
  .f-tone { min-width: 38px; padding: 3px 6px 2px; flex: none; border-radius: 9px; }
  .f-tone .deg { font-size: 11.5px; }
  .f-tone .nm { font-size: 14.5px; }
  .f-tone .sol { font-size: 9px; }
  .instrument { margin-top: 10px; padding: 8px 8px 8px; box-shadow: var(--shadow-sm); }
  .inst-head { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 8px; }
  .inst-tools { display: contents; }
  #labels { grid-column: 2; grid-row: 1; }
  #inst-tabs { justify-self: start; }
  .inst-head .seg button { height: 26px; padding: 0 11px; font-size: 11.5px; }
  .forms { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .forms .ico { width: 28px; height: 28px; }
  .toggle { display: none !important; }
  .shelves { gap: 3px; margin-top: 10px; }
  .shelf { padding: 5px 1px 6px; border-radius: 10px; }
  .shelf .sl { font-size: 9.5px; letter-spacing: 0; }
  .shelf .sv { font-size: 16px; min-height: 19px; }
  .shelf .sn { font-size: 10.5px; min-height: 13px; }
  .options { grid-template-columns: 1fr; gap: 6px; padding: 9px 10px 10px; }
  .opt-title { font-size: 13.5px; }
  .opt { height: 36px; padding: 0 10px; }
  .opt-hint { font-size: 11.5px; }
  .details { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
  .details .notation { align-self: flex-start; }
  .details .notation button { height: 28px; padding: 0 10px; font-size: 13px; }
  .char { font-size: 12.5px; }
  .compare { padding: 10px 12px; gap: 8px 10px; font-size: 12px; }
  .cmp-tools { margin-left: 0; }
  .form-label { min-width: 0; font-size: 11px; }
  .grammar { padding: 34px 14px 20px; }
  .grammar h2 { font-size: 21px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 16px 16px; }
  .foot { padding: 18px 14px 100px; flex-direction: column-reverse; gap: 6px; }
  .modal-card { padding: 24px 20px; }
  .toast { top: calc(var(--top) + 8px); }
}

/* ── nothing above the keys changes height while you play (the name card, choices and compare bar are fixed) ── */
@media (min-width: 761px) {
  .namecard { height: 236px; grid-template-rows: minmax(0, 1fr); }
  .name-info { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 6px; }
  .name-info.scrolls { -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
  .options { min-height: 100px; align-content: start; }
}
@media (min-width: 1041px) and (max-height: 940px) { .namecard { height: 206px; } }
.cmp-diff { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.cmp-diff::-webkit-scrollbar { display: none; }
.k-arrow { pointer-events: none; animation: arrowIn .5s var(--ease); }
@keyframes arrowIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 760px) {
  .instrument { order: 3; }
  .compare { order: 4; }
  .symbol, .symbol.long, .symbol.xlong { height: 56px; min-height: 0; align-items: center; }
  .reading { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
/* accidentals have taller glyphs: pin the heights so a ♭ never nudges the layout */
.shelf .sv { height: 24px; line-height: 24px; }
.shelf .sn { height: 15px; line-height: 15px; }
.f-tone { height: 54px; justify-content: center; }
.f-tone .deg, .f-tone .nm, .f-tone .sol { line-height: 1.15; }
@media (max-width: 760px) {
  .shelf .sv { height: 19px; line-height: 19px; }
  .shelf .sn { height: 13px; line-height: 13px; }
  .f-tone { height: 46px; }
  .reading { height: 1.6em; line-height: 1.6em; }
}

/* ── the grammar beside the keys ───────────────────────── */
.lib-tabs { margin: 18px 18px 0; display: flex; }
.lib-tabs button { flex: 1; }
.lib-list[hidden], .lib-lesson[hidden] { display: none; }
.lib-list { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.lib-list .search { margin-top: 12px; }
.lib-lesson { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 30px; scrollbar-width: thin; }
.lesson { display: flex; flex-direction: column; gap: 9px; padding: 16px 16px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.ls-top { display: flex; align-items: center; gap: 6px; }
.ls-n { font-family: var(--serif); font-size: 15px; color: var(--accent); letter-spacing: .08em; white-space: nowrap; margin-right: 4px; }
.ls-n small { font-size: 11px; color: var(--faint); letter-spacing: .04em; }
.ls-dots { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.ls-dot { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; background: var(--line-2); cursor: pointer; transition: background .2s, transform .2s; }
.ls-dot:hover { background: var(--faint); }
.ls-dot[aria-current="true"] { background: var(--accent); transform: scale(1.25); }
.ls-top .ico { width: 30px; height: 30px; flex: none; }
.ls-close { display: none !important; }
.ls-title { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 16.5px; line-height: 1.5; letter-spacing: .03em; }
.ls-body p { margin: 0; font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.ls-more { display: none; border: 0; background: none; padding: 2px 0 0; font-size: 12px; color: var(--accent); cursor: pointer; }
.ls-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.ls-ex .ex { background: var(--paper); }
.ls-ex .ex.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.ls-hint { margin: 0; font-size: 11px; color: var(--mist); }
.ls-index { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ls-index button { width: 100%; display: flex; gap: 10px; align-items: baseline; text-align: left; padding: 7px 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-family: var(--mincho); font-weight: 600; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.ls-index button span { font-family: var(--serif); font-size: 11px; color: var(--faint); flex: none; }
.ls-index button:hover { background: rgba(255, 255, 255, .6); }
.ls-index button[aria-current="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.ls-index button[aria-current="true"] span { color: var(--accent); }
.ex-try { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 12.5px; border-color: rgba(181, 82, 58, .5); color: var(--accent); background: rgba(181, 82, 58, .05); }
.dock { display: none; }

@media (max-width: 1040px) {
  .lib-tabs { display: none; }
  .lib-lesson { display: none; }
  /* the lesson docks at the bottom, under the keys, and leaves the page usable above it */
  .dock { display: block; position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; height: 220px; padding: 0 10px calc(8px + env(safe-area-inset-bottom)); transition: height .3s var(--ease); pointer-events: none; }
  .dock[hidden] { display: none; }
  .dock .lesson { pointer-events: auto; height: 100%; overflow-y: auto; overscroll-behavior: contain; gap: 7px; padding: 12px 14px 12px; border-radius: 18px 18px 14px 14px; box-shadow: 0 -12px 34px -16px rgba(42, 36, 32, .45); max-width: 620px; margin: 0 auto; }
  .dock .ls-close { display: inline-grid !important; }
  .dock .ls-title { font-size: 15px; }
  .dock .ls-body p { font-size: 12.5px; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dock .ls-body.more p { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .dock .ls-body.clipped .ls-more, .dock .ls-body.more .ls-more { display: inline-block; }
  .dock .ls-hint { display: none; }
  .dock .ex { height: 34px; }
  body.docked .bar { display: none; }
  body.docked .foot { padding-bottom: calc(var(--dock-h, 220px) + 20px); }
  body.docked .toast { top: calc(var(--top) + 8px); }
}
@media (max-width: 760px) {
  .dock { padding-left: 8px; padding-right: 8px; }
  .dock .ls-dots { gap: 3px; }
  .dock .ls-dot { width: 7px; height: 7px; }
}

@media (max-width: 760px) {
  /* one row: piano/guitar · shape ‹ 1/3 › · degrees/notes */
  .inst-head { grid-template-columns: auto 1fr auto; }
  .forms { grid-column: 2; grid-row: 1; justify-content: center; gap: 2px; }
  #labels { grid-column: 3; }
  .form-label { font-size: 11.5px; }
  .fl-w, .fl-k { display: none; }
}

.tour-foot .back { color: var(--ink-2); }
.tour-foot .back::before { content: "‹ "; }

/* the grammar lives in the sidebar now: a short heading and the list of the nine rules under the lesson card */
.lib-lesson .grammar { max-width: none; margin: 0; padding: 18px 0 0; border: 0; }
.lib-lesson .grammar h2 { font-size: 13px; letter-spacing: .12em; color: var(--mist); }
.lib-lesson .grammar-lead { margin: 4px 0 6px; font-size: 12px; }
.lib-lesson .cards { display: block; }
.lib-lesson .cards .card { margin-bottom: 8px; padding: 12px 14px; box-shadow: none; }
.lib-lesson .ls-index { margin-top: 6px; }
.chip-grammar[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
@media (max-width: 1040px) { .chip-grammar { display: none; } }

/* ── the chord name ─────────────────────────────────────
   no plate, no shadow: the name is set like the title of a page. On wider screens it has a quiet
   column of its own, a shade warmer than the card and closed by a hairline, with a short rule
   in the colour of the root under it. */
.symbol { position: relative; width: fit-content; max-width: 100%; color: #211b17; }
.symbol .tk-root { font-weight: 560; }
.symbol .tk-q, .symbol .tk-sup { font-weight: 460; }
.symbol .tk-bass { font-weight: 400; }
.symbol .tk { transition: color 1s cubic-bezier(.3, .6, .3, 1), text-shadow 1.2s ease-out; }
@media (min-width: 761px) {
  .namecard { --py: 22px; --px: 28px; padding: var(--py) var(--px); overflow: hidden; }
  .name-main { align-self: stretch; margin: calc(-1 * var(--py)) 0 calc(-1 * var(--py)) calc(-1 * var(--px)); padding: var(--py) 32px var(--py) var(--px);
    background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 62%, var(--card)) 0%, color-mix(in srgb, var(--paper) 28%, var(--card)) 100%);
    border-right: 1px solid var(--line); }
  .symbol::after { content: ""; position: absolute; left: .07em; bottom: -.1em; width: 30px; height: 2px; border-radius: 2px; background: var(--c-root); opacity: .9; }
}
@media (min-width: 1041px) and (max-height: 940px) { .namecard { --py: 14px; --px: 22px; } }
@media (min-width: 1041px) and (max-height: 820px) { .namecard { --py: 12px; } }
/* the name's column has one width for every chord, so nothing beside it moves when the name grows */
@media (min-width: 761px) { .namecard { grid-template-columns: clamp(290px, 40%, 470px) minmax(0, 1fr); } }
/* the name and its rule keep the top of the column; the buttons settle at the bottom, with air between */
@media (min-width: 1041px) {
  .name-main { display: flex; flex-direction: column; }
  .name-main .symbol::after { bottom: -.2em; }
  .name-main .actions { margin-top: auto; padding-top: 22px; }
}

/* ── when a note sounds ───────────────────────────────
   quick to bloom, slow to settle — a soft glow, a thin halo, a wash of colour on the key,
   and on the guitar the string itself ringing from the fret to the bridge */
.k-dot.sound, .fb-dot.sound circle { animation: swell .9s cubic-bezier(.22, .8, .3, 1); }
@keyframes swell { 0% { transform: scale(1); } 14% { transform: scale(1.13); } 100% { transform: scale(1); } }
.fx-bloom { pointer-events: none; transform-box: fill-box; transform-origin: center; opacity: 0; animation: bloom 1.4s cubic-bezier(.16, .7, .3, 1) forwards; }
@keyframes bloom { 0% { opacity: 0; transform: scale(.9); } 10% { opacity: .42; } 100% { opacity: 0; transform: scale(2.1); } }
.fx-halo { pointer-events: none; stroke-width: 1.3; transform-box: fill-box; transform-origin: center; opacity: 0; animation: halo 1.25s cubic-bezier(.12, .65, .3, 1) .03s forwards; }
@keyframes halo { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(2.35); } }
.fx-wash { pointer-events: none; opacity: 0; animation: wash 1.2s cubic-bezier(.2, .7, .3, 1) forwards; }
.fx-wash.on-b { animation-name: washB; }
@keyframes wash { 0% { opacity: 0; } 8% { opacity: .2; } 100% { opacity: 0; } }
@keyframes washB { 0% { opacity: 0; } 8% { opacity: .38; } 100% { opacity: 0; } }
.fx-lens, .fx-string { pointer-events: none; }
.fx-string { stroke-width: 1.8; stroke-linecap: round; }
.f-tone { transition: transform .9s cubic-bezier(.2, .7, .3, 1), background .9s ease-out, box-shadow .9s ease-out; }
.f-tone.sound { transform: translateY(-1.5px); background: color-mix(in srgb, var(--tc) 24%, #fff); box-shadow: 0 2px 5px -3px color-mix(in srgb, var(--tc) 70%, transparent); transition-duration: .09s; }
/* room above and below the chips, so a lifted chip never loses its border to the scroll edge */
.formula { padding: 3px 0 4px; margin: -3px 0 -4px; }
.symbol .tk { transition: color 1s cubic-bezier(.3, .6, .3, 1), text-shadow 1.2s ease-out; }
.symbol .tk.sing { color: var(--tc); text-shadow: 0 0 .3em color-mix(in srgb, var(--tc) 22%, transparent); transition-duration: .08s; }

/* ── during the tour only the highlighted part (and the tip) can be touched ── */
body.touring *:not(.tour, .tour *) { pointer-events: none; }

/* ── one slot under the shelves for the choices and the compare bar ──
   On tablets and computers the compare bar sits inside the same fixed-height slot as the choices,
   so turning it on or off (by hand or from a grammar example) never moves the keys or the fretboard. */
@media (max-width: 760px) { .slot { display: contents; } }
@media (min-width: 761px) {
  .slot { position: relative; margin-top: 8px; height: 100px; flex: none; }
  .slot .options { margin-top: 0; height: 100%; min-height: 0; overflow: hidden; align-content: start; }
  .slot .opt-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .slot .opt-row::-webkit-scrollbar { display: none; }
  .slot .opt-hint { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .slot .compare { position: absolute; left: 1px; right: 1px; bottom: 1px; margin: 0; height: 48px; padding: 0 12px 0 10px; flex-wrap: nowrap; gap: 12px; border: 0; border-top: 1px dashed rgba(181, 82, 58, .4); border-radius: 0 0 13px 13px; background: color-mix(in srgb, var(--accent) 6%, var(--card)); animation: cmpIn .35s var(--ease); }
  @keyframes cmpIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  .slot .compare[hidden] { display: none; }
  .slot .cmp-chip { height: 30px; font-size: 14px; }
  .slot .cmp-pair, .slot .cmp-tools { flex: none; }
  .slot .cmp-diff { min-width: 0; font-size: 12.5px; }
  .slot .cmp-legend { order: 3; width: auto; flex: none; gap: 10px; }
  .slot .cmp-tools { order: 4; margin-left: 0; }
  .slot .cmp-tools .ico { width: 30px; height: 30px; }
  /* while comparing, the choices keep their top row and give the hint's room to the bar */
  .slot:has(.compare:not([hidden])) .opt-hint { display: none; }
  .slot:has(.compare:not([hidden])) .options:has(.opt-row:empty) .opt-hint { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* the line under the fretboard keeps its place even when it has nothing to say */
  .instrument:has(.fret:not([hidden])) .inst-note:empty { display: block; visibility: hidden; }
  .inst-note { height: 18px; min-height: 0; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 761px) and (max-width: 1240px) { .slot .cmp-legend { display: none; } }
@media (min-width: 1041px) and (max-height: 940px) {
  .slot { margin-top: 7px; height: 92px; }
  .shelves { margin-top: 8px; }
  .instrument { margin-top: 8px; padding: 9px 14px 8px; }
  .inst-head { margin-bottom: 7px; }
  .inst-note { margin-top: 5px; }
}
@media (min-width: 1041px) and (max-height: 820px) { .namecard { height: 190px; padding-top: 12px; padding-bottom: 12px; } }
/* a chosen choice stays readable under the pointer */
.opt[aria-pressed="true"]:hover:not([aria-disabled="true"]) { background: var(--tc); border-color: var(--tc); filter: brightness(1.04); }

/* ── the three buttons under the name always stay on one line ──
   the page measures the row; if it is tight the buttons draw in their padding (1), the two quieter
   buttons let go of their icons (2), and at the very narrowest everything becomes a touch smaller (3) */
@media (min-width: 1041px) {
  .name-main .actions { flex-wrap: nowrap; gap: 8px; }
  .name-main .actions .btn { flex: none; }
  .actions[data-fit="1"], .actions[data-fit="2"] { gap: 6px; }
  .actions[data-fit="1"] .btn { padding: 0 13px; gap: 6px; }
  .actions[data-fit="2"] .btn { padding: 0 12px; gap: 6px; }
  .actions[data-fit="2"] .btn:not(.btn-play) svg, .actions[data-fit="3"] .btn:not(.btn-play) svg { display: none; }
  .actions[data-fit="3"] { gap: 5px; }
  .actions[data-fit="3"] .btn { height: 36px; padding: 0 10px; gap: 5px; font-size: 12.5px; }
}

/* ── typesetting the chord name ──
   Every part of the name stands on one baseline, the root's. A raised accidental or a superscript
   is moved without changing any line box, so a ♭ or ♯ after the root can no longer push the letter
   down and leave "m7" or "add9" floating. */
.symbol, .symbol.long, .symbol.xlong { align-items: baseline; }
.symbol .tk { line-height: 1; }
.symbol .tk-q { margin-top: 0; margin-left: .03em; }
.symbol .tk-bass { margin-top: 0; margin-left: .06em; }
.symbol .tk-sup { margin-top: 0; margin-left: .04em; top: -1.12em; }
.symbol .tk-root .acc { font-size: .66em; vertical-align: baseline; top: -.54em; margin: 0 -.01em 0 .03em; line-height: 0; }
.symbol .tk-q .acc, .symbol .tk-bass .acc { font-size: .78em; top: -.18em; line-height: 0; }
.symbol .tk-sup .acc { font-size: .84em; top: -.1em; line-height: 0; }

/* ── reset, above the keys / fretboard ── */
.reset { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink); font-size: 11.5px; letter-spacing: .02em; cursor: pointer; transition: background .2s, border-color .2s, opacity .25s, color .2s; }
.reset:hover:not(:disabled) { background: var(--card); border-color: rgba(42, 36, 32, .32); }
.reset:disabled { opacity: .38; cursor: default; }
.reset svg { flex: none; }
@media (max-width: 1040px) {
  .inst-head { grid-template-columns: 1fr auto auto; }
  #btn-reset { grid-column: 2; grid-row: 1; }
  #labels { grid-column: 3; }
  .reset { width: 28px; height: 26px; padding: 0; justify-content: center; }
  .reset span { display: none; }
}
@media (max-width: 760px) {
  .inst-head { grid-template-columns: auto 1fr auto auto; gap: 5px; }
  #btn-reset { grid-column: 3; }
  #labels { grid-column: 4; }
}
@media (min-width: 1041px) and (max-width: 1280px) {
  .reset { width: 28px; padding: 0; justify-content: center; }
  .reset span { display: none; }
}
@media (max-width: 340px) {
  .inst-head .seg button { padding: 0 6px !important; }
  .form-label { display: none; }
}
@media (max-width: 400px) {
  .inst-head .seg button { padding: 0 8px; }
  .forms .ico { width: 24px; height: 24px; }
  .form-label { font-size: 11px; }
  .reset { width: 26px; }
}

/* ── the way back after the grammar or the tour ── */
.ret { position: fixed; z-index: 58; left: 50%; bottom: 24px; transform: translate(-50%, 10px); width: max-content; max-width: min(560px, calc(100vw - 24px)); padding: 12px 14px 12px 18px; border-radius: 16px; background: rgba(253, 251, 246, .97); border: 1px solid var(--line-2); box-shadow: 0 18px 44px -18px rgba(42, 36, 32, .5); opacity: 0; transition: opacity .3s, transform .3s var(--ease); }
.ret.on { opacity: 1; transform: translate(-50%, 0); }
.ret[hidden] { display: none; }
.ret-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.ret-msg { margin: 0; font-size: 12.5px; color: var(--mist); }
.ret-msg b { font-family: var(--serif); font-weight: 500; font-size: 15px; color: var(--ink); }
.ret-acts { display: flex; align-items: center; gap: 8px; }
.ret-acts .btn { height: 34px; font-size: 12.5px; }
.ret-acts .btn .sym { font-family: var(--serif); font-size: 14px; }
.ret-keep { flex: none; margin: -6px -6px -6px 0; padding: 6px; border: 0; background: none; color: var(--mist); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(42, 36, 32, .25); }
.ret-keep:hover { color: var(--ink); }
@media (max-width: 1040px) { .ret { bottom: calc(86px + env(safe-area-inset-bottom)); } }
@media (max-width: 760px) {
  .ret { left: 12px; right: 12px; width: auto; max-width: none; transform: translateY(10px); padding: 12px 14px; }
  .ret.on { transform: none; }
  .ret-acts .btn { flex: 1 1 0; justify-content: center; padding: 0 10px; white-space: nowrap; }
}

/* ── messages appear at the foot of the screen, clear of the chord name ── */
.toast { top: auto; bottom: 26px; width: max-content; transform: translate(-50%, 8px); }
.toast.on { transform: translate(-50%, 0); }
@media (max-width: 1040px) { .toast { top: auto; bottom: calc(88px + env(safe-area-inset-bottom)); } body.docked .toast { top: calc(var(--top) + 8px); bottom: auto; } }
body.ret-on .toast { bottom: 138px; }
@media (max-width: 1040px) { body.ret-on .toast { bottom: calc(200px + env(safe-area-inset-bottom)); } }

/* ── footer: the way to "About" on every screen ── */
.foot-links { display: inline-flex; align-items: center; gap: 18px; }
.foot-about { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(42, 36, 32, .25); }
.foot-about:hover { color: var(--ink); }

/* "same notes": each other name carries a quiet note on how it is read */
.also .same { gap: 4px 14px; }
.also .alt { display: inline-flex; align-items: baseline; gap: 5px; }
.also .alt small { font-size: 10.5px; color: var(--mist); letter-spacing: .02em; }

/* the page's h1 is the name in the header; it keeps the look it had as plain text */
h1.brand-text { margin: 0; font: inherit; }
