/* Tuning & Temperament Explorer, 2026-11-06: only what ft-tool-20261106.css lacks
   (piano keyboard, circle of fifths, key colors, comma figures). Colors come from the shell tokens. */

.tte-row { margin-top: var(--ft-space-4); }
.tte-intro { margin: 0 0 var(--ft-space-4); max-width: var(--ft-measure); color: var(--ft-ink-2); }

/* Third-quality scale: pure (green) to very wide (red), always with numbers next to it. */
.tte-q0 { --tte-q: var(--ft-ok-soft); }
.tte-q1 { --tte-q: var(--ft-ok-soft); }
.tte-q2 { --tte-q: var(--ft-surface-2); }
.tte-q3 { --tte-q: var(--ft-warn-soft); }
.tte-q4 { --tte-q: var(--ft-warn-soft); }
.tte-q5 { --tte-q: var(--ft-bad-soft); }
@supports (color: color-mix(in oklab, red 50%, blue)) {
  .tte-q0 { --tte-q: color-mix(in oklab, var(--ft-ok) 40%, var(--ft-surface)); }
  .tte-q1 { --tte-q: color-mix(in oklab, var(--ft-ok) 18%, var(--ft-surface)); }
  .tte-q3 { --tte-q: color-mix(in oklab, var(--ft-warn) 16%, var(--ft-surface)); }
  .tte-q4 { --tte-q: color-mix(in oklab, var(--ft-warn) 34%, var(--ft-surface)); }
  .tte-q5 { --tte-q: color-mix(in oklab, var(--ft-bad) 36%, var(--ft-surface)); }
}

/* "A" / "B" marks */
.tte-ab {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.2rem;
  border-radius: var(--ft-radius-s);
  background: var(--ft-accent-soft);
  color: var(--ft-ink);
  font-size: var(--ft-text-xs);
  font-weight: 750;
  line-height: 1;
  vertical-align: 0.05em;
}

/* Inputs panel */
.tte-slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--ft-space-3); align-items: end; }
.tte-slot__key .ft-select { min-width: 5.5rem; }
.tte-slot:has(> .tte-slot__key[hidden]) { grid-template-columns: minmax(0, 1fr); }
.tte-ref .ft-segmented__option span { padding: 0 0.7rem; }

