/* ============================================================
   DORTI Musicians Toolkit: the tuner, the chord identifier and the
   scale identifier. lib/musicianstools.js draws the pages and
   /mt/tools.js runs them.

   Brought over from the dorti.co theme on 2026-11-10 and redrawn
   for the toolkit: black on white, #ececec behind anything that is
   a picture, ink frames, hard offset shadows. Nothing here signals
   with colour. In tune is the screen turning black; a root note
   wears a second ring.
============================================================ */

.dt {
  --dt-ink: #000;
  --dt-cream: #fff;
  --dt-bone: #ececec;
  --dt-muted: #555;
  --dt-quiet: #a8a8a8;
  --dt-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --dt-gutter: 16px;
  color: var(--dt-ink);
  background: var(--dt-cream);
}

.dt .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dt *,
.dt *::before,
.dt *::after { box-sizing: border-box; }

/* A button does not take the page's typeface unless told to. :where() keeps
   this weaker than every class below that names its own. */
:where(.dt) :is(button, select, input) { font-family: inherit; }

.dt-wrap {
  width: 100%;
  max-width: 1104px;
  margin: 0 auto;
  padding: 0 var(--dt-gutter);
}

@media (min-width: 750px) {
  .dt { --dt-gutter: 32px; }
}

/* ---------- Type helpers ---------- */
.dt-display {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 0.95;
  margin: 0;
  text-wrap: balance;
}

/* Tools bar: back to the hub, and straight to the other tools */
.dt-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 0 0;
}

.dt-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--dt-ink);
  font-family: var(--display);
  font-size: max(16px, 0.95rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}

.dt-nav__back {
  padding: 0 14px 0 10px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  box-shadow: 3px 3px 0 var(--dt-ink);
  transition: transform 0.25s var(--dt-spring), box-shadow 0.25s var(--dt-spring);
}

.dt-nav__back:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--dt-ink); }
.dt-nav__back:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--dt-ink); }
.dt-nav__back span:first-child { transition: transform 0.35s var(--dt-spring); }
.dt-nav__back:hover span:first-child { transform: translateX(-3px); }

.dt-nav__tools {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
}

.dt-nav__tools a {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 2px;
  font-size: max(16px, 0.85rem);
  transition: background-color 0.2s, color 0.2s;
}

.dt-nav__tools a:hover { background: var(--dt-bone); }

/* Phones: one row. The way back shrinks to its arrow (the words stay for a
   screen reader) and the tools take the rest of the width. On the very
   narrowest screens the tools drop to a second row rather than squeeze. */
@media (max-width: 749px) {
  .dt-nav { gap: 8px; flex-wrap: wrap; align-items: stretch; }
  .dt-nav a { font-size: max(16px, 0.8rem); }
  .dt-nav__back { flex: 0 0 44px; justify-content: center; padding: 0; }
  .dt-nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dt-nav__tools { display: flex; flex: 1 1 250px; }
  .dt-nav__tools a { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 0 4px; }
}
.dt-nav__tools a[aria-current="page"] { background: var(--dt-ink); color: var(--dt-cream); }

.dt-label {
  display: block;
  font-family: var(--callout);
  font-weight: 800;
  font-style: italic;
  font-size: max(16px, 0.78rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dt-muted);
}

/* ---------- Page head ---------- */
.dt-head {
  padding: 28px 0 22px;
}

.dt-head__title {
  font-size: max(16px, clamp(2.7rem, 11vw, 5.4rem));
}

.dt-head__sub {
  max-width: 58ch;
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--dt-muted);
}

@media (min-width: 990px) {
  .dt-head { padding: 48px 0 30px; }
}

/* ---------- Buttons ---------- */
.dt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  box-shadow: 3px 3px 0 var(--dt-ink);
  cursor: pointer;
  transition: transform 0.25s var(--dt-spring), box-shadow 0.25s var(--dt-spring), background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.dt-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--dt-ink); }
.dt-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--dt-ink); }

.dt-btn--ink {
  background: var(--dt-ink);
  color: var(--dt-cream);
  box-shadow: 3px 3px 0 var(--dt-cream), 3px 3px 0 2px var(--dt-ink);
}
.dt-btn--ink:hover { box-shadow: 4px 4px 0 var(--dt-cream), 4px 4px 0 2px var(--dt-ink); }
.dt-btn--ink:active { box-shadow: 1px 1px 0 var(--dt-cream), 1px 1px 0 2px var(--dt-ink); }

.dt-btn[disabled] {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: 3px 3px 0 var(--dt-ink);
}

