/* MusePulse design system — dark, fast, zero dependencies */

:root {
  --bg: #0b0e14;
  --surface: #121724;
  --surface-2: #1a2133;
  --border: #232c42;
  --text: #e8ecf4;
  --muted: #98a1b6;
  --accent-1: #7c5cff;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --container: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; vertical-align: middle; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 750; margin-top: 2.2em; }
h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1.6em; }
p { margin: 0 0 1em; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.muted { color: var(--muted); }
.grad-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
  position: relative;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo .pulse-mark { flex: none; }
.logo .brand-pulse { color: var(--accent-2); }
/* Grouped dropdown nav: Tools / Theory / Apps */
.site-nav { display: flex; gap: 4px; align-items: center; }
.nav-group { position: relative; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-weight: 650; font-size: 0.95rem; cursor: pointer;
  padding: 8px 12px; border-radius: 8px;
  transition: color 0.12s ease, background 0.12s ease;
}
.nav-btn:hover, .nav-group.open .nav-btn { color: var(--text); }
.nav-caret { flex: none; opacity: 0.65; transition: transform 0.15s ease; }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 214px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 8px; display: none; flex-direction: column; gap: 2px; z-index: 60;
}
.nav-group.open .nav-menu { display: flex; }
.nav-menu a {
  color: var(--muted); font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 8px; white-space: nowrap;
}
.nav-menu a:hover, .nav-menu a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }

.nav-toggle {
  display: none; background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); cursor: pointer; padding: 7px; line-height: 0;
}

/* Mobile: a hamburger reveals a stacked nav; each group is an accordion */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    padding: 8px 16px 16px; display: none;
  }
  .site-header.nav-open .site-nav { display: flex; }
  .nav-group { position: static; }
  .nav-btn { width: 100%; justify-content: space-between; padding: 13px 8px; font-size: 1rem; }
  .nav-menu {
    position: static; display: none; min-width: 0;
    background: transparent; border: 0; box-shadow: none; padding: 0 0 10px 12px;
  }
  .nav-group.open .nav-menu { display: flex; }
  .nav-menu a { padding: 9px 10px; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 96px;
  padding: 48px 0 40px;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 8px 0; }
.footer-grid a { color: var(--text); opacity: 0.85; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; font-size: 0.88rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */

.hero { padding: 72px 0 40px; text-align: center; }
.hero h1 { max-width: 780px; margin-left: auto; margin-right: auto; }
.hero .lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 640px;
  margin: 16px auto 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent-grad);
  color: #081018;
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(34, 211, 238, 0.4); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0;
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
a.card:hover { transform: translateY(-3px); border-color: var(--accent-1); text-decoration: none; }
.card .card-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--accent-2);
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- App cards ---------- */

.app-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  align-items: start;
}
.app-card .app-icon { width: 96px; height: 96px; border-radius: 22px; }
.app-card h3 { margin-top: 0; }
.app-card h3 a { color: var(--text); text-decoration: none; }
.app-card h3 a:hover { color: var(--accent-2); }
.app-icon-link { display: block; align-self: start; flex: none; }
.app-icon-link:hover { text-decoration: none; }
.app-icon-link img { transition: transform 0.15s ease; }
.app-icon-link:hover img { transform: scale(1.04); }
.app-more { font-weight: 700; color: var(--accent-2); font-size: 0.92rem; }
.app-card .app-links { display: flex; gap: 14px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .app-card { grid-template-columns: 1fr; }
  .app-card .app-icon { width: 72px; height: 72px; border-radius: 16px; }
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-soon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.appstore-badge { display: inline-block; height: 48px; }
.appstore-badge svg { height: 48px; width: auto; display: block; }

/* ---------- Apps band (home, above the tools) ---------- */
.eyebrow {
  display: inline-block; font-size: 0.78rem; font-weight: 750;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--accent-2); margin-bottom: 8px;
}
.apps-band {
  display: grid; grid-template-columns: 1fr; gap: 22px;
  border: 1px solid var(--border); border-radius: 20px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, 0.12), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(34, 211, 238, 0.10), transparent 55%),
    var(--surface);
  padding: 26px; margin-top: 30px;
}
.apps-band-intro h2 { margin: 0 0 8px; font-size: 1.5rem; }
.apps-band-intro p { margin: 0; max-width: 42ch; }
.apps-band-cards { display: grid; gap: 14px; }
.apps-band-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.app-icon-sm { width: 60px; height: 60px; max-width: none; border-radius: 14px; flex: none; }
.apps-band-body { min-width: 0; }
.apps-band-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.apps-band-body h3 a { color: var(--text); text-decoration: none; }
.apps-band-body h3 a:hover { color: var(--accent-2); }
.apps-band-body p { margin: 0 0 12px; font-size: 0.9rem; }
.apps-band-body .app-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.apps-band-body .appstore-badge, .apps-band-body .appstore-badge svg { height: 40px; }
@media (min-width: 680px) { .apps-band-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) {
  .apps-band { grid-template-columns: 0.85fr 1.5fr; align-items: center; gap: 30px; }
}

