:root {
  --bg: #eef1f5;
  --dots: #c6cedb;
  --surface: #ffffff;
  --raised: #f6f8fb;
  --sunken: #e7ebf1;
  --line: #dde2ea;
  --line-strong: #c3cad6;
  --text: #16202e;
  --soft: #4f5a6b;
  --faint: #8a93a3;
  --accent: #12a594;
  --accent-strong: #0b7f72;
  --accent-soft: #dcf4f0;
  --active: #b9efe5;
  --warn: #d9452a;
  --warn-soft: #fbe6e1;
  --dark: #1d2230;
  --dark-ink: #ffffff;
  --dark-hover: #2a3043;
  --lock: #3d7cc9;
  --lock-soft: #eef5fd;
  --c-on: #d32f2f;
  --c-nu: #1f5bd6;
  --c-co: #1b7f45;
  --c-gl: #a85600;
  --stripe: linear-gradient(90deg, #12a594, #6ac8f0 45%, #a78bfa 75%, #f59e8b);
  --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 8px 24px rgba(22, 32, 46, .08);
  --radius: 9px;
  --font: 'Atkinson Hyperlegible Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Schibsted Grotesk', 'Atkinson Hyperlegible Next', sans-serif;
  --ts: 1;
  --unit: 84px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--dots) 1px, transparent 1.4px);
  background-size: 18px 18px;
  min-height: 100vh; padding-bottom: 40px;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { display: block; }

/* ---------- header ---------- */
.head { text-align: center; padding: 14px 16px 6px; }
.title { display: inline-flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; color: var(--dark); }
h1 { margin: 0; font: 700 26px/1 var(--display); letter-spacing: -.01em; }
.subtitle { margin: 6px 0 0; font: 700 11.5px/1 var(--font); letter-spacing: .24em; text-transform: uppercase; color: var(--accent-strong); }

/* ---------- toolbars ---------- */
.toolbars { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); padding: 8px 16px 0; }
.tb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 1280px; margin: 0 auto; padding: 4px 0; }
.tb.second { padding-bottom: 8px; }
.grow { flex: 1; }
.tbtn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  font-weight: 600; font-size: 13.5px; box-shadow: 0 1px 2px rgba(22, 32, 46, .05); white-space: nowrap;
}
.tbtn svg { width: 17px; height: 17px; }
.tbtn:hover { background: var(--raised); }
.tbtn.icon { width: 40px; padding: 0; justify-content: center; }
.tbtn.primary { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); padding: 0 14px; }
.tbtn.primary:hover { background: var(--dark-hover); }
.tbtn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.tbtn[aria-expanded="true"] { background: var(--sunken); border-color: var(--soft); }
.tbtn .dd { width: 0; height: 0; border: 4px solid transparent; border-top: 5px solid var(--faint); border-bottom: 0; margin-left: 2px; }
.tbtn.focus { font: 700 15px/1 var(--tile, var(--display)); padding-left: 5px; gap: 9px; }
.fnum { font: 700 12px/1 var(--font); background: var(--accent-soft); color: var(--accent-strong); border-radius: 6px; padding: 6px 7px; }
.tempo { display: inline-flex; align-items: center; height: 36px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding-left: 10px; overflow: hidden; }
.tempo .note { font-weight: 600; color: var(--soft); white-space: nowrap; }
.tempo input { width: 3em; border: 0; background: transparent; font: 700 15px/1 var(--font); text-align: center; color: var(--text); -moz-appearance: textfield; }
.tempo input::-webkit-inner-spin-button, .tempo input::-webkit-outer-spin-button { -webkit-appearance: none; }
.tempo button { width: 30px; height: 100%; border: 0; border-left: 1px solid var(--line); background: var(--raised); font-weight: 700; font-size: 16px; }
.tempo button:hover { background: var(--sunken); }
.stepper { display: inline-flex; align-items: center; height: 36px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.stepper button { width: 32px; height: 100%; border: 0; background: transparent; font-weight: 700; font-size: 16px; color: var(--soft); }
.stepper button:hover { background: var(--raised); }
.sval { padding: 0 6px; font-size: 12.5px; color: var(--faint); font-weight: 600; white-space: nowrap; }
.sval b { color: var(--text); font-size: 14px; }
.pos { display: inline-flex; gap: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--faint); white-space: nowrap; }
.pos b { color: var(--text); font-size: 14px; margin-left: 3px; letter-spacing: 0; }
.pos.counting b { color: var(--accent-strong); }
.auto { display: inline-flex; gap: 6px; }
.auto span:empty { display: none; }
.auto span { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 5px 9px; white-space: nowrap; }
.auto b { font-size: 12.5px; margin-left: 3px; }
.stripe { height: 3px; margin: 0 -16px; background: var(--stripe); opacity: .85; }

