:root {
  --bg: #0e0d10;
  --surface: #17161a;
  --surface-2: #1f1d23;
  --surface-3: #2a2830;
  --line: #2f2d35;
  --text: #f2efe9;
  --muted: #a29fa8;
  --faint: #6c6973;
  --radius: 14px;
  --font-display: "Cabinet Grotesk", "Satoshi", system-ui, sans-serif;
  --font-body: "Satoshi", system-ui, -apple-system, sans-serif;
  --tint: #2a2830;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -200px, color-mix(in oklch, var(--tint) 22%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78em;
  padding: 0.1em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: grid;
  gap: 22px;
}

/* ---------- header ---------- */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.02em; margin: 0; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(from 0deg,
    #E10600 0 30deg, #FF4F00 0 60deg, #FF9500 0 90deg, #FFD000 0 120deg, #8CD000 0 150deg, #00A83E 0 180deg,
    #00A99D 0 210deg, #0091EA 0 240deg, #1A3FE0 0 270deg, #6A1BD8 0 300deg, #A100C9 0 330deg, #E0007A 0 360deg);
  mask: radial-gradient(circle, transparent 38%, #000 40%);
  align-self: center;
}
.tagline { color: var(--muted); margin: 0; }

/* ---------- stage ---------- */
.stage {
  --glow: transparent;
  position: relative;
  height: clamp(220px, 38vh, 360px);
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 0 0 0 var(--glow);
  transition: box-shadow 0.35s ease;
}
.stage.live { box-shadow: 0 20px 80px -20px var(--glow); }
.stage-bands { position: absolute; inset: 0; display: flex; }
.band {
  flex: 1 1 0;
  opacity: 0;
  transform: scaleY(0.96);
  transition: opacity 0.08s ease-out, transform 0.18s ease-out, flex-grow 0.25s ease;
}
.band.on { opacity: 1; transform: none; }
.band.off { opacity: 0; flex-grow: 0.0001; transition: opacity 0.6s ease, flex-grow 0.6s ease; }

.stage-idle {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 20px;
}
.idle-title { font-family: var(--font-display); font-weight: 500; font-size: 26px; margin: 0 0 6px; }
.idle-hint { color: var(--muted); margin: 0; }

.stage-readout {
  position: absolute; left: 28px; bottom: 22px;
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none;
  transition: color 0.2s ease;
}
.stage-readout[hidden] { display: none; }
.readout-main { display: flex; align-items: baseline; }
.readout-note {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(64px, 12vw, 128px); line-height: 0.9; letter-spacing: -0.03em;
}
.readout-octave { font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 4vw, 44px); margin-left: 4px; opacity: 0.8; }
.readout-freq { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.8; }

.octave-meter {
  position: absolute; right: 18px; top: 18px; bottom: 18px;
  list-style: none; margin: 0; padding: 4px;
  display: flex; flex-direction: column; gap: 4px;
  background: rgb(14 13 16 / 0.55);
  backdrop-filter: blur(6px);
  border-radius: 12px;
}
.octave-meter li {
  flex: 1; width: 34px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--faint);
  transition: background 0.15s ease, color 0.15s ease;
}

/* ---------- controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.control { display: grid; gap: 6px; }
.control-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.control.actions { display: flex; gap: 10px; align-items: center; margin-left: auto; flex-wrap: wrap; }

.btn {
  height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible, .seg:focus-visible, .key:focus-visible, .cell:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn.icon { width: 38px; padding: 0; font-size: 18px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-value { min-width: 34px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }

.segmented { display: flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; }
.seg { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg[aria-checked="true"] { background: var(--surface-3); color: var(--text); }

.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { accent-color: #d9d5ce; width: 16px; height: 16px; }

/* ---------- keyboard ---------- */
.keyboard {
  position: relative;
  display: grid; grid-template-columns: repeat(var(--whites, 8), 1fr); gap: 6px;
  height: clamp(200px, 30vh, 260px);
  user-select: none; touch-action: none;
}
.key {
  --c: #444; --ink: #fff;
  border: 0; border-radius: 0 0 12px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px;
  padding-bottom: 14px;
  background: var(--c);
  color: var(--ink);
  transition: transform 0.06s ease, filter 0.12s ease, box-shadow 0.12s ease;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / 0.22);
}
.key:hover { filter: brightness(1.07); }
.key.down { transform: translateY(3px); box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.22), 0 0 40px -6px var(--c); filter: brightness(1.12) saturate(1.1); }
.key-name { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.key-kbd { background: rgb(0 0 0 / 0.18); border-color: rgb(0 0 0 / 0.15); color: inherit; opacity: 0.85; }
.key.black {
  position: absolute; top: 0;
  --kw: calc((100% - (var(--whites) - 1) * 6px) / var(--whites));
  width: calc(var(--kw) * 0.62);
  height: 60%;
  left: calc(var(--pos) * (100% + 6px) / var(--whites) - 3px - var(--kw) * 0.31);
  z-index: 2;
  border-radius: 0 0 10px 10px;
  outline: 4px solid var(--bg);
  padding-bottom: 10px;
}
.key.black .key-name { font-size: 16px; }
.names-hidden .key-name, .names-hidden .atlas-col { visibility: hidden; }

/* ---------- atlas ---------- */
.atlas-wrap { display: grid; gap: 12px; margin-top: 8px; }
.section-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin: 0 0 2px; letter-spacing: -0.01em; }
.section-head p { margin: 0; color: var(--muted); max-width: 70ch; }
.atlas-scroll { overflow-x: auto; }
.atlas { display: grid; gap: 4px; min-width: 560px; }
.atlas-row { display: grid; grid-template-columns: 36px repeat(13, 1fr); gap: 4px; }
.atlas-top, .cell-top { margin-left: 6px; } /* the octave-up C, set off slightly so the 12 notes stay one block */
.atlas-col, .atlas-corner, .atlas-oct { font-size: 12px; font-weight: 700; color: var(--faint); display: grid; place-items: center; }
.cell {
  height: 34px; border: 0; border-radius: 6px; padding: 0;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  touch-action: none;
}
.cell:hover { transform: scale(1.06); }
.cell.down { transform: scale(1.12); box-shadow: 0 0 0 2px var(--text); }