/* ---------- Tool panel (interactive tools) ---------- */

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 32px 0;
}
.tool-panel:focus-visible { outline: 2px solid var(--accent-2); }

.big-value {
  font-family: var(--mono);
  font-size: clamp(3.2rem, 10vw, 5.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.big-value .unit { font-size: 0.3em; color: var(--muted); font-weight: 600; letter-spacing: 0; }

.control-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.control-label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 420px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  outline-offset: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-grad);
  border: 3px solid var(--bg);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 3px solid var(--bg);
  cursor: pointer;
}

select, .stepper-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.stepper-btn {
  width: 48px; height: 48px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}
.stepper-btn:hover, select:hover { border-color: var(--accent-1); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 24px 0; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--bg);
}
.data-table tbody tr:hover { background: var(--surface); }
.data-table .row-a4 td { color: var(--accent-2); font-weight: 700; }

/* ---------- FAQ ---------- */

/* Constrain + center to match the .prose column. Without the `auto` sides this
   would inherit .container's max-width but drop its auto margins and pin left. */
.faq { max-width: 720px; margin: 32px auto; }
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 20px;
  margin: 10px 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 16px 0;
  list-style: none;
  position: relative;
  padding-right: 28px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 2px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  font-size: 1.3rem;
  font-weight: 600;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); padding-bottom: 16px; margin: 0; }

/* ---------- Prose / SEO copy ---------- */

.prose { max-width: 720px; }
.prose ul, .prose ol { padding-left: 24px; color: var(--muted); }
.prose li { margin: 6px 0; }
.prose strong { color: var(--text); }

.section-title { margin-top: 72px; }
.section-title + p { color: var(--muted); max-width: 640px; }

/* ---------- CTA strip ---------- */

.cta-strip {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(34, 211, 238, 0.1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  margin: 56px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-strip h2 { margin: 0 0 6px; font-size: 1.4rem; }
.cta-strip p { margin: 0; color: var(--muted); }

/* ---------- Breadcrumbs ---------- */

.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin: 24px 0 0; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }

/* ---------- Beat indicator (metronome) ---------- */

.beat-dots { display: flex; gap: 12px; justify-content: center; margin: 28px 0 8px; flex-wrap: wrap; }
.beat-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform 0.05s ease, background 0.05s ease;
}
.beat-dot.accent-dot { width: 22px; height: 22px; }
.beat-dot.active { background: var(--accent-2); transform: scale(1.35); border-color: transparent; }
.beat-dot.active.accent-dot { background: var(--accent-1); }

/* ---------- Rhythm trainer ---------- */