/* ---------- main ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 14px 16px 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.infoline { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; }
.badge { flex: none; font: 700 12px/1 var(--font); color: var(--soft); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 7px; }
.cue { margin: 0; font-weight: 600; font-size: calc(15px * var(--ts)); line-height: 1.3; }
.cue.check { color: var(--accent-strong); }
.cue.check::before { content: 'Listen'; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--accent-soft); border-radius: 999px; padding: 3px 8px; margin-right: 8px; vertical-align: 1px; }
.excerpt { margin: -4px 0 10px; font-size: 13px; color: var(--soft); }
.excerpt b { color: var(--text); }
.msg { min-height: 1.4em; margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--warn); }
.tip { display: flex; gap: 10px; align-items: baseline; margin: 2px 0 0; color: var(--soft); max-width: 80ch; }
.tiplbl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }

/* ---------- score ---------- */
.scorewrap { display: flex; gap: 14px; align-items: flex-start; }
.score { flex: 1; min-width: 0; font-size: calc(23px * var(--ts)); border-top: 3px solid var(--accent); padding: 6px 0; }
.side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 18px; font-weight: 700; color: var(--soft); }
.round { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--dark); color: var(--dark-ink); display: grid; place-items: center; box-shadow: var(--shadow); }
.round svg { width: 18px; height: 18px; }
.round.ghost { background: transparent; color: var(--faint); border: 1.5px solid var(--line-strong); box-shadow: none; }
.round:disabled { opacity: .35; cursor: default; }
.row { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.rnum { font-size: .66em; font-weight: 700; color: var(--faint); padding: 1.35em 0 0 .9em; display: flex; flex-direction: column; gap: .4em; }
.rnum small { font-size: .82em; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .06em; }
.track { overflow-x: auto; overflow-y: hidden; padding: .75em .8em .85em .2em; scrollbar-width: thin; }
.strip { display: flex; align-items: stretch; gap: 0; position: relative; width: max-content; min-width: 100%; }
.ticks { display: none; }
.group { display: flex; flex-direction: column; flex: 0 0 auto; }
.wlabel { font-size: .68em; font-weight: 700; color: var(--soft); padding: 0 .4em .35em; margin: 0 .2em .35em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 2px solid var(--line-strong); }
.wlabel.unres { color: var(--warn); border-bottom: 2px dashed var(--warn); }
.gtiles { display: flex; }
.tile {
  --p: 0;
  position: relative; flex: 0 0 auto; width: calc(var(--d) * var(--unit) - .3em); margin: 0 .15em; min-height: 4.7em;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .2em;
  padding: .5em .6em .55em; text-align: left;
  background: var(--tile-bg, var(--raised)); border: 1px solid var(--tile-line, var(--line)); border-radius: 7px; color: var(--tile-text, var(--text));
  font-family: var(--tile, var(--display)); line-height: 1; overflow: hidden; transition: background-color .08s, border-color .08s;
}
.tile:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--tile-text, var(--text)) 3%, var(--tile-bg, var(--surface))); }
.tile .main { display: flex; align-items: baseline; gap: .14em; white-space: nowrap; }
.tile .on, .tile .co { font-size: 1.4em; font-weight: 500; color: var(--tile-soft, var(--soft)); }
.tile .nu { font-size: 2em; font-weight: 700; color: var(--tile-text, var(--text)); }
.tile .lbl { font-size: 1.7em; font-weight: 700; }
.tile .gl { font-family: var(--font); font-weight: 600; font-size: .45em; color: var(--accent); margin: 0 .15em; vertical-align: .4em; }
.tile .gl2 { font-size: .7em; font-weight: 600; color: var(--soft); }
.tile .dot { color: var(--line-strong); font-size: 1em; font-weight: 400; }
.tile.e-on .on, .tile.e-co .co { color: var(--tile-text, var(--text)); font-size: 2em; font-weight: 700; box-shadow: inset 0 -.12em 0 var(--accent); }
.tile.e-on .nu, .tile.e-co .nu { font-size: 1.4em; font-weight: 500; color: var(--tile-soft, var(--soft)); }
.tile.e-all .on, .tile.e-all .co, .tile.e-word .on, .tile.e-word .co { color: var(--tile-text, var(--text)); }
.tile .sub { font-family: var(--font); font-size: .66em; font-weight: 500; color: var(--faint); white-space: nowrap; }
.tile .sub b { color: var(--tile-text, var(--text)); font-weight: 700; }
.tile .top { position: absolute; top: .35em; left: .55em; font-family: var(--font); font-size: .56em; font-weight: 700; color: var(--accent-strong); letter-spacing: .04em; }
.tile .stress { font-family: var(--font); font-size: 1.1em; font-weight: 800; color: var(--accent); margin-right: .05em; }
.tile .marks { position: absolute; top: .35em; right: .45em; display: flex; gap: .3em; font-family: var(--font); font-size: .58em; font-weight: 700; color: var(--soft); }
.tile .lock svg { width: 1.1em; height: 1.1em; }
.tile .link { position: absolute; right: -.1em; bottom: .25em; z-index: 2; font: 700 1.2em/1 var(--font); color: var(--accent); }
.tile .prog { position: absolute; left: 0; bottom: 0; height: .26em; width: calc(var(--p) * 100%); background: var(--accent); border-radius: 0 3px 3px 0; }
.tile.held .sustain { position: absolute; left: .6em; right: .6em; bottom: .75em; border-bottom: 2px solid var(--line-strong); border-radius: 2px; }
.tile.short::after { content: ''; position: absolute; right: .6em; bottom: .65em; width: .38em; height: .38em; border-radius: 50%; background: var(--text); }
.tile.rest { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--text) 7%, transparent) 6px 8px), var(--sunken); border-style: dashed; align-items: center; }
.tile.rest .lbl { font-family: var(--font); font-size: .7em; font-weight: 700; letter-spacing: .12em; color: var(--faint); }
.tile.locked { border-color: var(--lock); box-shadow: inset 0 0 0 1px var(--lock); background: var(--lock-soft); }
.tile.unresolved { background: var(--warn-soft); border-color: var(--warn); }
.tile.unresolved .lbl { color: var(--warn); }
.tile.next { border-color: var(--accent); }
.tile.active { background: var(--active); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile.active .prog { background: var(--accent-strong); }
.tile.active.rest { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--accent) 25%, transparent) 6px 8px), var(--accent-soft); }
.tile.selecting { outline: 2px dashed var(--accent); outline-offset: -4px; }
.tile.inloop { background: color-mix(in srgb, #f2cf6b 22%, var(--surface)); border-color: #f2cf6b; }
.tile.outloop { opacity: .35; }
.tile.own::before { content: 'your melody'; position: absolute; bottom: .4em; right: .55em; font-family: var(--font); font-size: .5em; font-weight: 600; color: var(--faint); }

/* the IPA symbol sits in the tile's top corner, so rows of eight or more still fit across */
.tile .ipa {
  position: absolute; top: .3em; right: .3em; padding: .1em .3em; border-radius: .35em; border: 1px dashed transparent;
  font-family: 'Noto Sans', 'Segoe UI', 'Lucida Grande', 'Arial Unicode MS', sans-serif; font-size: .7em; font-weight: 500; line-height: 1.1;
  color: var(--tile-soft, var(--soft)); cursor: pointer; white-space: nowrap;
}
.tile .ipa:hover { background: color-mix(in srgb, var(--tile-text, var(--text)) 8%, transparent); }
.tile .ipa.off { color: transparent; border-color: color-mix(in srgb, var(--tile-text, var(--text)) 22%, transparent); }
.tile .ipa.off:hover { border-color: var(--accent); background: var(--accent-soft); }
.v-cons .tile .ipa, .v-words .tile .ipa { display: none; }
.tile:has(.marks) .ipa { top: auto; bottom: .5em; }
.tile:has(.ipa) { padding-top: 1.2em; }

/* sound views */
.v-vowels .tile:not(.rest) .on, .v-vowels .tile:not(.rest) .co, .v-vowels .tile .dot { opacity: .12; }
.v-cons .tile:not(.rest) .nu { opacity: .12; }
.v-cons .tile .on, .v-cons .tile .co { color: var(--text); }
.v-diph .tile:not(.diph):not(.rest) .main { opacity: .14; }
.v-words .tile .main { display: none; }
.v-words .tile .sub { font-family: var(--display); font-size: 1.7em; font-weight: 700; color: var(--text); }
.v-words .wlabel { visibility: hidden; }
.empty { padding: 2.2em 1.4em; font-size: 14px; color: var(--soft); }

/* ---------- loop ---------- */
.loopbar { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; margin-bottom: 10px; background: color-mix(in srgb, #f2cf6b 22%, var(--surface)); border: 1px solid #f2cf6b; border-radius: 8px; font-weight: 600; }

/* ---------- lyrics ---------- */
.lyrics { padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 10px; }
.ly-entry summary { cursor: pointer; display: flex; align-items: baseline; gap: 10px; list-style: none; }
.ly-entry summary::-webkit-details-marker { display: none; }
.ly-entry summary::before { content: ''; width: 0; height: 0; border: 5px solid transparent; border-left: 6px solid var(--soft); border-right: 0; align-self: center; transition: transform .12s; }
.ly-entry[open] summary::before { transform: rotate(90deg); }
.ly-entry[open] summary { margin-bottom: 8px; }
.ly-sum { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ly-entry[open] .ly-sum { display: none; }
.lbl { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
textarea { width: 100%; font: 15px/1.5 var(--font); border: 1px solid var(--line-strong); background: var(--raised); padding: 9px 11px; resize: vertical; border-radius: 8px; color: var(--text); }
.ly-row, .ly-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ly-row { margin-top: 8px; }
.ly-err { color: var(--warn); font-size: 13px; font-weight: 500; }
.private { font-size: 12px; color: var(--faint); margin-left: auto; }
.ly-pos { font-size: 12.5px; font-weight: 600; color: var(--soft); min-width: 8.5em; text-align: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; font-weight: 600; font-size: 13px; }
.btn:hover { background: var(--raised); }
.btn.ink { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.btn.ink:hover { background: var(--dark-hover); }
.btn:disabled { opacity: .4; cursor: default; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 9px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 0 10px; height: 28px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }

/* ---------- menus ---------- */
.layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.pop {
  position: absolute; pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 2px 6px rgba(22, 32, 46, .08), 0 18px 40px rgba(22, 32, 46, .16); width: 290px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 40px); overflow: auto; padding: 0 0 10px; font-size: 14px;
}
.pop::before { content: ''; display: block; height: 3px; margin-bottom: 8px; background: var(--accent); }
.pop.wide { width: 360px; }
.pop h3 { margin: 6px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pop h3 button { border: 0; background: none; font-size: 13px; font-weight: 700; padding: 4px 0; color: var(--accent-strong); text-transform: none; letter-spacing: 0; }
.frow {
  display: grid; grid-template-columns: 1fr auto 10px; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 3px 8px;
  padding: 0 12px; height: 46px; border: 1px solid var(--line); background: var(--surface); text-align: left; border-radius: 9px;
}
.frow:hover { background: var(--raised); }
.frow.open { background: var(--sunken); border-color: var(--line-strong); }
.frow .fl { font-weight: 600; font-size: 14px; display: flex; gap: 9px; align-items: center; }
.frow .fl .n { font-size: 11px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); border-radius: 5px; padding: 3px 5px; }
.frow .fv { font-size: 12.5px; color: var(--faint); max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.frow .chev { width: 7px; height: 7px; border-right: 2px solid var(--faint); border-top: 2px solid var(--faint); transform: rotate(45deg); }
.frow.cur { border-color: var(--accent); background: var(--accent-soft); }
.field { padding: 8px 14px; display: grid; gap: 6px; }
.field > .fh { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); }
.field .note { font-size: 12.5px; color: var(--faint); line-height: 1.4; }
.field input[type=text], .field input[type=number], .field select {
  width: 100%; font: 500 14px/1.2 var(--font); padding: 0 10px; height: 36px; border: 1px solid var(--line-strong); background: var(--raised); border-radius: 8px; color: var(--text);
}
.field input[type=number] { width: 6.5em; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); font: 600 13px/1 var(--display); height: 30px; padding: 0 8px; min-width: 2.5em; border-radius: 7px; }
.chip:hover { background: var(--raised); }
.chip[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.chip .w { font-size: 10px; color: var(--accent); margin-left: 2px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 16px); margin: 0 8px; padding: 9px 6px; background: none; border: 0; text-align: left; font-weight: 600; }
.toggle .sw { width: 36px; height: 21px; border-radius: 999px; position: relative; flex: none; background: var(--line-strong); transition: background .12s; }
.toggle .sw::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .12s; }
.toggle[aria-pressed="true"] .sw { background: var(--accent); }
.toggle[aria-pressed="true"] .sw::after { left: 17.5px; }
.toggle small { display: block; font-weight: 400; color: var(--faint); font-size: 12px; margin-top: 1px; }
.radio { display: grid; gap: 2px; padding: 0 8px; }
.radio > button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 0 8px; min-height: 38px; border-radius: 8px; font-weight: 500; }
.radio > button:hover { background: var(--raised); }
.radio > button::before { content: ''; width: 15px; height: 15px; border: 1.5px solid var(--line-strong); border-radius: 50%; flex: none; background: var(--surface); box-sizing: border-box; }
.radio > button[aria-pressed="true"] { font-weight: 600; }
.radio > button[aria-pressed="true"]::before { border: 5px solid var(--accent); }
.radio .field { padding: 2px 8px 8px 33px; }
.foot { padding: 10px 14px 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.links { list-style: none; margin: 0; padding: 0 8px; display: grid; gap: 4px; }
.links a { display: block; padding: 9px 12px; color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 9px; }
.links a:hover { background: var(--raised); }
.links a b { display: block; font-size: 14px; font-weight: 600; }
.links a span { font-size: 12px; color: var(--faint); }
.disclaim { margin: 10px 14px 4px; font-size: 12.5px; color: var(--soft); line-height: 1.45; }
.credits { padding: 4px 14px 8px; font-size: 12px; color: var(--faint); line-height: 1.45; }
.credits a { color: var(--soft); }

/* sound pools: active pool + library folders, drag and drop */
.pool-head { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 14px 6px; }
.pool-head .fh { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); }
.pcount { font-size: 12px; color: var(--faint); }
.pool-zone {
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; min-height: 52px; margin: 0 12px; padding: 8px;
  border: 1.5px dashed var(--line-strong); border-radius: 10px; background: var(--raised); transition: border-color .1s, background-color .1s;
}
.pool-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.pool-zone .drop-hint { display: none; align-self: center; font-size: 12px; color: var(--faint); padding: 0 4px; }
.pool-zone.over .drop-hint, .pool-zone:not(:has(.pchip)) .drop-hint { display: inline; }
.pchip {
  display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 2px 0 4px; border-radius: 8px;
  background: var(--dark); color: var(--dark-ink); font: 600 13.5px/1 var(--display); cursor: grab; user-select: none; touch-action: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12); position: relative;
}
.pchip b { font-weight: 700; padding: 0 3px; }
.pchip .grip { width: 6px; height: 14px; margin-right: 2px; opacity: .5; background: radial-gradient(circle, currentColor 1px, transparent 1.3px) 0 0 / 3px 3.5px; }
.pchip .wt, .pchip .x { border: 0; background: transparent; color: inherit; height: 26px; min-width: 22px; padding: 0 3px; border-radius: 6px; font: 600 11px/1 var(--font); opacity: .55; }
.pchip .x { font-size: 16px; }
.pchip.heavy .wt { opacity: 1; color: var(--accent); }
@media (hover: hover) { .pchip:not(.heavy) .wt { opacity: 0; } .pchip:not(.heavy):hover .wt, .pchip:not(.heavy):focus-within .wt { opacity: .55; } }
.pchip .wt:hover, .pchip .x:hover { opacity: 1; background: color-mix(in srgb, var(--dark-ink) 16%, transparent); }
.pchip.dragging { opacity: .35; }
.pchip.ins::before, .pool-zone.ins-end::after { content: ''; width: 3px; height: 30px; border-radius: 2px; background: var(--accent); }
.pchip.ins::before { position: absolute; left: -5px; top: 1px; }
.pool-zone.ins-end::after { align-self: center; }
.library { margin: 8px 8px 4px; display: grid; gap: 4px; }
.pop.removing .library { outline: 2px dashed var(--warn); outline-offset: 2px; border-radius: 10px; }
.folder { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.folder summary { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 40px; cursor: pointer; list-style: none; font-weight: 600; }
.folder summary::-webkit-details-marker { display: none; }
.folder summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-top: 2px solid var(--faint); transform: rotate(45deg); transition: transform .12s; margin: 0 2px 0 -2px; }
.folder[open] summary::before { transform: rotate(135deg); }
.folder[open] summary { border-bottom: 1px solid var(--line); }
.folder .ft { flex: 1; }
.folder .fc { font-size: 12px; color: var(--faint); font-weight: 500; }
.folder .fnote { padding: 8px 12px 0; font-size: 12px; color: var(--faint); }
.folder .field { padding: 8px 10px; }
.fgroup { padding: 6px 10px 2px; }
.fgroup .gl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 5px; }
.lchips { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px 10px; }
.fgroup .lchips { padding: 0 0 6px; }
.lchip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 600 13px/1 var(--display); height: 32px; min-width: 2.6em; padding: 0 9px; border-radius: 8px; cursor: grab; user-select: none; touch-action: pan-y; }
.lchip:hover { background: var(--raised); border-color: var(--soft); }
.lchip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.lchip[aria-pressed="true"]::after { content: ' ✓'; font-size: 11px; }
.lchip.dragging { opacity: .4; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; margin: -18px 0 0 -14px; padding: 0 12px; height: 34px; display: grid; place-items: center;
  background: var(--dark); color: var(--dark-ink); border-radius: 8px; font: 700 14px/1 var(--display); box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
}

/* settings drawer */
.pop.drawer { position: fixed; top: 0 !important; right: 0; left: auto !important; bottom: 0; width: 380px; max-height: none; border-radius: 0; border-width: 0 0 0 1px; }
.pop.drawer::before { display: none; }
.dhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.dhead b { font: 700 18px/1 var(--display); }
.dhead button { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--faint); width: 32px; height: 32px; border-radius: 8px; }
.dhead button:hover { background: var(--raised); }
.tabs { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tabs button { border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--soft); }
.tabs button[aria-pressed="true"] { background: var(--sunken); color: var(--text); }

