:root {
  --ink: #0e0e0e;
  --paper: #ffffff;
  --g1: #f6f6f5;
  --g2: #e8e8e6;
  --g3: #c8c8c5;
  --g4: #8d8d89;
  --g5: #5c5c58;
  --red: #e2372b;
  --red-wash: #fdeeed;
  --line: 1.5px;
  --serif: "Castoro", "Iowan Old Style", Georgia, serif;
  --ui: "Host Grotesk", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --card: 128px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* Dark theme: dark grays rather than black, light ink. Set on <html> by the head script / switch. */
:root[data-theme="dark"] {
  --ink: #ececee;
  --paper: #1c1c1f;
  --g1: #242428;
  --g2: #303035;
  --g3: #4a4a50;
  --g4: #8b8b92;
  --g5: #b6b6bc;
  --red: #ff5d52;
  --red-wash: #3b2120;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.app {
  min-height: 100vh;
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 28px 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.app > * { min-width: 0; }

/* ---------------------------------------------------------------- top bar + tabs */

.topbar {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  border-bottom: var(--line) solid var(--ink);
}
.brand { font: italic 24px/1 var(--serif); padding-bottom: 9px; white-space: nowrap; }

/* Capo: one button in the top bar (left of the tabs) that opens a small panel */
.topbar { position: relative; z-index: 20; } /* keep the capo panel above the views */
.capo-tools { position: relative; margin-left: -12px; padding-bottom: 6px; } /* sits just right of the theme switch */

/* Light / dark switch: sun on the left in light mode, moon on the right in dark mode */
.theme-switch {
  margin-left: auto;
  padding: 0 0 6px;
  border: 0;
  background: none;
  cursor: pointer;
}
.theme-track {
  position: relative;
  display: block;
  width: 48px;
  height: 26px;
  border: var(--line) solid var(--g3);
  border-radius: 999px;
  background: var(--g1);
  transition: background-color .2s, border-color .2s;
}
.theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  color: #d99700;
  transition: transform .22s var(--ease), color .2s;
}
.theme-thumb svg { grid-area: 1 / 1; width: 13px; height: 13px; transition: opacity .2s, transform .3s var(--ease); }
.ti-moon { opacity: 0; transform: rotate(-60deg); }
.theme-switch:hover .theme-track { border-color: var(--ink); }
.theme-switch:focus-visible { outline: none; }
.theme-switch:focus-visible .theme-track { outline: 2px solid var(--ink); outline-offset: 2px; }
:root[data-theme="dark"] .theme-track { background: var(--g2); }
:root[data-theme="dark"] .theme-thumb { transform: translateX(22px); color: var(--ink); background: var(--g3); }
:root[data-theme="dark"] .ti-sun { opacity: 0; transform: rotate(60deg); }
:root[data-theme="dark"] .ti-moon { opacity: 1; transform: none; }
body[data-tab="tuner"] .theme-switch + .capo-tools { visibility: hidden; }

.capo-btn {
  height: 26px;
  padding: 0 7px 0 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  white-space: nowrap;
}
.capo-btn:hover { background: var(--g1); }
.capo-btn-label { font: 500 10.5px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--g5); }
.capo-btn-val { min-width: 8px; font: 600 12px/1 var(--ui); font-variant-numeric: tabular-nums; text-align: center; }
.capo-btn svg { width: 13px; height: 13px; transition: transform .15s var(--ease); }
.capo-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.capo-tools.is-on .capo-btn { background: var(--ink); color: var(--paper); }
.capo-tools.is-on .capo-btn-label { color: var(--g3); }
.capo-tools.is-on .capo-btn:hover { background: var(--g5); border-color: var(--g5); }