/* Compare panel */
.tte-chordpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--ft-space-3); }
.tte-playrow .ft-btn { flex: 1 1 auto; }
.tte-volume { max-width: 28rem; }
.tte-comparewrap { min-height: 15.5rem; }
.tte-compare th, .tte-compare td { vertical-align: top; }
.tte-compare thead th { white-space: normal; font-size: var(--ft-text-sm); }
.tte-compare .tte-ab { margin-right: 0.15rem; }
.tte-cell__main, .tte-cell__sub, .tte-cell__beat, .tte-cell__pair { display: block; }
.tte-cell__pair { color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tte-compare thead .tte-cell__sub { font-weight: 400; }
.tte-compare tbody th { width: 34%; }
.tte-cell__main { color: var(--ft-ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.tte-cell__sub { color: var(--ft-ink-2); font-size: var(--ft-text-xs); font-weight: 400; }
.tte-cell__beat { color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.tte-compare__hz td { color: var(--ft-ink-2); font-size: var(--ft-text-xs); font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) {
  .tte-compare th, .tte-compare td { padding: 0.5rem 0.45rem; }
  .tte-cell__beat { font-size: var(--ft-text-xs); white-space: nowrap; }
}

/* Keyboard panel */
.tte-abswitch .ft-segmented__option span { white-space: normal; text-align: left; }
.tte-kbdbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ft-space-2) var(--ft-space-4); margin-bottom: var(--ft-space-3); }
.tte-kbdbar__octaves { margin-left: auto; }
.tte-kbd {
  --tte-white: var(--ft-surface);
  --tte-white-ink: var(--ft-ink-2);
  --tte-black: var(--ft-frame-deep);
  --tte-black-ink: var(--ft-frame-ink-2);
  --tte-key-line: var(--ft-line-strong);
  --tte-down: var(--ft-accent-soft);
  --tte-down-line: var(--ft-accent);
  position: relative;
  display: flex;
  height: 9.5rem;
  margin: 0;
  touch-action: pan-y; /* a vertical swipe on the keys scrolls the page; in Hold mode a touch plays on lift (page script) */
  user-select: none;
  -webkit-user-select: none;
}
:root[data-theme="dark"] .tte-kbd { --tte-white: var(--ft-surface-2); --tte-black: var(--ft-bg); --tte-black-ink: var(--ft-ink-2); --tte-black-edge: var(--ft-line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tte-kbd { --tte-white: var(--ft-surface-2); --tte-black: var(--ft-bg); --tte-black-ink: var(--ft-ink-2); --tte-black-edge: var(--ft-line-strong); } }
.tte-k {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin: 0;
  padding: 0 0 0.5rem;
  border: 1px solid var(--tte-key-line);
  font: inherit;
  font-size: var(--ft-text-xs);
  font-weight: 650;
  line-height: 1.1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tte-k--white { position: relative; flex: 1 1 0; min-width: 0; height: 100%; margin-right: -1px; border-radius: 0 0 var(--ft-radius) var(--ft-radius); background: var(--tte-white); color: var(--tte-white-ink); }
.tte-k--white:last-of-type { margin-right: 0; }
.tte-k--black {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(var(--tte-x) - 100% / var(--tte-n) * 0.31);
  width: calc(100% / var(--tte-n) * 0.62);
  height: 60%;
  border-color: var(--tte-black-edge, var(--tte-black));
  border-radius: 0 0 var(--ft-radius-s) var(--ft-radius-s);
  background: var(--tte-black);
  color: var(--tte-black-ink);
}
.tte-k__hint { display: none; color: var(--ft-ink-3); font-size: 0.6875rem; font-weight: 500; }
.tte-k--black .tte-k__hint { color: inherit; opacity: 0.8; }
@media (hover: hover) and (pointer: fine) and (min-width: 56rem) { .tte-k__hint { display: block; } }
.tte-k:hover { filter: brightness(0.97); }
.tte-k.is-down { background: var(--tte-down); border-color: var(--tte-down-line); color: var(--ft-ink); box-shadow: inset 0 -4px 0 var(--tte-down-line); }
.tte-k--black.is-down { background: var(--ft-frame-mid); border-color: var(--ft-frame-accent); color: var(--ft-frame-ink); box-shadow: inset 0 -4px 0 var(--ft-frame-accent); }
.tte-k:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: -5px; }
.tte-k--black:focus-visible { z-index: 3; outline-offset: 2px; }
.tte-kbd__status { min-height: 3em; }
#kbd-hint { margin-top: var(--ft-space-3); }
@media (max-width: 40rem) { .tte-kbd { height: 8.5rem; margin-inline: calc(var(--ft-space-4) * -1); } }

/* Details panel */
.tte-details { display: grid; gap: var(--ft-space-5); }
@media (min-width: 56rem) { .tte-details { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } }
.tte-circlefig { max-width: 28rem; width: 100%; margin-inline: auto; }
.tte-circlefig__frame { touch-action: pan-y; }
.tte-rule { margin: 0 0 var(--ft-space-2); color: var(--ft-ink); }
.tte-summary { margin: 0 0 var(--ft-space-4); padding-left: 1.2em; color: var(--ft-ink-2); font-size: var(--ft-text-sm); }
.tte-summary li { margin: 0.2em 0; }
.tte-keys__title { margin: var(--ft-space-3) 0 var(--ft-space-2); color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 650; }
.tte-keys__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--ft-space-1); margin: 0; padding: 0; list-style: none; }
@media (max-width: 26rem) { .tte-keys__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tte-key {
  display: grid;
  width: 100%;
  min-height: var(--ft-target);
  padding: 0.3rem 0.2rem;
  border: 1px solid var(--ft-line-strong);
  border-radius: var(--ft-radius);
  background: var(--tte-q);
  color: var(--ft-ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.tte-key:hover { border-color: var(--ft-ink-2); }
.tte-key:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: 2px; }
.tte-key__name { font-size: var(--ft-text-sm); font-weight: 750; line-height: 1.2; }
.tte-key__third { font-size: var(--ft-text-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.tte-key__fifth { color: var(--ft-ink); font-size: var(--ft-text-xs); font-weight: 450; font-variant-numeric: tabular-nums; } /* ink on every fill: 4.5:1 or more in both themes */
.tte-legend { margin-top: var(--ft-space-3); }
.tte-keys + .ft-hint { margin-top: var(--ft-space-2); }
.tte-swatch { display: inline-block; flex: none; width: 0.9rem; height: 0.9rem; border: 1px solid var(--ft-line-strong); border-radius: 3px; background: var(--tte-q); }

/* Circle of fifths (SVG) */
.tte-circle { overflow: visible; }
.tte-circle__ring { fill: none; stroke: var(--ft-plot-grid); stroke-width: 2; }
.tte-circle__bar { stroke-width: 7; stroke-linecap: round; }
.tte-circle__bar.is-narrow { stroke: var(--ft-plot-1); }
.tte-circle__bar.is-wide { stroke: var(--ft-plot-2); }
.tte-circle__bar.is-rest { stroke-dasharray: 3 4; stroke-width: 5; }
.tte-circle__pure { fill: var(--ft-plot-surface); stroke: var(--ft-plot-axis); stroke-width: 2; }
.tte-circle__label { fill: var(--ft-plot-ink-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tte-circle__label.is-wolf { fill: var(--ft-bad); font-weight: 750; }
.tte-circle__sublabel { fill: var(--ft-plot-ink-2); font-size: 11px; font-weight: 700; }
.tte-circle__sublabel.is-wolf { fill: var(--ft-bad); }
.tte-node__dot { fill: var(--tte-q); stroke: var(--ft-line-strong); stroke-width: 1.5; }
.tte-node__name { fill: var(--ft-plot-ink); font-size: 15px; font-weight: 750; }
.tte-node__third { fill: var(--ft-plot-ink); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tte-fifth { cursor: grab; touch-action: none; } /* only a handle captures a drag; the rest of the circle scrolls */
/* the knob ring and the shaded track are the focus indicator; no box around the whole group */
body.ft-page .tte-circle .tte-fifth:focus, body.ft-page .tte-circle .tte-fifth:focus-visible { outline: none; }
.tte-fifth__hit { stroke: transparent; stroke-width: 26; stroke-linecap: round; }
.tte-fifth__knob { fill: var(--ft-plot-surface); stroke: var(--ft-accent); stroke-width: 2.5; }
.tte-fifth:hover .tte-fifth__hit { stroke: var(--ft-accent-soft); }
.tte-fifth:focus-visible .tte-fifth__hit { stroke: var(--ft-accent-soft); }
.tte-fifth:focus-visible .tte-fifth__knob { stroke: var(--ft-focus); stroke-width: 4; }
.is-dragging .tte-fifth { cursor: grabbing; }

/* Custom tuning editor */
.tte-custom { margin-top: var(--ft-space-5); padding-top: var(--ft-space-4); border-top: 1px solid var(--ft-line); }
.tte-copybar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ft-space-2) var(--ft-space-4); }
.tte-copybar .ft-hint { max-width: 40rem; font-size: var(--ft-text-sm); }
.tte-editor { display: grid; gap: var(--ft-space-4); }
.tte-editor__title { margin: 0; color: var(--ft-ink); font-size: var(--ft-text-md); font-weight: 650; }
.tte-editor__title:focus { outline: none; }
.tte-editor__closing { max-width: 22rem; }
.tte-fifthtable .ft-select { min-height: 2.5rem; padding-block: 0.25rem; font-size: var(--ft-text-sm); }
.tte-fifthtable td { vertical-align: middle; }
.tte-fifthtable th[scope="row"] { white-space: nowrap; vertical-align: middle; }
.tte-fifthtable td:nth-child(2) { width: 100%; }
.tte-notegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 6.75rem), 1fr)); gap: var(--ft-space-3); align-items: start; }
.tte-notegrid__hint { grid-column: 1 / -1; font-size: var(--ft-text-sm); }

/* Tables and downloads */
.tte-tablebar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--ft-space-3) var(--ft-space-5); margin: var(--ft-space-5) 0 var(--ft-space-4); padding-top: var(--ft-space-4); border-top: 1px solid var(--ft-line); }
.tte-tablebar__octave { min-width: 11rem; }
.tte-table caption { font-weight: 600; color: var(--ft-ink); }
.tte-table thead th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.tte-table td.ft-num, .tte-table th.ft-num { min-width: 4.5rem; }
.tte-downloads { margin-top: var(--ft-space-5); }
.tte-downloads__title { margin: 0 0 var(--ft-space-3); color: var(--ft-ink); font-size: var(--ft-text-md); font-weight: 650; overflow-wrap: anywhere; }
.tte-downloads__title span { font-family: var(--ft-font-mono); font-size: 0.9em; font-weight: 500; color: var(--ft-ink-2); }
.tte-downloads .ft-hint { margin-top: var(--ft-space-2); }