/* theme swatches (top-left corner, as in Groove Builder) */
.corner-tools { position: fixed; top: 10px; left: 10px; z-index: 30; }
.theme-switcher { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 5px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.theme-row { display: flex; align-items: center; gap: 5px; }
.theme-swatch { position: relative; overflow: hidden; width: 18px; height: 18px; padding: 0; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .18); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .1s; }
.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch.active { outline: 2px solid var(--text); outline-offset: 2px; }
.theme-swatch.colored::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(to right, var(--c-on) 0 25%, var(--c-nu) 25% 50%, var(--c-co) 50% 75%, var(--c-gl) 75%); }
.theme-more { width: 16px; height: 18px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 9px; line-height: 1; }
.theme-more[aria-expanded="true"] { background: var(--dark); border-color: var(--dark); color: var(--dark-ink); }
@media (max-width: 1240px) { .corner-tools { position: static; width: fit-content; margin: 8px auto 0; } }
@media (max-width: 760px) { .corner-tools { display: none; } }
.phone .corner-tools { display: none; }

/* settings › colours */
.hint { margin: -2px 14px 8px; font-size: 12.5px; color: var(--faint); line-height: 1.4; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent-strong); font: inherit; font-weight: 600; text-decoration: underline; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 14px 10px; }
.theme-card { display: grid; justify-items: start; gap: 5px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; color: var(--text); }
.theme-card:hover { border-color: var(--line-strong); background: var(--raised); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card .tsw { width: 100%; height: 30px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .15); }
.theme-card .tname { font-size: 12px; font-weight: 600; line-height: 1.15; }
.theme-card small { font-size: 10.5px; color: var(--faint); margin-top: -3px; }
.part-preview { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 2px 14px 10px; font-size: 12px; color: var(--soft); }
.part-preview .pp { display: inline-flex; align-items: baseline; gap: 5px; }
.part-preview b { font: 700 16px/1 var(--display); color: var(--text); }
:root[data-colored] .pp-on b { color: var(--c-on); }
:root[data-colored] .pp-nu b { color: var(--c-nu); }
:root[data-colored] .pp-co b { color: var(--c-co); }
:root[data-colored] .pp-gl b { color: var(--c-gl); }
.palette-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px 14px 10px; }
.palette-option { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 600; text-align: left; }
.palette-option.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.palette-dots { display: inline-flex; }
.palette-dots i { width: 12px; height: 12px; border-radius: 50%; margin-right: -3px; border: 1.5px solid var(--surface); }
.custom-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 2px 14px 8px; }
.custom-colors label { display: grid; justify-items: center; gap: 4px; font-size: 11px; color: var(--soft); text-align: center; cursor: pointer; }
.custom-colors input { width: 40px; height: 32px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: none; cursor: pointer; }
.custom-colors label.custom input { box-shadow: 0 0 0 2px var(--accent); }

/* coloured sounds */
:root[data-colored] .tile .on { color: var(--c-on); }
:root[data-colored] .tile .nu { color: var(--c-nu); }
:root[data-colored] .tile .co { color: var(--c-co); }
:root[data-colored] .tile .gl, :root[data-colored] .tile .gl2, :root[data-colored] .tile .stress { color: var(--c-gl); }
:root[data-colored] .tile.e-on .nu, :root[data-colored] .tile.e-co .nu, :root[data-colored] .tile.e-nu .on, :root[data-colored] .tile.e-nu .co { opacity: .78; }

/* tile editor */
.pop.tileed { width: 320px; }
.tileed .durs { display: flex; gap: 4px; }
.tileed .durs button { border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; width: 40px; height: 34px; border-radius: 8px; }
.tileed .durs button[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.tileed .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 14px; }
.tileed .actions .btn { height: auto; min-height: 34px; padding: 6px 8px; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .head { padding: 10px 12px 2px; }
  h1 { font-size: 21px; }
  .logo { width: 24px; height: 24px; }
  .subtitle { font-size: 10px; }
  .toolbars { padding: 6px 10px 0; }
  .tb { gap: 6px; }
  .tbtn { padding: 0 10px; }
  .tbtn.primary span { display: none; }
  .tbtn.primary { width: 40px; padding: 0; justify-content: center; }
  #healthBtn span, #settingsBtn span, #customizeBtn span, #practiceBtn span { display: none; }
  #healthBtn, #settingsBtn, #customizeBtn, #practiceBtn { padding: 0 9px; }
  .tbtn.focus { flex: 1 1 auto; }
  .grow { display: none; }
  .pos { padding: 0 2px; gap: 6px; }
  main { padding: 12px 10px 0; }
  .side { display: none; }
  .row { grid-template-columns: 1.9em minmax(0, 1fr); }
  .rnum { padding-left: .6em; }
  .pop.drawer { width: 100%; }
  .private { margin-left: 0; }
}
@media (max-width: 520px) {
  .tempo .note { display: none; }
  .tempo { padding-left: 2px; }
  .tempo input { width: 2.6em; }
  .tbtn.icon { width: 36px; }
  .pos { font-size: 10px; }
  .pos b { font-size: 13px; }
  .tip { font-size: 13px; }
}

/* ---------- phone layout (html.phone, set by app.js) ---------- */
.head-actions { display: none; }
.thumb { display: none; }
.phone body { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
.phone .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 4px; text-align: left; }
.phone .title { gap: 8px; min-width: 0; }
.phone .logo { width: 26px; height: 26px; flex: none; }
.phone h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone .subtitle { display: none; }
.phone .head-actions { display: flex; gap: 3px; flex: none; }
.phone .head-actions .tbtn { width: 32px; height: 34px; padding: 0; justify-content: center; }
.phone .head-actions .corner-sep { height: 18px; margin: 0 1px; }
.phone .head-actions #droneBtn .cb { display: block; }
.phone .head-actions #droneBtn .cb:empty { display: none; }
.phone .head-actions .tbtn span, .phone .head-actions .tbtn .dd { display: none; }
.phone .toolbars { padding: 4px 12px 0; }
.phone .tb:first-child { display: none; }
.phone .tb.second { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 4px 0 8px; }
.phone .tbtn.focus { grid-column: 1 / -1; height: 44px; font-size: 17px; justify-content: flex-start; }
.phone .tbtn.focus .dd { margin-left: auto; margin-right: 6px; }
.phone #customizeBtn, .phone #practiceBtn { justify-content: center; height: 40px; padding: 0 8px; }
.phone #customizeBtn span, .phone #practiceBtn span { display: inline; }
.phone .tb.second .stepper { height: 40px; grid-column: 3; grid-row: 2; }
.phone #practiceBtn { grid-column: 2; grid-row: 2; }
.phone #customizeBtn { grid-column: 1; grid-row: 2; }
.phone .stripe { margin: 0 -12px; }
.phone main { padding: 10px 8px 0; }
.phone .infoline { margin: 0 4px 8px; }
.phone .badge { display: none; }
.phone .cue { font-size: calc(14px * var(--ts)); }
.phone .excerpt { margin: -2px 4px 8px; }
.phone .tip { margin: 0 4px; font-size: 13px; }
.phone .msg { margin: 8px 4px 0; }
.phone .side { display: none; }
.phone .row { grid-template-columns: 1.6em minmax(0, 1fr); }
.phone .rnum { padding-left: .5em; }
.phone .track { padding: .55em .5em .65em .1em; }
.phone .tile { min-height: 4.2em; padding: .45em .45em .5em; }
.phone .lyrics { padding: 10px; }
.phone .ly-nav .seg { width: 100%; justify-content: space-between; }
.phone .ly-nav .seg button { flex: 1; padding: 0 4px; font-size: 12px; }

.phone .thumb {
  display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 97%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(22, 32, 46, .08); padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
}
.thumb-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; padding: 0 2px 6px; }
.thumb-status .pos { padding: 0; }
.thumb-row { display: grid; grid-template-columns: 1.15fr 64px 48px 1.25fr; gap: 8px; align-items: center; }
.phone .thumb .tbtn { height: 52px; border-radius: 12px; justify-content: center; }
.phone .thumb #newBtn { width: auto; padding: 0 10px; font-size: 15px; }
.phone .thumb #newBtn span { display: inline; }
.phone .thumb #playBtn { width: 64px; height: 56px; border-radius: 16px; background: var(--accent); border-color: var(--accent); color: var(--dark-ink); }
.phone .thumb #playBtn.on { background: var(--accent-strong); border-color: var(--accent-strong); }
.phone .thumb #playBtn svg { width: 24px; height: 24px; }
.phone .thumb #restartBtn { width: 48px; }
.phone .thumb .tempo { height: 52px; border-radius: 12px; padding: 0; display: grid; grid-template-columns: 38px 1fr 38px; }
.phone .thumb .tempo .note { display: none; }
.phone .thumb .tempo input { width: 100%; font-size: 18px; order: 2; }
.phone .thumb .tempo #bpmDown { order: 1; border-left: 0; border-right: 1px solid var(--line); font-size: 20px; }
.phone .thumb .tempo #bpmUp { order: 3; font-size: 20px; }
.phone .pop.drawer { width: 100%; max-width: none; }
.phone .tile { padding: .45em .3em .5em; }
.phone .tile .dot { display: none; }
.phone .tile .main { gap: .08em; }
.phone .tile .top { left: .35em; }
.phone main { padding: 10px 6px 0; }
.phone .track { padding: .55em .25em .65em 0; }
.phone .row { grid-template-columns: 1.4em minmax(0, 1fr); }
.phone .rnum { padding-left: .35em; }
.phone .tile .sub, .phone .wlabel { font-size: max(.66em, 10px); }
.phone .tile .top, .phone .tile .marks { font-size: max(.56em, 9px); }
.phone .rnum { font-size: max(.66em, 10px); }
.phone .tile { min-height: max(4.2em, 52px); }
/* phones: the IPA symbol sits in the tile's corner so it never widens the row */
.phone .tile .ipa { position: absolute; top: .3em; right: .25em; margin: 0; padding: .1em .25em; font-size: max(.62em, 10px); }
.phone .tile:has(.marks) .ipa { top: auto; bottom: .55em; }
.phone .tile:has(.ipa) { padding-top: max(1.15em, 14px); padding-bottom: max(.95em, 12px); min-height: max(5em, 62px); }

