/* Metronome & Polyrhythm Trainer (/tools/metronome-subdivision-trainer/), 2026-11-30.
   Uses tokens from ft-shell-20261106.css and components from ft-tool-20261106.css.
   Reserves polyrhythm circle, LCM step grid, and stat-card heights from first paint so CLS stays 0.000. */

.ft-tool .ft-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), minmax(0, 1fr)));
}

.ft-tool .ft-field,
.ft-tool fieldset,
.ft-tool .ft-panel,
.ft-tool .ft-stack,
.ft-tool .ft-inputgroup {
  min-width: 0;
  max-width: 100%;
}

.ft-tool .ft-select {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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 {
  font-size: max(16px, 1rem);
  min-height: 44px;
}

.ft-tool input[type="range"] {
  min-height: 44px;
}

.ft-tool .ft-btn {
  min-width: 44px;
  min-height: 44px;
  height: auto;
  padding-block: 0.48rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mst-tip {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--ft-accent);
  border-radius: 0 var(--ft-radius) var(--ft-radius) 0;
  background: var(--ft-surface-2);
  color: var(--ft-ink-2);
  font-size: var(--ft-text-xs);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mst-presets {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-2);
}

.mst-presets__label {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  font-weight: 600;
}

.mst-presets__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), minmax(0, 1fr)));
  gap: var(--ft-space-2);
}

.mst-preset {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.mst-preset[aria-pressed="true"] {
  border-color: var(--ft-accent);
  background: var(--ft-accent-soft);
  color: var(--ft-ink);
}

.mst-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-3);
  min-width: 0;
  margin: 0;
  padding: var(--ft-space-4) 0 0;
  border: 0;
  border-top: 1px solid var(--ft-line);
}

.mst-group__legend {
  float: left;
  width: 100%;
  margin: 0 0 var(--ft-space-1);
  padding: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  font-weight: 650;
}

.mst-group__legend + * {
  clear: both;
}

.mst-sliderrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.25rem;
  align-items: center;
  gap: var(--ft-space-2) var(--ft-space-3);
  min-width: 0;
}

.mst-sliderrow > .ft-range__input {
  min-width: 0;
  width: 100%;
}

.mst-sliderrow > .ft-inputgroup {
  min-width: 0;
}

@media (max-width: 26rem) {
  .mst-sliderrow {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mst-field--muted {
  opacity: 0.56;
}

.mst-temponudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ft-space-2);
  min-width: 0;
}

.mst-taprow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ft-space-2) var(--ft-space-3);
  min-width: 0;
}

.mst-tapreadout {
  flex: 1 1 10rem;
  min-width: 0;
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-xs);
  font-family: var(--ft-font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.mst-checkrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2);
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  line-height: 1.35;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.mst-checkrow input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--ft-accent);
  cursor: pointer;
}

.mst-volhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ft-space-2);
  min-width: 0;
}

.mst-volval {
  color: var(--ft-ink-2);
  font-family: var(--ft-font-mono);
  font-size: var(--ft-text-xs);
  font-variant-numeric: tabular-nums;
}

.mst-transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ft-space-2);
  min-width: 0;
}

.mst-transport__btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ft-space-2);
  min-width: 0;
}

.mst-barpill {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2);
  color: var(--ft-ink);
  font-family: var(--ft-font-mono);
  font-size: var(--ft-text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.mst-barpill--muted {
  border-color: var(--ft-warn, #b45309);
  background: var(--ft-accent-soft);
}

.mst-visgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-3);
  min-width: 0;
}

.mst-chart {
  margin: 0;
  min-width: 0;
}

.mst-circle-frame,
.mst-grid-frame {
  position: relative;
  width: 100%;
  padding: 0;
  border: 1px solid var(--ft-line-strong);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2);
  overflow: hidden;
  box-sizing: border-box;
  user-select: none;
}

.mst-circle-frame {
  height: 14.5rem;
}

.mst-grid-frame {
  height: 8.5rem;
}

.mst-circle-frame canvas,
.mst-grid-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.mst-readoutcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-3);
  padding: var(--ft-space-4);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2);
}

.mst-readoutcard__head {
  display: grid;
  gap: 0.25rem;
}

.mst-readoutcard__title {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  font-weight: 650;
}

.mst-readoutcard__sub {
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-xs);
  line-height: 1.45;
}

.mst-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ft-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mst-stats .ft-stat {
  min-height: 5.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 34rem) {
  .mst-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mst-after-example {
  margin-top: var(--ft-space-4);
}

@media (max-width: 24rem) {
  .ft-tool .ft-panel {
    padding: 0.75rem;
  }
  .mst-readoutcard {
    padding: 0.75rem;
  }
}
