:root{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif;color:#20372e;background:#f3f6f2;font-size:16px;--green:#196b55;--line:#d9e2dc;--muted:#52675b}
*{box-sizing:border-box}body{margin:0}button,select,input{font:inherit}button,a,select{touch-action:manipulation}button{cursor:pointer;min-height:44px;border:1px solid var(--line);background:#fff;color:inherit;border-radius:10px;padding:8px 12px}button:disabled{opacity:.55;cursor:default}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #b1782b;outline-offset:2px}
main{max-width:680px;margin:auto;min-height:100dvh;display:flex;flex-direction:column;background:#fff}
header{display:flex;align-items:center;gap:10px;padding:8px 14px;border-bottom:1px solid var(--line)}header a{display:grid;place-items:center;font-size:30px;text-decoration:none;color:var(--green);width:44px;height:44px}h1{font-size:20px;margin:0;line-height:1.3}header small{display:none}header button{margin-left:auto;width:44px;padding:9px}svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.8}
nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:8px 14px}nav button{padding:8px 2px;font-size:15px}button[aria-pressed=true]{background:var(--green);color:#fff;border-color:var(--green)}
.session{padding:2px 16px 8px;color:var(--muted);font-size:13px}.session>div{display:flex;justify-content:space-between;gap:8px}.answers{flex:1;padding:4px 14px 10px;display:flex;flex-direction:column;justify-content:center;overflow:visible}.choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.choices button{text-align:left;min-height:54px;padding:6px 12px}.choices b{display:block;font-size:19px;font-weight:650;line-height:1.2}.choices small{display:block;font-size:12px;line-height:1.35;color:var(--muted);margin-top:3px;letter-spacing:0}.choices button:disabled{opacity:.72}.choices button.correct{background:#e4f4e9;border:2px solid var(--green)}.choices button.wrong{background:#fff0e9;border:2px solid #a64328}.choices button:disabled.correct,.choices button:disabled.wrong{opacity:1}
.roots{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--line)}.roots:empty{display:none}.roots button{padding:6px 0}.roots button[aria-pressed=true]{font-weight:700}main[data-mode=C] .choices{grid-template-columns:repeat(3,minmax(0,1fr))}main[data-mode=C] .choices button{padding:5px 7px;min-height:48px}main[data-mode=C] .choices b{font-size:17px}main[data-mode=C] .choices small{font-size:12px}
#reveal{padding:6px 14px;background:#f1f6f2;border-top:1px solid var(--line);flex-shrink:0}.feedback-heading{display:flex;align-items:baseline;justify-content:space-between;gap:8px;min-height:21px}.feedback-heading strong{font-size:14px;line-height:1.4}.feedback-heading p{margin:0;font-size:12px;color:var(--muted);text-align:right}#keyboard svg{display:block;width:100%;height:48px;stroke-width:.6;stroke:#819489;fill:none}.white-key{fill:#fff}.black-key{fill:#24372e}.active-key.correct{fill:#238565}.active-key.wrong{fill:#a9442e}.bass-key{fill:#b57b28}.key-dot{fill:#fff;stroke:none}.keyboard-legend{display:flex;justify-content:center;gap:18px;font-size:12px;color:var(--muted);margin-top:3px}.keyboard-legend span{display:flex;align-items:center;gap:5px}.keyboard-legend i{width:8px;height:8px;border-radius:2px}.bass-swatch{background:#b57b28}.chord-swatch{background:#238565}#keyboard[data-kind=wrong]+.keyboard-legend .chord-swatch{background:#a9442e}
footer{padding:8px 14px max(8px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}.transport{display:flex;gap:8px}.primary{background:var(--green);border-color:var(--green);color:#fff;flex:1;font-weight:600}#stop{min-width:76px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.visible-status{position:static;width:auto;height:auto;clip-path:none;white-space:normal;font-size:14px;margin:0 0 8px;color:#914024}
dialog{width:min(94vw,520px);max-height:90dvh;border:1px solid var(--line);border-radius:18px;padding:0;color:inherit}dialog::backdrop{background:#10281e88}dialog h2{font-size:20px;margin:0}.fields{padding:18px}.fields label{display:block;margin-bottom:16px;line-height:1.7}.fields select,.fields input{display:block;width:100%;min-height:46px;margin-top:6px;border:1px solid var(--line);border-radius:8px;padding:8px;background:white}.fields p{color:var(--muted);font-size:14px;line-height:1.6}.fields input{padding:0}[hidden]{display:none!important}
@media(min-width:700px){.answers{padding:12px 24px}.choices button{min-height:66px}.choices b{font-size:22px}header,nav{padding-left:24px;padding-right:24px}}
main[data-mode=C] .choices{grid-template-columns:repeat(4,minmax(0,1fr))}main[data-mode=C] .choices button{min-height:44px;padding:6px 4px;text-align:center}main[data-mode=C] .choices b{font-size:16px;line-height:1.2}main[data-mode=C] .choices small{display:none}
@media(max-width:359px){main[data-mode=C] .choices{grid-template-columns:repeat(3,minmax(0,1fr))}}
nav{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}nav button{font-size:14px}#custom-edit{margin:0 14px 8px;text-align:left;color:var(--green);background:#f1f6f2}main[data-mode=custom] .choices{grid-template-columns:repeat(3,minmax(0,1fr))}main[data-mode=custom] .choices button{padding:7px;overflow-wrap:anywhere}main[data-mode=custom] .choices b{font-size:17px}main[data-mode=custom] .choices small{font-size:12px}
#custom-dialog[open]{display:flex;flex-direction:column;max-height:90dvh;width:min(94vw,640px)}#custom-dialog>form{flex-shrink:0}.custom-tools{padding:10px 16px;border-bottom:1px solid var(--line)}.custom-tools input{width:100%;min-height:44px;font-size:16px;padding:8px 10px;border:1px solid var(--line);border-radius:8px}.custom-tools p{font-size:12px;color:var(--muted);line-height:1.4;margin:6px 0 0}.custom-actions{display:flex;gap:8px;margin-top:8px}.custom-actions button{flex:1;padding:6px}.custom-groups{overflow:auto;min-height:0;padding:0 16px 14px;overscroll-behavior:contain}.custom-groups summary{padding:14px 0 8px;font-weight:600;min-height:44px}.custom-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.custom-grid label{display:flex;align-items:center;gap:7px;padding:8px;border:1px solid var(--line);border-radius:8px;min-height:54px;cursor:pointer}.custom-grid label:has(input:checked){border-color:var(--green);background:#edf5ef}.custom-grid input{accent-color:var(--green);width:18px;height:18px;flex-shrink:0}.custom-grid b{font-size:16px;overflow-wrap:anywhere}.custom-grid small{display:block;font-size:12px;color:var(--muted);line-height:1.4}.custom-footer{display:flex;align-items:center;gap:12px;flex-shrink:0}.custom-footer span{font-size:14px}
nav{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.tonal-kind{display:flex;gap:8px;padding:0 14px 8px}.tonal-kind button{flex:1;font-size:15px}
main[data-mode=II] .choices{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px 8px}
main[data-mode=II] .choices button{min-height:44px;padding:5px 8px}
main[data-mode=II] .choices b{font-size:18px}
main[data-mode=II] .choices small{font-size:12px;margin-top:1px}
@media(min-width:700px){nav{grid-template-columns:repeat(6,minmax(0,1fr))}.tonal-kind{padding-left:24px;padding-right:24px}}
