/* mtk.css - shared styles for the music tools (assets/music/tools/mtk.js). Site tokens only (brainlag.css): light and
   dark come from the tokens. Every control is at least 44 px. */
.mt-panel{padding:22px 24px 24px}
@media (max-width:600px){.mt-panel{padding:16px 14px 18px}}
.mt-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:22px 36px}
@media (min-width:900px){.mt-grid{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}}
.mt-h2{font-size:17px;margin:0 0 12px}
.mt-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:0 0 14px}
.mt-row label{margin:0;font-size:14.5px;font-weight:600}
.mt-row select,.mt-row input[type="number"],.mt-row input[type="text"]{min-height:44px}
.mt-row input[type="number"]{width:7ch;flex:none;text-align:center}
.mt-row select{width:auto;max-width:100%;background-color:var(--surface);border:2px solid var(--rule-2);border-radius:var(--r1);padding-block:9px;padding-inline-start:14px;color:var(--ink)}   /* the site's .select look */
.mt-row select:focus{border-color:var(--blue)}
.mt-note{margin:8px 0 0;font-size:14px;color:var(--ink-3)}
.mt-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.mt-big{font:700 clamp(56px,14vw,96px)/1 var(--f-display);color:var(--ink);font-variant-numeric:tabular-nums;letter-spacing:-.02em;text-align:center}
.mt-sub{text-align:center;font:600 18px var(--f-display);color:var(--study-ink);min-height:1.3em;margin:6px 0 0}
.mt-btn{min-height:52px;font-size:17px;border-radius:14px}   /* tuner and drone (batch 5) */
/* the shell's two button styles (_shell.php, the race card's .pl-go and .pl-link) and its chips (.pl-levels):
   one primary per screen, secondary actions as text links, choices as radiogroup tiles. Press feedback is a
   transform only, 180 ms, off under reduced motion. */