.dt-btn__icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: -6px;
  border-radius: 3px;
  background: var(--dt-ink);
  color: var(--dt-cream);
  font-size: max(16px, 0.85rem);
  transition: transform 0.35s var(--dt-spring);
}
.dt-btn--ink .dt-btn__icon { background: var(--dt-cream); color: var(--dt-ink); }
.dt-btn:hover .dt-btn__icon { transform: translateX(2px); }

.dt :focus-visible {
  outline: 3px solid var(--dt-ink);
  outline-offset: 3px;
}
.dt-pedal :focus-visible,
.dt-dock :focus-visible { outline-color: var(--dt-cream); }
.dt-face :focus-visible { outline-color: var(--dt-ink); }

/* Segmented control */
.dt-seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
}

.dt-seg button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--dt-ink);
  font-family: inherit;
  font-size: max(16px, 0.95rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.dt-seg button[aria-checked="true"],
.dt-seg button[aria-selected="true"] {
  background: var(--dt-ink);
  color: var(--dt-cream);
}

/* Native select, dressed */
.dt-select {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dt-select select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  width: 100%;
  padding: 0 38px 0 12px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--dt-ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

/* ---------- Tool body: shared layout ---------- */
.dt-body {
  display: grid;
  gap: 22px;
  padding-bottom: 36px;
}

@media (min-width: 990px) {
  .dt-body--split {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 32px;
  }

  /* Chords and scales need the full width for the neck; the steps sit
     under it, two across */
  .dt-body--wide .dt-tips ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 32px;
  }
}

.dt-rig {
  position: relative;
  padding: 14px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-bone);
  box-shadow: 6px 6px 0 var(--dt-ink);
}

@media (min-width: 750px) {
  .dt-rig { padding: 22px; }
}

.dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.dt-toolbar--flush { margin: 0; }
.dt-toolbar .dt-select { flex: 1 1 180px; }
.dt-toolbar .dt-seg { flex: 0 0 auto; }

@media (max-width: 749px) {
  .dt-toolbar .dt-seg { width: 100%; }
  .dt-toolbar .dt-seg button { flex: 1; }
}

/* ============================================================
   TUNER
============================================================ */
.dt-pedal {
  position: relative;
  isolation: isolate;
  padding: 14px 14px 18px;
  border: 2px solid var(--dt-ink);
  border-radius: 6px;
  background: var(--dt-ink);
  color: var(--dt-cream);
  box-shadow: 6px 6px 0 var(--dt-cream), 6px 6px 0 2px var(--dt-ink);
}

@media (min-width: 750px) {
  .dt-pedal { padding: 22px 26px 26px; }
}

.dt-pedal__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.dt-mic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--callout);
  font-weight: 800;
  font-style: italic;
  font-size: max(16px, 0.85rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dt-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--dt-quiet);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.dt-pedal[data-state="listening"] .dt-led,
.dt-pedal[data-state="running"] .dt-led {
  background: var(--dt-cream);
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.55);
}

.dt-pedal .dt-seg {
  border-color: var(--dt-cream);
  background: transparent;
}
.dt-pedal .dt-seg button { color: var(--dt-cream); min-width: 44px; min-height: 44px; font-size: max(16px, 0.85rem); }
.dt-pedal .dt-seg button[aria-checked="true"] { background: var(--dt-cream); color: var(--dt-ink); }

.dt-face {
  position: relative;
  padding: 10px 10px 16px;
  border: 2px solid var(--dt-cream);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  text-align: center;
  transition: background-color 0.35s var(--dt-spring);
}

.dt-gauge {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto -8px;
  overflow: visible;
}

.dt-gauge__arc { fill: none; stroke: var(--dt-ink); stroke-width: 2; }
.dt-gauge__major { stroke: var(--dt-ink); stroke-width: 3; stroke-linecap: square; }
.dt-gauge__minor { stroke: var(--dt-ink); stroke-width: 1.5; opacity: 0.55; }
.dt-gauge__zone { fill: var(--dt-ink); opacity: 0.12; transition: opacity 0.3s; }
.dt-gauge__label {
  font-family: var(--callout);
  font-weight: 800;
  font-style: italic;
  font-size: max(16px, 13px);
  fill: var(--dt-ink);
  text-anchor: middle;
  dominant-baseline: middle;
}
.dt-gauge__needle {
  transform-origin: 160px 166px;
}

