/* Musical content (note names, degree numbers, chord symbols) uses a sans face:
   the theme's monospace fallback lacks ♭/♯ and has a thin bold. The page chrome
   stays in the theme font. */
:root {
  --notes: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sym: "Segoe UI Symbol", "Noto Music", "Apple Symbols", "Bravura Text", serif;
}

.tool-main {
  padding-block: 32px 64px;
}

.tool-head {
  margin-bottom: 20px;
}

.tool-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.25;
}

/* ---- layout: everything centered on the wheel ---- */

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---- controls ---- */

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
}

.control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control > label {
  margin-right: 2px;
  color: var(--muted);
}

.control button {
  padding: 4px 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  font: inherit;
  cursor: pointer;
}

.control button:hover {
  border-color: var(--accent);
}

.segmented {
  display: flex;
}

.segmented button + button {
  border-left-width: 0;
}

.segmented button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.segmented button:disabled {
  opacity: 0.35;
  cursor: default;
}

.segmented button:disabled:hover {
  border-color: var(--line);
}

.chord-degrees {
  flex-basis: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

.chord-degrees .segmented button {
  min-width: 38px;
  min-height: 44px;
}

.chord-degrees button:disabled[aria-pressed="true"] {
  opacity: 0.8;
  border-color: var(--accent);
}

.wheel-turns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
}

.turn-control {
  min-inline-size: 0;
  margin: 0;
  padding: 6px 12px 10px;
  border: 1px solid var(--line);
}

.turn-control legend {
  padding-inline: 4px;
  color: var(--ink);
  font-weight: 700;
}

.turn-control .control button {
  min-width: 44px;
  min-height: 44px;
  font-family: var(--notes);
  font-size: 1.375rem;
}

#solfege-labels { min-height: 44px; }

/* ---- caption + staff ---- */

#caption {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  width: min(100%, 15rem);
  margin: 0;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

#scale-dots {
  display: flex;
  gap: 4px;
}

#scale-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.keysig {
  display: flex;
  align-items: center;
}

#keysig .staff { stroke: var(--ink); stroke-width: 1; opacity: 0.45; }
#keysig .clef { font-size: 69px; fill: var(--ink); font-family: var(--sym); }
#keysig .acc { font-family: var(--notes); font-size: 22px; font-weight: 700; text-anchor: middle;
  dominant-baseline: central; paint-order: stroke; stroke: var(--ink); stroke-width: 0.6; }
#keysig .head { stroke: var(--ink); stroke-width: 1.2; }
#keysig .ledger { stroke: var(--ink); stroke-width: 1.2; opacity: 0.7; }

/* ---- wheel ---- */

/* Sized so the controls, staff, wheel, scale and chord cards fit in one window
   (about 400px of the height is everything except the wheel), but never tiny. */
#wheel {
  display: block;
  width: min(100%, max(300px, min(62vh, 100vh - 400px)));
  height: auto;
}

.ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.degree-guide { opacity: 0.55; }
.note-label { font-family: var(--notes); font-size: 11px; font-weight: 600;
  text-anchor: middle; dominant-baseline: central; }

/* Numbers keep one font size/weight; emphasis changes animate as scale + opacity,
   which the browser can interpolate smoothly (animating font-size makes glyphs jitter) */
.numeral, .rel { font-family: var(--notes); font-weight: 600; fill: var(--ink);
  text-anchor: middle; dominant-baseline: central; text-rendering: geometricPrecision;
  transform-box: fill-box; transform-origin: center; will-change: transform;
  transition: opacity 0.35s, transform 0.35s; }
.numeral { font-size: 20px; }
.numeral.off { opacity: 0.35; transform: scale(0.7); }
.rel { font-size: 17px; opacity: 0.35; transform: scale(0.76); }
.rel.on { opacity: 1; transform: none; }
.rel-circle { display: none; fill: var(--paper); stroke: var(--ink); stroke-opacity: 0.6; stroke-width: 1.25; }
.rel-circle.on { display: inline; }

.dot { transform-box: fill-box; transform-origin: center; transition: transform 0.3s, fill 0.3s, opacity 0.3s; }
.dot.big { transform: scale(1.3); }
/* Notes outside the scale: hue kept, saturation mostly removed (set in app.js), faded */
.dot.out { opacity: 0.4; }
.note-label { transition: opacity 0.3s; }
.note-label.out { opacity: 0.45; }
.chord-layer { transition: opacity 0.3s; }
.chord-layer.hidden { opacity: 0; }
.voice-arrow { stroke-width: 3; stroke-linecap: round; transition: stroke 0.3s; }
.bass-ring { fill: none; stroke: var(--ink); stroke-width: 2; }

.chord .tone.light { color: #222; }

/* ---- chords ---- */

#chords {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.chord {
  display: flex;
  min-width: 88px;
  max-width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  font: inherit;
  cursor: pointer;
}

.chord:hover { border-color: var(--accent); }
.chord.selected { padding: 7px 5px; border: 2px solid var(--accent); }

/* Fixed line heights: ♭/♯ come from a fallback font that would otherwise make cards taller */
.chord .numeral-label { min-height: 22px; font-family: Georgia, serif; font-size: 18px; line-height: 22px; overflow-wrap: anywhere; }
.chord .numeral-label sup { margin-left: 1px; font-size: 0.6em; line-height: 0; }
/* Figured-bass numbers stacked after the numeral (e.g. ⁶₄) */
.chord .figs { display: inline-flex; flex-direction: column; margin-left: 1px;
  font-size: 0.55em; line-height: 1; vertical-align: top; }
.chord .symbol { min-height: 20px; font-family: var(--notes); font-size: 16px; font-weight: 600; line-height: 20px; overflow-wrap: anywhere; }
.chord .tones { display: flex; gap: 2px; }
.chord .tone { display: flex; width: 24px; height: 24px; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-family: var(--notes); font-size: 11px; font-weight: 600; }

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .app * { transition: none !important; }
}