.rt-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px auto 18px;
  max-width: 520px;
}
.rt-beat {
  position: relative;
  flex: 1 1 0;
  max-width: 120px;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rt-beat .rt-beat-no {
  position: absolute;
  top: 5px; left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rt-beat.playing { border-color: var(--accent-2); background: #17324a; }
.rt-beat.changed { animation: rt-flash 0.5s ease; }
@keyframes rt-flash {
  0% { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.5) inset; }
  100% { border-color: var(--border); box-shadow: none; }
}
/* Note glyphs are the app's own template icons (dark art) — invert to light. */
.rt-note-img {
  width: 78%; height: 62%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.rt-beat.playing .rt-note-img {
  filter: brightness(0) invert(1)
          drop-shadow(0 0 6px color-mix(in srgb, var(--accent-2) 70%, transparent));
}

.rt-barcount { text-align: center; color: var(--muted); font-size: 0.88rem; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.rt-barcount b { color: var(--text); font-weight: 700; }

.rt-toggles { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: center; margin: 16px 0 2px; }
.rt-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 600; color: var(--muted); cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.rt-toggle input { width: 17px; height: 17px; accent-color: var(--accent-1); cursor: pointer; }
.rt-toggle:hover { color: var(--text); }

.rt-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 16px; }
.rt-presets .btn { padding: 8px 16px; font-size: 0.9rem; }

.rt-pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.rt-pattern-group-title {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 700; margin: 18px 0 4px;
}
.rt-chip {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 8px 9px; cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rt-chip:hover { border-color: var(--accent-1); }
.rt-chip .rt-note-img { width: 60px; height: 30px; opacity: 0.55; }
.rt-chip .rt-chip-label { font-size: 0.73rem; color: var(--muted); text-align: center; line-height: 1.15; }
.rt-chip.selected { border-color: var(--accent-2); background: #12233a; }
.rt-chip.selected .rt-note-img { opacity: 1; }
.rt-chip.selected .rt-chip-label { color: var(--text); }

.rt-hint { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.rt-hint.warn { color: var(--warn); }

/* beat-blocks dot view */
.rt-dots { width: 82%; height: 60%; }
.rt-dot-on { fill: var(--text); }
.rt-beat.playing .rt-dot-on { fill: var(--accent-2); }
.rt-dot-off { fill: none; stroke: var(--muted); stroke-width: 2.4; opacity: 0.5; }
.rt-chip .rt-dots { width: 58px; height: 28px; opacity: 0.55; }
.rt-chip.selected .rt-dots { opacity: 1; }

/* Notes / Dots segmented toggle */
.rt-viewrow { display: flex; justify-content: center; margin-bottom: 10px; }
.rt-view { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.rt-view button { background: transparent; border: 0; color: var(--muted); padding: 6px 18px; font: inherit; font-weight: 650; font-size: 0.85rem; cursor: pointer; transition: color 0.12s ease, background 0.12s ease; }
.rt-view button:hover { color: var(--text); }
.rt-view button.active { background: var(--accent-grad); color: #081018; }

/* ---------- Screenshot gallery (pre-framed marketing shots) ---------- */

.shot-gallery {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 10px 2px 22px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.shot {
  flex: 0 0 auto;
  width: 236px;
  scroll-snap-align: center;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
}
.shot img { display: block; width: 100%; height: auto; }

/* ---------- Circle of fifths ---------- */

.cof-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin: 24px 0 8px;
}
@media (max-width: 720px) { .cof-layout { grid-template-columns: 1fr; } }

.cof-wheel svg { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto; }
.cof-seg {
  fill: var(--surface-2);
  stroke: var(--bg);
  stroke-width: 2;
  transition: fill 0.12s ease;
}
.cof-maj { fill: var(--surface-2); }
.cof-min { fill: var(--surface); }
.cof-wedge { cursor: pointer; outline: none; }
.cof-wedge:hover .cof-seg { fill: var(--border); }
.cof-wedge:focus-visible .cof-maj { fill: var(--border); }
.cof-wedge.active .cof-maj { fill: var(--accent-1); }
.cof-wedge.active .cof-min { fill: color-mix(in srgb, var(--accent-1) 45%, var(--surface)); }
.cof-lbl { fill: var(--text); font-family: var(--font); pointer-events: none; }
.cof-lbl-maj { font-weight: 750; font-size: 15px; }
.cof-lbl-min { font-weight: 600; font-size: 11px; fill: var(--muted); }
.cof-wedge.active .cof-lbl { fill: #081018; }
.cof-wedge.active .cof-lbl-min { fill: #0b1622; }
.cof-hub { fill: var(--bg); stroke: var(--border); stroke-width: 2; }
.cof-hub-text { fill: var(--text); font-family: var(--mono); font-weight: 700; font-size: 34px; }

.cof-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.cof-detail h3 { margin: 0 0 4px; font-size: 1.5rem; }
.cof-detail-head p { margin: 0; font-size: 0.92rem; }
.cof-chord-label {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 700; margin: 18px 0 10px;
}
.cof-chords { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.cof-chord {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 4px; font-weight: 650;
}
.cof-chord .cof-rn { font-size: 0.72rem; color: var(--accent-2); font-weight: 700; }

/* ---------- String tuner ---------- */

.st-panel { transition: border-color 0.15s ease; }
.st-panel.st-in-tune { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }

.st-display { text-align: center; margin: 8px 0 4px; }
.st-note {
  font-family: var(--mono); font-weight: 700; letter-spacing: -0.03em;
  font-size: clamp(3.6rem, 12vw, 5.6rem); line-height: 1; font-variant-numeric: tabular-nums;
}
.st-panel.st-in-tune .st-note { color: var(--good); }
.st-panel.st-idle .st-note { color: var(--muted); opacity: 0.5; }
.st-octave { font-size: 0.32em; color: var(--muted); font-weight: 600; vertical-align: super; }
.st-readout { color: var(--muted); font-family: var(--mono); font-size: 0.98rem; margin-top: 2px; }
.st-readout .sep { opacity: 0.4; margin: 0 8px; }

.st-scale {
  position: relative; height: 46px; max-width: 460px; margin: 18px auto 6px;
  border-bottom: 2px solid var(--border);
}
.st-scale .st-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-end; }
.st-scale .st-ticks span { width: 1px; height: 12px; background: var(--border); }
.st-scale .st-ticks span.mid { height: 22px; width: 2px; background: var(--muted); }
.st-needle {
  position: absolute; left: 50%; bottom: 0; width: 3px; height: 40px;
  background: var(--accent-2); border-radius: 3px; transform: translateX(0);
  transition: transform 0.08s linear;
}
.st-panel.st-in-tune .st-needle { background: var(--good); }
.st-panel.st-idle .st-needle { background: var(--border); }
.st-scale-labels { display: flex; justify-content: space-between; max-width: 460px; margin: 0 auto; color: var(--muted); font-size: 0.78rem; }

.st-strings { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0 6px; }
.st-string {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font: inherit; line-height: 1; gap: 1px;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}
.st-string:hover { border-color: var(--accent-1); }
.st-string-note { font-weight: 750; font-size: 1.15rem; }
.st-string-oct { font-size: 0.66rem; color: var(--muted); }
.st-string.active { border-color: var(--accent-2); background: #12233a; }
.st-string.tuned { border-color: var(--good); background: color-mix(in srgb, var(--good) 22%, var(--surface-2)); }
.st-string.tuned .st-string-oct { color: var(--text); }
.st-string.ringing { animation: st-ring 0.9s ease; }
@keyframes st-ring {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.5); }
  30% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(124, 92, 255, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124, 92, 255, 0); }
}
.st-hint { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.st-tuning-row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Scale finder ---------- */

.sf-controls { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.sf-roots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.sf-root {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 11px; font: inherit; font-weight: 700; cursor: pointer; min-width: 42px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.sf-root:hover { border-color: var(--accent-1); }
.sf-root.active { background: var(--accent-grad); color: #081018; border-color: transparent; }

.sf-piano { overflow-x: auto; padding: 4px 0 14px; -webkit-overflow-scrolling: touch; }
.sf-svg { width: 100%; max-width: 620px; min-width: 440px; height: auto; display: block; margin: 0 auto; }
.sf-key { cursor: pointer; transition: fill 0.08s ease; }
.sf-white { fill: #e9edf5; stroke: #0b0e14; stroke-width: 1.2; }
.sf-black { fill: #161c2b; stroke: #0b0e14; stroke-width: 1.2; }
.sf-white.in-scale { fill: var(--accent-2); }
.sf-black.in-scale { fill: color-mix(in srgb, var(--accent-2) 78%, #0b0e14); }
.sf-key.is-root { fill: var(--accent-1); }
.sf-key.lit { fill: var(--good); }

.sf-title { text-align: center; font-size: 1.4rem; font-weight: 750; letter-spacing: -0.02em; margin: 8px 0 2px; }
.sf-notes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 8px; }
.sf-note {
  font-family: var(--mono); font-weight: 700; font-size: 1.25rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; min-width: 46px; text-align: center;
}
.sf-note.sf-oct { opacity: 0.45; }
.sf-formula { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 0.95rem; }
.sf-formula b { color: var(--text); }

/* ---- Guitar Scales (fretboard) ---- */
.gs-controls { display: flex; gap: 18px 22px; align-items: flex-end; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.gs-field { display: flex; flex-direction: column; gap: 6px; }
.gs-field .control-label { text-align: left; }
.gs-views.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.gs-views.seg button { background: transparent; border: 0; color: var(--muted); padding: 7px 15px; font: inherit; font-weight: 650; font-size: 0.85rem; cursor: pointer; transition: color 0.12s ease, background 0.12s ease; }
.gs-views.seg button:hover { color: var(--text); }
.gs-views.seg button.active { background: var(--accent-grad); color: #081018; }
.gs-lefty-wrap { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 0.9rem; color: var(--muted); cursor: pointer; padding-bottom: 8px; }
.gs-lefty-wrap input { width: 16px; height: 16px; accent-color: var(--accent-1); cursor: pointer; }

.gs-roots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }

.gs-board { overflow-x: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.gs-board.lefty .gs-svg { transform: scaleX(-1); }
.gs-board.lefty .gs-svg .gs-lbl,
.gs-board.lefty .gs-svg .gs-open,
.gs-board.lefty .gs-svg .gs-fretnum { transform: scaleX(-1); transform-box: fill-box; transform-origin: center; }
.gs-svg { width: 100%; min-width: 980px; height: auto; display: block; margin: 0 auto; }
.gs-fret { stroke: #3a4358; stroke-width: 2; }
.gs-nut { fill: #cfd6e6; }
.gs-string { stroke: #5b6479; stroke-width: 1.4; }
.gs-inlay { fill: #2b3346; }
.gs-fretnum { fill: var(--muted); font-family: var(--mono); font-size: 15px; }
.gs-open { fill: var(--text); font-family: var(--mono); font-weight: 700; font-size: 16px; }
.gs-dot { cursor: pointer; }
.gs-dot circle { fill: var(--accent-2); stroke: #0b0e14; stroke-width: 1; transition: fill 0.08s ease; }
.gs-dot.root circle { fill: var(--accent-1); }
.gs-dot.open circle { fill: color-mix(in srgb, var(--accent-2) 55%, #0b0e14); }
.gs-dot.root.open circle { fill: color-mix(in srgb, var(--accent-1) 62%, #0b0e14); }
.gs-dot.lit circle { fill: var(--good); }
.gs-dot .gs-lbl { fill: #081018; font-family: var(--mono); font-weight: 800; font-size: 14px; pointer-events: none; }
.gs-dot.root .gs-lbl { fill: #fff; }
.gs-dot:focus-visible { outline: none; }
.gs-dot:focus-visible circle { stroke: #fff; stroke-width: 2.4; }
.gs-title { text-align: center; font-size: 1.4rem; font-weight: 750; letter-spacing: -0.02em; margin: 10px 0 2px; }

/* ---- Chords (piano + guitar) ---- */
.ch-title { text-align: center; font-size: 1.4rem; font-weight: 750; letter-spacing: -0.02em; margin: 6px 0 2px; }
.ch-views { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 14px; }
@media (min-width: 780px) { .ch-views { grid-template-columns: 1.7fr 1fr; align-items: start; } }
.ch-view { min-width: 0; }
.ch-view-label { text-align: center; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }
.ch-piano { overflow-x: auto; padding: 2px 0 6px; -webkit-overflow-scrolling: touch; }
.ch-piano-svg { width: 100%; max-width: 520px; min-width: 360px; height: auto; display: block; margin: 0 auto; }
.ch-key { cursor: pointer; }
.ch-white { fill: #e9edf5; stroke: #0b0e14; stroke-width: 1.2; }
.ch-black { fill: #161c2b; stroke: #0b0e14; stroke-width: 1.2; }
.ch-key.in-chord .ch-white { fill: var(--accent-2); }
.ch-key.in-chord .ch-black { fill: color-mix(in srgb, var(--accent-2) 78%, #0b0e14); }
.ch-key.is-root .ch-white { fill: var(--accent-1); }
.ch-key.is-root .ch-black { fill: color-mix(in srgb, var(--accent-1) 82%, #0b0e14); }
.ch-key.lit .ch-white, .ch-key.lit .ch-black { fill: var(--good); }
.ch-klbl { font-family: var(--mono); font-weight: 800; font-size: 13px; fill: #081018; pointer-events: none; }
.ch-klbl-b { fill: #e9edf5; }

.ch-guitar { display: flex; justify-content: center; padding: 2px 0; }
.ch-guitar.empty { display: none; }
.ch-guitar-svg { width: 100%; max-width: 200px; height: auto; display: block; }
.ch-gstring { stroke: #5b6479; stroke-width: 1.4; }
.ch-gfret { stroke: #3a4358; stroke-width: 1.6; }
.ch-gnut { stroke: #cfd6e6; stroke-width: 5; }
.ch-gfretnum { fill: var(--muted); font-family: var(--mono); font-size: 15px; }
.ch-gmark { fill: var(--muted); font-family: var(--mono); font-size: 17px; }
.ch-gmark.ch-gopen { fill: var(--text); }
.ch-gdot { fill: var(--accent-2); stroke: #0b0e14; stroke-width: 1; }
.ch-gdot.root { fill: var(--accent-1); }
.ch-gtr-label { text-align: center; color: var(--muted); font-size: 0.88rem; margin: 8px 0 0; }

/* ---- Ear Training ---- */
.et-controls { display: flex; gap: 18px 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.et-field { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.seg.et-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.seg.et-seg button { background: transparent; border: 0; color: var(--muted); padding: 7px 15px; font: inherit; font-weight: 650; font-size: 0.85rem; cursor: pointer; transition: color 0.12s ease, background 0.12s ease; }
.seg.et-seg button:hover { color: var(--text); }
.seg.et-seg button.active { background: var(--accent-grad); color: #081018; }
#et-dir-wrap[hidden] { display: none; }

.et-stage { text-align: center; padding: 22px 0 6px; }
.et-play { font-size: 1.05rem; padding: 14px 34px; }
.et-feedback { min-height: 1.4em; margin: 16px 0 4px; font-weight: 650; }
.et-feedback.good { color: var(--good); }
.et-feedback.bad { color: #fb7185; }
.et-answers { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px auto 0; max-width: 560px; }
.et-answer {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 650; cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.et-answer:hover:not(:disabled) { border-color: var(--accent-1); }
.et-answer:disabled { cursor: default; opacity: 0.9; }
.et-answer.correct { background: rgba(52, 211, 153, 0.18); border-color: var(--good); color: var(--good); }
.et-answer.wrong { background: rgba(251, 113, 133, 0.16); border-color: #fb7185; color: #fb7185; }
.et-next { margin-top: 18px; }

.et-score { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.et-stat { display: flex; flex-direction: column; align-items: center; min-width: 74px; }
.et-num { font-family: var(--mono); font-weight: 800; font-size: 1.5rem; }
.et-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-top: 2px; }

/* ---- Timing Test ---- */
.tt-controls { display: flex; gap: 16px 20px; align-items: flex-end; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.tt-field { display: flex; flex-direction: column; gap: 6px; }
.tt-field .control-label { text-align: left; }

.tt-pad {
  display: flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; min-height: 168px; margin: 4px 0 6px;
  background: var(--surface-2); border: 2px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); font: inherit; font-weight: 650; font-size: 1.05rem; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.08s ease, border-color 0.08s ease, transform 0.05s ease;
}
.tt-pad:hover { border-color: var(--accent-1); color: var(--text); }
.tt-pad:focus-visible { outline: none; border-color: var(--accent-2); color: var(--text); }
.tt-pad.disabled { cursor: default; opacity: 0.75; }
.tt-pad.pulse { border-color: var(--accent-2); }
.tt-pad.flash { background: var(--accent-grad); color: #081018; border-style: solid; border-color: transparent; transform: scale(0.99); }
.tt-pad-label { pointer-events: none; padding: 0 16px; }
.tt-status { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 0.92rem; min-height: 1.2em; margin: 2px 0 0; }

.tt-results { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.tt-scorecard { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; justify-content: center; }
.tt-scorebox { display: flex; flex-direction: column; align-items: center; min-width: 132px; }
.tt-score { font-family: var(--mono); font-weight: 800; font-size: 3.4rem; line-height: 1; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tt-score-cap { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 4px; }
.tt-metrics { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.tt-metric { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.tt-metric:last-child { border-bottom: 0; }
.tt-metric-k { font-size: 0.82rem; color: var(--muted); }
.tt-metric-v, .tt-tier, .tt-drift { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; }
.tt-tier.great, .tt-drift.great { color: var(--good); }
.tt-tier.good { color: var(--accent-2); }
.tt-tier.ok, .tt-drift.ok { color: var(--warn); }
.tt-tier.bad { color: #fb7185; }

.tt-viz { overflow-x: auto; margin: 20px 0 8px; -webkit-overflow-scrolling: touch; }
.tt-svg { width: 100%; min-width: 440px; height: auto; display: block; }
.tt-zero { stroke: var(--text); stroke-width: 1.4; stroke-dasharray: 5 4; opacity: 0.65; }
.tt-zerolabel { fill: var(--muted); font-family: var(--mono); font-size: 12px; }
.tt-axislabel { fill: var(--muted); font-size: 12px; }
.tt-tick { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.tt-trend { stroke: var(--accent-1); stroke-width: 2; opacity: 0.9; }
.tt-dot { stroke: #0b0e14; stroke-width: 1; }
.tt-dot.great { fill: var(--good); }
.tt-dot.ok { fill: var(--warn); }
.tt-dot.bad { fill: #fb7185; }
.tt-detail { text-align: center; color: var(--muted); font-size: 0.95rem; max-width: 620px; margin: 10px auto 0; line-height: 1.55; }
.tt-detail b { color: var(--text); }
.tt-result-actions { display: flex; justify-content: center; margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Fruit Rhythms (kids) ---- */
.fr-modebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.fr-modes.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.fr-modes.seg button {
  background: transparent; border: 0; color: var(--muted); padding: 8px 14px;
  font: inherit; font-weight: 650; font-size: 0.88rem; cursor: pointer; white-space: nowrap;
  transition: color 0.12s ease, background 0.12s ease;
}
.fr-modes.seg button:hover { color: var(--text); }
.fr-modes.seg button.active { background: var(--accent-grad); color: #081018; }
.fr-fullbtn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 650; font-size: 0.85rem;
  cursor: pointer; white-space: nowrap; transition: color 0.12s ease, border-color 0.12s ease;
}
.fr-fullbtn:hover { color: var(--text); border-color: var(--accent-1); }

/* phones: the pill can't fit three labels side by side — go full-width 3-up
   and drop the secondary words, or "Build" gets clipped out of reach */
@media (max-width: 560px) {
  .fr-modebar { flex-direction: column; align-items: stretch; gap: 8px; }
  .fr-modes.seg { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .fr-modes.seg button { padding: 9px 2px; font-size: 0.76rem; }
  .fr-mode-long { display: none; }
  .fr-fullbtn { width: 100%; }
}

/* bouncing ball lane */
.fr-lane { margin: 0 0 8px; }
.fr-lane-svg { width: 100%; height: auto; display: block; }
.fr-ground { stroke: var(--border); stroke-width: 2; }
.fr-barline { stroke: var(--border); stroke-width: 2; opacity: 0.7; }
.fr-onset { fill: var(--muted); opacity: 0.75; }
.fr-ball { fill: var(--accent-2); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent-2) 60%, transparent)); opacity: 0; }

/* build mode */
.fr-build { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.fr-build-hint { text-align: center; color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }
.fr-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.fr-pal {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 4px; cursor: pointer; color: var(--text); font: inherit;
  transition: border-color 0.12s ease, transform 0.08s ease, background 0.12s ease;
}
.fr-pal:hover { border-color: var(--accent-1); }
.fr-pal.playing { border-color: var(--accent-2); background: #17324a; transform: scale(1.06); }
.fr-pal .fr-emoji { font-size: 26px; }
.fr-pal .fr-word { font-size: 0.6rem; }
.fr-beat.sel { border-color: var(--accent-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 35%, transparent); }
.fr-beat.changed { animation: fr-pop 0.6s ease; }
@keyframes fr-pop {
  0% { border-color: var(--accent-1); transform: scale(1.1); }
  100% { border-color: var(--border); transform: scale(1); }
}
button.fr-beat { font: inherit; cursor: pointer; }

/* fullscreen: fill the screen, blow the bar up for small hands */
.tool-panel.is-full {
  display: flex; flex-direction: column; justify-content: center;
  width: 100vw; height: 100vh; border-radius: 0; border: 0;
  background: var(--bg); padding: 3vh 4vw; overflow-y: auto;
}
.tool-panel.is-full .fr-emoji { font-size: clamp(40px, 9vw, 96px); }
.tool-panel.is-full .fr-word { font-size: clamp(0.8rem, 1.7vw, 1.2rem); }
.tool-panel.is-full .fr-glyph { width: clamp(44px, 6vw, 84px); }
.tool-panel.is-full .fr-phase { font-size: clamp(1.4rem, 4vw, 2.4rem); }
.tool-panel.is-full .fr-pal .fr-emoji { font-size: clamp(26px, 3vw, 40px); }

.fr-phase {
  text-align: center; font-weight: 750; color: var(--muted);
  font-size: clamp(1rem, 3.2vw, 1.45rem); min-height: 1.7em; margin: 0 0 14px;
  transition: color 0.15s ease;
}
.fr-phase.countin { color: var(--warn); font-family: var(--mono); }
.fr-phase.listen { color: var(--accent-2); }
.fr-phase.turn { color: var(--good); }

.fr-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(5px, 1.5vw, 12px); }
.fr-beat {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: clamp(4px, 1vw, 8px); padding: clamp(8px, 1.6vw, 16px) 4px;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.fr-beat.playing { border-color: var(--accent-2); background: #17324a; transform: scale(1.05); }
.fr-glyph { width: clamp(32px, 9vw, 56px); height: auto; filter: brightness(0) invert(1); opacity: 0.85; }
.fr-emoji { font-size: clamp(28px, 8vw, 52px); line-height: 1.1; }
.fr-word {
  font-size: clamp(0.72rem, 2.6vw, 0.85rem); font-weight: 700; color: var(--muted);
  text-align: center; line-height: 1.2; word-break: break-word;
}
.fr-beat.playing .fr-word { color: var(--text); }

.fr-controls { display: flex; gap: 14px 18px; align-items: flex-end; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.fr-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fr-field .control-label { text-align: left; }
.fr-play.is-playing { background: var(--surface-2); color: var(--text); box-shadow: none; }
/* on phones the wrapped flex row goes ragged — lay the controls out as a tidy 2-up grid */
@media (max-width: 560px) {
  .fr-controls { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 12px 10px; }
  .fr-controls > .btn { width: 100%; }
  .fr-field select { width: 100%; }
  .fr-controls .rt-toggle { justify-content: center; }
}

.fr-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.fr-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 8px 10px; font: inherit; cursor: pointer; color: var(--text);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.fr-card:hover { border-color: var(--accent-1); }
.fr-card.playing { border-color: var(--accent-2); background: #17324a; transform: scale(1.04); }
.fr-card .fr-word { font-size: 0.85rem; }
.fr-rhythm-name { font-size: 0.66rem; color: var(--muted); text-align: center; line-height: 1.25; }

/* ---- Programmatic scale pages ---- */
.sc-panel { text-align: center; }
.sc-piano { overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.sc-piano-svg { width: 100%; max-width: 340px; min-width: 240px; height: auto; display: block; margin: 0 auto; }
.sc-w { fill: #e9edf5; stroke: #0b0e14; stroke-width: 1.2; }
.sc-b { fill: #161c2b; stroke: #0b0e14; stroke-width: 1.2; }
.sc-w.inx { fill: var(--accent-2); }
.sc-b.inx { fill: color-mix(in srgb, var(--accent-2) 78%, #0b0e14); }
.sc-w.root, .sc-b.root { fill: var(--accent-1); }
.sc-notes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.sc-note {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; min-width: 46px;
}
.sc-note.root { border-color: var(--accent-1); }
.sc-note-n { font-family: var(--mono); font-weight: 800; font-size: 1.25rem; }
.sc-note-d { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.sc-formula { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 0.95rem; margin: 6px 0 0; }
.sc-formula b { color: var(--text); }
/* scales hub */
.sc-hub-group { margin-top: 8px; }
.sc-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0 20px; }
.sc-hub-grid a {
  display: block; text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 8px; color: var(--text); font-weight: 650;
  transition: border-color 0.12s ease, transform 0.1s ease;
}
.sc-hub-grid a:hover { border-color: var(--accent-1); transform: translateY(-2px); text-decoration: none; }

/* ---- Support form ---- */
.sup-form { display: flex; flex-direction: column; gap: 16px; }
.sup-row { display: flex; flex-direction: column; gap: 6px; }
.sup-row label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.sup-row .hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.sup-form input[type="text"], .sup-form input[type="email"], .sup-form select, .sup-form textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font: inherit; font-size: 1rem;
}
.sup-form textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.sup-form input:focus, .sup-form select:focus, .sup-form textarea:focus {
  outline: none; border-color: var(--accent-2);
}
.sup-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sup-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sup-status { margin: 0; font-size: 0.92rem; color: var(--muted); min-height: 1.4em; }
.sup-status.ok { color: var(--good); }
.sup-status.bad { color: #fb7185; }
.sup-mail {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px; margin: 20px 0;
}
.sup-mail b { font-size: 1.05rem; }
.sup-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 20px 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