.foot { color: var(--faint); font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .app { padding: 18px 14px 32px; gap: 16px; }
  .control.actions { margin-left: 0; }
  .keyboard { gap: 4px; }
  .key.black { --kw: calc((100% - (var(--whites) - 1) * 4px) / var(--whites)); width: calc(var(--kw) * 0.66); left: calc(var(--pos) * (100% + 4px) / var(--whites) - 2px - var(--kw) * 0.33); }
  .key-name { font-size: 17px; }
  .key.black .key-name { font-size: 12px; }
  .key-kbd { display: none; }
  .readout-freq { font-size: 13px; }
  .octave-meter li { width: 28px; }
  .stage-readout { left: 18px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

[hidden] { display: none !important; }
.stage-readout.chord .readout-note { font-size: clamp(36px, 7vw, 72px); letter-spacing: -0.02em; }
.stage:not(.live) .stage-readout { opacity: 0.55; }

/* ---------- sound chips ---------- */
.control.sound { flex-basis: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  font-weight: 500; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--surface-3); }
.chip[aria-checked="true"] { background: var(--surface-3); color: var(--text); border-color: var(--surface-3); }
.chip.loading { position: relative; color: var(--faint); }
.chip.loading::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--text), transparent); background-size: 200% 100%;
  animation: chip-load 1s linear infinite;
}
@keyframes chip-load { to { background-position: -200% 0; } }
.chip:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Neutral (black/gray) swatches need an edge so they don't vanish into the dark UI. */
.key[data-neutral="black"], .key[data-neutral="gray"], .cell[data-neutral="black"] { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22), inset 0 -6px 0 rgb(0 0 0 / 0.3); }
.cell[data-neutral="black"] { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.2); }
.band { box-shadow: inset 1px 0 0 rgb(255 255 255 / 0.08); }
.app { grid-template-columns: minmax(0, 1fr); }
.app > * { min-width: 0; }
@media (max-width: 640px) {
  .seg { padding: 0 9px; font-size: 14px; }
  .controls { padding: 14px; }
}
@media (max-width: 640px) {
  .stage-idle { padding: 20px 64px 20px 18px; }
  .idle-title { font-size: 21px; }
  
}

/* ---------- outlined note letters: white fill, black stroke ---------- */
.key-name, .fret-name {
  color: #fff;
}
.fret-name, .key.black .key-name { }
.readout-note, .readout-octave {
  color: #fff;
}

.stage:not(.live) .stage-readout { opacity: 0.6; }

/* ---------- pad layout switch ---------- */
.pads-wrap { display: grid; gap: 12px; }
.pads-head { display: flex; justify-content: flex-start; }