.mt-go{display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:58px;padding:0 24px;border:0;border-radius:18px;background:var(--study-btn);color:var(--on-study-btn,#fff);font:800 19px var(--f-body);text-decoration:none;cursor:pointer;touch-action:manipulation;box-shadow:0 3px 0 var(--study-btn-lip);transition:transform .12s cubic-bezier(.22,1,.36,1),box-shadow .12s}
:root[data-theme="dark"] .mt-go{color:var(--on-study-btn,#fff)}
.mt-go:hover{background:var(--study-btn-hover);color:var(--on-study-btn,#fff);text-decoration:none}
.mt-go:active{transform:translateY(2px);background:var(--study-btn-press);box-shadow:0 1px 0 var(--study-btn-lip)}
.mt-go:disabled,.mt-go[aria-disabled="true"]{background:var(--sunk);color:var(--ink-3);cursor:default;transform:none}
:root[data-theme="dark"] :is(.mt-go:disabled,.mt-go[aria-disabled="true"]){background:#1a2c44;color:var(--ink-3)}   /* a raised tile, never a hole in the card */
.mt-go:focus-visible{outline:3px solid var(--study-ink);outline-offset:3px}
@media (min-width:600px){.mt-go{width:auto;min-width:220px}}
.mt-link{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:7px 16px;border:2px solid var(--rule-2);border-radius:var(--pill);background:var(--surface);color:var(--ink);font:700 16px var(--f-body);text-decoration:none;cursor:pointer;touch-action:manipulation}   /* an action is a button, as the metronome's (house rules, triage 282: not underlined text) */
.mt-link:hover{border-color:rgba(var(--ink-rgb),.35)}
.mt-link:active{transform:scale(.97)}
.mt-link:disabled{color:var(--ink-3);background:var(--sunk);cursor:default;transform:none}
.mt-link:focus-visible{outline:2px solid var(--study-ink);outline-offset:2px;border-radius:8px}
.mt-acts{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin:16px 0 0}
.mt-chips{display:flex;flex-wrap:wrap;gap:6px}
.mt-chips button,.mt-chip{min-height:44px;min-width:44px;padding:0 12px;border:2px solid transparent;border-radius:12px;background:var(--sunk);color:var(--ink-2);font:700 15px var(--f-body);cursor:pointer;touch-action:manipulation;transition:transform .18s cubic-bezier(.22,1,.36,1)}
:root[data-theme="dark"] .mt-chips button,:root[data-theme="dark"] .mt-chip{background:#1a2c44}
.mt-chips button:hover,.mt-chip:hover{color:var(--ink);border-color:var(--rule-2)}
.mt-chips button:active,.mt-chip:active{transform:scale(.97)}
.mt-chips button:is([aria-checked="true"],[aria-pressed="true"]),:root[data-theme="dark"] .mt-chips button:is([aria-checked="true"],[aria-pressed="true"]){background:var(--surface);border-color:var(--study);color:var(--study-ink);box-shadow:var(--shadow)}
.mt-chips button:focus-visible,.mt-chip:focus-visible{outline:2px solid var(--study-ink);outline-offset:2px}
/* a secondary action with an icon (Hear it, Play one note at a time): a real button, an outlined tile, never a text link */
.mt-play{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:54px;padding:0 24px 0 20px;border:2px solid var(--study);border-radius:var(--r2);background:var(--surface);color:var(--study-ink);font:800 17px var(--f-body);cursor:pointer;touch-action:manipulation;box-shadow:0 3px 0 var(--study);transition:transform .12s cubic-bezier(.22,1,.36,1),box-shadow .12s,background-color .15s}
.mt-play:hover{background:var(--study-tint);color:var(--ink)}
.mt-play:active{transform:translateY(2px);box-shadow:0 1px 0 var(--study)}
.mt-play[aria-pressed="true"]{background:var(--study-tint);box-shadow:inset 0 0 0 1px var(--study)}
.mt-play:disabled{border-color:var(--rule-2);color:var(--ink-3);background:var(--sunk);cursor:default;transform:none}
.mt-play:focus-visible{outline:3px solid var(--study-ink);outline-offset:3px}
.mt-play svg{flex:none}
.mt-play[hidden]{display:none}
/* a round icon button (swap): 46 px tap area */
.mt-icon{display:inline-grid;place-items:center;width:56px;height:56px;border:2px solid var(--study);border-radius:50%;background:var(--surface);color:var(--study-ink);cursor:pointer;vertical-align:middle;touch-action:manipulation;box-shadow:0 3px 0 var(--study);transition:transform .12s cubic-bezier(.22,1,.36,1),box-shadow .12s}
.mt-icon:hover{border-color:var(--study);color:var(--ink)}
.mt-icon:active{transform:translateY(2px);box-shadow:0 1px 0 var(--study)}
.mt-icon:focus-visible{outline:3px solid var(--study-ink);outline-offset:3px}
/* on the white music paper (the transposer's Sounds/Written card) the round button keeps its light look in both themes
   (owner, 28 Oct: "no need for dark mode button here since it's on light bg"): the light theme's own values */
.mt-paper .mt-icon,:root[data-theme="dark"] .mt-paper .mt-icon{background:#fff;border-color:#0d9aa7;color:#08707a;box-shadow:0 3px 0 #0d9aa7}
.mt-paper .mt-icon:hover,:root[data-theme="dark"] .mt-paper .mt-icon:hover{background:#dcf3f2;color:#14243a}
.mt-paper .mt-icon:active{box-shadow:0 1px 0 #0d9aa7}
.mt-paper .mt-icon:focus-visible{outline-color:#08707a}
/* the chunky tile (v3): every choice is a big friendly key you press, with a lip under it like a piano key; the chosen one is
   filled in the accent colour. Choices are radio tiles (K.radios), so the arrow keys and the screen reader work as before. */
.mt-sec{margin:0 0 24px}   /* v4 spacing: 24 between sections, 12 under a heading and between a section's controls */
.mt-sec > h3,.mt-sec > .mt-h3{display:block;margin:0 0 12px;font:700 18px/1.3 var(--f-display);color:var(--ink)}
.mt-sec > label.mt-h2{display:block}
.mt-tiles{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(var(--tw,64px),1fr))}
.mt-tile{display:inline-flex;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:58px;min-width:58px;padding:8px 12px;border:2px solid var(--rule-2);border-radius:var(--r2);background:var(--surface);color:var(--ink);font:700 18px/1.2 var(--f-body);text-align:center;cursor:pointer;touch-action:manipulation;box-shadow:0 3px 0 var(--rule-2);transition:transform .12s cubic-bezier(.22,1,.36,1),box-shadow .12s,background-color .15s,border-color .15s}
.mt-tile small{display:block;font:600 14px/1.3 var(--f-body);color:var(--ink-3)}
.mt-tile:hover{border-color:var(--study)}
.mt-tile:active{transform:translateY(2px);box-shadow:0 1px 0 var(--rule-2)}
.mt-tile:focus-visible{outline:3px solid var(--study-ink);outline-offset:3px}
.mt-tile[aria-checked="true"],:root[data-theme="dark"] .mt-tile[aria-checked="true"]{background:var(--study-btn);border-color:var(--study-btn);color:var(--on-study-btn,#fff);box-shadow:0 3px 0 var(--study-btn-lip)}
.mt-tile[aria-checked="true"] small{color:rgba(255,255,255,.86)}
.mt-tile.lg{font:700 clamp(21px,2.4vw,26px)/1.1 var(--f-display);min-height:64px}
.mt-tile.wide{padding:10px 14px}
.mt-tile.lg .mn-acc{font-size:1.55em;vertical-align:-.08em;margin:0}
.mt-tile.lg .mn-acc.sh,.mt-tile.lg .mn-acc.na{font-size:1.45em;vertical-align:-.02em}
.mt-tile.lg .mn-acc.dsh,.mt-tile.lg .mn-acc.dfl{font-size:1.5em;vertical-align:-.05em}
.mt-tiles.r7{grid-template-columns:repeat(7,minmax(0,1fr))}
.mt-tiles.r5{grid-template-columns:repeat(5,minmax(0,1fr))}
@media (min-width:760px){.mt-tiles.r15{grid-template-columns:repeat(15,minmax(0,1fr))}}
.mt-tiles.r15{grid-template-columns:repeat(5,minmax(0,1fr))}
.mt-tiles.k3{--tw:96px}.mt-tiles.k5{--tw:72px}.mt-tiles.k8{--tw:60px}.mt-tiles.wide{--tw:200px}.mt-tiles.mid{--tw:150px}
@media (max-width:520px){.mt-tiles{gap:8px}.mt-tiles.k8{--tw:48px}.mt-tiles.k5{--tw:56px}.mt-tiles.wide{--tw:calc(50% - 4px)}.mt-tiles.mid{--tw:calc(50% - 4px)}.mt-tile{padding:8px 4px;min-width:0}.mt-tiles.r7,.mt-tiles.r5{gap:4px}.mt-tiles.r7 .mt-tile,.mt-tiles.r5 .mt-tile{min-width:0;padding-left:2px;padding-right:2px}}
/* v4 (owner 28 Oct: "overlapping, too compact on mobile, simplify"): fewer, calmer controls.
   The seven letters: one row where they fit at 44 px or more with 8 px gaps, else two rows (4 and 3, the 3 centred). */
.mt-letters{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
.mt-letters .mt-tile{min-width:0;padding:8px 4px}
@media (max-width:600px){.mt-letters{grid-template-columns:repeat(8,minmax(0,1fr));gap:12px 8px}.mt-letters .mt-tile{grid-column:span 2}.mt-letters .mt-tile:nth-child(5){grid-column:2 / span 2}}
/* two equal columns with even heights (the instruments) */
.mt-tiles.mt-two{grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr));grid-auto-rows:1fr;gap:8px}
@media (max-width:600px){.mt-tiles.mt-two{grid-template-columns:repeat(2,minmax(0,1fr))}.mt-tiles.mt-two .mt-tile{font-size:16.5px}}
.mt-tiles.mt-two .mt-tile{padding:10px 8px;min-height:64px}
.mt-tiles.mt-two .mt-tile small{font-size:13.5px}
/* a segmented control: one tray, the choices share its width, the chosen one filled; for 2 to 5 short choices */
.mt-seg{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:4px;padding:4px;border-radius:var(--r2);background:var(--sunk);box-shadow:inset 0 0 0 1.5px var(--rule)}
:root[data-theme="dark"] .mt-seg{background:#1a2c44}
.mt-seg button{min-height:48px;min-width:0;padding:0 6px;border:0;border-radius:14px;background:transparent;color:var(--ink-2);font:700 16px/1.2 var(--f-body);cursor:pointer;touch-action:manipulation;transition:background-color .15s,color .15s,transform .12s cubic-bezier(.22,1,.36,1)}
.mt-seg button:hover{color:var(--ink);background:var(--surface)}
.mt-seg button:active{transform:scale(.97)}
.mt-seg button[aria-checked="true"]{background:var(--study-btn);color:var(--on-study-btn,#fff)}
.mt-seg button:focus-visible{outline:3px solid var(--study-ink);outline-offset:1px}
.mt-seg button[data-a]{font:700 24px/1 var(--f-display)}
.mt-seg .mn-acc{font-size:1.5em;vertical-align:-.08em;margin:0;line-height:1}
/* a stepper: minus, the value, plus */
.mt-step{display:grid;grid-template-columns:52px minmax(0,1fr) 52px;align-items:center;gap:8px;padding:4px;border-radius:var(--r2);background:var(--sunk);box-shadow:inset 0 0 0 1.5px var(--rule)}
:root[data-theme="dark"] .mt-step{background:#1a2c44}
.mt-step button{display:grid;place-items:center;height:48px;border:2px solid var(--rule-2);border-radius:14px;background:var(--surface);color:var(--study-ink);cursor:pointer;touch-action:manipulation;transition:transform .12s cubic-bezier(.22,1,.36,1)}
.mt-step button:hover{border-color:var(--study)}
.mt-step button:active{transform:scale(.96)}
.mt-step button:disabled{color:var(--ink-3);opacity:.5;cursor:default;transform:none}
.mt-step button:focus-visible{outline:3px solid var(--study-ink);outline-offset:2px}
.mt-step output{text-align:center;font:700 17px/1.2 var(--f-body);color:var(--ink);font-variant-numeric:tabular-nums}
/* a list (the key, the scale or chord type): the site's .select look, full width, a thumb tall */
.mt-select{display:block;width:100%;min-height:52px;background-color:var(--surface);border:2px solid var(--rule-2);border-radius:var(--r1);padding:10px 14px;color:var(--ink);font:600 17px var(--f-body);cursor:pointer}
.mt-select:focus{border-color:var(--blue);outline:none}
.mt-select:focus-visible{outline:3px solid var(--study-ink);outline-offset:2px}
/* the paper: one big sheet of white paper with soft corners for the music, the same in both themes */
.mt-paper{background:#fff;color:#14243a;border-radius:var(--r3);box-shadow:var(--shadow),inset 0 0 0 1.5px rgba(20,36,58,.1)}
/* the keyboard: real buttons; it scrolls sideways on a narrow screen so no key is under 44 px */
.mtk-kb-scroll{overflow-x:auto;overscroll-behavior-x:contain;padding:2px 0 8px;-webkit-overflow-scrolling:touch}
.mtk-kb{position:relative;display:grid;grid-template-columns:repeat(var(--whites),minmax(44px,1fr));height:168px;min-width:calc(var(--whites) * 44px)}
.mtk-key{border:0;padding:0;margin:0;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;font:inherit}
.mtk-key.wht{grid-row:1;grid-column:calc(var(--i) + 1);background:#fff;border:1.5px solid #9fb0c4;border-radius:0 0 10px 10px;position:relative;display:flex;align-items:flex-end;justify-content:center;padding-bottom:8px;color:#5b6b80}
/* a black key keeps a piano's width (about 0.62 of a white key) but its button is at least 44 px wide: 7 px of
   transparent border each side (and below) are part of the hit area, the key is drawn in the padding box. Each white
   key still has its whole lower part, 44 px wide and 64 px tall, to itself. */
.mtk-key.blk{position:absolute;top:0;z-index:2;height:calc(62% + 7px);width:max(44px,calc(100% / var(--whites) * .62 + 14px));left:calc(100% / var(--whites) * var(--at) - max(22px,calc(100% / var(--whites) * .31 + 7px)));
  background:#1d2a3c;background-clip:padding-box;border:7px solid transparent;border-top:0;border-radius:0 0 15px 15px;box-shadow:inset 0 0 0 1.5px #0e1622}
.mtk-key.wht.on,.mtk-key.wht.hit{background:var(--study-tint);border-color:var(--study)}
.mtk-key.blk.on,.mtk-key.blk.hit{background:var(--study);background-clip:padding-box;box-shadow:inset 0 0 0 1.5px var(--study-ink)}
/* a marked key (in the scale, the drone's note): a fill and a full outline, never an edge bar */
.mtk-key.wht.in{background:var(--study-tint);box-shadow:inset 0 0 0 2px var(--study)}
.mtk-key.blk.in{background:var(--study);background-clip:padding-box;box-shadow:inset 0 0 0 2px var(--study-tint)}
.mtk-key:focus-visible{outline:3px solid var(--blue);outline-offset:-3px;z-index:3}
.mtk-c{font:700 12px var(--f-body);pointer-events:none}
/* the computer key that plays each piano key (keyHints): shown only while the pointer is over the keyboard */
.mtk-kh{position:absolute;left:0;right:0;bottom:26px;text-align:center;font:600 12px var(--f-mono,ui-monospace,Menlo,monospace);color:var(--ink-3);opacity:0;transition:opacity .16s cubic-bezier(.22,1,.36,1);pointer-events:none}
.mtk-key.blk .mtk-kh{bottom:13px;color:#c9d6e6}
.mtk-kb:hover .mtk-kh,.mtk-kb:focus-within .mtk-kh{opacity:1}
.mtk-kb-scroll{direction:ltr}
:root[data-theme="dark"] .mtk-key.wht{background:#e9eef5;border-color:#3d4f68}
/* the fitted keyboard (scales and chords): the keys share the panel's width, so there is no scrollbar and no key is cut off.
   A key in the scale is filled in the accent colour with its note name on it, the same for white keys and black; while it
   sounds it presses in a little. A tapped key keeps no focus ring (the arrow keys still show one). */
.mtk-fit{overflow:visible;padding:2px 0 4px}
.mtk-fit .mtk-kb{grid-template-columns:repeat(var(--whites),minmax(0,1fr));min-width:0;height:clamp(116px,22vw,170px)}
.mtk-fit .mtk-key.wht{border-radius:0 0 8px 8px;padding-bottom:6px;transition:transform .12s ease-out,background-color .12s,filter .12s;transform-origin:50% 0}
.mtk-fit .mtk-key.blk{border:0;background-clip:border-box;width:calc(100% / var(--whites) * .62);left:calc(100% / var(--whites) * (var(--at) - .31));height:62%;border-radius:0 0 6px 6px;box-shadow:none;display:flex;align-items:flex-end;justify-content:center;padding:0 0 5px;transition:transform .12s ease-out,background-color .12s,filter .12s;transform-origin:50% 0}
.mtk-fit .mtk-key.wht.in,.mtk-fit .mtk-key.wht.on,.mtk-fit .mtk-key.wht.hit{background:var(--study-btn,#0f7f8b);border-color:rgba(255,255,255,.75);box-shadow:none}   /* a pale seam between neighbouring keys, so each is its own key */
.mtk-fit .mtk-key.blk.in,.mtk-fit .mtk-key.blk.on,.mtk-fit .mtk-key.blk.hit{background:var(--study-btn,#0f7f8b);box-shadow:none}
.mtk-fit .mtk-key.in .mtk-c,.mtk-fit .mtk-key.named .mtk-c{display:none}
.mtk-nm{font:800 clamp(10px,1.2vw + 5px,15px)/1 var(--f-body);color:#fff;pointer-events:none;letter-spacing:0}
.mtk-fit .mtk-key.on{transform:translateY(3px) scaleY(.985);filter:brightness(1.18)}
.mtk-fit .mtk-key.hit:not(.on){transform:translateY(2px)}
:root[data-theme="dark"] .mtk-fit .mtk-key.wht.in,:root[data-theme="dark"] .mtk-fit .mtk-key.wht.on,:root[data-theme="dark"] .mtk-fit .mtk-key.wht.hit{background:var(--study-btn,#0f7f8b)}
/* stave sheets: white paper with ink in both themes (as music pages) */
.mt-sheet{background:#fff;border-radius:14px;padding:6px 8px;min-height:120px;color:#14243a}
@media (prefers-reduced-motion:reduce){.mtk-fit .mtk-key.on,.mtk-fit .mtk-key.hit:not(.on){transform:none}.mtk-fit .mtk-key{transition:none}.mtk-key,.mtk-kh,.mt-go,.mt-link,.mt-chips button,.mt-chip,.mt-play,.mt-icon,.mt-tile,.mt-seg button,.mt-step button{transition:none}.mt-go:active,.mt-link:active,.mt-chips button:active,.mt-chip:active,.mt-play:active,.mt-icon:active,.mt-tile:active,.mt-seg button:active,.mt-step button:active{transform:none}}