/* Hear the comma */
.tte-comma { display: grid; gap: var(--ft-space-5); }
@media (min-width: 56rem) { .tte-comma { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: start; } }
.tte-comma__stats .ft-stat__value { font-size: var(--ft-text-lg); }
.tte-comma__text { margin: 0; color: var(--ft-ink); min-height: 4.65em; }
.tte-comma__figs { display: grid; gap: var(--ft-space-3); width: 100%; max-width: 24rem; margin: 0 auto; }
.tte-comma__spiral, .tte-comma__ruler { border: 1px solid var(--ft-line); border-radius: var(--ft-radius); background: var(--ft-plot-surface); }
.tte-comma__spiral { aspect-ratio: 1 / 1; width: 100%; }
.tte-comma__ruler { aspect-ratio: 320 / 70; }
.tte-spiral, .tte-ruler { display: block; width: 100%; height: 100%; }
.tte-spiral__c { stroke: var(--ft-plot-axis); stroke-width: 1.5; stroke-dasharray: 4 4; }
.tte-spiral__path { fill: none; stroke: var(--ft-plot-axis); stroke-width: 1.5; opacity: 0.7; }
.tte-spiral__gap { fill: none; stroke: var(--ft-plot-2); stroke-width: 5; stroke-linecap: round; }
.tte-spiral__dot { fill: var(--ft-plot-1); }
.tte-spiral__dot.is-end { fill: var(--ft-plot-2); stroke: var(--ft-plot-surface); stroke-width: 2; }
.tte-spiral__label { fill: var(--ft-plot-ink-2); font-size: 11.5px; font-weight: 600; }
.tte-spiral__label.is-end { fill: var(--ft-plot-ink); font-weight: 750; }
.tte-ruler__axis, .tte-ruler__tick { stroke: var(--ft-plot-axis); stroke-width: 1.5; }
.tte-ruler__zero { stroke: var(--ft-plot-ink); stroke-width: 2; }
.tte-ruler__num { fill: var(--ft-plot-ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.tte-ruler__c, .tte-ruler__end { fill: var(--ft-plot-ink); font-size: 12px; font-weight: 750; }
.tte-ruler__gap { stroke: var(--ft-plot-2); stroke-width: 5; stroke-linecap: round; }
.tte-ruler__mark { fill: var(--ft-plot-2); stroke: var(--ft-plot-surface); stroke-width: 2; }

/* Example section */
.tte-example-more { margin-top: var(--ft-space-4); }
.tte-deftable th[scope="row"] { white-space: nowrap; }
@media (max-width: 40rem) { .tte-deftable th[scope="row"] { white-space: normal; } }

/* One Stop button, shown only while something plays */
.tte-stop { position: fixed; z-index: 55; right: max(var(--ft-space-4), env(safe-area-inset-right)); bottom: max(var(--ft-space-4), env(safe-area-inset-bottom)); box-shadow: var(--ft-shadow); }

@media print {
  .tte-kbd, .tte-kbdbar, .tte-stop, .tte-presets, .tte-copybar, #kbd-hint { display: none !important; }
  .tte-row--kbd, .tte-downloads, .tte-volume, .tte-playrow, .tte-comma .ft-range, #comma-size-hint, .tte-comma__controls > .ft-btnrow, .tte-quick { display: none !important; }
  .tte-key { break-inside: avoid; }
}

/* Mobile form controls (16px to prevent iOS Safari zoom) and 44px primary buttons */
@media screen and (max-width: 640px), screen and (hover: none) and (pointer: coarse) {
  .ft-tool input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  .ft-tool select,
  .ft-tool textarea,
  .ft-tool .ft-input,
  .ft-tool .ft-select,
  .ft-tool .ft-textarea,
  .ft-tool .ft-inputgroup > .ft-select.ft-inputgroup__unit,
  .ft-tool .tte-fifthtable .ft-select {
    font-size: max(16px, 1rem);
  }
  .ft-tool .ft-btn--primary {
    min-height: 44px;
  }
}

/* Phones: the result of the current settings, under the tuning selects (Listen and compare is a screen further down) */
.tte-quick { margin: 0; padding: var(--ft-space-2) var(--ft-space-3); border-left: 3px solid var(--ft-accent); border-radius: var(--ft-radius-s); background: var(--ft-surface-2); color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 600; }
@media (min-width: 56rem) { .tte-quick { display: none; } }
#tool .ft-panel { scroll-margin-top: var(--ft-space-3); }
/* U9: a pressed toggle (Play A, Play B, Play A then B, Hold C4–G4) looks pressed */
#tool .ft-btn[aria-pressed="true"] { border-color: var(--ft-accent); background: var(--ft-accent-soft); color: var(--ft-ink); box-shadow: inset 0 -3px 0 var(--ft-accent); }
/* U16: the computer-key sentence only where the key letters are shown (a mouse and a wide screen) */
.tte-kbd__keys { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 56rem) { .tte-kbd__keys { display: inline; } }