/* metronome, drone and notes per row */
.tbtn.lit { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.tbtn.lit svg { color: var(--accent-strong); }
.tbtn.miss { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.tbtn.miss:active { transform: translateY(1px); }
.frow.preset { grid-template-columns: 1fr auto; }
.frow.preset .fv { max-width: 15em; }
.keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.keys .chip { min-width: 0; padding: 0; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.phone .tb.second { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.phone #notesBtn, .phone #metroBtn, .phone #droneBtn { grid-row: 3; justify-content: center; height: 40px; padding: 0 8px; min-width: 0; }
.phone #notesBtn span, .phone #metroBtn span, .phone #droneBtn span { overflow: hidden; text-overflow: ellipsis; }
.phone #notesBtn { grid-column: 1; }
.phone #metroBtn { grid-column: 2; }
.phone #droneBtn { grid-column: 3; }
.phone .thumb #missBtn { height: 30px; padding: 0 12px; font-size: 13px; }
.score.wrap .strip { flex-wrap: wrap; row-gap: .55em; width: auto; }
.field .inline select, .field .inline input[type=number] { width: auto; min-width: 5.5em; }
.phone .tb.second .tbtn:not(.focus) { gap: 5px; padding: 0 6px; font-size: 13px; }
.phone .tb.second .tbtn:not(.focus) svg { flex: none; width: 15px; height: 15px; }
.phone #notesBtn .dd, .phone #metroBtn .dd, .phone #droneBtn .dd { display: none; }

/* breath marks and dynamics */
.tile.breath { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--accent) 10%, transparent) 6px 8px), var(--accent-soft); border: 1px dashed var(--accent); align-items: center; cursor: default; }
.tile.breath .lbl { font-family: var(--font); font-size: .72em; font-weight: 800; letter-spacing: .12em; color: var(--accent-strong); }
.tile.breath .sub { text-align: center; }
.tile.breath.active { background: var(--active); }
.dynline { display: flex; align-items: center; gap: .4em; padding: 0 .3em .3em; font: italic 700 .8em/1 Georgia, 'Times New Roman', serif; color: var(--accent-strong); }
.dynline .dm { flex: none; }
.dynline .hp { flex: 1; height: .7em; display: block; }
.dynline .hp svg { width: 100%; height: 100%; display: block; overflow: visible; }
.dynline .hp path { fill: none; stroke: currentColor; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.score.wrap .dynline { max-width: 100%; }

/* body panel: docked to the side on a desktop, above the thumb bar on a phone */
.bodypanel {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 340px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow, 0 8px 30px rgba(0,0,0,.12));
  display: flex; flex-direction: column;
}
.bodypanel[hidden] { display: none; }
html.body-open main { margin-left: max(0px, calc((100vw - 1280px - 360px) / 2)); margin-right: 360px; }
.bp-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0; }
.bp-tabs { display: flex; gap: 2px; flex: 1; background: var(--sunken); border-radius: 8px; padding: 2px; }
.bp-tabs button { flex: 1; height: 28px; border-radius: 6px; font: 600 12px/1 var(--font); color: var(--soft); }
.bp-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.bp-mic { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); font: 600 12px/1 var(--font); background: var(--surface); }
.bp-mic[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.bp-x { width: 30px; height: 30px; font-size: 20px; line-height: 1; color: var(--soft); border-radius: 8px; }
.bp-x:hover { background: var(--sunken); }
.bp-meter { padding: 10px 14px 0; display: grid; gap: 6px; }
.bp-meter[hidden] { display: none; }
.bp-bar { position: relative; height: 10px; border-radius: 5px; background: var(--sunken); margin-bottom: 12px; }
.bp-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); width: 0; }
.bp-target { position: absolute; top: -4px; width: 3px; height: 18px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.bp-ticks b { position: absolute; top: 13px; transform: translateX(-50%); font: italic 700 11px/1 Georgia, serif; color: var(--soft); }
.bp-read { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--soft); }
.bp-note { font: 700 15px/1 var(--font); color: var(--text); min-width: 4.5em; }
.bp-read label { display: flex; align-items: center; gap: 6px; }
.bp-read input { width: 90px; accent-color: var(--accent); }
.bp-svg { width: 100%; height: auto; max-height: 46vh; display: block; padding: 6px 6px 0; }
.bp-cap { margin: 0; padding: 4px 14px 14px; font-size: 13px; line-height: 1.45; color: var(--soft); min-height: 4.4em; }
.bp-cap b { color: var(--text); }