.dt-face.is-idle .dt-gauge__needle { transition: transform 0.6s var(--dt-spring); }
.dt-gauge__needle line { stroke: var(--dt-ink); stroke-width: 4; stroke-linecap: round; }
.dt-gauge__pivot { fill: var(--dt-ink); }

.dt-note {
  font-family: var(--display);
  font-size: max(16px, clamp(4.4rem, 22vw, 7rem));
  line-height: 0.9;
  letter-spacing: 0.01em;
  min-height: 0.9em;
}

.dt-note sub {
  font-size: max(16px, 0.32em);
  vertical-align: baseline;
  margin-left: 2px;
  font-family: var(--callout);
  font-weight: 800;
}

.dt-acc { font-family: system-ui, sans-serif; font-weight: 700; font-size: max(16px, 0.7em); vertical-align: 0.25em; }

.dt-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: max(16px, 0.95rem);
  font-variant-numeric: tabular-nums;
  color: var(--dt-muted);
}

.dt-direction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin: 10px 0 0;
  padding: 0 14px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dt-face[data-dir="flat"] .dt-direction,
.dt-face[data-dir="sharp"] .dt-direction { background: var(--dt-ink); color: var(--dt-cream); }
.dt-face[data-dir="close"] .dt-direction { background: var(--dt-bone); }
.dt-face.is-idle .dt-direction { font-size: 1rem; }

/* In tune: the screen turns black. Nothing to tell apart by colour, and it
   reads from across the room with the phone propped on an amp. */
.dt-face.is-locked { background: var(--dt-ink); color: var(--dt-cream); }
.dt-face.is-locked .dt-gauge__arc,
.dt-face.is-locked .dt-gauge__major,
.dt-face.is-locked .dt-gauge__minor,
.dt-face.is-locked .dt-gauge__needle line { stroke: var(--dt-cream); }
.dt-face.is-locked .dt-gauge__label,
.dt-face.is-locked .dt-gauge__pivot { fill: var(--dt-cream); }
.dt-face.is-locked .dt-gauge__zone { opacity: 1; fill: var(--dt-cream); }
.dt-face.is-locked .dt-direction { border-color: var(--dt-cream); background: var(--dt-cream); color: var(--dt-ink); }
.dt-face.is-locked .dt-meta { color: var(--dt-cream); }

.dt-face.is-idle .dt-note { color: var(--dt-quiet); }

.dt-strings {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0 0;
}

.dt-string {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  padding: 6px 0;
  border: 2px solid var(--dt-cream);
  border-radius: 4px;
  background: transparent;
  color: var(--dt-cream);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.25s var(--dt-spring);
  -webkit-tap-highlight-color: transparent;
}

.dt-string:active { transform: scale(0.96); }

.dt-string__note {
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1;
}

.dt-string__num {
  font-size: max(16px, 0.72rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.dt-string.is-target { background: var(--dt-cream); color: var(--dt-ink); }
.dt-string.is-locked { background: var(--dt-cream); color: var(--dt-ink); box-shadow: inset 0 -7px 0 var(--dt-ink); }
.dt-string.is-ringing .dt-string__note { animation: dt-ring 0.6s var(--dt-spring); }

@keyframes dt-ring {
  0% { transform: translateX(0); }
  20% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

.dt-pedal__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 14px;
}

.dt-pedal__controls .dt-select { flex: 1 1 200px; }
.dt-pedal .dt-label { color: #ffffff; }
.dt-pedal .dt-select select { border-color: var(--dt-cream); }

.dt-a4 {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.dt-a4__row {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--dt-cream);
  border-radius: 4px;
}

.dt-a4__row button {
  width: 44px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--dt-cream);
  font-size: 1.3rem;
  cursor: pointer;
}

.dt-a4__row output {
  min-width: 62px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dt-footswitch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin-top: 16px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 var(--dt-quiet);
  cursor: pointer;
  transition: transform 0.2s var(--dt-spring), box-shadow 0.2s var(--dt-spring);
  -webkit-tap-highlight-color: transparent;
}

.dt-footswitch:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--dt-quiet); }

.dt-footswitch__cap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--dt-ink);
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, #ffffff 30%, #000000 100%);
}

/* Running: the switch is held down and outlined, so "Stop" never looks like "Start". */
.dt-pedal[data-state="listening"] .dt-footswitch,
.dt-pedal[data-state="running"] .dt-footswitch { transform: translateY(4px); border-color: var(--dt-cream); background: transparent; color: var(--dt-cream); box-shadow: none; }
.dt-pedal[data-state="listening"] .dt-footswitch__cap,
.dt-pedal[data-state="running"] .dt-footswitch__cap { border-color: var(--dt-cream); }