.capo-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 284px;
  padding: 14px;
  border: var(--line) solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .35);
  animation: capo-pop-in .14s var(--ease);
}
@keyframes capo-pop-in { from { opacity: 0; transform: translateY(-4px); } }
.capo-pop-head { margin: 0 0 10px; font: 500 10.5px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--g5); }
.capo-frets { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.capo-fret {
  height: 30px;
  padding: 0;
  border: var(--line) solid var(--g2);
  border-radius: 8px;
  background: var(--paper);
  font: 600 12px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.capo-fret:hover { border-color: var(--ink); }
.capo-fret[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.capo-pop-note { margin: 10px 0 0; min-height: 14px; font: 11px/1.4 var(--ui); color: var(--g4); }
.capo-pop-sep { height: var(--line); margin: 12px -14px; background: var(--g2); }

/* iOS-style on/off switch */
.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 19px;
  border-radius: 999px;
  background: var(--g3);
  transition: background .18s var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(13px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch-body { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.switch-text { font: 500 12px/1.2 var(--ui); color: var(--ink); }
.switch-sub { font: 11px/1.35 var(--ui); color: var(--g4); }
.capo-tools:not(.is-on) .keep-switch { opacity: .5; } /* no effect without a capo */

.tabs { display: flex; gap: 26px; }
.tab {
  position: relative;
  border: 0;
  background: none;
  padding: 0 1px 12px;
  font: 500 11px/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--g4);
  cursor: pointer;
  transition: color .12s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--line));
  height: 3px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform .2s var(--ease);
}
.tab[aria-selected="true"]::after { transform: none; }
.tab:focus-visible { outline-offset: 4px; border-radius: 2px; }

.view { min-width: 0; min-height: 0; }
.view[hidden] { display: none; }
.view.enter { animation: view-in .24s var(--ease); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.view-chords {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}
.view-chords > * { min-width: 0; }

/* ---------------------------------------------------------------- shelf */

.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.label {
  margin: 0;
  font: 500 11px/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.count { font-size: 11px; color: var(--g4); }
.spacer { flex: 1; }

.strip {
  position: relative;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 2px 10px;
  min-height: calc(var(--card) + 24px);
  scrollbar-width: thin;
  scrollbar-color: var(--g3) transparent;
}

.empty {
  flex: 0 0 auto;
  width: var(--card);
  height: var(--card);
  border: var(--line) dashed var(--g3);
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--g4);
  font-size: 11px;
  line-height: 1.5;
}

.card {
  position: relative;
  flex: 0 0 auto;
  width: var(--card);
  height: var(--card);
  border: var(--line) solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background-color .15s, opacity .16s, transform .16s;
}
.card:hover { background: var(--g1); }
.card .diagram { width: 70px; height: auto; display: block; color: var(--ink); }
.card-name {
  /* Roomy line box and side padding so italic qualities (the 7 in maj7) and descenders never get clipped. */
  font: 25px/1.3 var(--serif);
  padding: 0 .16em .04em .1em;
  white-space: nowrap;
  max-width: calc(100% - 10px);
  overflow: hidden;
}
.card.enter { animation: card-in .28s var(--ease); }
.card.strum { animation: card-strum .26s var(--ease); }
@keyframes card-strum {
  35% { transform: scale(.955); background: var(--g2); }
}
.card.leaving { opacity: 0; transform: scale(.88); }
.card.placeholder { border-style: dashed; border-color: var(--g3); background: transparent; }
.card.placeholder > * { visibility: hidden; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px) scale(.94); }
  to { opacity: 1; transform: none; }
}

.ghost {
  position: fixed;
  z-index: 50;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  background: var(--paper);
  transform: rotate(-2.5deg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .08);
}
.ghost .trash { display: none; }
body.dragging, body.dragging * { cursor: grabbing !important; }

.trash {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: var(--line) solid var(--red);
  border-radius: 8px;
  background: var(--paper);
  color: var(--red);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .14s, transform .14s, background-color .14s;
}
.trash svg { width: 15px; height: 15px; }
.card:hover .trash, .card:focus-within .trash { opacity: 1; transform: none; }
.trash:hover { background: var(--red-wash); }
.trash:focus-visible { outline-color: var(--red); }
@media (hover: none) { .trash { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- stage */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.neck { display: flex; align-items: center; gap: 14px; }
.neck-side { width: 34px; }
.neck-tools { display: flex; flex-direction: column; gap: 8px; }

.diagram-box .diagram {
  width: clamp(150px, 24vh, 250px);
  height: auto;
  display: block;
  color: var(--ink);
  overflow: visible;
}

.dg-fr { font: 500 7.5px var(--ui); fill: var(--g5); }
.dg-tab { font: 500 9.5px var(--ui); fill: var(--ink); }
.dg-tab-x { fill: var(--g4); }
.dg-str { font: 400 7px var(--ui); fill: var(--g4); letter-spacing: .04em; }
.dg-faint { color: var(--g3); }
.dg-hit { cursor: pointer; }
.dg-ghost { fill: var(--g4); opacity: 0; pointer-events: none; transition: opacity .1s; }
.dg-cell:hover .dg-ghost { opacity: .35; }
.dg-cell.on:hover .dg-ghost { opacity: 1; fill: var(--g3); }
.dg-capo { fill: var(--g5); }
.dg-top rect { transition: fill .1s; }
.dg-top:hover rect { fill: rgba(0, 0, 0, .06); }


.name-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  width: 100%;
  margin-top: 6px;
}
.name-side { display: flex; justify-content: flex-start; }

.chord-name {
  margin: 0;
  font: 400 clamp(56px, min(9vw, 12vh), 124px)/1 var(--serif);
  letter-spacing: -.01em;
  white-space: nowrap;
  text-align: center;
  min-height: 1em;
}
.cn-q { font-style: italic; font-size: .62em; margin-left: .03em; }
.cn-bass { color: var(--g4); font-size: .62em; }
.cn-notes { font-size: .6em; }
.cn-empty { color: var(--g3); font-style: italic; font-size: .5em; }
.chord-name.pop { animation: pop .22s var(--ease); }
@keyframes pop {
  from { opacity: .25; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.add-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: var(--line) solid var(--ink);
  background: var(--paper);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background-color .14s, color .14s, transform .1s, border-color .14s;
}
.add-btn svg { width: 24px; height: 24px; }
.add-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.add-btn:active:not(:disabled) { transform: scale(.93); }
.add-btn:disabled { border-color: var(--g3); color: var(--g3); cursor: not-allowed; }
.add-btn.nudge { animation: nudge .3s; }
@keyframes nudge {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.chord-notes {
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 12px;
  color: var(--g5);
  letter-spacing: .04em;
  text-align: center;
}
.chord-notes .sep { color: var(--g3); margin: 0 .55em; }
.chord-notes .cap { color: var(--g4); margin-left: 1.2em; font-style: italic; }

/* ---------------------------------------------------------------- buttons */

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: var(--line) solid var(--ink);
  border-radius: 9px;
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.icon-btn:disabled { border-color: var(--g3); color: var(--g3); cursor: default; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.small svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- keys */

.keys {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px 28px;
  padding-top: 4px;
}

.hints {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--g4);
  font-size: 11px;
}
kbd {
  display: inline-block;
  min-width: 19px;
  padding: 1px 5px;
  margin: 0 1px;
  border: 1px solid var(--g3);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 500 10.5px/1.4 var(--ui);
  color: var(--ink);
  text-align: center;
}

.keys-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.seg {
  display: inline-flex;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: 2px;
}
.seg button {
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 5px 14px;
  font: 500 11px/1.2 var(--ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--g5);
  transition: background-color .14s, color .14s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.status { margin: 0; min-height: 14px; max-width: 260px; font-size: 10.5px; line-height: 1.4; color: var(--g4); text-align: right; }

/* Compact keyboard: C to the F above, one key per letter. */
.mini {
  --kw: clamp(24px, calc((100vw - 40px) / 11 - 4px), 46px);
  --kg: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: calc(11 * var(--kw) + 10 * var(--kg));
}

.oct-row { display: flex; align-items: center; gap: 10px; }
.oct-btns { display: flex; gap: 5px; }
.oct-btn {
  width: 28px;
  height: 22px;
  padding: 0;
  border: var(--line) solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  font: 500 11px/1 var(--ui);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color .12s, color .12s;
}
.oct-btn:hover { background: var(--g1); }
.oct-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.oct-line { flex: 1; min-width: 12px; height: var(--line); background: var(--g3); }
.oct-range { font-size: 11px; color: var(--g5); white-space: nowrap; }

.piano {
  position: relative;
  display: flex;
  gap: var(--kg);
  height: calc(var(--kw) * 2.35);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.key { position: relative; cursor: pointer; }
.white {
  flex: 0 0 var(--kw);
  height: 100%;
  background: var(--paper);
  border: var(--line) solid var(--ink);
  border-radius: 7px;
  transition: background-color .06s;
}
.white.down { background: var(--g2); }
.black {
  position: absolute;
  top: 0;
  z-index: 2;
  left: calc(var(--i) * (var(--kw) + var(--kg)) - var(--kg) / 2);
  width: calc(var(--kw) * .66);
  height: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  border: var(--line) solid var(--paper);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  transition: background-color .06s;
}
.black.down { background: var(--g5); }

.kl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  text-align: center;
  font: 500 12px/1 var(--ui);
  color: var(--ink);
  pointer-events: none;
}
.black .kl { bottom: 8px; color: var(--paper); font-size: 11px; }

/* a dark piano keeps black keys darker than white keys */
:root[data-theme="dark"] .white { background: #2c2c30; border-color: #45454b; }
:root[data-theme="dark"] .white.down { background: #3e3e44; }
:root[data-theme="dark"] .black { background: #0f0f11; border-color: var(--paper); }
:root[data-theme="dark"] .black.down { background: #4a4a50; }
:root[data-theme="dark"] .black .kl { color: var(--g4); }

/* ---------------------------------------------------------------- tuner */

.view-tuner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 0 14px;
}
.tuner {
  width: 100%;
  max-width: 1160px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tn-tuning { align-self: flex-start; display: flex; gap: 10px; align-items: baseline; }
.tn-tuning .count { letter-spacing: .04em; text-transform: none; font-weight: 400; }

/* Headstock */
.tn-neck { display: flex; justify-content: center; width: 100%; margin-top: 4px; }
.neck-svg { display: block; height: clamp(250px, 41vh, 440px); width: auto; max-width: 100%; overflow: visible; }

.hs-body { fill: var(--paper); stroke: var(--ink); stroke-width: var(--line); stroke-linejoin: round; }
.hs-shaft { fill: var(--g1); stroke: var(--ink); stroke-width: 1.2; }
.hs-bushing { fill: var(--g1); stroke: var(--ink); stroke-width: 1.4; }
.hs-post { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.hs-board { fill: var(--paper); }
.hs-edge { stroke: var(--ink); stroke-width: var(--line); }
.hs-fret { stroke: var(--g3); stroke-width: 2.4; }
.hs-nut { fill: var(--ink); }
.hs-str { stroke: var(--ink); fill: none; stroke-linecap: round; }
.hs-blur { fill: var(--ink); opacity: 0; pointer-events: none; }

.peg { cursor: pointer; outline: none; }
.peg-hit { fill: transparent; } /* a larger touch target than the drawn circle */
.peg-c { fill: var(--paper); stroke: var(--ink); stroke-width: var(--line); transition: fill .12s, stroke-width .12s; }
.peg-t { font: 31px var(--serif); fill: var(--ink); pointer-events: none; transition: fill .12s; }
.peg-o { font: 500 10px var(--ui); }
.peg:hover .peg-c { fill: var(--g1); }
.peg:focus-visible .peg-c, .peg:active .peg-c { stroke-width: 3; }
.peg.target .peg-c { fill: var(--ink); }
.peg.target .peg-t { fill: var(--paper); }
.peg-halo {
  fill: none;
  stroke: var(--ink);
  stroke-width: var(--line);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(.86);
  transition: opacity .15s, transform .2s var(--ease);
  pointer-events: none;
}
.peg.in-tune .peg-halo { opacity: 1; transform: none; }
.peg.ringing .peg-halo { animation: halo 1.1s var(--ease) infinite; }
@keyframes halo {
  from { opacity: .8; transform: scale(.88); }
  to { opacity: 0; transform: scale(1.3); }
}

.tn-controls { margin-top: 12px; }
.auto-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 18px 0 15px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font: 500 11px/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .14s, color .14s, transform .1s;
}
.auto-btn:hover { background: var(--g1); }
.auto-btn:active { transform: scale(.96); }
.auto-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.auto-dot { width: 8px; height: 8px; border-radius: 50%; border: var(--line) solid currentColor; }
.auto-btn[aria-pressed="true"] .auto-dot { background: currentColor; }

/* Dial */
.tn-dial { margin-top: 10px; width: min(440px, 100%, 46vh); }
.dial-svg { display: block; width: 100%; height: auto; overflow: visible; }
.dl-zone { fill: var(--g1); transition: fill .15s; }
.tuner.ok .dl-zone { fill: var(--g2); }
.dl-arc { fill: none; stroke: var(--g3); stroke-width: 1.2; }
.dl-tick { stroke-linecap: round; }
.dl-tick.minor { stroke: var(--g3); stroke-width: 1.5; }
.dl-tick.mid { stroke: var(--g4); stroke-width: 2; }
.dl-tick.zero { stroke: var(--ink); stroke-width: 2.6; }
.dl-lab { font: 11px var(--ui); fill: var(--g4); }
.dl-sym { font: 30px var(--serif); fill: var(--g4); }
.dl-needle { color: var(--g3); transition: color .25s; }
.tuner.live .dl-needle { color: var(--ink); }
.tuner.held .dl-needle { color: var(--g4); }
.dl-arm { stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.dl-weight { fill: currentColor; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.dl-pivot { fill: var(--paper); stroke: currentColor; stroke-width: 2.2; }
.dl-pin { fill: currentColor; }

.tn-read { margin-top: 2px; display: flex; flex-direction: column; align-items: center; }
.tn-note {
  display: flex;
  align-items: baseline;
  min-height: 1em;
  font: 400 clamp(48px, 8vh, 84px)/1 var(--serif);
}
.tn-note sub { font: 500 .2em/1 var(--ui); color: var(--g4); margin-left: .1em; }
.tn-note .dash { color: var(--g3); }
.tn-hint {
  margin: 8px 0 0;
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 999px;
  font: 500 11px/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--g5);
  transition: background-color .15s, color .15s, opacity .2s;
}
.tuner.ok .tn-hint { background: var(--ink); color: var(--paper); }
.tuner.held .tn-hint { opacity: .5; }

.tn-status:empty { display: none; }
.tn-status { margin: 10px 0 0; min-height: 14px; max-width: 420px; font-size: 11px; line-height: 1.45; color: var(--g4); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .peg.ringing .peg-halo { animation: none; }
}

@media (max-width: 980px) {
  .keys { grid-template-columns: 1fr; justify-items: center; }
  .mini { grid-row: 1; }
  .hints { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
  .keys-side { align-items: center; }
  .status { text-align: center; }
}

@media (max-width: 720px) {
  .app { padding: 16px 16px 14px; }
  :root { --card: 118px; }
  .card .diagram { width: 64px; }
  .card-name { font-size: 22px; }
  .diagram-box .diagram { width: 196px; }
  .name-row { gap: 12px; }
  .oct-btn { width: 26px; }
  .oct-range { display: none; }
  .brand { font-size: 21px; }
  .tabs { gap: 18px; }
}


/* ---------------------------------------------------------------- right-click menus */

.ctx-menu {
  position: fixed;
  z-index: 300;
  min-width: 196px;
  max-width: 300px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: var(--line) solid var(--ink);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .07);
  animation: ctx-in .12s var(--ease);
}
@keyframes ctx-in { from { opacity: 0; transform: translateY(-3px) scale(.98); } }
.ctx-item {
  height: 30px;
  padding: 0 10px 0 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: 500 12px/1 var(--ui);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
}
.ctx-item svg, .ctx-spacer { width: 15px; height: 15px; flex: none; color: var(--g5); }
.ctx-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ctx-item:focus-visible, .ctx-item:hover:not(:disabled), .ctx-item:focus:not(:disabled) { background: var(--ink); color: var(--paper); }
.ctx-item:hover:not(:disabled) svg, .ctx-item:focus:not(:disabled) svg { color: var(--paper); }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger svg { color: var(--red); }
.ctx-item.danger:hover:not(:disabled), .ctx-item.danger:focus:not(:disabled) { background: var(--red-wash); color: var(--red); }
.ctx-item.danger:hover:not(:disabled) svg, .ctx-item.danger:focus:not(:disabled) svg { color: var(--red); }
.ctx-item:disabled { color: var(--g3); cursor: default; }
.ctx-item:disabled svg { color: var(--g3); }
.ctx-item kbd { margin-left: 12px; border-color: currentColor; color: inherit; opacity: .55; font-size: 10px; }
.ctx-sep { height: var(--line); margin: 4px 6px; background: var(--g2); }
.ctx-head { padding: 7px 9px 4px; font: 500 10px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g4); }

/* ---------------------------------------------------------------- toasts */

#toast-root {
  position: fixed;
  left: 50%;
  bottom: var(--toast-bottom, 22px);
  z-index: 320;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  max-width: min(560px, calc(100vw - 32px));
  min-height: 40px;
  padding: 8px 8px 8px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: var(--line) solid var(--ink);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .13);
  font: 500 12px/1.45 var(--ui);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s, transform .18s var(--ease);
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast-msg { padding-right: 5px; }
.toast-error { border-color: var(--red); }
.toast-error svg { color: var(--red); }
.toast-action {
  flex: none;
  height: 28px;
  padding: 0 12px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 500 11px/1 var(--ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.toast-action:hover { background: var(--g5); border-color: var(--g5); }

/* four tabs on a phone: tighter tab row so "DAW" stays inside the page */
@media (max-width: 440px) {
  .topbar { gap: 12px; }
  .brand { font-size: 19px; }
  .tabs { gap: 11px; }
  .tab { letter-spacing: .06em; font-size: 10.5px; }
}

/* ---------------------------------------------------------------- scrollbars */
/* Thin, rounded, and without the arrow buttons at either end. Firefox draws thin scrollbars with no
   arrows. Chrome and Safari draw arrows unless the ::-webkit-scrollbar rules below style the bar, and
   Chrome ignores those rules wherever scrollbar-width / scrollbar-color are set, so they're reset there. */
* { scrollbar-width: thin; scrollbar-color: var(--g3) transparent; }
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto !important; scrollbar-color: auto !important; }
  ::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
  ::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: var(--g3) padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--g4); }
}