.bp-svg text { font-family: var(--font); }
.b-skin { fill: var(--raised); stroke: var(--line-strong); stroke-width: 1.5; }
.b-airway { fill: none; stroke: var(--soft); stroke-width: 5; stroke-linecap: round; opacity: .45; }
.b-lung { fill: color-mix(in srgb, var(--c-co, #7aa6e0) 28%, transparent); stroke: color-mix(in srgb, var(--c-co, #7aa6e0) 60%, transparent); stroke-width: 1.2; }
.b-rib { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; opacity: .8; }
.b-gut { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.b-dia { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.b-muscle { fill: none; stroke: var(--c-on, #e8838a); stroke-linecap: round; }
.b-arrow { fill: none; stroke: var(--c-on, #e8838a); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.b-arrow.soft { stroke: var(--soft); opacity: .7; }
.b-air { fill: none; stroke: var(--accent-strong); stroke-linecap: round; stroke-linejoin: round; }
.b-lbl { font-size: 10.5px; fill: var(--soft); font-weight: 600; }
.b-lbl.strong { fill: var(--accent-strong); }
.b-lead { stroke: var(--accent-strong); stroke-width: 1; opacity: .6; }
.b-big { font-size: 22px; font-weight: 800; fill: var(--text); letter-spacing: .04em; }
.b-big.dyn { font: italic 700 30px Georgia, serif; fill: var(--accent-strong); }
.b-track { fill: var(--sunken); }
.b-lvl { fill: var(--accent); }
.b-dyn { font: italic 700 11px Georgia, serif; fill: var(--soft); }
.b-you { fill: var(--text); }
.v-head { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.v-cavity { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.v-palate { fill: none; stroke: var(--soft); stroke-width: 4; stroke-linecap: round; }
.v-velum { fill: none; stroke: var(--soft); stroke-width: 3; stroke-linecap: round; opacity: .7; }
.v-teeth { fill: var(--surface); stroke: var(--line-strong); }
.v-tongue { fill: color-mix(in srgb, var(--c-on, #e8838a) 45%, var(--surface)); stroke: var(--c-on, #e8838a); stroke-width: 1.5; }
.v-lip { fill: color-mix(in srgb, var(--c-on, #e8838a) 70%, var(--surface)); }
.l-hyoid { fill: none; stroke: var(--soft); stroke-width: 3; stroke-linecap: round; }
.l-thyroid { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.l-cricoid, .l-ring { fill: var(--raised); stroke: var(--line-strong); }
.l-glottis { fill: color-mix(in srgb, var(--c-on, #e8838a) 25%, var(--surface)); stroke: var(--line-strong); }
.l-gap { fill: var(--text); }
.l-fold { fill: color-mix(in srgb, var(--surface) 70%, var(--c-on, #e8838a)); stroke: var(--c-on, #e8838a); stroke-width: 1.2; stroke-linejoin: round; }

.phone .bodypanel { left: 0; right: 0; width: auto; border-radius: 14px 14px 0 0; max-height: 52vh; border-bottom: 0; }
.phone .bp-svg { max-height: 20vh; padding-top: 2px; }
.phone .bp-cap { min-height: 0; font-size: 12.5px; padding-bottom: 10px; }
html.phone.body-open main { margin: 0; padding-bottom: var(--body-h, 0px); }
.bp-tabs button { border: 0; background: transparent; }
.bp-tabs button[aria-selected="true"] { background: var(--surface); }
.v-wall { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }

/* melody */
.tile .top .pn { color: var(--soft); font-weight: 700; letter-spacing: .02em; }
.tile .top .pn:not(:first-child) { margin-left: .4em; }
.figs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.chip.fig { display: flex; align-items: center; gap: .5em; justify-content: flex-start; padding: 6px 8px; text-align: left; height: auto; }
.chip.fig .gly { min-width: 3.6em; display: flex; }
.chip.fig small { font-size: 11.5px; color: inherit; opacity: .8; }
.keys.voices { grid-template-columns: repeat(3, 1fr); }
.phone .tb.second { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.phone #customizeBtn { grid-column: 1 / 5; }
.phone #practiceBtn { grid-column: 5 / 9; }
.phone .tb.second .stepper { grid-column: 9 / 13; }
.phone #notesBtn { grid-column: 1 / 4; }
.phone #melBtn { grid-column: 4 / 7; grid-row: 3; justify-content: center; height: 40px; padding: 0 6px; min-width: 0; }
.phone #melBtn span { overflow: hidden; text-overflow: ellipsis; }
.phone #melBtn .dd { display: none; }
.phone #metroBtn { grid-column: 7 / 10; }
.phone #droneBtn { grid-column: 10 / 13; }
.radio.two { grid-template-columns: 1fr 1fr; }
.phone #melBtn svg { display: none; }
.phone .tile.sn .ipa, .phone .tile.sn .sub { display: none; }
.phone .tile.sn:has(.ipa) { padding-top: max(1.15em, 14px); }



/* ===== Groove Builder look: tinted category buttons, pill choices, sectioned menus ===== */
.tbtn { height: 32px; font-size: 12.5px; border-radius: 8px; }
.tbtn .val { font-weight: 400; color: var(--soft); margin-left: 1px; white-space: nowrap; }
#metroBtn, #droneBtn, #melBtn { --cat: #e8590c; }
#customizeBtn, #barsBox { --cat: #3b5bdb; }
#toolsBtn { --cat: #7048e8; }
#practiceBtn { --cat: #2f9e44; }
#bodyBtn { --cat: #0c96b0; }
#healthBtn { --cat: #c2255c; }
:is(#metroBtn, #droneBtn, #melBtn, #customizeBtn, #toolsBtn, #practiceBtn, #bodyBtn, #healthBtn) {
  background: color-mix(in srgb, var(--cat) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--cat) 34%, var(--line-strong));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--cat) 55%, transparent);
}
:is(#metroBtn, #droneBtn, #melBtn, #customizeBtn, #toolsBtn, #practiceBtn, #bodyBtn, #healthBtn):hover { background: color-mix(in srgb, var(--cat) 14%, var(--surface)); }
:is(#metroBtn, #droneBtn, #melBtn, #customizeBtn, #toolsBtn, #practiceBtn, #bodyBtn, #healthBtn):is(.lit, [aria-expanded="true"]) {
  background: color-mix(in srgb, var(--cat) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--cat) 70%, var(--line-strong));
  color: var(--text);
}
:is(#metroBtn, #droneBtn, #melBtn, #customizeBtn, #toolsBtn, #practiceBtn, #bodyBtn, #healthBtn) svg { color: color-mix(in srgb, var(--cat) 80%, var(--text)); }
.tbtn.lit svg { color: color-mix(in srgb, var(--cat, var(--accent)) 85%, var(--text)); }

/* choices are pills everywhere */
.radio { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 12px 8px; }
.radio > button { min-height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 500; gap: 0; }
.radio > button::before { display: none; }
.radio > button:hover { background: var(--sunken); }
.radio > button[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); font-weight: 600; }
.radio .field { flex-basis: 100%; padding: 4px 2px 2px; }

/* menus */
.pop { border-radius: 10px; }
.pop::before { background: var(--cat, var(--accent)); }
.mhead { display: flex; gap: 10px; align-items: center; padding: 2px 12px 10px; }
.mh-ico { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--dark); color: var(--dark-ink); display: grid; place-items: center; }
.mh-ico svg { width: 18px; height: 18px; }
.mhead b { display: block; font-size: 14px; }
.mhead small { display: block; font-size: 12px; color: var(--soft); line-height: 1.35; }
.sec { margin: 0 10px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.sec-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 12.5px; }
.sec-h b { font-weight: 700; }
.sec-h span { color: var(--soft); font-size: 12px; }
.sec-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.sec-l { font-size: 12.5px; font-weight: 600; min-width: 5.5em; }
.sec input[type=range] { width: 100%; accent-color: var(--cat, var(--accent)); margin: 2px 0 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pills > button { min-height: 28px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: 500 12.5px var(--font); color: var(--text); cursor: pointer; }
.pills > button:hover { border-color: var(--soft); }
.pills > button[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); font-weight: 600; }
.pills.keys12 { display: grid; grid-template-columns: repeat(6, 1fr); }
.pills.keys12 > button { padding: 0; }
.mcheck { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 3px 4px; border: 0; background: none; border-radius: 7px; text-align: left; font: 500 13px var(--font); color: var(--text); cursor: pointer; }
.mcheck:hover { background: var(--sunken); }
.mcheck .box { width: 15px; height: 15px; flex: none; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); position: relative; }
.mcheck[aria-pressed="true"] .box { background: var(--dark); border-color: var(--dark); }
.mcheck[aria-pressed="true"] .box::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--dark-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.mcheck .pic { display: inline-flex; min-width: 46px; color: var(--text); }
.prow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; cursor: pointer; color: var(--text); }
.prow:hover { background: var(--surface); }
.prow[aria-pressed="true"] { background: var(--surface); border-color: var(--cat, var(--accent)); box-shadow: inset 3px 0 0 var(--cat, var(--accent)); }
.prow .pic { display: inline-flex; width: 72px; justify-content: center; color: var(--cat, var(--accent)); flex: none; }
.prow .pic svg { max-height: 24px; }
.prow .pt b { display: block; font-size: 13px; font-weight: 600; }
.prow .pt small { display: block; font-size: 11.5px; color: var(--soft); }
.prow.pal .pic, .prow.pal .sw7 { width: auto; }
.sw7 { display: inline-flex; border-radius: 5px; overflow: hidden; flex: none; }
.sw7 i { width: 17px; height: 20px; display: grid; place-items: center; font: 700 9.5px var(--font); font-style: normal; color: rgba(255, 255, 255, .92); }
.mfoot { display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 20px); margin: 2px 10px 6px; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); font: 600 13px var(--font); color: var(--text); cursor: pointer; }
.mfoot:hover { border-color: var(--cat, var(--accent)); }
.mfoot svg { width: 17px; height: 17px; }
.nstep { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.nstep button { width: 30px; height: 30px; border: 0; background: none; font-weight: 700; font-size: 15px; color: var(--soft); cursor: pointer; }
.nstep button:hover { background: var(--sunken); }
.nstep select { border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; height: 30px; font: 600 13px var(--font); padding: 0 6px; background: var(--surface); color: var(--text); }

/* ===== melody stage ===== */
.melpanel { margin: 0 0 14px; }
.ms-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
:is(.ms-bar, .mtools) .rowlab { width: 58px; flex: none; font: 700 9.5px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.ms-bar .tool { height: 30px; padding: 0 9px; gap: 6px; font-size: 11.5px; }
.mtools { display: contents; }
:is(.ms-bar, .mtools) .tool .ic svg { width: 15px; height: 15px; display: block; }
:is(.ms-bar, .mtools) .tool .ic .mh-glyph { font-size: 16px; }
:is(.ms-bar, .mtools) .tool .lb { font-weight: 650; }
:is(.ms-bar, .mtools) .tool .val { font-weight: 500; font-variant-numeric: tabular-nums; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in srgb, var(--soft) 60%, var(--text)); }
:is(.ms-bar, .mtools) .tool .car { font-style: normal; font-size: 9px; opacity: .6; margin-left: 1px; }
:is(.ms-bar, .mtools) .tool[aria-expanded="true"] .val { font-weight: 700; }
:is(.ms-bar, .mtools) .cat-write { --cat: #2f6fdb; }
:is(.ms-bar, .mtools) .cat-shape { --cat: #8b45d6; }
:is(.ms-bar, .mtools) .cat-sound { --cat: #d9822b; }
:is(.ms-bar, .mtools) :is(.cat-write, .cat-shape, .cat-sound) {
  background: color-mix(in oklab, var(--cat) 9%, var(--surface));
  border-color: color-mix(in oklab, var(--cat) 40%, var(--line-strong));
  box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--cat) 75%, transparent);
}
:is(.ms-bar, .mtools) :is(.cat-write, .cat-shape, .cat-sound) .ic { color: color-mix(in oklab, var(--cat) 82%, var(--text)); }
:is(.ms-bar, .mtools) :is(.cat-write, .cat-shape, .cat-sound):hover { background: color-mix(in oklab, var(--cat) 14%, var(--surface)); }
:is(.ms-bar, .mtools) :is(.cat-write, .cat-shape, .cat-sound)[aria-expanded="true"] { background: color-mix(in oklab, var(--cat) 20%, var(--surface)); border-color: color-mix(in oklab, var(--cat) 80%, var(--line-strong)); }
:is(.ms-bar, .mtools) .cat-plain, :is(.ms-bar, .mtools) .mel-new, :is(.ms-bar, .mtools) .mel-on { background: var(--surface); border-color: var(--line-strong); box-shadow: none; }
:is(.ms-bar, .mtools) .cat-plain[aria-expanded="true"] { background: var(--sunken); }
/* solid only for the mode switch, as Groove Builder's Pitched */
:is(.ms-bar, .mtools) .mel-on.on { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
:is(.ms-bar, .mtools) .bsep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 3px; }
:is(.ms-bar, .mtools) .badge { min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: var(--dark); color: var(--dark-ink); font: 700 10px/15px var(--font); text-align: center; }
:is(.ms-bar, .mtools) .badge.nudge { background: #e8a200; color: #1d1600; }
.seg { display: inline-flex; height: 30px; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.seg button { border: 0; border-radius: 6px; padding: 0 8px; background: none; font: 600 11.5px var(--font); color: var(--soft); cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); box-shadow: inset 0 -2px 0 var(--accent); }
.ms-meta { display: flex; align-items: center; gap: 10px; margin: 0 0 6px 64px; min-height: 30px; }
.ms-meta select { height: 28px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 6px; font: 600 12px var(--font); background: var(--surface); color: var(--text); }
.ms-sum { font-size: 12.5px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-sum b { font-weight: 800; }
.ms-card { position: relative; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 14px 6px; }
.ms-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 10px 10px 0 0; background: linear-gradient(90deg, #f5b82e, #ff7a45 50%, #ff5a3c); }
.ms-card.off .mp-staff, .ms-card.off .ms-walk { opacity: .35; filter: grayscale(1); }
.ms-off { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 14px 34px rgba(0,0,0,.16); font-size: 13px; white-space: nowrap; }
.ms-offbtn { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--dark); color: var(--dark-ink); font: 650 12.5px var(--font); cursor: pointer; }
.ms-ics { position: absolute; top: 9px; right: 10px; z-index: 3; display: inline-flex; gap: 5px; }
.ms-ic { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--raised); color: var(--soft); cursor: pointer; }
.ms-ic:hover { color: var(--text); border-color: var(--line-strong); }
.ms-ic[aria-pressed="true"] { color: var(--accent-strong, var(--accent)); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ms-ic svg { width: 15px; height: 15px; }
/* fill the window: the notation and the few controls you sing with */
html.mel-full, html.mel-full body { overflow: hidden; }
html.mel-full .ms-card { position: fixed; inset: 0; z-index: 60; border-radius: 0; padding: 64px 3vw 20px; display: flex; flex-direction: column; justify-content: center; }
html.mel-full .ms-card::before { border-radius: 0; height: 4px; }
html.mel-full .ms-ics { top: 14px; right: 16px; }
html.mel-full .mp-staff { display: flex; justify-content: center; overflow: visible; }
html.mel-full .ms-walk { max-width: 900px; width: 100%; margin: 18px auto 0; }
.ms-fbar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); }
.ms-fbar .fb { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.ms-fbar .fb:hover { border-color: var(--line-strong); }
.ms-fbar .fb.solid { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.ms-fbar .fb svg { width: 16px; height: 16px; }
.fb-tempo { display: inline-flex; align-items: center; gap: 4px; padding-left: 6px; border-left: 1px solid var(--line); font: 700 13px var(--font); font-variant-numeric: tabular-nums; }
.fb-tempo span { min-width: 54px; text-align: center; }
/* menu parts the melody uses */
.mhelp { margin: 4px 12px 8px; font-size: 11.5px; line-height: 1.45; color: var(--soft); }
.sec .mhelp { margin: 8px 0 0; }
.mnudge { margin: 0 10px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); font-size: 12.5px; color: var(--soft); }
.mh-glyph { font-size: 22px; line-height: 1; }
.big-ico svg { width: 22px; height: 22px; }
.sl { display: flex; align-items: center; gap: 8px; flex: 1; }
.sl small { font-size: 12px; color: var(--soft); }
.sl input[type=range] { flex: 1; margin: 0; }
.fig-group { margin: 0 10px 6px; }
.fig-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 2px; }
.fig-h label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.fig-h h4 { margin: 0; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.fig-reset { border: 0; background: none; font: 600 10.5px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); cursor: pointer; }
.fig-reset:hover { color: var(--text); }
.fig-opt { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 4px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.fig-opt:hover { background: var(--sunken); }
.fig-opt.idle { opacity: .45; }
.fig-group input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--dark); flex: none; }
.mini { display: inline-flex; align-items: center; }
.mini svg { display: block; }
.prow .pic:has(.mini, .big-ico) { width: 172px; justify-content: flex-start; margin: -6px 0; }
/* a folder row opens its panel under itself */
.fold { margin: 0 10px 6px; }
.fold > .frow { width: 100%; height: 42px; }
.fold > .frow.open, .pop .frow.open { border-color: var(--cat, var(--accent)); background: color-mix(in srgb, var(--cat, var(--accent)) 9%, var(--surface)); }
.pop .frow.open .chev { transform: rotate(135deg); }
/* one nested style everywhere: a folder's panel opens under its row */
.pop .nest.sub { margin: 6px 0 8px; padding: 8px 0 2px; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 16px rgba(0,0,0,.08); }
.sec .nest.sub { margin: 6px 0 4px; }
.nest.sub > .field, .nest.sub > .toggle, .nest.sub > .radio, .nest.sub > p, .nest.sub > .hint, .nest.sub > .note { margin-left: 8px; margin-right: 8px; }
.nest { margin-top: 6px; padding: 10px 0 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 10px 24px rgba(0,0,0,.12); }
.nest .sec { margin: 0 8px 8px; }
.mp-staff { overflow-x: auto; min-height: 60px; color: var(--soft); font-size: 13px; }
.mp-staff svg { display: block; }
.mp-staff .hit { fill: transparent; stroke: none; cursor: pointer; }
.mp-staff .hit:hover { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.mp-staff .hit.sel { fill: color-mix(in srgb, #7048e8 10%, transparent); stroke: #7048e8; stroke-width: 1.2; stroke-dasharray: 3 3; }
.ms-pop { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 14px 34px rgba(0,0,0,.18); padding: 8px; }
.pp-h { display: flex; align-items: baseline; gap: 8px; padding: 0 2px 6px; }
.pp-n { font: 800 18px var(--font); }
.pp-h small { font-size: 11.5px; color: var(--soft); }
.pp-row { display: flex; align-items: center; gap: 8px; }
.pp-pitch, .pp-lens, .pp-more { display: flex; gap: 3px; }
.pp-lens { padding: 0 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.ms-pop .pb { min-width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; padding: 0 3px; }
.ms-pop .pb:hover { background: var(--sunken); }
.ms-pop .pb svg { width: 16px; height: 16px; }
.ms-pop .pp-lens .pb svg { width: auto; height: 24px; }
.ms-pop .pb[aria-pressed="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.ms-walk { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); margin-top: 2px; padding-top: 2px; color: var(--soft); }
.ms-walk .wl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.ms-walk svg { flex: none; display: block; overflow: visible; }
.ms-walk .wk { cursor: pointer; }
.ms-walk .wk .hit { fill: transparent; }
.ms-walk .wk:hover .hit { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.ms-walk .wk.on .hit { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.ms-walk .wk .d { stroke: none; }
.ms-walk text { font: 700 11px var(--font); fill: var(--text); }
.phone .ms-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 0 8px; padding: 0 0 2px; scrollbar-width: none; }
.phone .ms-bar::-webkit-scrollbar { display: none; }
.phone .ms-bar .tbtn, .phone .ms-bar .seg { flex: none; height: 34px; }
.phone .ms-bar .rowlab { display: none; }
.phone .ms-meta { margin-left: 0; }
.phone .ms-off { white-space: normal; width: 86%; flex-direction: column; text-align: center; }
.phone .ms-card { padding: 6px 8px 4px; }
.phone .ms-pop { left: 8px !important; right: 8px; }
.phone .pp-row { flex-wrap: wrap; }
.prow { padding: 4px 8px; }

/* controls inside section boxes */
.sec .frow { width: 100%; margin: 0 0 4px; height: 40px; padding: 0 10px; }
.sec .frow:last-child { margin-bottom: 0; }
.sec .frow .fl { font-size: 13px; }
.sec .frow .fv { font-size: 12px; }
.sec .frow.cur { box-shadow: inset 3px 0 0 var(--cat, var(--accent)); border-color: var(--cat, var(--accent)); background: var(--surface); }
.sec .frow.open { border-color: var(--cat, var(--accent)); background: color-mix(in srgb, var(--cat, var(--accent)) 8%, var(--surface)); }
.sec .frow .fl .n { color: var(--dark-ink); background: var(--dark); }
.sec .toggle { width: 100%; margin: 0; padding: 6px 2px; font-size: 13px; }
.sec .radio { padding: 0; }
.sec .field { padding: 6px 0 2px; }
.sec .field:first-child { padding-top: 0; }
.sec .field > .fh { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text); }
.sec .keys { margin-top: 2px; }
.sec .links { padding: 0; }
.sec .links a { background: var(--surface); }
.sec .disclaim, .sec .hint { margin: 8px 0 0; padding: 0; font-size: 12px; }
.sec .sec-h:only-child { margin-bottom: 0; }
.sec .sec-h button { border: 0; background: none; font: 700 12.5px var(--font); color: var(--cat, var(--accent)); padding: 0; margin-left: auto; cursor: pointer; }
.pop .foot { padding: 4px 10px 6px; }
.pop .foot .btn { flex: 1; justify-content: center; min-height: 36px; border-radius: 9px; }
.pop.drawer .sec { margin: 0 14px 10px; }
.phone .prow .pic:has(.mini, .big-ico) { width: 118px; }
/* the note sounding now, lit without redrawing the staff */
.mp-staff .vf-stavenote.on .vf-notehead path, .mp-staff .vf-stavenote.on .vf-notehead { fill: var(--accent) !important; stroke: var(--accent) !important; }
.mp-staff .vf-stavenote.on .vf-annotation text, .mp-staff .vf-stavenote.on text { fill: var(--accent) !important; }
/* the melody switch: solid while on, like Groove Builder's Pitched */
#melBtn.lit { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); box-shadow: none; }
#melBtn.lit svg { color: var(--dark-ink); }
.tb .seg { height: 32px; }
.ms-showstaff { height: 30px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: none; font: 600 12.5px var(--font); color: var(--soft); cursor: pointer; }
.ms-showstaff:hover { color: var(--text); border-color: var(--soft); }
.ms-meta { margin-left: 0; }
/* two rows, Groove Builder sizes: 30px tools, 11.5px type, tight gaps */
@media (min-width: 641px) {
  .tb { gap: 4px; }
  .tb .stepper button { width: 26px; }
  .tb .stepper .sval { padding: 0 4px; }
  .tb .tbtn:not(.icon) { height: 30px; padding: 0 8px; gap: 5px; font-size: 11.5px; }
  .tb .tool .val { max-width: 96px; }
  .tb .seg button { padding: 0 6px; font-size: 11px; }
  .tb .tbtn .dd { margin-left: -1px; }
  .tb .tbtn.icon { height: 30px; width: 34px; }
  .tb .tbtn svg { width: 15px; height: 15px; }
  .tb .tempo, .tb .stepper, .tb .seg { height: 30px; }
  .tb .tbtn.focus { height: 30px; }
}

/* keyboard sheet */
.keys-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 4px 14px 14px; align-items: center; font-size: 13px; }
.keys-list kbd { font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface); justify-self: start; white-space: nowrap; }

/* corner: metronome, drone, body, health, tools, settings as symbols */
.tbtn.icon.corner { position: relative; width: 34px; }
.corner-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 2px; flex: none; }
.corner-gap { display: none; }
#droneBtn .cb { position: absolute; right: 2px; bottom: 1px; font: 700 9px/1 var(--sans, inherit); color: color-mix(in srgb, var(--cat) 80%, var(--text)); }
#droneBtn .cb:empty { display: none; }
#metroBtn.ramp::after { content: ''; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--cat); }
#metroBtn:not(.lit) svg, #droneBtn:not(.lit) svg { opacity: .55; }
/* bars per row, with the metronome's time signature */
.stepper.bars { gap: 0; }
.stepper.bars .tsig { height: 22px; min-width: 0; margin: 0 4px 0 2px; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--cat) 40%, var(--line-strong)); border-radius: 5px; background: color-mix(in srgb, var(--cat) 9%, var(--surface)); font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: color-mix(in srgb, var(--cat) 80%, var(--text)); cursor: pointer; }
.stepper.bars .tsig:hover { background: color-mix(in srgb, var(--cat) 16%, var(--surface)); }
.stepper button:disabled { opacity: .35; cursor: default; }
.phone .tb .corner-sep { display: none; }

/* rows read as bars: a hairline between bars, notes inside one beat joined */
.barline { flex: none; width: 1px; align-self: stretch; margin: .45em .2em; background: var(--line-strong); opacity: .8; }
.tile.jr { margin-right: .03em; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }
.tile.jl { margin-left: .03em; border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.tile.jl, .tile.jr { width: calc(var(--d) * var(--unit) - .18em); }
.tile.jl.jr { width: calc(var(--d) * var(--unit) - .06em); }
/* colour mode: the vowel in its note's colour */
:root .tile.tile[style*="--nc"] .nu, :root .tile.tile[style*="--nc"] .lbl { color: var(--nc); }
.tile[style*="--nc"] .top .pn { color: var(--nc); }

/* circled i: hover or focus for how a setting works */
.info { position: relative; display: inline-grid; place-items: center; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1.3px solid var(--faint); color: var(--soft); font: italic 700 10px/1 Georgia, serif; cursor: help; vertical-align: middle; margin-left: 6px; }
.info:hover, .info:focus-visible { border-color: var(--text); color: var(--text); outline: none; }
/* between repeats */
.gap-len { display: flex; align-items: center; gap: 6px; padding: 0 12px 6px; }
.gap-len input { width: 52px; }
.gap-row { display: flex; align-items: center; gap: 4px; padding: 0 12px 8px; }
.gap-slots { display: flex; gap: 3px; flex: 1; min-width: 0; flex-wrap: wrap; }
.gslot { flex: 1 0 24px; max-width: 46px; height: 30px; border-radius: 6px; border: 1px dashed var(--line-strong); background: var(--sunken, var(--surface)); font: 700 12px/1 var(--font); color: var(--cat, var(--accent)); cursor: pointer; }
.gslot[aria-pressed="true"] { border-style: solid; border-color: color-mix(in srgb, var(--cat, var(--accent)) 70%, var(--line-strong)); background: color-mix(in srgb, var(--cat, var(--accent)) 22%, var(--surface)); }
.frow.static { cursor: default; }
.frow.static .fv { display: flex; align-items: center; }
.frow.static .stepper { height: 28px; }

.mp-pitch { display: block; width: 100%; height: 150px; margin: 4px 0 0; border-top: 1px dashed var(--line); }
html.phone .mp-pitch { height: 120px; }
.mp-score { display: flex; flex-wrap: wrap; gap: 4px 12px; min-height: 18px; margin: 0 0 6px; padding: 0 8px; font: 500 12px var(--font); color: var(--soft); }
.mp-score b { color: var(--text); font-weight: 700; }
.mp-score .warn { color: var(--warn); }
.tool-note, .tool-line { display: flex; align-items: center; gap: 4px; padding: 0 12px 8px; font-size: 12px; color: var(--soft); }
.tool-line .mfoot { flex: 1; }

/* phone: second toolbar as three rows: focus · Exercises, Customize, Practice · rows and bars */
.phone #melBtn { grid-column: 1 / 5; grid-row: 2; }
.phone #customizeBtn { grid-column: 5 / 9; grid-row: 2; }
.phone #practiceBtn { grid-column: 9 / 13; grid-row: 2; }
.phone .tb.second .stepper { grid-row: 3; grid-column: 1 / 6; }
.phone .tb.second .stepper.bars { grid-column: 6 / 13; justify-content: space-between; }
.phone .tb.second .stepper.bars .tsig { height: 26px; }

/* split tool button: Regenerate | ▾ */
.tsplit { display: inline-flex; flex: none; }
.tsplit > .tbtn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tsplit > .car-only { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; padding: 0 6px; min-width: 0; }
.tsplit > .car-only .car { margin: 0; }
.tbtn.tool.icon-tool .lb { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tbtn.tool.icon-tool { padding: 0 7px; }
@media (min-width: 641px) {
  .tb.second .tbtn.focus { max-width: 150px; }
  .tb.second .tbtn.focus #focusName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .tb.second .tbtn.tool .val { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- Design a rhythm: Groove Builder's Beat Designer, one voice ---- */
.bd-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.beat-designer-modal { position: relative; width: min(900px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow), 0 24px 64px rgba(0, 0, 0, 0.35); overflow: hidden; }
.beat-designer-modal-header { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 10px 12px 10px 16px; flex-shrink: 0; }
.beat-designer-modal-header h2 { margin: 0; font-size: 14px; font-weight: 600; }
.bd-spacer { flex: 1 1 auto; }
.beat-designer-modal-close { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--soft); padding: 2px 8px; border-radius: 6px; }
.beat-designer-modal-close:hover { color: var(--text); background: var(--sunken); }
.bd-off, .bd-clear-all, .bd-chance { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 11px; font: 600 12px var(--font); cursor: pointer; }
.bd-off:hover, .bd-clear-all:hover:not(:disabled), .bd-chance:hover { background: var(--sunken); }
.bd-clear-all:disabled { opacity: 0.4; cursor: default; }
.bd-chance.on { background: #6743f0; border-color: #6743f0; color: #fff; }
.beat-designer-modal-body { overflow: auto; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.beat-designer-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.bd-grid-picker { display: flex; gap: 14px; }
.bd-grid-family { display: flex; flex-direction: column; gap: 3px; }
.bd-grid-family-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.bd-grid-family-options { display: flex; gap: 2px; padding: 2px; background: var(--raised, var(--sunken)); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.bd-grid-family-options button { border: none; background: transparent; border-radius: 4px; padding: 3px 10px; font: 600 12px var(--font); color: var(--soft); cursor: pointer; }
.bd-grid-family-options button:hover { color: var(--text); }
.bd-grid-family-options button.active { background: #2f6fdb; color: #fff; }
.bd-hidden { margin: 0; font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--text); }
.bd-legend { margin: 0; font-size: 11.5px; color: var(--soft); }
.bd-grid { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.bd-row { display: flex; align-items: center; gap: 6px; min-width: max-content; }
.bd-row-head { position: sticky; left: 0; z-index: 1; background: var(--surface); display: flex; align-items: center; gap: 2px; width: 58px; flex: 0 0 auto; }
.bd-limb-name { font-size: 11px; font-weight: 700; color: var(--soft); }
.bd-row-clear { border: none; background: transparent; color: var(--soft); font-size: 15px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.bd-row-clear:disabled { opacity: 0.2; cursor: default; }
.bd-row-clear:hover:not(:disabled) { color: #c0392b; }
.bd-steps { display: flex; gap: 4px; flex: 1 1 auto; }
.bd-beat { display: flex; gap: 2px; flex: 1 1 auto; min-width: max-content; padding: 2px; border-radius: 6px; background: rgba(127, 127, 127, 0.07); }
.bd-beat.alt { background: rgba(127, 127, 127, 0.14); }
.bd-cell { flex: 1 1 0; min-width: 22px; height: 30px; border: 1px solid transparent; border-radius: 4px; background: var(--surface); color: var(--soft); font: 600 10px var(--font); cursor: pointer; transition: transform 0.08s ease, background 0.12s ease, color 0.12s ease; }
.bd-cell.downbeat { color: var(--text); }
.bd-cell:hover { border-color: #2f6fdb; transform: translateY(-1px); }
.bd-cell.on { background: #2f6fdb; color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22); }
.bd-cell.on.chance { background: color-mix(in srgb, #6743f0 calc(40% + var(--cell-chance, 0.5) * 60%), var(--surface)); }
@media (max-width: 640px) {
  .bd-backdrop { padding: 8px; align-items: flex-end; }
  .beat-designer-modal { max-height: calc(100vh - 16px); }
  .bd-off { display: none; }
  .bd-cell { min-width: 26px; height: 34px; }
  .bd-row-head { width: 48px; }
}
/* example word on a tile: click for its menu */
.tile .sub.ex { cursor: pointer; border-radius: 4px; padding: 0 3px; }
.tile .sub.ex b { font-weight: 600; text-decoration: underline dotted color-mix(in oklab, currentColor 45%, transparent); text-underline-offset: 2px; }
.tile .sub.ex:hover { background: color-mix(in oklab, var(--accent) 14%, transparent); }

/* ---- Focus menu: source switch, syllable builder ---- */
.bsrc { margin: 2px 10px 8px; }
.bsrc .seg { width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box; }
.bsrc .seg button { flex: 1 1 auto; padding: 0 5px; white-space: nowrap; }
.bacts { display: flex; gap: 6px; margin: 0 10px 8px; }
.bacts .btn { flex: 1; font-size: 12px; padding: 6px 8px; }
.bacts .btn:disabled { opacity: .45; cursor: default; }
.bsave { display: flex; gap: 6px; margin: 0 10px 8px; }
.bsave input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: 500 13px var(--font); background: var(--surface); color: var(--text); }
.bslot { --sc: var(--c-nu); margin: 0 10px 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid color-mix(in oklab, var(--sc) 35%, var(--line)); background: color-mix(in oklab, var(--sc) 7%, var(--surface)); }
.bslot.c-on { --sc: var(--c-on); } .bslot.c-co { --sc: var(--c-co); }
.bslot.off { background: var(--surface); border-color: var(--line); }
.bslot.off > :not(.bs-head) { opacity: .45; }
.bs-head { display: flex; align-items: center; gap: 8px; }
.bs-head b { font-size: 13px; color: color-mix(in oklab, var(--sc) 70%, var(--text)); }
.bslot.off .bs-head b { color: var(--soft); }
.bs-sp { flex: 1; }
.bs-head .seg button { height: 24px; padding: 0 8px; font-size: 11.5px; }
.bs-often { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.bs-l { font-size: 11.5px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.bs-often input { flex: 1; accent-color: var(--sc); min-width: 0; }
.bs-pct { font: 600 11.5px var(--font); width: 3.2em; text-align: right; color: var(--soft); }
.bslot .frow.bs-pool { margin: 2px -6px 0; width: calc(100% + 12px); }
.bslot .nest.sub { margin: 4px -6px 0; }
.bs-on { flex: none; width: 30px; height: 18px; border-radius: 999px; border: 0; background: var(--line-strong); position: relative; cursor: pointer; padding: 0; }
.bs-on::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.bs-on[aria-checked="true"] { background: var(--sc, var(--accent)); }
.bs-on[aria-checked="true"]::after { transform: translateX(12px); }
.brules-h { margin: 10px 10px 4px; }
.brules { margin: 0 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.brule { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 12.5px; font-weight: 600; }
.brule .info { margin-left: 0; }
.brule .seg button { height: 24px; padding: 0 8px; font-size: 11.5px; }
.bgroup { margin: 0 10px 8px; }
.bgroup h4 { margin: 6px 0 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.bpres { display: flex; flex-wrap: wrap; gap: 4px; }
.bpre { --gc: var(--accent); display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 999px; border: 1px solid color-mix(in oklab, var(--gc) 35%, var(--line)); background: color-mix(in oklab, var(--gc) 8%, var(--surface)); font: 600 12px var(--font); color: var(--text); cursor: pointer; }
.bpre .info { margin-left: 2px; width: 13px; height: 13px; font-size: 9px; }
.bpre[aria-pressed="true"] { background: var(--gc); border-color: var(--gc); color: #fff; }
.bpre[aria-pressed="true"] .info { border-color: rgba(255,255,255,.7); color: #fff; }
.g-vowels .bpre { --gc: #2f6fdb; } .g-consonants .bpre { --gc: #2e9e6b; } .g-shapes .bpre { --gc: #8a4fd6; } .g-linking .bpre { --gc: #c26a12; } .g-warmups .bpre { --gc: #c0446b; } .g-mine .bpre { --gc: #4a5568; }
.bpre-x { margin-left: 2px; font-size: 14px; line-height: 1; opacity: .6; }
.bpre-x:hover { opacity: 1; }
.bslot .seg, .brule .seg { flex-wrap: nowrap; flex: none; }
.bslot .seg button, .brule .seg button { white-space: nowrap; }
.bacts .btn { white-space: nowrap; }
.brule > span:not(.info):not(.bs-sp) { min-width: 0; }
.pop:has(.bslot) { width: min(360px, calc(100vw - 24px)); max-width: none; }

/* ⓘ tooltip (ui/tooltip.js) */
.tipbox { position: fixed; z-index: 200; padding: 8px 10px; border-radius: 8px; background: var(--dark, #1d2330); color: var(--dark-ink, #fff); font: 400 12px/1.45 var(--font); box-shadow: 0 6px 20px rgba(0,0,0,.2); pointer-events: none; }
.note-i { display: flex; justify-content: flex-end; margin: -2px 4px 2px; }
.prow .pt b .info, .toggle .info, .fh .info, .sec-h .info, .mhead b .info { margin-left: 6px; }
/* action rows: each its own tint, so they are told apart at a glance */
.pop .prow { --rc: #2f6fdb; background: color-mix(in oklab, var(--rc) 6%, transparent); box-shadow: inset 3px 0 0 color-mix(in oklab, var(--rc) 55%, transparent); margin-bottom: 3px; }
.pop .prow:nth-child(5n+2) { --rc: #2e9e6b; }
.pop .prow:nth-child(5n+3) { --rc: #8a4fd6; }
.pop .prow:nth-child(5n+4) { --rc: #c26a12; }
.pop .prow:nth-child(5n+5) { --rc: #c0446b; }
.pop .prow:hover { background: color-mix(in oklab, var(--rc) 13%, transparent); }
.pop .prow[aria-pressed="true"] { background: color-mix(in oklab, var(--rc) 16%, var(--surface)); border-color: color-mix(in oklab, var(--rc) 60%, transparent); box-shadow: inset 3px 0 0 var(--rc); }
.prow .pt small.keep { display: block; font-size: 11.5px; color: var(--soft); }
/* pattern cards: name only; the notation floats in on hover (or the first tap on a phone) */
.prow.haspv { position: relative; }
.prow .pv { display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 2px 6px; border-radius: 8px; background: var(--surface); box-shadow: 0 4px 14px rgba(0,0,0,.16); border: 1px solid var(--line); z-index: 2; pointer-events: none; }
.prow .pv svg { display: block; }
@media (hover: hover) { .prow.haspv:hover .pv { display: block; } }
.prow.haspv.peek .pv { display: block; }
.prow.haspv.peek::after { content: 'Tap again to use'; position: absolute; left: 11px; bottom: 1px; font-size: 10px; color: var(--soft); }
.rg { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; margin: 4px 0 2px; }
.rg-ladder { display: block; width: 92px; height: 260px; }
.rg-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: rg; }
.rg-steps li { counter-increment: rg; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: var(--sunken); font: 600 12px var(--font); color: var(--faint); }
.rg-steps li::before { content: counter(rg); display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--line); color: var(--soft); font-size: 10px; }
.rg-steps li span { flex: 1; min-width: 0; }
.rg-steps li b { font-weight: 800; color: var(--text); }
.rg-steps li.on { background: color-mix(in oklab, var(--accent) 16%, var(--surface)); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.rg-steps li.on::before { background: var(--accent); color: var(--dark-ink, #000); }
.rg-steps li.done { color: var(--soft); }
.range-reach { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 500 12px var(--font); color: var(--soft); }
.range-acts { flex-wrap: wrap; }
.out-pick { margin-top: 6px; }
.out-pick button { flex: 1; padding: 10px; font-weight: 700; }
.range-now { margin: 4px 0 8px; font: 600 15px var(--font); }
.range-acts { display: flex; gap: 6px; }
.range-acts .btn { flex: 1; }
.range-acts .btn:disabled { opacity: .45; }
.range-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 6px; }
/* rhythm above the tiles, one glyph per note at the tile's width */
.rlane { display: flex; width: max-content; min-width: 100%; height: 1.15em; margin-bottom: .2em; }
.rlane .rn { flex: 0 0 auto; width: calc(var(--d) * var(--unit)); padding-left: .65em; font: 400 .95em/1 'Noto Music', 'Bravura Text', serif; color: var(--soft); position: relative; white-space: nowrap; }
.rlane .rr { color: var(--faint); }
.rlane .rs::after { content: ''; position: absolute; left: .7em; right: -1em; top: -.15em; height: .5em; border-top: 1.6px solid var(--accent); border-radius: 50% 50% 0 0; }
.rlane .rc { color: var(--accent); }
/* a held vowel: the first tile runs into the next ones */
.tile.spans { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; width: calc(var(--d) * var(--unit) - .15em); }
.tile.cont { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; width: calc(var(--d) * var(--unit) - .15em); background: color-mix(in oklab, var(--accent) 6%, var(--tile-bg, var(--raised))); }
.tile.cont + .tile.cont, .tile.cont:has(+ .tile.cont) { border-right-color: transparent; }
.tile.cont:has(+ .tile.cont) { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; width: calc(var(--d) * var(--unit)); }
.tile .ext { display: block; width: 100%; min-width: 1.5em; height: 0; border-top: 2px solid color-mix(in oklab, var(--accent) 60%, transparent); margin-top: .6em; }
.tile .spanh { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; touch-action: none; opacity: 0; transition: opacity .12s; }
.tile .spanh::after { content: ''; position: absolute; right: 3px; top: 30%; bottom: 30%; width: 3px; border-radius: 2px; background: var(--accent); }
.tile:hover .spanh { opacity: .7; }
@media (hover: none) { .tile .spanh { opacity: .45; width: 16px; } }
.tile.spanprev { background: color-mix(in oklab, var(--accent) 14%, var(--tile-bg, var(--raised))); border-color: var(--accent); }

/* ---------- Pitch Playground ---------- */
html.pgmode #melPanel, html.pgmode .infoline, html.pgmode #excerpt, html.pgmode #loopBar, html.pgmode .scorewrap, html.pgmode #tip, html.pgmode #lyricsPanel,
html.pgmode #pos, html.pgmode #missBtn { display: none !important; }
.pg { position: relative; padding: 0; overflow: hidden; margin-bottom: 10px; }
.pg canvas { display: block; width: 100%; height: max(380px, min(780px, calc(100dvh - 200px))); touch-action: manipulation; }
html.phone .pg canvas { height: max(340px, calc(100dvh - 250px - var(--body-h, 0px))); }
.pg-hud { position: absolute; left: 82px; top: 12px; right: 210px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; pointer-events: none; }
html.phone .pg-hud { left: 58px; right: 146px; top: 8px; }
.pg-act { padding: 2px 8px; border-radius: 999px; background: color-mix(in oklab, var(--accent) 22%, var(--surface)); font: 700 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.pg-say { font: 700 17px/1.25 var(--display); color: var(--text); text-shadow: 0 1px 0 var(--surface); }
html.phone .pg-say { font-size: 15px; }
.pg-stat { font: 600 12.5px var(--font); color: var(--soft); }
.pg-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; border-radius: 999px; font: 700 17px var(--font); box-shadow: var(--shadow); }
.pg-start svg { width: 20px; height: 20px; }
.pg-acts .bpre:nth-child(7n+1) { --gc: #4a5568; } .pg-acts .bpre:nth-child(7n+2) { --gc: #2f6fdb; } .pg-acts .bpre:nth-child(7n+3) { --gc: #8a4fd6; }
.pg-acts .bpre:nth-child(7n+4) { --gc: #c26a12; } .pg-acts .bpre:nth-child(7n+5) { --gc: #0b8a8a; } .pg-acts .bpre:nth-child(7n+6) { --gc: #c0446b; } .pg-acts .bpre:nth-child(7n+7) { --gc: #2e9e6b; }
.pg-pats { margin: 6px 0 2px; }
.pg-pcs, .pg-ivs { margin: 8px 0; }

/* ===== Task 4: three folders (Exercise, Sound, Practice), a mode switch, the Guide ===== */
#focusBtn { --cat: #2f6fdb; }
#melBtn { --cat: #8b45d6; }
#soundBtn { --cat: #d9822b; }
#practiceBtn { --cat: #2f9e44; }
#guideBtn { --cat: #0c96b0; }
:is(#focusBtn, #melBtn, #soundBtn, #practiceBtn, #guideBtn) {
  background: color-mix(in srgb, var(--cat) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--cat) 34%, var(--line-strong));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--cat) 60%, transparent);
}
:is(#focusBtn, #melBtn, #soundBtn, #practiceBtn, #guideBtn):hover { background: color-mix(in srgb, var(--cat) 14%, var(--surface)); }
:is(#focusBtn, #melBtn, #soundBtn, #practiceBtn, #guideBtn):is(.lit, [aria-expanded="true"]) { background: color-mix(in srgb, var(--cat) 20%, var(--surface)); border-color: color-mix(in srgb, var(--cat) 75%, var(--line-strong)); }
:is(#focusBtn, #melBtn, #soundBtn, #practiceBtn, #guideBtn) svg { color: color-mix(in srgb, var(--cat) 82%, var(--text)); }
.tbtn.fold { gap: 6px; padding: 0 10px; position: relative; }
.tbtn.fold .lb { font-weight: 700; }
.tbtn.fold .val { font-weight: 500; color: color-mix(in srgb, var(--soft) 60%, var(--text)); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tbtn.fold .val:empty { display: none; }
.tbtn.fold .car { font-style: normal; font-size: 9px; opacity: .6; }
#soundBtn.ramp::after { content: ''; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--cat); }
.modeseg { height: 32px; }
.modeseg button { padding: 0 12px; font-size: 12.5px; }
.ftabs { margin: 0 12px 8px; }
.fswitch { padding: 4px 12px 8px; }
.fswitch b { font-weight: 700; }
.bp-hint { font-size: 11px; color: var(--faint); }
/* rows: one control, the round buttons beside the score (under it on narrow screens) */
@media (max-width: 760px) {
  .scorewrap { flex-direction: column; align-items: stretch; }
  .side { display: flex; flex-direction: row; justify-content: center; padding-top: 8px; }
}
.phone .scorewrap { flex-direction: column; align-items: stretch; }
.phone .side { display: flex; flex-direction: row; justify-content: center; gap: 10px; padding-top: 8px; }
/* phone: the mode switch, then Exercise, then Sound and Practice */
.phone .tb.second { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
.phone .modeseg { flex: 1 1 100%; height: 34px; }
.phone .modeseg button { flex: 1; font-size: 13px; }
.phone #focusBtn { flex: 1 1 100%; height: 40px; font-size: 14px; }
.phone #focusBtn .val { max-width: none; flex: 1; text-align: left; }
.phone #melBtn { flex: 1 1 0; min-width: 0; height: 36px; justify-content: flex-start; }
.phone #soundBtn, .phone #practiceBtn { flex: 1 1 0; min-width: 0; height: 36px; justify-content: flex-start; }
.phone :is(#soundBtn, #practiceBtn) .val { flex: 1; min-width: 0; }
@media (max-width: 1100px) { .tbtn.fold .val { max-width: 170px; } }

/* ===== The Focus button, the Melody switch and the context bar ===== */
.tbtn.focusb { padding-left: 4px; }
.tbtn.focusb .lb { font: 700 13.5px/1 var(--display); }
#melBtn.lit { background: color-mix(in srgb, var(--cat) 85%, #000); border-color: color-mix(in srgb, var(--cat) 85%, #000); color: #fff; box-shadow: none; }
#melBtn.lit svg, #melBtn.lit .val { color: #fff; }
html.pgmode #melBtn { display: none; }
.tb.ctx { padding: 0 0 8px; gap: 8px; align-items: stretch; }
.ctxg { --g: #2f6fdb; display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 3px 5px 3px 3px; border-radius: 10px;
  background: color-mix(in srgb, var(--g) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--g) 24%, var(--line)); }
.ctx-melody { --g: #8b45d6; } .ctx-listen { --g: #2f9e44; } .ctx-play { --g: #0b8a8a; }
.ctxg .rowlab { font: 700 9.5px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: color-mix(in srgb, var(--g) 75%, var(--text)); padding: 0 5px; white-space: nowrap; }
.ctx .tool { position: relative; height: 30px; padding: 0 9px; gap: 6px; font-size: 11.5px; --cat: #4a5568;
  background: color-mix(in oklab, var(--cat) 9%, var(--surface)); border-color: color-mix(in oklab, var(--cat) 40%, var(--line-strong)); box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--cat) 75%, transparent); }
.ctx .tool:hover { background: color-mix(in oklab, var(--cat) 15%, var(--surface)); }
.ctx .tool[aria-expanded="true"], .ctx .tool.on { background: color-mix(in oklab, var(--cat) 22%, var(--surface)); border-color: color-mix(in oklab, var(--cat) 80%, var(--line-strong)); }
.ctx .tool .lb { font-weight: 650; }
.ctx .tool .val { font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in srgb, var(--soft) 55%, var(--text)); }
.ctx .tool .ic svg { width: 15px; height: 15px; display: block; color: color-mix(in oklab, var(--cat) 82%, var(--text)); }
.ctx .tool .car { font-style: normal; font-size: 9px; opacity: .6; }
.ctx .tool .badge { min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: var(--dark); color: var(--dark-ink); font: 700 10px/15px var(--font); text-align: center; }
.ctx .tool .badge.nudge { background: #e8a200; color: #1d1600; }
.ctx .cat-write, .ctx .cat-focus { --cat: #2f6fdb; }
.ctx .cat-shape { --cat: #8b45d6; }
.ctx .cat-listen { --cat: #2f9e44; }
.ctx .cat-on { --cat: var(--c-on, #d9480f); } .ctx .cat-nu { --cat: var(--c-nu, #1971c2); } .ctx .cat-co { --cat: var(--c-co, #2b8a3e); }
.ctx .cat-plain { --cat: #6b7280; }
.ctx .tool.dim { opacity: .55; }
.ctx .seg { height: 30px; }
.ctx .stepper { height: 30px; }
.ctx .stepper button { width: 28px; }
.ctx .pg-seg button { padding: 0 7px; }
.phone .tb.ctx { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.phone .tb.ctx::-webkit-scrollbar { display: none; }
.phone .ctxg { flex: none; flex-wrap: nowrap; }
.phone .ctx .tool, .phone .ctx .seg, .phone .ctx .stepper { height: 34px; }

/* ===== Corner buttons (Click, Drone, Listen, Playground, Guide), the Studio tag, the ending steppers ===== */
#clickBtn { --cat: #e8590c; } #droneBtn { --cat: #0b8a8a; } #listenBtn { --cat: #2f9e44; } #pgBtn { --cat: #c2255c; }
.tbtn.cb { position: relative; gap: 6px; padding: 0 10px;
  background: color-mix(in srgb, var(--cat) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--cat) 34%, var(--line-strong));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--cat) 60%, transparent); }
.tbtn.cb:hover { background: color-mix(in srgb, var(--cat) 14%, var(--surface)); }
.tbtn.cb[aria-expanded="true"] { background: color-mix(in srgb, var(--cat) 20%, var(--surface)); border-color: color-mix(in srgb, var(--cat) 75%, var(--line-strong)); }
.tbtn.cb svg { color: color-mix(in srgb, var(--cat) 82%, var(--text)); }
.tbtn.cb .lb { font-weight: 650; }
.tbtn.cb.lit { background: color-mix(in srgb, var(--cat) 86%, #000); border-color: color-mix(in srgb, var(--cat) 86%, #000); color: #fff; box-shadow: none; }
.tbtn.cb.lit svg, .tbtn.cb.lit .val { color: #fff; }
.tbtn.cb .val { font-weight: 600; margin: 0; }
.tbtn.cb .val:empty { display: none; }
#clickBtn.ramp::after { content: ''; position: absolute; right: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #ffd43b; }
#guideBtn.cb.lit { background: color-mix(in srgb, var(--cat) 20%, var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--cat) 75%, var(--line-strong)); }
#guideBtn.cb.lit svg { color: color-mix(in srgb, var(--cat) 82%, var(--text)); }
@media (max-width: 1180px) { html:not(.phone) .tb:not(.second) .tbtn.cb:not(#guideBtn) .lb { display: none; } html:not(.phone) .tbtn.cb { padding: 0 8px; } }
.studio-tag { font: 800 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); background: none; border: 0; padding: 0 4px 0 2px; cursor: default; align-self: center; }
.studio-tag.back { cursor: pointer; color: var(--text); padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); letter-spacing: .08em; }
.studio-tag.back:hover { background: color-mix(in srgb, var(--text) 6%, var(--surface)); }
.ctx .stepper.lab { --cat: #2f6fdb; display: inline-flex; align-items: center; gap: 0; padding-left: 8px; border-radius: 8px;
  background: color-mix(in oklab, var(--cat) 9%, var(--surface)); border: 1px solid color-mix(in oklab, var(--cat) 40%, var(--line-strong)); box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--cat) 75%, transparent); }
.ctx .stepper.lab .slab { font: 650 11.5px var(--font); margin-right: 2px; white-space: nowrap; }
.ctx .stepper.lab .sval { min-width: 30px; text-align: center; font-size: 12px; }
.ctx .stepper.lab button { background: none; border: 0; }
.ctx .stepper.lab button:disabled { opacity: .3; }
.ctx .cat-sound { --cat: #d9822b; }
.phone .tb:not(.second):not(.ctx) { display: flex; justify-content: flex-end; gap: 6px; padding-bottom: 6px; }
.phone .tbtn.cb { flex: 1 1 auto; justify-content: center; height: 36px; min-width: 0; padding: 0 6px; gap: 4px; }
.phone .tbtn.cb .lb { display: inline; font-size: 11.5px; }
.phone .studio-tag:not(.back) { display: none; }
.phone .tb:not(.second):not(.ctx) > .grow { display: none; }