.dt-pedal__note {
  margin: 12px 0 0;
  font-size: max(16px, 0.85rem);
  line-height: 1.4;
  color: #ffffff;
}

.dt-pedal__error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 2px solid var(--dt-cream);
  border-radius: 4px;
  font-size: max(16px, 0.95rem);
  line-height: 1.4;
}

.dt-pedal__error[hidden] { display: none; }

/* ============================================================
   METRONOME
   The tuner's pedal with a different face: the beats of the bar
   as a row of dots, the tempo, and the slider that sets it.
============================================================ */
/* One row whatever the count: the dots give up width before they wrap, so the
   number under them never moves. A square marks the accented first beat. */
.dt-beats {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 22px));
  justify-content: center;
  gap: 8px;
  height: 22px;
  align-items: center;
  margin: 8px 0 10px;
}

.dt-beats i {
  aspect-ratio: 1;
  border: 2px solid var(--dt-ink);
  border-radius: 50%;
}

.dt-beats i.is-accent { border-radius: 3px; }
.dt-beats i.is-on { background: var(--dt-ink); }

.dt-bpm {
  font-family: var(--display);
  font-size: max(16px, clamp(5rem, 27vw, 8rem));
  line-height: 0.9;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.dt-bpm.is-hit { animation: dt-hit 0.14s var(--dt-spring); }

@keyframes dt-hit {
  from { transform: scale(1.035); }
}

.dt-tempo {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.dt-tempo button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  font-size: 1.4rem;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--dt-ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dt-tempo button:active { transform: translate(2px, 2px); box-shadow: none; }

.dt-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.dt-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--dt-ink); }
.dt-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--dt-ink); }

.dt-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -12px;
  border: 2px solid var(--dt-ink);
  border-radius: 50%;
  background: var(--dt-cream);
  box-shadow: 2px 2px 0 var(--dt-ink);
}

.dt-range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 2px solid var(--dt-ink);
  border-radius: 50%;
  background: var(--dt-cream);
  box-shadow: 2px 2px 0 var(--dt-ink);
}

.dt-tap {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--dt-cream);
  border-radius: 4px;
  background: transparent;
  color: var(--dt-cream);
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dt-tap.is-tapped { background: var(--dt-cream); color: var(--dt-ink); }

.dt-metro .dt-pedal__controls { gap: 14px 18px; }
.dt-metro .dt-a4__row output { min-width: 48px; }
.dt-pedal .dt-toggle { color: var(--dt-cream); }
.dt-pedal .dt-toggle input { accent-color: var(--dt-cream); }

/* ============================================================
   FRETBOARD (chords + scales)
============================================================ */
.dt-board {
  position: relative;
  width: 100%;
  margin: 0 auto;
  touch-action: manipulation;
}

.dt-board svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.dt-board svg:focus { outline: none; }
.dt-board svg:focus-visible { outline: 3px solid var(--dt-ink); outline-offset: 4px; }

/* Reserve the drawn size before the script runs (no layout jump):
   phones draw 12 frets 46px apart under a 68px open-string row (632px);
   wider screens draw the neck sideways, 224px tall */
.dt-board--chords,
.dt-board--scales { min-height: 632px; }
@media (min-width: 750px) {
  .dt-board--chords,
  .dt-board--scales { min-height: 224px; }
}

/* Drawn as a chord chart, the way a songbook prints one: a white board, ink
   strings and frets, a heavy nut. */