/* ---------- fretboard ---------- */
.fretboard-scroll { overflow-x: auto; padding-bottom: 4px; }
.fretboard {
  min-width: 640px;
  display: grid; gap: 0;
  padding: 10px 0 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2a1d16, #1f1510);
  border: 1px solid #3a2a20;
  user-select: none; touch-action: none;
}
.string-row, .fret-numbers {
  display: grid;
  grid-template-columns: 34px 0.75fr repeat(calc(var(--frets) - 1), 1fr);
  align-items: center;
}
.string-row { position: relative; height: 50px; }
/* the string itself */
.string-row::before {
  content: ""; position: absolute; left: 34px; right: 0; top: 50%;
  height: var(--gauge); transform: translateY(-50%);
  background: linear-gradient(180deg, #e9e1d3, #9c958a);
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.5);
  pointer-events: none;
}
.string-label { font-size: 12px; font-weight: 700; color: #b9a58f; text-align: center; }
.fret {
  --c: #444;
  position: relative; height: 100%;
  border: 0; padding: 0; background: transparent;
  border-right: 3px solid #b8b2a7;           /* fret wire */
  display: grid; place-items: center;
}
.fret.open { border-right: 7px solid #e8e0cf; } /* nut */
.fret-dot {
  position: relative; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.45), inset 0 0 0 1px rgb(255 255 255 / 0.18);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.fret[data-neutral="black"] .fret-dot { box-shadow: 0 2px 6px rgb(0 0 0 / 0.45), inset 0 0 0 1.5px rgb(255 255 255 / 0.4); }
.fret-name { font-family: var(--font-display); font-weight: 800; font-size: 15px; line-height: 1; }
.fret:hover .fret-dot { transform: scale(1.08); }
.fret.down .fret-dot { transform: scale(1.22); box-shadow: 0 0 0 3px #fff, 0 0 26px 4px var(--c); }
.fret:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.fret-numbers { padding-top: 6px; }
.fret-numbers span { text-align: center; font-size: 12px; font-weight: 700; color: #8a7663; }
.fret-numbers span.marker { color: #e8dccb; }
.fret-numbers span.marker::after { content: ""; display: block; width: 6px; height: 6px; margin: 3px auto 0; border-radius: 50%; background: #e8dccb; }
.fret-note { margin: 0; color: var(--faint); font-size: 13px; }
.names-hidden .fret-name { visibility: hidden; }

@media (max-width: 640px) {
  .readout-note, .readout-octave { }
}
.pads-wrap > *, .layout { min-width: 0; }
.readout-octave { }

/* ---------- display toggles ---------- */
.toggles { display: flex; gap: 16px; align-items: center; height: 38px; flex-wrap: wrap; }
.control.sound { flex-basis: 100%; }

/* ---------- stage toolbar ---------- */
.stage-tools {
  position: absolute; left: 14px; top: 14px; z-index: 3;
  display: flex; gap: 6px; align-items: center;
}
.tool {
  height: 32px; padding: 0 12px; border-radius: 9px;
  border: 1px solid rgb(255 255 255 / 0.14);
  background: rgb(14 13 16 / 0.6); backdrop-filter: blur(8px);
  color: var(--text); font-weight: 500; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tool:hover { background: rgb(14 13 16 / 0.8); }
.mini-octave { display: inline-flex; align-items: center; gap: 4px; }
.mini-octave .tool { width: 32px; padding: 0; font-size: 17px; }
.mini-octave output { min-width: 20px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: #fff; }
.phone-only { display: none !important; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- rotate prompt (portrait phones) ---------- */
.rotate-prompt { display: none; }
@media (orientation: portrait) and (max-width: 600px) {
  .app { display: none; }
  .rotate-prompt {
    display: grid; place-items: center; min-height: 100dvh; padding: 32px; text-align: center;
  }
  .rotate-card { display: grid; gap: 10px; justify-items: center; max-width: 300px; }
  .rotate-icon { color: var(--text); animation: tilt 2.4s ease-in-out infinite; transform-origin: 50% 40%; }
  .rotate-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; margin: 8px 0 0; }
  .rotate-sub { color: var(--muted); margin: 0 0 8px; }
  body {
    background:
      conic-gradient(from 0deg at 50% 120%, #E10600, #FF9500, #FFD000, #00A83E, #0091EA, #6A1BD8, #E0007A, #E10600) bottom / 100% 6px no-repeat,
      var(--bg);
  }
}
@keyframes tilt { 0%, 30% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }

/* ---------- landscape phones: one-screen instrument ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  html, body { height: 100%; overflow: hidden; }
  .app {
    max-width: none; height: 100dvh;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    gap: 6px;
    grid-template-columns: minmax(0, 68fr) minmax(0, 32fr);
    grid-template-rows: minmax(0, 1fr) 38%;
    grid-template-areas: "guitar stage" "piano piano";
  }
  .top, .atlas-wrap, .foot, .pads-head, .fret-note { display: none !important; }
  .pads-wrap { display: contents; }
  .layout.layout-piano, .layout.layout-piano[hidden] { grid-area: piano; display: grid !important; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .layout.layout-guitar, .layout.layout-guitar[hidden] { grid-area: guitar; display: block !important; min-height: 0; }
  .phone-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }

  .stage { grid-area: stage; height: auto; min-height: 0; border-radius: 14px; }
  .stage-tools { left: 8px; top: 8px; gap: 4px; }
  .tool { height: 30px; padding: 0 8px; }
  .mini-octave .tool { width: 30px; }
  .stage-idle { padding: 44px 40px 10px 10px; }
  .idle-title { font-size: 15px; }
  .idle-hint { display: none; }
  .stage-readout { left: 10px; bottom: 8px; }
  .readout-note { font-size: clamp(36px, 15vh, 64px); }
  .stage-readout.chord .readout-note { font-size: clamp(18px, 7vh, 28px); }
  .readout-octave { font-size: clamp(16px, 6vh, 26px); }
  .readout-freq { font-size: 11px; }
  .octave-meter { right: 6px; top: 6px; bottom: 6px; padding: 3px; gap: 2px; border-radius: 9px; }
  .octave-meter li { width: 20px; font-size: 10px; border-radius: 5px; }

  .keyboard { height: 100%; }
  .key { padding-bottom: 6px; border-radius: 0 0 9px 9px; }
  .key-kbd { display: none; }
  .key-name { font-size: 17px; }
  .key.black { height: 58%; padding-bottom: 6px; }
  .key.black .key-name { font-size: 12px; }

  .fretboard-scroll { height: 100%; overflow: hidden; padding: 0; }
  .fretboard { min-width: 0; height: 100%; grid-template-rows: repeat(6, minmax(0, 1fr)) auto; padding: 3px 0 1px; border-radius: 12px; }
  .string-row { height: auto; }
  .string-row, .fret-numbers { grid-template-columns: 18px 0.75fr repeat(calc(var(--frets) - 1), 1fr); }
  .string-row::before { left: 18px; }
  .string-label { font-size: 10px; }
  .fret-dot { width: auto; height: 84%; aspect-ratio: 1; max-height: 32px; }
  .fret-name { font-size: clamp(9px, 3.4vh, 13px); }
  .fret-numbers { padding-top: 1px; }
  .fret-numbers span { font-size: 9px; line-height: 1.1; }
  .fret-numbers span.marker::after { width: 4px; height: 4px; margin-top: 1px; }

  /* settings live in a sheet */
  .controls {
    position: fixed; z-index: 50;
    inset: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    display: none; overflow: auto; align-content: flex-start;
    background: rgb(23 22 26 / 0.97); backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgb(0 0 0 / 0.6);
  }
  .settings-open .controls { display: flex; }
  .sheet-actions { flex-basis: 100%; display: flex !important; gap: 8px; flex-wrap: wrap; }
  .sheet-actions .primary { margin-left: auto; }
}


/* ---------- note badges: white rounded tile, black outline, black letter ---------- */
.key-name, .fret-name, .readout-main, .mini-octave output {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #000;
  border: 2px solid #000;
  text-shadow: none;
  font-family: var(--font-display); font-weight: 800;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
  white-space: nowrap;
}
.key-name { min-width: 38px; height: 38px; padding: 0 7px; border-radius: 11px; font-size: 20px; line-height: 1; }
.key.black .key-name { min-width: 32px; height: 30px; padding: 0 5px; border-radius: 9px; font-size: 14px; }
.fret-name { min-width: 24px; height: 22px; padding: 0 4px; border-radius: 7px; border-width: 1.5px; font-size: 12px; line-height: 1; box-shadow: none; }
.fret-dot { width: 40px; height: 40px; }

.readout-main {
  align-items: baseline; gap: 2px;
  padding: 10px 20px 12px; border-radius: 26px; border-width: 3px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.3);
}
.readout-note, .readout-octave { color: #000; }
.readout-note { font-size: clamp(56px, 9vw, 104px); }
.readout-octave { font-size: clamp(24px, 3.4vw, 38px); margin-left: 2px; opacity: 1; color: #444; }
.stage-readout.chord .readout-main { padding: 8px 16px 10px; border-radius: 20px; }
.stage-readout.chord .readout-note { font-size: clamp(30px, 5vw, 56px); }
.readout-freq {
  align-self: flex-start; margin-top: 8px;
  background: rgb(14 13 16 / 0.6); backdrop-filter: blur(6px);
  color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 13px; opacity: 1;
}
.mini-octave output { min-width: 30px; height: 30px; border-radius: 9px; font-size: 16px; color: #000; }

@media (max-width: 640px) {
  .key-name { min-width: 30px; height: 30px; font-size: 15px; border-radius: 9px; padding: 0 5px; }
  .key.black .key-name { min-width: 26px; height: 24px; font-size: 11px; border-radius: 7px; padding: 0 3px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .key-name { min-width: 30px; height: 28px; font-size: 15px; border-radius: 8px; padding: 0 5px; }
  .key.black .key-name { min-width: 26px; height: 22px; font-size: 11px; border-radius: 7px; padding: 0 3px; border-width: 1.5px; }
  .fret-dot { width: auto; height: 86%; }
  .fret-name { min-width: 0; height: auto; padding: 1px 3px; font-size: clamp(8px, 2.8vh, 11px); border-radius: 5px; border-width: 1px; }
  .readout-main { padding: 4px 10px 6px; border-radius: 14px; border-width: 2px; }
  .readout-note { font-size: clamp(30px, 12vh, 52px); }
  .readout-octave { font-size: clamp(14px, 5vh, 22px); }
  .stage-readout.chord .readout-main { padding: 3px 8px 4px; border-radius: 10px; }
  .stage-readout.chord .readout-note { font-size: clamp(14px, 5.5vh, 22px); }
  .readout-freq { font-size: 10px; padding: 2px 7px; margin-top: 4px; }
  .mini-octave output { min-width: 26px; height: 26px; font-size: 14px; border-radius: 8px; }
}

/* =========================================================
   Label styles (switchable): Clean (default) · Nameplate · Badge
   ========================================================= */

/* Clean: plain bold letter in black or white, whichever reads best on that color. */
.labels-ink .key-name, .labels-ink .fret-name, .labels-ink .readout-main {
  background: none; border: 0; box-shadow: none; padding: 0; min-width: 0; height: auto;
  color: var(--ink);
}
.labels-ink .readout-note, .labels-ink .readout-octave { color: var(--ink, #fff); }
.labels-ink .readout-octave { opacity: 0.75; }
.labels-ink .key-name { font-size: 24px; }
.labels-ink .key.black .key-name { font-size: 17px; }
.labels-ink .fret-name { font-size: 15px; }
.labels-ink .key-kbd { background: transparent; border-color: currentColor; color: var(--ink); opacity: 0.55; }

/* Nameplate: colors stay untouched; names sit on a dark plate. */
.labels-plate .key-name {
  align-self: stretch; margin: 0 6px; height: 34px; min-width: 0; padding: 0;
  background: rgb(14 13 16 / 0.88); color: #fff; border: 0; border-radius: 8px; box-shadow: none;
  font-size: 18px;
}
.labels-plate .key.black .key-name { margin: 0 4px; height: 28px; font-size: 13px; border-radius: 7px; }
.labels-plate .key-kbd { display: none; }
.labels-plate .key { padding-bottom: 8px; }
.labels-plate .fret-dot { overflow: visible; }
.labels-plate .fret-name {
  position: absolute; right: -9px; bottom: -6px;
  min-width: 0; height: 17px; padding: 0 4px;
  background: rgb(14 13 16 / 0.92); color: #fff; border: 1px solid rgb(255 255 255 / 0.25); border-radius: 6px;
  font-size: 10px; box-shadow: none;
}
.labels-plate .readout-main { background: rgb(14 13 16 / 0.85); border: 0; color: #fff; box-shadow: none; backdrop-filter: blur(6px); }
.labels-plate .readout-note { color: #fff; }
.labels-plate .readout-octave { color: #b9b6bf; }

@media (orientation: landscape) and (max-height: 520px) {
  .labels-ink .key-name { font-size: 18px; }
  .labels-ink .key.black .key-name { font-size: 13px; }
  .labels-ink .fret-name { font-size: clamp(9px, 3.4vh, 13px); padding: 0; }
  .labels-plate .key-name { height: 24px; font-size: 14px; margin: 0 4px; }
  .labels-plate .key.black .key-name { height: 20px; font-size: 10px; margin: 0 3px; }
  .labels-plate .fret-name { height: 13px; font-size: 8px; right: -7px; bottom: -4px; padding: 0 3px; }
}
@media (max-width: 640px) {
  .labels-ink .key-name { font-size: 18px; }
  .labels-ink .key.black .key-name { font-size: 12px; }
}
.labels-ink .mini-octave output, .labels-plate .mini-octave output { background: none; border: 0; box-shadow: none; color: #fff; }
.key.black { box-shadow: 0 10px 18px -4px rgb(0 0 0 / 0.65), inset 0 -6px 0 rgb(0 0 0 / 0.25); }
.key.white { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #000) 0%, var(--c) 30%); }
/* a soft lift (not an outline) so letters separate from the color */
.labels-ink .key-name, .labels-ink .fret-name, .labels-ink .readout-note { text-shadow: 0 1px 2px rgb(0 0 0 / 0.25); }

/* ---------- color names ---------- */
.readout-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.readout-meta .readout-freq { margin-top: 0; }
.readout-color {
  background: rgb(14 13 16 / 0.6); backdrop-filter: blur(6px);
  color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
.atlas-col { display: grid; justify-items: center; line-height: 1.15; }
.atlas-col b { font-weight: 700; color: var(--muted); }
.atlas-col small { font-size: 10px; font-weight: 500; color: var(--faint); }
.names-hidden .atlas-col b { visibility: hidden; }
.names-hidden .atlas-col { visibility: visible; }

/* ---------- mode switch ---------- */
.top { align-items: center; }
.mode-switch .seg { min-width: 84px; }
.mode-practice .pads-wrap, .mode-practice .atlas-wrap, .mode-practice .play-only { display: none !important; }

/* ---------- practice ---------- */
.practice {
  display: grid; gap: 14px;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.practice-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.scores { display: flex; gap: 22px; }
.score { display: grid; gap: 0; }
.score span { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.score strong { font-family: var(--font-display); font-weight: 800; font-size: 24px; font-variant-numeric: tabular-nums; }
.practice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.practice-msg { margin: 0; color: var(--muted); min-height: 1.5em; }
.practice-msg b { color: var(--text); }

.answers { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.answer {
  --c: #444; --ink: #fff;
  position: relative; height: 86px; border: 0; border-radius: 14px;
  background: var(--c); color: var(--ink);
  display: grid; align-content: end; justify-items: start; padding: 10px 12px; gap: 0;
  box-shadow: inset 0 -5px 0 rgb(0 0 0 / 0.2);
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}
.answer:hover { transform: translateY(-2px); }
.answer:active { transform: translateY(1px); }
.answer[data-neutral="black"], .answer[data-neutral="gray"] { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25), inset 0 -5px 0 rgb(0 0 0 / 0.2); }
.answer-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1.1; text-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
.answer-note { font-size: 12px; font-weight: 700; opacity: 0.8; display: none; }
.show-notes .answer-note { display: block; }
.answer.off { opacity: 0.15; pointer-events: none; }
.answer.correct { box-shadow: 0 0 0 3px #fff, 0 0 28px 2px var(--c); transform: scale(1.03); z-index: 1; }
.answer.wrong::after {
  content: "✕"; position: absolute; top: 6px; right: 10px;
  font-size: 18px; font-weight: 800; color: var(--ink);
}
.answer.wrong { opacity: 0.7; }
.practice-options { display: flex; gap: 18px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .answers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .answer { height: 64px; padding: 8px; }
  .answer-name { font-size: 14px; }
}

/* landscape phones: practice takes the left column, stage stays on the right */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-practice .app { grid-template-areas: "practice stage" "practice stage"; }
  .mode-practice .pads-wrap { display: none !important; }
  .mode-practice .layout.layout-piano, .mode-practice .layout.layout-guitar { display: none !important; }
  .practice { grid-area: practice; min-height: 0; padding: 8px; gap: 6px; grid-template-rows: auto auto minmax(0, 1fr) auto; border-radius: 12px; }
  .scores { gap: 12px; }
  .score span { font-size: 9px; }
  .score strong { font-size: 16px; }
  .practice-actions .btn { height: 30px; padding: 0 10px; font-size: 13px; }
  .practice-msg { font-size: 12px; min-height: 0; }
  .answers { gap: 5px; grid-auto-rows: minmax(0, 1fr); }
  .answer { height: auto; padding: 5px 7px; border-radius: 10px; }
  .answer-name { font-size: 12px; }
  .answer-note { font-size: 10px; }
  .practice-options { gap: 10px; font-size: 12px; }
  .practice-options .toggle input { width: 14px; height: 14px; }
  .readout-meta { margin-top: 4px; gap: 4px; }
  .readout-color { font-size: 10px; padding: 2px 7px; }
}

/* ---------- whole / half steps ---------- */
.steps { position: relative; list-style: none; margin: 8px 0 0; padding: 0; height: 24px; }
.step {
  display: inline-grid; place-items: center;
  width: 24px; height: 22px; border-radius: 7px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
}
.steps .step { position: absolute; top: 0; left: calc(var(--pos) * 100% / var(--whites) - 12px); }
.step.whole { background: var(--surface-2, #26242a); color: var(--muted); border: 1px solid var(--line); }
.step.half { background: #fff; color: #111; }
.steps-key { margin: 8px 0 0; font-size: 13px; color: var(--faint); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.steps-key .step { width: 20px; height: 18px; font-size: 11px; border-radius: 5px; }
.steps-key .step.half { margin-left: 8px; }
@media (orientation: landscape) and (max-height: 520px) {
  .steps { height: 15px; margin-top: 3px; }
  .steps .step { width: 18px; height: 14px; font-size: 9px; border-radius: 4px; left: calc(var(--pos) * 100% / var(--whites) - 9px); }
  .steps-key { display: none; }
}

/* ---------- learn: levels ---------- */
.levels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.level {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); position: relative;
}
.level:hover { color: var(--text); }
.level[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.level-n {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  background: rgb(255 255 255 / 0.08);
}
.level[aria-pressed="true"] .level-n { background: rgb(0 0 0 / 0.12); }
.level-text { display: grid; min-width: 0; line-height: 1.15; }
.level-sense { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.level-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-short { display: none; }
.level-acc { position: absolute; top: 5px; right: 8px; font-size: 10px; font-weight: 700; opacity: 0.7; }
.practice:not(.is-hear) .hear-only { display: none; }
.pick-line { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text); font-weight: 700; }
.link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; font: inherit; font-weight: 700; cursor: pointer; }

/* answer pad as note letters (levels 1-3): neutral tiles, colors only as a hint or on reveal */
.pad-letters .answer { background: var(--surface-3); color: var(--text); align-content: center; justify-items: center; box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.25); }
.pad-letters .answer-name { display: none; }
.pad-letters .answer-note { display: block; font-family: var(--font-display); font-weight: 800; font-size: 24px; opacity: 1; }
.pad-letters.hints .answer, .pad-letters .answer.correct { background: var(--c); color: var(--ink); }
.pad-colors.hints .answer-note { display: block; }
.answer.picked { box-shadow: 0 0 0 3px var(--text); }

/* ---------- learn: stage panels ---------- */
.stage-quiz {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: stretch; gap: 10px; padding: 64px 70px 22px 22px;
}
.stage-quiz[hidden] { display: none; }
.mode-practice .octave-meter { display: none; }
.mode-practice .stage-quiz { padding-right: 22px; }
.quiz-panel {
  --c: var(--surface-2); --ink: var(--text);
  flex: 1; min-width: 0; border-radius: 18px; position: relative;
  background: var(--surface-2); border: 1px dashed var(--line);
  display: grid; place-items: center;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.quiz-panel.lit { background: var(--c); border: 0; box-shadow: 0 0 60px -10px var(--c); }
.quiz-panel[data-neutral="black"] { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25); }
.quiz-panel.pulse { transform: scale(1.03); box-shadow: 0 0 0 3px var(--text); }
.quiz-q { font-family: var(--font-display); font-weight: 800; font-size: clamp(40px, 9vw, 110px); color: var(--faint); line-height: 1; }
.quiz-panel.lit .quiz-q { visibility: hidden; }
.quiz-panel.named .quiz-q { visibility: visible; color: var(--ink); text-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }
.quiz-label { position: absolute; left: 14px; bottom: 12px; font-size: 13px; font-weight: 700; color: var(--ink); opacity: 0.9; }
.quiz-arrow { align-self: center; font-size: 34px; font-weight: 800; color: var(--muted); }
.quiz-interval {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgb(14 13 16 / 0.82); color: #fff; padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.atlas-col sup { font-size: 9px; margin-left: 1px; }

@media (max-width: 900px) {
  .level-sense { display: none; }
}
@media (max-width: 640px) {
  .levels { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .level { padding: 6px; justify-content: center; }
  .level-text { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .practice { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  .levels { gap: 4px; }
  .level { padding: 3px 5px; gap: 5px; border-radius: 8px; }
  .level-n { width: 20px; height: 20px; font-size: 12px; border-radius: 6px; }
  .level-sense, .level-acc { display: none; }
  .level-title { display: none; }
  .level-short { display: block !important; font-size: 11px; font-weight: 700; white-space: nowrap; }
  .pad-letters .answer-note { font-size: 16px; }
  .stage-quiz { padding: 44px 8px 8px 8px; gap: 6px; }
  .quiz-q { font-size: clamp(28px, 12vh, 56px); }
  .quiz-arrow { font-size: 20px; }
  .quiz-label { font-size: 10px; left: 8px; bottom: 6px; }
  .quiz-interval { display: none; } /* the message line already names the interval */
  .pick-line { padding: 0 5px; }
}

/* ---------- octave on press ---------- */
.key-name[data-oct]::after { content: attr(data-oct); font-size: 0.6em; margin-left: 1px; align-self: flex-end; }
.fret[data-oct]::after {
  content: attr(data-oct); position: absolute; z-index: 3;
  top: 1px; left: calc(50% + 9px);
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 5px;
  display: grid; place-items: center;
  background: #fff; color: #111; font-size: 10px; font-weight: 800; line-height: 1;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.5);
}
@media (orientation: landscape) and (max-height: 520px) {
  /* phone: no octave column, the octave number is shown big in the color instead */
  .octave-meter { display: none !important; }
  .readout-octave { font-size: clamp(30px, 12vh, 54px); opacity: 1; }
  .stage-idle { padding-right: 10px; }
}

/* full map: name the octave of what's playing, and of the right-hand C column */
.cell { position: relative; color: var(--ink, #fff); }
.cell[data-label]::after {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
}
.cell-tag { position: absolute; right: 5px; bottom: 3px; font-size: 10px; font-weight: 800; color: #fff; opacity: 0.85; text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); pointer-events: none; }
.cell[data-label] .cell-tag { display: none; }

/* ---------- install ---------- */
.install-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 40px; }
.install-status { color: var(--muted); font-size: 14px; }

/* ---------- chords & circle of fifths (advanced) ---------- */
.mode-chords .atlas-wrap, .mode-chords .play-only { display: none !important; }
.mode-chords .octave-meter { display: none; }
.chords {
  display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 22px; align-items: start;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.chords[hidden] { display: none; }
.wheel-col { display: grid; gap: 10px; justify-items: center; }
.wheel { width: 100%; max-width: 420px; aspect-ratio: 1; color: var(--text); overflow: visible; }
.wheel .seg-g { cursor: pointer; transition: opacity 0.25s ease; outline: none; }
.wheel .seg-g:hover path, .wheel .seg-g:focus-visible path { filter: brightness(1.15); }
.seg-label { font-family: var(--font-display); font-weight: 800; font-size: 19px; pointer-events: none; }
.seg-deg { font-size: 11px; font-weight: 700; opacity: 0.8; pointer-events: none; }
.wheel-symbol { font-family: var(--font-display); font-weight: 800; font-size: 40px; fill: var(--text); }
.wheel-sub { font-size: 13px; font-weight: 600; fill: var(--muted); letter-spacing: 0.04em; }
.wheel .shape { transition: fill 0.2s ease; }
.wheel-caption { margin: 0; font-size: 13px; color: var(--faint); text-align: center; max-width: 40ch; }
.chord-col { display: grid; gap: 14px; min-width: 0; }
.chord-tabs { align-items: center; justify-self: start; }
.adv-badge { margin: 0 6px 0 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.ctab-panel { display: grid; gap: 14px; }
.ctab-panel[hidden] { display: none; }
.chord-card, .key-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.chord-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chord-title strong { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; }
.chord-title span { color: var(--muted); font-weight: 600; }
.formula, .scale-notes { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
.tone { display: grid; justify-items: center; gap: 2px; min-width: 52px; }
.note-chip { display: inline-grid; place-items: center; min-width: 48px; height: 40px; padding: 0 8px; border-radius: 10px; font-family: var(--font-display); font-weight: 800; font-size: 18px; box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.2), inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.tone .deg { font-size: 12px; font-weight: 800; color: var(--text); }
.tone .cname { font-size: 10px; color: var(--faint); }
.gap { align-self: center; margin-top: -24px; font-size: 11px; font-weight: 700; color: var(--faint); }
.chord-feel, .key-rel { margin: 0; color: var(--muted); font-size: 14px; }
.chord-feel .muted { color: var(--faint); }
.chord-actions, .key-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chord-actions .inv { margin-left: auto; }
.seg[hidden] { display: none; }
.picker { display: grid; gap: 6px; }
.picker-label { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.root-chips { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; }
.root-chip { height: 38px; border: 0; border-radius: 9px; font-family: var(--font-display); font-weight: 800; font-size: 15px; padding: 0; box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.2), inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.root-chip[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.type-chips, .dia-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.type-chip { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-weight: 700; }
.type-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.dia-chip { display: grid; justify-items: center; gap: 0; min-width: 62px; padding: 6px 8px; border: 0; border-radius: 10px; background: var(--c); color: var(--i); box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.2), inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.dia-chip b { font-family: var(--font-display); font-size: 16px; }
.dia-chip span { font-size: 12px; font-weight: 700; }
.dia-chip[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.chords .hint { margin: 0; font-size: 13px; color: var(--faint); }
@media (max-width: 900px) and (min-height: 521px) {
  .chords { grid-template-columns: 1fr; }
  .root-chips { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* landscape phones: chords take the left column, stage stays on the right */
@media (orientation: landscape) and (max-height: 520px) {
  .mode-chords .app { grid-template-areas: "chords stage" "chords stage"; }
  .mode-chords .pads-wrap { display: none !important; }
  .mode-chords .layout.layout-piano, .mode-chords .layout.layout-guitar { display: none !important; }
  .chords { grid-area: chords; min-height: 0; padding: 8px; gap: 10px; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); border-radius: 12px; overflow: hidden; }
  .wheel-col { gap: 6px; align-content: start; min-height: 0; }
  .wheel { max-width: min(100%, calc(100dvh - 90px)); }
  .wheel-order .seg { height: 26px; padding: 0 8px; font-size: 11px; }
  .wheel-caption { display: none; }
  .chord-col { overflow-y: auto; min-height: 0; max-height: 100%; gap: 8px; align-content: start; padding-right: 2px; }
  .chord-tabs .seg { height: 26px; font-size: 12px; }
  .ctab-panel { gap: 8px; }
  .chord-card, .key-card { padding: 8px 10px; gap: 6px; }
  .chord-title strong { font-size: 20px; }
  .chord-title span, .chord-feel, .key-rel { font-size: 12px; }
  .note-chip { min-width: 36px; height: 30px; font-size: 14px; }
  .tone { min-width: 38px; }
  .tone .cname { display: none; }
  .gap { margin-top: -14px; }
  .chord-actions .btn, .key-head .btn { height: 30px; padding: 0 10px; font-size: 12px; }
  .chord-actions .inv { margin-left: 0; }
  .inv .seg, .key-head .seg { height: 26px; padding: 0 8px; font-size: 11px; }
  .root-chips { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .root-chip { height: 28px; font-size: 13px; }
  .type-chip { height: 26px; padding: 0 8px; font-size: 12px; }
  .dia-chip { min-width: 48px; padding: 3px 6px; }
  .dia-chip b { font-size: 13px; }
  .dia-chip span { font-size: 10px; }
  .chords .hint { display: none; }
}
/* roman numerals: the display face draws a lowercase i like a capital I */
.dia-chip b, .wheel-sub.numeral { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: 0.02em; }
.wheel-sub.numeral { font-size: 20px; fill: var(--text); }

/* fifths on guitar */
.fifths-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.fifths-card[hidden] { display: none; }
.fifths-card .chord-title strong { font-size: 20px; }
.mini-neck { width: 100%; height: auto; overflow: visible; }
.mini-neck .fret-line { stroke: var(--line); stroke-width: 2; }
.mini-neck .nut-line { stroke: var(--muted); stroke-width: 5; }
.mini-neck .string-line { stroke: #8d8a93; }
.mini-neck .neck-mark { fill: var(--faint); }
.mini-neck .string-name { font-size: 13px; font-weight: 700; fill: var(--faint); }
.mini-neck .pair { cursor: pointer; }
.mini-neck .pair-line { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.mini-neck .pair-dot { stroke: var(--text); stroke-width: 2; }
.mini-neck .pair:hover .pair-dot { stroke-width: 3.5; }
.mini-neck .pair-name { font-family: var(--font-display); font-weight: 800; font-size: 12px; pointer-events: none; }
.wheel-col .toggle { font-size: 14px; }
@media (orientation: landscape) and (max-height: 520px) {
  .wheel-col .toggle { font-size: 11px; gap: 5px; }
  .wheel-col .toggle input { width: 14px; height: 14px; }
  .fifths-card { padding: 8px 10px; gap: 6px; }
  .fifths-card .chord-feel { font-size: 11px; }
  .wheel { max-width: min(100%, calc(100dvh - 115px)); }
}
/* guitar panel: CAGED */
.guitar-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.guitar-title { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.mini-neck .fret-num { font-size: 12px; font-weight: 700; fill: var(--faint); }
.mini-neck .shape-g { cursor: pointer; opacity: 0.38; transition: opacity 0.2s ease; }
.mini-neck .shape-g.on { opacity: 1; }
.mini-neck .shape-g:hover { opacity: 0.8; }
.mini-neck .shape-g.on:hover { opacity: 1; }
.mini-neck .shape-box { fill: rgb(255 255 255 / 0.03); stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 4; }
.mini-neck .shape-g.on .shape-box { fill: rgb(255 255 255 / 0.07); stroke: var(--text); stroke-dasharray: none; }
.mini-neck .shape-letter { font-family: var(--font-display); font-weight: 800; font-size: 16px; fill: var(--muted); }
.mini-neck .shape-g.on .shape-letter { fill: var(--text); }
.mini-neck { margin-top: 16px; }
.caged-shapes .seg { padding: 0 10px; }
[data-gpanel] { display: grid; gap: 8px; }
[data-gpanel][hidden] { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .caged-shapes .seg { height: 26px; padding: 0 6px; font-size: 11px; }
  .guitar-head .seg { height: 26px; font-size: 11px; }
  .guitar-title { font-size: 14px; }
}
.caged-types { justify-self: start; }
@media (orientation: landscape) and (max-height: 520px) { .caged-types .seg { height: 26px; padding: 0 8px; font-size: 11px; } }

/* learn: saved progress */
.progress-row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.missed { display: flex; gap: 8px 16px; flex-wrap: wrap; flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.missed .muted, .progress-row .muted { color: var(--faint); }
.missed-item { display: inline-flex; align-items: center; gap: 6px; }
.missed-item b { color: var(--text); }
.note-chip.sm { min-width: 28px; height: 24px; font-size: 13px; border-radius: 7px; padding: 0 5px; }
.saved-note { font-size: 12px; color: var(--faint); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
@media (orientation: landscape) and (max-height: 520px) {
  .progress-row { display: none; }
}