.fb-wood { fill: var(--dt-cream); stroke: var(--dt-ink); stroke-width: 2; }
.fb-fret { stroke: var(--dt-ink); stroke-width: 2; }
.fb-nut { fill: var(--dt-ink); }
.fb-inlay { fill: #d6d6d6; }
.fb-string { stroke: var(--dt-ink); }
.fb-string.is-muted { opacity: 0.3; }
.fb-num {
  font-family: var(--callout);
  font-weight: 800;
  font-style: italic;
  font-size: max(16px, 13px);
  fill: var(--dt-muted);
  text-anchor: middle;
  dominant-baseline: middle;
}
.fb-name {
  font-family: var(--display);
  font-size: max(16px, 15px);
  fill: var(--dt-ink);
  text-anchor: middle;
  dominant-baseline: middle;
}
.fb-cursor { fill: none; stroke: var(--dt-ink); stroke-width: 3; stroke-dasharray: 5 4; }
.fb-mark text {
  font-family: var(--body);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
/* Yours are solid, the ones to add are open, and a root wears a second ring
   (.fb-ring, drawn behind the note by tools.js). */
.fb-mark--user circle { fill: var(--dt-ink); stroke: var(--dt-ink); stroke-width: 2; }
.fb-mark--user text { fill: var(--dt-cream); }
.fb-mark--fill circle,
.fb-mark--root circle { fill: var(--dt-cream); stroke: var(--dt-ink); stroke-width: 2; }
.fb-mark--fill text,
.fb-mark--root text { fill: var(--dt-ink); }
.fb-mark .fb-ring { fill: var(--dt-cream); stroke: var(--dt-ink); stroke-width: 2; }
.fb-mute { stroke: var(--dt-ink); stroke-width: 3; stroke-linecap: round; }
.fb-mark.is-new { animation: fb-pop 0.32s var(--dt-spring); transform-box: fill-box; transform-origin: center; }

@keyframes fb-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Readout (chords + scales) ----------
   Fixed rows in every state (name / line / note chips / last line), so the
   fretboard under it never moves while you tap. The name shrinks to fit one
   line (fitOneLine in dorti-tools.js) rather than wrapping; the chips scroll
   sideways when a chord has more of them than fit. */
.dt-readout {
  --ro-name: 50px;
  --ro-line: 40px;
  display: grid;
  grid-template-rows: var(--ro-name) var(--ro-line) 48px 20px;
  row-gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  overflow: hidden;
}

.dt--scales .dt-readout { grid-template-rows: var(--ro-name) var(--ro-line) 48px; }

@media (min-width: 750px) {
  .dt-readout { --ro-name: 60px; --ro-line: 22px; }
}

.dt-readout__name {
  display: flex;
  align-items: flex-end;
  min-width: 0;
  overflow: hidden;
  font-family: var(--display);
  font-size: 3rem;
  line-height: 1;
}

@media (min-width: 750px) {
  .dt-readout__name { font-size: 3.6rem; }
}

.dt-readout__name span {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.dt-readout__name.is-empty {
  font-size: 1.6rem;
  text-transform: uppercase;
  color: #000000;
}

.dt--scales .dt-readout__name { font-size: 2.3rem; text-transform: uppercase; }
@media (min-width: 750px) {
  .dt--scales .dt-readout__name { font-size: 2.8rem; }
}
.dt--scales .dt-readout__name.is-empty { font-size: 1.6rem; }

.dt-readout__line {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: max(16px, 0.98rem);
  font-weight: 600;
  line-height: 20px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (min-width: 750px) {
  .dt-readout__line { -webkit-line-clamp: 1; }
}

.dt-readout__line.is-muted { font-weight: 500; color: var(--dt-muted); }

/* Empty states: the hint takes all the rows under the name */
.dt-readout__line.is-tall {
  grid-row: 2 / -1;
  align-self: start;
  line-height: 1.45;
  -webkit-line-clamp: 5;
}

.dt-readout__notes {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.dt-readout__notes::-webkit-scrollbar { display: none; }
.dt-readout__notes .dt-notes { flex-wrap: nowrap; }
.dt-readout__notes .dt-notes li { flex: 0 0 auto; }

.dt-readout__alt {
  margin: 0;
  overflow: hidden;
  font-size: max(16px, 0.9rem);
  line-height: 20px;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--dt-muted);
}

.dt-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dt-notes li {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  padding: 5px 8px 4px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-bone);
  line-height: 1.05;
}

.dt-notes li b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
}

.dt-notes li span { font-size: max(16px, 0.78rem); color: var(--dt-muted); font-variant-numeric: tabular-nums; }
.dt-notes li.is-root { background: var(--dt-ink); color: var(--dt-cream); }
.dt-notes li.is-root span { color: #ffffff; }
.dt-notes li.is-missing { border-style: dashed; background: transparent; }

/* Sticky bar under the board: the answer stays on screen while you tap */
.dt-dock {
  position: sticky;
  bottom: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 8px 8px 14px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-ink);
  color: var(--dt-cream);
  box-shadow: 4px 4px 0 var(--dt-cream), 4px 4px 0 2px var(--dt-ink);
}

.dt-dock__name {
  min-width: 0;
  overflow: hidden;
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dt--scales .dt-dock__name { text-transform: uppercase; }

.dt-dock button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--dt-cream);
  border-radius: 3px;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s var(--dt-spring), opacity 0.2s;
}

.dt-dock button:active { transform: scale(0.96); }
.dt-dock__play { background: var(--dt-cream); color: var(--dt-ink); }
.dt-dock__play[disabled] { opacity: 0.4; cursor: default; transform: none; }
.dt-dock__clear { background: transparent; color: var(--dt-cream); }

.dt-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed #000000;
}

.dt-foot .dt-select { flex: 1 1 220px; max-width: 360px; }
.dt-foot .dt-legend { margin: 0; flex-basis: 100%; }

/* Suggestion chips */
.dt-suggest { margin-top: 16px; }
.dt-suggest[hidden] { display: none; }

.dt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dt-chip {
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.25s var(--dt-spring);
}

.dt-chip:hover { transform: translateY(-1px); }
.dt-chip[aria-pressed="true"] { background: var(--dt-ink); color: var(--dt-cream); }
.dt-chip small {
  margin-left: 6px;
  font-family: var(--body);
  font-size: max(16px, 0.78rem);
  opacity: 0.7;
}

/* Build-a-chord / show-a-scale pickers */
.dt-picker { display: grid; gap: 12px; margin-bottom: 14px; }
.dt-picker[hidden] { display: none; }

.dt-roots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 750px) {
  .dt-roots { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

.dt-roots .dt-chip { padding: 0; min-width: 0; }

.dt-pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dt-pager__label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dt-pager .dt-btn { min-width: 46px; padding: 0 12px; }

/* Scale results */
.dt-results {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 750px) {
  .dt-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dt-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  color: var(--dt-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.25s var(--dt-spring);
}

.dt-result:hover { transform: translateY(-1px); }
.dt-result[aria-pressed="true"] { background: var(--dt-ink); color: var(--dt-cream); }
.dt-result b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.dt-result span { font-size: max(16px, 0.85rem); opacity: 0.75; }

.dt-more { margin-top: 10px; }

.dt-keychords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dt-keychords li {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  padding: 5px 8px 4px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
  line-height: 1.05;
}

.dt-keychords b { font-family: var(--display); font-weight: 400; font-size: 1.05rem; }
.dt-keychords span { font-size: max(16px, 0.75rem); color: var(--dt-muted); }

.dt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: max(16px, 0.85rem);
  color: var(--dt-muted);
}

.dt-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dt-legend i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--dt-ink);
}
.dt-legend .is-user { background: var(--dt-ink); }
.dt-legend .is-fill,
.dt-legend .is-root { background: var(--dt-cream); }
.dt-legend .is-ring,
.dt-legend .is-root { margin: 0 4px; box-shadow: 0 0 0 2px var(--dt-cream), 0 0 0 4px var(--dt-ink); }

.dt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

.dt-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--dt-ink);
}

/* ---------- Side column: how it works ---------- */
.dt-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.dt-tips {
  margin: 0;
  padding: 16px;
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-bone);
}

.dt-tips h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.3rem;
  text-transform: uppercase;
}

.dt-tips ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: dt-step;
}

.dt-tips li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  font-size: max(16px, 0.95rem);
  line-height: 1.45;
  counter-increment: dt-step;
}

.dt-tips li::before {
  content: counter(dt-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dt-ink);
  color: var(--dt-cream);
  font-family: var(--display);
  font-size: max(16px, 0.95rem);
}

.dt-tips li strong { display: block; }

/* ---------- FAQ ---------- */
.dt-faq {
  padding: 8px 0 44px;
}

.dt-faq h2 {
  margin: 0 0 14px;
  font-size: max(16px, clamp(1.8rem, 6vw, 2.6rem));
}

.dt-faq__list {
  display: grid;
  gap: 8px;
  max-width: 820px;
}

.dt-faq details {
  border: 2px solid var(--dt-ink);
  border-radius: 4px;
  background: var(--dt-cream);
}

.dt-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  list-style: none;
}

.dt-faq summary::-webkit-details-marker { display: none; }

.dt-faq summary::after {
  content: "+";
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  height: 28px;
  border-radius: 3px;
  background: var(--dt-ink);
  color: var(--dt-cream);
  font-size: 1.2rem;
  transition: transform 0.3s var(--dt-spring);
}

.dt-faq details[open] summary::after { transform: rotate(45deg); }

.dt-faq__answer {
  padding: 0 14px 14px;
  font-size: max(16px, 0.98rem);
  line-height: 1.55;
  max-width: 68ch;
}

.dt-faq__answer p { margin: 0 0 8px; }
.dt-faq__answer p:last-child { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .dt *,
  .dt *::before,
  .dt *::after {
    animation: none !important;
    transition: none !important;
  }
}
