:root{color-scheme:dark;--orange:#ff873a;--cyan:#69d3d3;--purple:#cda5fa;--line:#454545;--muted:#aaa}*{box-sizing:border-box}body{margin:0;background:#101010;color:#f1eee9;font-family:Arial,Helvetica,sans-serif;font-size:16px;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}main{max-width:1040px;margin:auto;padding:20px 16px 24px;background:linear-gradient(115deg,#252525,#191919 65%);min-height:100dvh}header{display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:2px solid var(--orange);padding-bottom:16px}h1{font-size:30px;letter-spacing:-1px;margin:0}h1 span{font-size:14px;letter-spacing:2px;color:var(--orange);display:inline-block}header p{font-size:12px;letter-spacing:1px;color:var(--muted);margin:6px 0 0}.badge{font-size:12px;border:1px solid #555;padding:6px;white-space:nowrap}button,select,input{font:inherit}button,select,input[type=number]{background:#303030;color:white;border:1px solid #666;border-radius:3px;min-height:44px;padding:8px}button{cursor:pointer;touch-action:manipulation}button:active{transform:translateY(1px)}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}button:disabled{opacity:.45;cursor:default}label{font-size:12px;letter-spacing:1px;color:#c8c8c8}select{max-width:100%;font-size:16px}input[type=number]{width:74px}input[type=range]{width:100%;accent-color:var(--orange);min-height:34px}.topbar{display:flex;align-items:end;gap:12px;padding:18px 0}.topbar label{display:flex;gap:5px;align-items:center}.topbar button{margin-left:auto;font-size:14px}.tempo span{font-size:12px;color:var(--muted)}section{border:1px solid var(--line);border-radius:3px;padding:12px;background:#1b1b1b}.section-title{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.section-title h2{font-size:12px;letter-spacing:1.5px;margin:0;color:#ded9d2}.section-title>span{font-size:12px;color:var(--muted)}.steps{display:grid;grid-template-columns:repeat(16,minmax(0,1fr));gap:5px}.step{position:relative;padding:0 0 8px;min-width:0;background:linear-gradient(#3a3a3a,#292929);border:1px solid #555;min-height:104px}.step strong{font-size:15px;display:block;margin-top:13px}.step .count{display:block;font-size:12px;color:#aaa;padding:6px 0;background:#222}.step .n{display:block;font-size:12px;color:#aaa;margin-top:4px}.step .lights{display:flex;justify-content:center;gap:5px;margin-top:10px}.lights i,.legend i{display:inline-block;width:5px;height:5px;border-radius:50%;background:#555}.lights .on.ac,.orange{background:var(--orange)!important}.lights .on.sl,.cyan{background:var(--cyan)!important}.lights .on.ti,.purple{background:var(--purple)!important}.step.selected{border-color:var(--orange);box-shadow:inset 0 -3px var(--orange)}.step.playing{background:#6c4429}.step.playing .count{background:var(--orange);color:#171717}.step:nth-child(4n+1) .count{color:var(--orange);font-weight:bold}.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:#aaa;margin-top:12px}.legend span{display:flex;gap:5px;align-items:center}.sequencer{margin-top:12px}.scope-panel{margin-top:0;background:#141817}canvas{display:block;width:100%;height:100px;background:repeating-linear-gradient(90deg,transparent 0,transparent calc(6.25% - 1px),#26312c calc(6.25% - 1px),#26312c 6.25%)}.beat-ruler{display:grid;grid-template-columns:repeat(4,1fr);font:12px monospace;color:#999;margin-top:5px}.lower{display:grid;grid-template-columns:1fr 1.3fr;gap:12px;margin-top:12px}.note-controls{display:flex;align-items:end;gap:8px}.note-controls label{display:flex;flex-direction:column;gap:5px}.note-controls button{width:44px;font-size:24px}.note-controls #prev{margin-left:auto}.flags{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:12px}.flags button{font-size:21px;background:#343434}.flags span{display:block;font-size:12px;margin-top:3px}.flags .active{border-color:var(--orange);color:var(--orange);background:#4a3020}#slide.active{border-color:var(--cyan);color:var(--cyan);background:#213c3c}#tie.active{border-color:var(--purple);color:var(--purple);background:#372941}.keyboard-panel{display:none}.keyboard{height:132px;position:relative;display:flex;gap:4px}.key.white{flex:1;min-width:0;background:linear-gradient(#e9e5df,#aaa7a2);color:#252525;padding-top:94px;border:1px solid #777;font-size:13px}.key.black{position:absolute;top:0;width:8.4%;height:80px;z-index:1;background:linear-gradient(#444,#111);color:#ddd;padding-top:43px;border:1px solid #666;font-size:12px}.key.chosen{border-bottom:5px solid var(--orange);color:#cf5c19}.key.black.chosen{color:var(--orange)}.live{display:flex;align-items:center;gap:4px;font-size:12px;letter-spacing:0}.sound{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-top:12px}.transport{display:flex;gap:10px;margin-top:16px}.transport button{flex:1;min-height:50px;font-size:15px}.primary{background:var(--orange);color:#1c1c1c;border-color:var(--orange);font-weight:bold}small{font-size:12px;display:block}.foot{display:flex;justify-content:space-between;gap:10px;font-size:13px;color:#aaa;margin-top:13px;line-height:1.5}.rotate-hint{color:#d8b591}details{margin-top:18px;font-size:14px;color:#aaa;line-height:1.6}summary{cursor:pointer}details p{max-width:750px}@media(orientation:portrait){.steps{grid-template-columns:repeat(8,minmax(0,1fr))}.lower{grid-template-columns:1fr}.topbar{gap:6px;flex-wrap:wrap}.topbar label{flex-direction:column;align-items:start}.topbar button{align-self:end}.tempo span{display:none}.step{min-height:88px}.step strong{margin-top:7px}.step .lights{margin-top:6px}.foot{flex-direction:column;gap:2px}.sound{gap:9px}.section-title{flex-wrap:wrap}h1 span{display:block;margin-top:4px}.step .n{font-size:12px}}
@media(orientation:landscape){.keyboard-panel{display:block}.rotate-hint{display:none}}@media(orientation:landscape) and (max-height:540px){main{padding:10px 16px}header{padding-bottom:8px}header p{display:none}h1{font-size:24px}.topbar{padding:9px 0}.step{min-height:84px}.step strong{margin-top:7px}canvas{height:65px}.lower{grid-template-columns:.85fr 1.2fr}.sound{padding:7px 12px}.keyboard{height:122px}.key.white{padding-top:84px}.transport{margin-top:10px}.section-title{margin-bottom:8px}}

.audio-enable{font-size:14px;margin:0 0 10px;border-color:var(--orange);color:var(--orange)}.audio-enable.ready{border-color:#555;color:#bbb}.scope-caption{display:flex;justify-content:space-between;margin-top:6px;font:12px monospace;color:#8aab98}canvas{background:repeating-linear-gradient(0deg,transparent 0,transparent calc(25% - 1px),#26312c calc(25% - 1px),#26312c 25%),repeating-linear-gradient(90deg,transparent 0,transparent calc(6.25% - 1px),#26312c calc(6.25% - 1px),#26312c 6.25%)}.key.held{box-shadow:inset 0 -6px var(--orange);color:var(--orange)}
/* TDBuilder: tactile tempo control and a viewport-sized landscape instrument. */
h1 span{font-size:inherit;letter-spacing:-1px;display:inline-block;margin:0}h1{white-space:nowrap}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.topbar{align-items:center}.topbar #save{margin-left:auto}.topbar #help{margin-left:0;min-width:44px}
.tempo{display:flex;align-items:center;gap:8px}.tempo-label{font-size:12px;letter-spacing:1px;color:#c8c8c8}.tempo-value{display:flex;align-items:center;gap:4px}.tempo-value span{font-size:12px;color:#aaa}.tempo-adjust{display:flex;gap:4px}.tempo-adjust button{width:40px;font-size:22px;padding:0}.tempo-knob{--knob-angle:-16.2deg;position:relative;flex-shrink:0;width:54px;height:54px;min-height:54px;padding:5px;border:1px solid #888;border-radius:50%;background:repeating-conic-gradient(#555 0deg 3deg,#242424 3deg 12deg);box-shadow:0 3px 6px #000;touch-action:none}.tempo-knob:active{transform:none}.knob-cap{position:relative;display:block;width:100%;height:100%;border-radius:50%;border:1px solid #777;background:radial-gradient(circle at 40% 28%,#555,#272727 65%,#101010);transform:rotate(var(--knob-angle))}.knob-cap i{display:block;position:absolute;top:3px;left:calc(50% - 2px);height:14px;width:4px;border-radius:1px;background:#eee;box-shadow:0 0 2px #000}
#bpm{font-size:16px;width:65px;padding:6px;-moz-appearance:textfield}#bpm::-webkit-inner-spin-button,#bpm::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
dialog{background:#222;color:#ddd;border:1px solid #666;border-radius:6px;width:min(600px,calc(100% - 24px));max-height:85dvh;padding:18px;font-size:16px;line-height:1.6}dialog::backdrop{background:#000b}.help-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.help-heading h2{font-size:18px;margin:0}.help-heading button{min-width:44px}dialog p{margin:14px 0}
@media(orientation:portrait){.topbar{flex-wrap:wrap;gap:10px}.tempo{margin-left:auto}.tempo-label{display:none}.tempo-value{flex-direction:column;gap:2px}.tempo-value span{display:block}.tempo-adjust{flex-direction:column}.tempo-adjust button{min-height:26px;height:26px;width:32px;font-size:20px}.topbar #save{margin-left:0;flex:1}.topbar #help{flex:none}h1 span{display:inline-block;margin:0}}
@media(orientation:landscape) and (max-height:540px){
 body{height:100dvh}main{height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0;max-width:1200px;padding:6px 10px;display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);grid-template-rows:40px minmax(40px,.7fr) minmax(62px,.9fr) minmax(74px,1.1fr) 34px 14px;gap:4px 8px}
 header{grid-column:1;grid-row:1;padding:0;border:0;min-width:0}h1{font-size:22px}header p,.badge{display:none}
 .topbar{grid-column:2;grid-row:1;margin:0;padding:0;gap:5px;justify-content:flex-end;min-width:0}.topbar label{font-size:12px;letter-spacing:0;gap:3px}.topbar label:first-child{font-size:0}.topbar select{font-size:14px;padding:3px;min-height:32px}.topbar #save{font-size:12px;padding:4px;min-height:32px;margin:0}.topbar #help{font-size:14px;min-width:28px;min-height:32px;padding:0}
 .tempo{gap:4px}.tempo-label{display:none}.tempo-knob{width:36px;height:36px;min-height:36px;padding:4px}.knob-cap i{height:9px;top:2px;width:3px}.tempo-value{position:relative;gap:0}.tempo-value span{display:none}#bpm{width:48px;min-height:32px;padding:3px;font-size:16px}.tempo-adjust{gap:2px;flex-direction:column}.tempo-adjust button{width:25px;height:18px;min-height:18px;font-size:17px;line-height:1}
 section{padding:5px 8px;min-width:0;min-height:0}.section-title{margin:0 0 4px;gap:4px;flex-wrap:nowrap}.section-title h2{font-size:12px;letter-spacing:.5px}.section-title>span{font-size:12px;white-space:nowrap}
 .scope-panel{grid-column:1;grid-row:2;position:relative;display:flex;flex-direction:column}.scope-panel .section-title{padding-right:98px}.scope-panel .section-title>span{overflow:hidden;text-overflow:ellipsis}.audio-enable{position:absolute;right:7px;top:3px;font-size:12px;padding:3px 6px;min-height:24px;margin:0}.scope-panel canvas{flex:1;height:0;min-height:12px}.scope-caption{margin-top:2px;font-size:12px;line-height:12px}
 .sequencer{grid-column:1/-1;grid-row:3;margin:0;display:flex;flex-direction:column}.sequencer .section-title{margin-bottom:3px}.steps{flex:1;min-height:0;gap:4px}.step{min-height:0;padding:0;display:grid;grid-template-rows:14px 1fr 12px 7px}.step .count{padding:0;font-size:12px;line-height:14px}.step strong{font-size:14px;line-height:16px;align-self:center;margin:0}.step .n{font-size:12px;line-height:12px;margin:0}.step .lights{margin:0;align-items:center}.legend{margin-top:3px;gap:10px;font-size:12px;line-height:12px}
 .lower{display:contents}.editor{grid-column:2;grid-row:2;display:grid;grid-template-rows:14px 1fr 1fr;gap:3px}.editor .section-title{margin:0}.note-controls{gap:4px;align-items:center;min-height:0}.note-controls label{flex-direction:row;align-items:center;gap:3px;font-size:12px;letter-spacing:0}.note-controls select{min-height:24px;height:24px;padding:1px 4px;font-size:14px}.note-controls button{min-height:24px;height:24px;width:28px;padding:0;font-size:20px}.flags{margin:0;gap:4px;min-height:0}.flags button{display:flex;align-items:center;justify-content:center;gap:3px;font-size:16px;padding:0 3px;min-height:24px}.flags span{font-size:12px;margin:0;letter-spacing:0}
 .keyboard-panel{grid-column:1;grid-row:4;display:flex;flex-direction:column}.keyboard-panel .section-title{margin-bottom:3px}.live{font-size:12px;white-space:nowrap}.live input{margin:0}.keyboard{flex:1;min-height:0;height:0;gap:3px}.key.white{padding:0 0 4px;display:flex;align-items:flex-end;justify-content:center;min-height:0;font-size:12px}.key.black{height:61%;min-height:0;padding:0 0 3px;display:flex;align-items:flex-end;justify-content:center;font-size:12px;touch-action:none}.key.white{touch-action:none}
 .sound{grid-column:2;grid-row:4;margin:0;padding:6px 8px;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 10px}.sound label{font-size:12px;display:flex;flex-direction:column;justify-content:center}.sound input{min-height:20px;height:20px;margin:0}
 .transport{grid-column:1/-1;grid-row:5;margin:0;gap:8px}.transport button{min-height:0;padding:2px 8px;font-size:14px}.transport :is(#send,#wavQuick){display:flex;justify-content:center;align-items:center;gap:8px}.transport small{font-size:12px}
 .foot{grid-column:1/-1;grid-row:6;margin:0;font-size:12px;line-height:14px;white-space:nowrap;min-width:0}.foot #status{overflow:hidden;text-overflow:ellipsis}.rotate-hint{display:none}
}
@media(orientation:landscape) and (max-height:350px){main{grid-template-rows:34px minmax(40px,.7fr) minmax(62px,.9fr) minmax(62px,1.1fr) 30px 14px;gap:3px 6px;padding:4px 8px}.scope-caption{display:none}.scope-panel .section-title>span{display:none}.legend{margin-top:1px}.editor{grid-template-rows:12px 1fr 1fr;gap:2px}.editor .section-title{line-height:12px}.flags button,.note-controls select,.note-controls button{min-height:22px;height:22px}.sound{padding:3px 8px}.sound input{min-height:16px;height:16px}}
@media(orientation:landscape) and (max-height:540px){main{grid-template-rows:40px minmax(76px,.7fr) minmax(62px,.9fr) minmax(74px,1.1fr) 34px 14px}}
@media(orientation:landscape) and (max-height:350px){main{grid-template-rows:34px minmax(66px,.7fr) minmax(62px,.9fr) minmax(62px,1.1fr) 30px 14px}}
@media(orientation:landscape) and (max-height:300px){main{padding:3px 8px;gap:2px 6px;grid-template-rows:30px minmax(54px,.7fr) minmax(60px,.9fr) minmax(54px,1.1fr) 28px 12px}.editor{grid-template-rows:1fr 1fr;gap:2px}.editor .section-title{display:none}.topbar #help,.topbar #save,.topbar select,#bpm{min-height:28px}.tempo-knob{height:28px;width:28px;min-height:28px;padding:3px}.tempo-adjust button{height:14px;min-height:14px}.foot{font-size:12px;line-height:12px}.scope-caption{display:none}.sound input{height:14px;min-height:14px}.live{font-size:12px}.keyboard-panel .section-title{margin-bottom:2px}}

/* Blank silver transport key with a shallow physical bevel. */
.transport{align-items:center}
#play{flex:0 0 64px;width:64px;height:64px;min-height:64px;padding:0;border:1px solid #656565;border-radius:3px;background:linear-gradient(175deg,#f6f6f4 0%,#dfdfdd 16%,#c6c6c4 83%,#a5a5a3 100%);box-shadow:inset 0 2px 1px #fff,inset 2px 0 2px #eee,inset -2px 0 2px #b2b2b0,inset 0 -5px 1px #989896,0 3px 2px #0008;transition:box-shadow .08s,transform .08s}
#play:active,#play[aria-pressed="true"]{background:linear-gradient(#dededc,#bfbfbd);box-shadow:inset 0 1px 3px #999,inset 0 -2px 1px #aaa,0 1px 1px #0008;transform:translateY(2px)}
#play:focus-visible{outline:2px solid var(--cyan);outline-offset:3px}
@media(orientation:landscape) and (max-height:540px){#play{flex-basis:30px;width:30px;height:30px;min-height:30px}}
@media(orientation:landscape) and (max-height:350px){#play{flex-basis:26px;width:26px;height:26px;min-height:26px}}

/* TD-3 colour editions: coloured casing, dark instrument panels. */
:root{--chassis:#252525;--chassis-edge:#191919;--chassis-ink:#f1eee9}
main{background:linear-gradient(115deg,var(--chassis),var(--chassis-edge) 85%)}
header{border-bottom-color:var(--chassis-ink);color:var(--chassis-ink)}h1 span,header p{color:var(--chassis-ink)}
.topbar>label,.tempo-label,.tempo-value span,.foot,.rotate-hint{color:var(--chassis-ink)}
.theme-button{display:flex;align-items:center;gap:7px;flex-shrink:0;padding:7px 10px;background:#202020;color:#eee;border-color:#777;font-size:12px;letter-spacing:.6px}
.theme-button i{width:17px;height:17px;border-radius:50%;background:var(--chassis);border:1px solid #ffffffa0;box-shadow:inset 0 1px 2px #0005}
#themeDialog{width:min(520px,calc(100% - 24px))}.theme-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px}
.theme-choices button{display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 10px;text-align:left;font-size:14px;background:#303030;color:#eee;border:1px solid #666}
.theme-swatch{width:32px;height:30px;flex-shrink:0;border-radius:3px;background:var(--swatch);border:1px solid #ffffff60;box-shadow:inset 0 1px 2px #fff4,0 2px 2px #0007}
.theme-check{margin-left:auto;visibility:hidden;color:var(--orange)}.theme-choices button[aria-pressed="true"]{border-color:var(--orange);box-shadow:inset 0 0 0 1px var(--orange)}.theme-choices button[aria-pressed="true"] .theme-check{visibility:visible}
@media(orientation:landscape) and (max-height:540px){.theme-button{min-height:30px;padding:3px 6px;gap:4px}.theme-button span{display:none}.theme-button i{width:18px;height:18px}#themeDialog{max-height:calc(100dvh - 16px);padding:12px}.theme-choices{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:10px}.theme-choices button{flex-direction:column;gap:4px;font-size:12px;min-height:60px;padding:6px 2px;position:relative;text-align:center}.theme-check{position:absolute;right:3px;top:2px}.theme-swatch{height:24px;width:28px}}

.brand{display:flex;align-items:center;gap:10px;min-width:0}.yellow-smiley{display:block;width:60px;height:auto;flex-shrink:0;border-radius:50%}html[data-theme="yellow"] .yellow-smiley{display:block}@media(orientation:landscape) and (max-height:540px){.brand{gap:6px}.yellow-smiley{width:36px}}

/* Fill the available iPhone viewport; reserve real space for all step labels. */
#themeDialog h3{font-size:14px;margin:14px 0 8px}.usb-settings{border-top:1px solid #555;margin-top:16px}.usb-settings p{font-size:14px;line-height:1.45}.usb-settings ul{font-size:14px;padding-left:20px}.settings-note{color:#aaa}.theme-button b{font-size:22px;line-height:1;font-weight:normal}
@media(orientation:landscape) and (max-height:540px){
 main{max-width:none;width:100%;padding:5px 10px;grid-template-rows:36px minmax(70px,.8fr) minmax(90px,1fr) minmax(66px,1fr) 34px 14px;gap:4px 8px}
 .theme-button{min-width:34px;min-height:32px}.theme-button b{font-size:22px}
 .sequencer{padding:4px 8px}.sequencer .section-title{min-height:14px;line-height:14px;margin-bottom:2px}
 .steps{flex:1;min-height:44px}.step{grid-template-rows:12px minmax(16px,1fr) 10px 6px;overflow:hidden}
 .step .count{line-height:12px}.step strong{line-height:16px;margin:0}.step .n{line-height:10px;font-size:12px}.step .lights{gap:4px}
 .legend{margin-top:2px;line-height:12px;min-height:12px;flex-wrap:nowrap;gap:10px}
 .scope-caption{display:none}.scope-panel .section-title>span{display:none}
 .keyboard-panel .section-title{min-height:14px;line-height:14px}.keyboard{min-height:36px}
 .editor{grid-template-rows:12px minmax(22px,1fr) minmax(22px,1fr);gap:2px}.editor .section-title{display:flex;line-height:12px}
 .note-controls select,.note-controls button,.flags button{height:auto;min-height:22px}
 #themeDialog{width:min(680px,calc(100% - 24px))}.theme-choices{margin-top:8px}
}
@media(orientation:landscape) and (max-height:320px){
 main{padding:3px 8px;gap:2px 6px;grid-template-rows:30px minmax(58px,.8fr) minmax(86px,1fr) minmax(58px,1fr) 28px 12px}
 .editor{grid-template-rows:1fr 1fr}.editor .section-title{display:none}.section-title>span,.legend span:last-child{display:none}
 .keyboard-panel .section-title{margin-bottom:2px}.sound{padding:3px 8px}
}

/* Silver TD-3 tempo dial: graduated rim, ridged edge, flat cap and index. */
.tempo-knob{border:0;padding:6px;background:repeating-conic-gradient(from -135deg,#262626 0deg 2deg,transparent 2deg 18deg);box-shadow:none;isolation:isolate}
.tempo-knob::before{content:"";position:absolute;inset:5px;border-radius:50%;background:repeating-conic-gradient(#bcbcbc 0deg 3deg,#737373 3deg 6deg);border:1px solid #777;box-shadow:0 2px 3px #0008,inset 0 1px 2px #fff;z-index:-1}
.tempo-knob .knob-cap{display:block;border:3px solid #c2c2c2;background:linear-gradient(175deg,#f8f8f6 0%,#e4e4e2 28%,#bdbdbb 32%,#c6c6c4 82%,#ababaa 100%);box-shadow:inset 0 1px 2px #fff,inset 0 -2px 2px #929292,0 1px 2px #555}
.tempo-knob .knob-cap i{top:0;left:calc(50% - 1px);width:2px;height:9px;background:#f3f3f1;border:1px solid #999;box-shadow:0 0 1px #888}
@media(orientation:landscape) and (max-height:540px){.tempo-knob{padding:4px}.tempo-knob::before{inset:3px}.tempo-knob .knob-cap{border-width:2px}.tempo-knob .knob-cap i{height:6px}}

#themeDialog{max-height:calc(100dvh - 32px);overflow-y:auto}
.generator-settings{margin:14px 0 18px;padding:12px;background:#202020;border:1px solid #555}
#themeDialog .generator-settings h3{margin:0 0 12px;font-size:16px}
.generator-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.generator-fields label{display:flex;flex-direction:column;gap:6px;font-size:14px;letter-spacing:.5px;color:#ddd}
.generator-fields select{width:100%;font-size:14px;min-height:44px}
.generator-fields input{margin:0}
.generator-settings p{font-size:14px;line-height:1.45;margin:12px 0}
.generator-context{color:#bbb}.generator-actions{display:flex;flex-wrap:wrap;gap:8px}.generator-actions button{flex:1;font-size:14px;min-height:44px}.generator-actions #genGenerate{background:var(--orange);color:#171717;border-color:var(--orange);font-weight:bold}
#genFeedback{margin-bottom:0;color:#ccc}
@media(orientation:landscape) and (max-height:540px){.generator-settings{margin-top:10px}.generator-fields{gap:8px 12px}.generator-settings p{margin:8px 0}}

.usb-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:14px 0}.usb-fields label{display:flex;flex-direction:column;gap:6px;font-size:14px;color:#ddd;letter-spacing:.5px}.usb-fields select{width:100%;font-size:14px;min-height:44px}.usb-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.usb-actions button{flex:1;font-size:14px;min-height:44px}#tdConfirm{border:1px solid var(--orange);padding:10px;margin:12px 0}#tdConfirm[hidden]{display:none}#tdConfirm button{font-size:14px;margin:0 4px 6px 0}#tdBackup,#tdUndoImport{font-size:14px;margin:0 8px 8px 0}#tdFeedback{min-height:20px;color:#eee}

/* USB connection status uses the same fixed colours in every theme. */
.header-controls{display:flex;align-items:center;gap:14px;flex-shrink:0}
.connection-led{display:block;width:11px;height:11px;flex:0 0 11px;border-radius:50%;border:1px solid #520b0b;background:radial-gradient(circle at 35% 30%,#ffb2a5 0%,#f34335 35%,#a51414 80%);box-shadow:inset 0 1px 2px #fff7,0 0 6px #f43b3655;transition:background .18s,box-shadow .18s}
.connection-led[data-connected="true"]{border-color:#145b25;background:radial-gradient(circle at 35% 30%,#c2ffd1 0%,#44e16b 35%,#188537 80%);box-shadow:inset 0 1px 2px #fff7,0 0 7px #43e66b88}
#detectMidi[data-connected="false"]{background:#3d2020;border-color:#d45048;color:#ffc5bf;box-shadow:inset 0 1px 0 #ffffff15}
#detectMidi[data-connected="true"]{background:#193d25;border-color:#48cf70;color:#baffce;box-shadow:inset 0 1px 0 #ffffff15,0 0 8px #42dd6b25}
#detectMidi:disabled{opacity:.75}
@media(orientation:landscape) and (max-height:540px){.header-controls{gap:9px}}

/* Desktop: fluid web workspace, with all instrument sections using the window. */
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
 body{height:auto;padding:0}
 main{width:100%;max-width:none;margin:0;height:100dvh;min-height:710px;padding:12px 20px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:44px 44px minmax(90px,1fr) minmax(120px,1fr) minmax(128px,1.15fr) 46px 44px 18px;gap:7px}
 main>header,main>.topbar,main>.scope-panel,main>.sequencer,main>.lower,main>.sound,main>.transport,main>.foot{grid-column:auto;grid-row:auto;min-width:0;margin:0}
 header{padding:0;border:0;display:flex;align-items:center;justify-content:space-between}
 header p{display:block;font-size:11px;margin-top:4px}.brand{gap:12px}.yellow-smiley{width:44px;height:44px}h1{font-size:27px}h1 span{display:inline-block;margin:0;font-size:inherit}
 .theme-button{height:40px;min-height:40px;padding:6px 10px}.header-controls{gap:14px}
 .topbar{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:0;flex-wrap:nowrap}
 .topbar label:first-child{font-size:12px;letter-spacing:1px}.topbar label{flex-direction:row;align-items:center}
 .topbar select,.topbar #save,.topbar #help,#bpm{min-height:40px;height:40px;font-size:14px;padding:6px 10px}.topbar #save{margin-left:auto}.topbar #help{margin-left:0;min-width:40px}
 .tempo{gap:8px;margin:0}.tempo-label{display:inline;font-size:12px}.tempo-knob{width:44px;height:44px;min-height:44px;padding:5px}.tempo-knob::before{inset:4px}.tempo-value{flex-direction:row;gap:6px}.tempo-value span{display:inline;font-size:12px}.tempo-adjust{flex-direction:row;gap:5px}.tempo-adjust button{width:38px;height:40px;min-height:40px;font-size:22px}#bpm{width:65px}
 section{min-height:0;padding:8px 12px}
 .section-title{min-height:14px;margin-bottom:6px;flex-wrap:nowrap}.section-title h2{font-size:12px;letter-spacing:1px}.section-title>span{display:inline;font-size:12px;white-space:nowrap}
 .scope-panel{position:relative;display:flex;flex-direction:column;padding-top:9px}.scope-panel .section-title{padding-right:122px}.scope-panel .section-title>span{display:inline;overflow:hidden;text-overflow:ellipsis}
 .audio-enable{position:absolute;right:12px;top:5px;min-height:26px;height:26px;padding:3px 8px;font-size:12px;margin:0}
 .scope-panel canvas{flex:1;height:0;min-height:30px}.scope-caption{display:flex;font-size:11px;line-height:12px;margin-top:4px}
 .sequencer{display:flex;flex-direction:column}.steps{grid-template-columns:repeat(16,minmax(0,1fr));flex:1;min-height:66px;gap:6px}
 .step{min-height:0;padding:0;display:grid;grid-template-rows:20px minmax(20px,1fr) 14px 10px}.step .count{font-size:12px;line-height:20px;padding:0}.step strong{font-size:17px;line-height:20px;align-self:center;margin:0}.step .n{font-size:12px;line-height:14px;margin:0}.step .lights{margin:0;align-items:center}
 .legend{margin-top:5px;gap:16px;line-height:14px;font-size:12px;min-height:14px;flex-wrap:nowrap}.legend span:last-child{display:flex}
 .lower{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:10px}
 .editor{display:grid;grid-template-rows:14px minmax(40px,1fr) minmax(36px,1fr);gap:5px}.editor .section-title{display:flex;margin:0}
 .note-controls{align-items:center;gap:10px;min-height:0}.note-controls label{flex-direction:row;align-items:center;gap:7px;font-size:12px;letter-spacing:.5px}.note-controls select{height:34px;min-height:34px;padding:4px 7px;font-size:16px}.note-controls button{height:34px;min-height:34px;width:40px;font-size:24px;padding:0}
 .flags{gap:7px;margin:0;min-height:0}.flags button{min-height:34px;display:flex;align-items:center;justify-content:center;gap:7px;padding:3px 6px;font-size:20px}.flags span{font-size:12px;margin:0}
 .keyboard-panel{display:flex;flex-direction:column}.keyboard-panel .section-title{margin-bottom:6px}.live{font-size:12px}.keyboard{height:0;flex:1;min-height:72px;gap:4px}.key.white{min-height:0;padding:0 0 6px;display:flex;align-items:flex-end;justify-content:center;font-size:12px}.key.black{min-height:0;height:62%;padding:0 0 5px;display:flex;align-items:flex-end;justify-content:center;font-size:12px}
 .sound{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px;padding:5px 12px}.sound label{display:flex;flex-direction:column;justify-content:center;font-size:12px}.sound input{height:22px;min-height:22px;margin:0}
 .transport{align-items:center;gap:12px}#play{flex:0 0 42px;width:42px;height:42px;min-height:42px}.transport :is(#send,#wavQuick){flex:0 1 280px;height:40px;min-height:40px;font-size:14px;padding:6px 16px}
 .foot{flex-direction:row;font-size:12px;line-height:18px;white-space:nowrap}.foot #status{overflow:hidden;text-overflow:ellipsis}.rotate-hint{display:none}
 #themeDialog{width:min(700px,calc(100% - 48px));padding:20px;max-height:calc(100dvh - 40px)}.theme-choices{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.theme-choices button{flex-direction:row;text-align:left;min-height:52px;padding:8px 10px;font-size:14px}.theme-check{position:static;margin-left:auto}.theme-swatch{width:32px;height:30px}
}

.distortion{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;gap:14px;margin-top:12px;padding:12px}
.dist-switch-control,.dist-control{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0}
.distortion h2,.dist-control label{font-size:12px;letter-spacing:1px;margin:0;color:#ded9d2}.dist-control output{font-size:11px;color:#aaa;line-height:12px}
.distortion-knob{width:48px;height:48px;min-height:48px}.distortion[data-enabled="false"] .dist-control{opacity:.65}
@media(orientation:landscape) and (max-height:540px){
 .distortion{grid-column:2;grid-row:5;margin:0;padding:2px 5px;gap:5px;grid-template-columns:1.3fr repeat(3,1fr)}
 .distortion h2{font-size:9px;letter-spacing:0}.dist-switch-control,.dist-control{flex-direction:row;gap:3px}.dist-control{position:relative;justify-content:center}.dist-control label{font-size:9px;letter-spacing:0}.dist-control output,.switch-state{display:none}
 .distortion-knob{width:22px;height:22px;min-height:22px;padding:3px}.distortion-knob::before{inset:2px}.distortion-knob .knob-cap{border-width:1px}.distortion-knob .knob-cap i{height:4px}
 .transport{grid-column:1;grid-row:5}.transport :is(#send,#wavQuick){font-size:11px;padding:2px 4px}
}
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
 main{min-height:780px;grid-template-rows:44px 44px minmax(90px,1fr) minmax(120px,1fr) minmax(128px,1.15fr) 46px 64px 44px 18px}
 main>.distortion,main>.transport{grid-column:auto;grid-row:auto;margin:0}
 .distortion{grid-template-columns:minmax(180px,.8fr) repeat(3,minmax(0,1fr));gap:20px;padding:5px 12px}
 .dist-switch-control,.dist-control{flex-direction:row;justify-content:center;gap:12px;position:static}.distortion h2,.dist-control label{font-size:12px;letter-spacing:1px}.dist-control output{display:block;width:24px;font-size:12px}.switch-state{display:inline;width:24px}
 .distortion-knob{width:46px;height:46px;min-height:46px;padding:5px}.distortion-knob::before{inset:4px}.distortion-knob .knob-cap{border-width:3px}.distortion-knob .knob-cap i{height:9px}
 .transport :is(#send,#wavQuick){font-size:14px;padding:6px 16px}
}

/* Play belongs to the tempo toolbar; distortion uses the same silver dial. */
.topbar #play{flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;margin:0}
.distortion-knob{width:54px;height:54px;min-height:54px;padding:6px}
.distortion-toggle{position:relative;width:58px;height:32px;min-height:32px;border:0;border-radius:999px;background:#a8a8ad;padding:3px;box-shadow:inset 0 1px 2px #0002;transition:background .18s}
.switch-thumb{display:block;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transform:translateX(0);transition:transform .18s}
.distortion-toggle[aria-checked="true"]{background:#099849}.distortion-toggle[aria-checked="true"] .switch-thumb{transform:translateX(26px)}.distortion-toggle:active{transform:none}
.switch-state{font-size:10px;letter-spacing:1px;color:#999}.distortion[data-enabled="true"] .switch-state{color:#49dc85}
@media(orientation:landscape) and (max-height:540px){
 .topbar #play{flex-basis:30px;width:30px;height:30px;min-height:30px}
 .distortion-knob{width:36px;height:36px;min-height:36px;padding:4px}.distortion-knob::before{inset:3px}.distortion-knob .knob-cap{border-width:2px}.distortion-knob .knob-cap i{height:6px}
 .distortion-toggle{width:32px;height:20px;min-height:20px;padding:2px;flex-shrink:0}.switch-thumb{width:16px;height:16px}.distortion-toggle[aria-checked="true"] .switch-thumb{transform:translateX(12px)}
 main{grid-template-rows:36px minmax(70px,.8fr) minmax(90px,1fr) minmax(66px,1fr) 46px 14px}
}
@media(orientation:landscape) and (max-height:320px){main{grid-template-rows:30px minmax(58px,.8fr) minmax(86px,1fr) minmax(58px,1fr) 40px 12px}}
@media(orientation:landscape) and (max-height:300px){.distortion-knob{width:28px;height:28px;min-height:28px;padding:3px}.distortion-knob::before{inset:3px}}
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
 main{grid-template-rows:44px 44px minmax(90px,1fr) minmax(120px,1fr) minmax(128px,1.15fr) 46px 64px 44px 18px}
 .tempo-knob .knob-cap{border-width:3px}.tempo-knob .knob-cap i{height:9px}
 .topbar #play{flex:0 0 42px;width:42px;height:42px;min-height:42px;margin-left:8px}
 .distortion-knob{width:44px;height:44px;min-height:44px;padding:5px}.distortion-knob::before{inset:4px}.distortion-knob .knob-cap{border-width:3px}.distortion-knob .knob-cap i{height:9px}
 .distortion-toggle{width:58px;height:32px;min-height:32px;padding:3px}.switch-thumb{width:26px;height:26px}.distortion-toggle[aria-checked="true"] .switch-thumb{transform:translateX(26px)}
}
.generator-note-count{display:flex;flex-direction:column;gap:6px;grid-column:1/-1}.generator-note-count label{font-size:14px;color:#ddd;letter-spacing:.5px}.note-count-controls{display:flex;align-items:center;gap:8px}.note-count-controls button{width:44px;min-height:44px;padding:0;font-size:24px}.note-count-controls input{width:80px;text-align:center;height:44px}.generator-note-count small{font-size:12px;color:#aaa}

/* Quarter-note kick switch beside the silver transport. */
.kick-control{display:flex;align-items:center;gap:6px;flex-shrink:0}.kick-label{font-size:14px;letter-spacing:1px;color:var(--text,#ddd)}.topbar .kick-control button{margin:0;flex-shrink:0}.kick-control .switch-state{font-size:12px;min-width:22px}
@media(orientation:landscape) and (max-height:540px){.kick-control{gap:3px}.kick-label{font-size:12px}.kick-control .switch-state{display:none}}

.kick-control #drumVolume{width:82px;min-width:0;min-height:32px;margin:0;cursor:pointer}.kick-control output{font-size:12px;color:var(--muted,#aaa);min-width:36px;white-space:nowrap}
@media(orientation:landscape) and (max-height:540px){.kick-control #drumVolume{width:48px;min-height:24px}.kick-control output{display:none}}

.topbar #genQuick{margin-left:0;white-space:nowrap;background:var(--orange);color:#171717;border-color:var(--orange);font-weight:bold}
@media(orientation:portrait){.topbar #genQuick{flex:1}}
@media(orientation:landscape) and (max-height:540px){.topbar #genQuick{font-size:12px;padding:4px;min-height:32px}}
@media(orientation:landscape) and (max-height:300px){.topbar #genQuick{min-height:28px}}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){.topbar #genQuick{min-height:40px;height:40px;font-size:14px;padding:6px 10px}}
.kick-control{background:#1b1b1b;border:1px solid var(--line);border-radius:3px;padding:4px 8px}.kick-control .kick-label{color:#ded9d2}
@media(orientation:landscape) and (max-height:540px){.kick-control{padding:3px 5px}}

.kick-control{background:#303030;border-color:#666}.generator-ties-hint{grid-column:1/-1;color:#aaa;font-size:12px;line-height:1.5}

.kick-control .hat-label{margin-left:6px}.kick-control #kickToggle[aria-checked="true"]+#kickState,.kick-control #hatToggle[aria-checked="true"]+#hatState{color:#49dc85}

.topbar #genQuick{margin-left:auto}.topbar #save,.topbar #play{margin-left:0}

/* Distortion uses the same range controls as the sound section. */
.distortion .dist-control{flex-direction:column;align-items:stretch;justify-content:center;gap:5px}.distortion .dist-control input{width:100%;min-width:0;margin:0;min-height:34px}.distortion .dist-control label{font-size:12px}
@media(orientation:landscape) and (max-height:540px){.distortion .dist-control{gap:0}.distortion .dist-control label{font-size:12px;letter-spacing:0}.distortion .dist-control input{height:20px;min-height:20px}}
@media(orientation:landscape) and (max-height:350px){.distortion .dist-control input{height:16px;min-height:16px}}
@media(orientation:landscape) and (max-height:300px){.distortion .dist-control input{height:14px;min-height:14px}}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){.distortion .dist-control{gap:0}.distortion .dist-control input{height:22px;min-height:22px}}

/* Translucent colour editions: tinted plastic, fine underlying structure and a lit rim. */
html[data-shell="translucent"] main{position:relative;isolation:isolate;background-color:var(--chassis);background-image:linear-gradient(132deg,#ffffff30 0%,#ffffff08 24%,#00000000 48%,#00000024 100%),linear-gradient(115deg,color-mix(in srgb,var(--chassis) 76%,transparent),color-mix(in srgb,var(--chassis-edge) 82%,transparent)),url("circuit-interior.webp");background-size:auto,auto,cover;background-position:center;background-repeat:no-repeat}
html[data-shell="translucent"] main>section,html[data-shell="translucent"] .lower>section{background:linear-gradient(140deg,#ffffff0a,#00000016),#0c1410b8;border-color:#ffffff40;box-shadow:inset 0 1px 0 #ffffff12,0 2px 5px #00000018}
html[data-shell="translucent"] .scope-panel{background:linear-gradient(140deg,#ffffff05,#00000012),#0c1714d0}
[data-shell-choice="translucent"] .theme-swatch{background:linear-gradient(135deg,#ffffff55,#ffffff05 42%,#00000018),repeating-linear-gradient(90deg,#00000000 0 8px,#00000018 8px 9px),var(--swatch);box-shadow:inset 0 1px 1px #ffffff80,inset 0 -2px 1px #00000025,0 2px 2px #0005;border-color:#ffffff70}

/* Saved patterns mirror the TD-3: groups I–IV, banks A/B, eight patterns each. */
.topbar .pattern-library{display:flex;align-items:flex-end;gap:8px;min-width:0;flex-shrink:0}.topbar .pattern-library label{display:flex;flex-direction:column;align-items:stretch;gap:2px;font-size:12px;letter-spacing:.5px;color:var(--chassis-ink)}.pattern-library select{width:60px;font-size:14px;min-height:28px;height:28px;padding:2px 5px}.pattern-library #bank{width:128px}
/* TR-909-inspired lettering is limited to the instrument's wordmark and caption. */
@font-face{font-family:TDBuilderDisplay;src:url("fonts/orbitron.woff") format("woff");font-weight:400 900;font-style:normal;font-display:swap}
.brand-copy{min-width:0}
.brand h1,.brand .brand-caption{font-family:TDBuilderDisplay,"Arial Black",sans-serif;font-weight:500;font-synthesis:none}
.brand h1{font-size:30px;font-weight:650;line-height:1.1;letter-spacing:.025em;text-transform:uppercase}
.brand h1 span{font-size:inherit;letter-spacing:inherit;display:inline;margin:0;color:inherit}
.brand .brand-caption{font-size:11px;line-height:1.4;letter-spacing:.035em;margin:4px 0 0}
.brand-caption span{display:inline-block;white-space:nowrap}
.brand .yellow-smiley{width:64px;height:64px}
@media (min-width:1024px) and (hover:hover) and (pointer:fine){
 .brand h1{font-size:26px}.brand .brand-caption{font-size:11px;margin-top:3px}.brand .yellow-smiley{width:48px;height:48px}
}
@media (orientation:landscape) and (max-height:540px){
 .brand h1{font-size:22px}.brand .yellow-smiley{width:40px;height:40px}
}

/* The supplied combined play/pause symbol sits in the centre of the silver key. */
#play{display:grid;place-items:center}
#play .transport-mark{display:block;width:100%;height:100%;max-width:44px;max-height:44px;object-fit:contain;pointer-events:none;user-select:none}

/* Silver casing uses the supplied brushed aluminium reference. */
html[data-theme="silver"] main{
 background-color:#c9cdcf;
 background-image:linear-gradient(115deg,#ffffff08,#ffffff00 45%,#00000008),url("brushed-aluminium.png");
 background-size:auto,cover;
 background-position:center;
 background-repeat:no-repeat;
 box-shadow:inset 0 1px 0 #ffffffa6,inset 0 -2px 0 #737b8040;
}
[data-theme-choice="silver"] .theme-swatch{
 background:#c9cdcf url("brushed-aluminium.png") center/cover no-repeat;
}

/* Match the import/export bar to the transport key's silver bevel. */
:is(#send,#wavQuick){color:#252525;font-weight:600;border-color:#656565;border-radius:3px;background:linear-gradient(175deg,#f6f6f4 0%,#dfdfdd 16%,#c6c6c4 83%,#a5a5a3 100%);box-shadow:inset 0 2px 1px #fff,inset 2px 0 2px #eee,inset -2px 0 2px #b2b2b0,inset 0 -5px 1px #989896,0 3px 2px #0008;transition:box-shadow .08s,transform .08s}
:is(#send,#wavQuick):active{background:linear-gradient(#dededc,#bfbfbd);box-shadow:inset 0 1px 3px #999,inset 0 -2px 1px #aaa,0 1px 1px #0008;transform:translateY(2px)}
:is(#send,#wavQuick):focus-visible{outline:2px solid var(--cyan);outline-offset:3px}

.settings-tabs{display:flex;gap:8px;margin:12px 0 16px}.settings-tabs button{flex:1;min-width:0;font-size:14px}.settings-tabs button[aria-selected="true"]{border-color:var(--orange);box-shadow:inset 0 -2px var(--orange)}
.settings-panel[hidden]{display:none!important}.settings-panel:focus-visible{outline:2px solid var(--cyan)}
.language-panel{padding:14px;background:#1b1b1b}.language-panel h3{margin-top:0}.language-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.language-choices button{min-height:48px;font-size:16px}.language-choices button[aria-pressed="true"]{color:var(--orange);border-color:var(--orange);box-shadow:inset 0 0 0 1px var(--orange)}
.language-panel p{font-size:14px;color:#bbb}.settings-panel button{overflow-wrap:anywhere}

/* Discreet release number at the bottom right of the instrument. */
.foot #status{min-width:0}.app-version{margin-left:auto;align-self:flex-end;flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;letter-spacing:.3px;color:#aaa;white-space:nowrap}
.help-contact a{color:var(--cyan);text-underline-offset:3px;overflow-wrap:anywhere}

.access-button{display:inline-flex;align-items:center;justify-content:center;gap:4px;flex-shrink:0;min-height:40px;padding:7px 10px;font-size:14px;background:#202020;color:#eee;border-color:#777;line-height:1.2}.access-button[data-unlocked="true"]{border-color:var(--cyan)}
#accessDialog{width:min(420px,calc(100% - 24px))}#accessForm{display:grid;gap:12px}#accessForm label{font-size:14px;letter-spacing:0}#accessCode{width:100%;min-width:0;min-height:48px;background:#303030;color:#fff;border:1px solid #666;border-radius:3px;padding:10px;font-size:16px}#accessFeedback{font-size:14px;line-height:1.5;margin-bottom:0}#accessLogout{margin-top:14px}#accessForm[hidden],#accessLogout[hidden]{display:none!important}

#genQuick{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1px;line-height:1.15}#generationQuota{display:block;font-size:12px;line-height:1.15;font-variant-numeric:tabular-nums;white-space:nowrap;letter-spacing:0}#genQuotaNote{font-size:14px;line-height:1.4;margin:4px 0 12px}

.transport :is(#send,#wavQuick){flex:1 1 0;min-width:0;width:auto;display:flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.wav-lock{flex:none}#wavQuick[data-locked="false"] .wav-lock{display:none}#wavQuick[data-locked="true"]{color:#555}.wav-export{margin:16px 0}.wav-export button{width:100%}

.tutorial-overlay{position:fixed;inset:0;z-index:5000;pointer-events:none}.tutorial-overlay[hidden]{display:none}.tutorial-spotlight{position:absolute;border:2px solid var(--orange);border-radius:5px;box-shadow:0 0 0 9999px #0009;pointer-events:none}.tutorial-card{position:absolute;right:max(12px,env(safe-area-inset-right));width:min(380px,calc(100% - max(12px,env(safe-area-inset-left)) - max(12px,env(safe-area-inset-right))));max-height:calc(100dvh - max(12px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)));overflow:auto;padding:16px;background:#222;color:#f4f4f2;border:1px solid #777;border-radius:8px;box-shadow:0 8px 30px #0008;pointer-events:auto;font-size:14px;line-height:1.45}.tutorial-card[data-edge=bottom]{bottom:max(12px,env(safe-area-inset-bottom))}.tutorial-card[data-edge=top]{top:max(12px,env(safe-area-inset-top))}.tutorial-card h2{font-size:20px;margin:4px 32px 8px 0}.tutorial-card p{margin:0 0 12px}.tutorial-progress{font-size:12px;color:#ccc;padding-right:36px}.tutorial-close{position:absolute;top:6px;right:6px;width:36px;min-height:36px;padding:3px;background:transparent;border:0;font-size:20px}.tutorial-actions{display:flex;justify-content:space-between;gap:12px}.tutorial-actions button{min-height:40px;font-size:14px}#tutorialNext{background:var(--orange);border-color:var(--orange);color:#171717;font-weight:bold}@media (orientation:landscape) and (max-height:500px){.tutorial-card{padding:10px 14px;width:360px;font-size:13px;line-height:1.3}.tutorial-card h2{font-size:16px;margin:2px 32px 5px 0}.tutorial-card p{margin-bottom:7px}.tutorial-actions button{min-height:36px;padding:5px 10px}}

.theme-select{display:block;width:100%;min-height:44px;margin:8px 0 12px;font-size:16px}

/* Beta accounts use the instrument's existing dark controls. */
#accessDialog{max-height:calc(100dvh - 24px);overflow:auto}#accessDialog [hidden]{display:none!important}#accountForm{display:grid;gap:10px}#accountForm input{width:100%;min-width:0;min-height:44px;padding:10px;background:#303030;color:#fff;border:1px solid #777;border-radius:3px;font-size:16px}#accountForm label{font-size:14px;letter-spacing:0}.account-names{display:grid;grid-template-columns:1fr 1fr;gap:12px}.account-names label{display:grid;gap:8px}.account-tabs{display:flex;gap:8px;margin:8px 0 18px}.account-tabs button{flex:1;min-height:44px;font-size:14px}.account-tabs [aria-pressed=true]{border-color:var(--cyan);color:var(--cyan)}#accountSubmit{margin-top:6px;min-height:44px}#passwordHint,.account-hint{font-size:14px;line-height:1.5;color:#ccc;margin:4px 0 12px}#guestButton{width:100%;margin-top:14px;min-height:44px}#accountIdentity{overflow-wrap:anywhere;font-size:16px}#accountRole{font-size:14px}#adminLink{display:block;color:var(--cyan);padding:12px 0;font-size:16px}#codeDetails{margin-top:18px}#codeDetails summary{cursor:pointer;font-size:14px;padding:10px 0}#accountPassword,#accessCode{letter-spacing:normal}

.account-renewal{font-variant-numeric:tabular-nums;font-size:1.05rem;margin:8px 0 16px}#accountQuota{margin-bottom:6px}

#helpDialog{width:min(780px,calc(100% - 24px))}#helpDialog h3{margin:24px 0 6px;font-size:17px}#helpDialog h3+p{margin-top:6px}.help-table-scroll{overflow-x:auto;margin-top:24px;border:1px solid #555;border-radius:5px}.help-plans{width:100%;border-collapse:collapse;font-size:14px;line-height:1.4;min-width:480px}.help-plans caption{text-align:left;font-weight:bold;font-size:17px;padding:14px;background:#292929}.help-plans th,.help-plans td{padding:11px 10px;text-align:left;vertical-align:top;border-top:1px solid #555}.help-plans thead{background:#303030}.help-plans tbody th{font-weight:normal}.help-plans th:last-child,.help-plans td:last-child{background:#ff8b2a14}.help-plans thead th:last-child{color:#ffad69}@media(max-width:480px){.help-plans{min-width:0;font-size:12px}.help-plans th,.help-plans td{padding:9px 5px;overflow-wrap:anywhere}.help-plans th:first-child{width:25%}}

.pattern-slot-controls{display:grid;grid-template-columns:32px minmax(0,1fr) 32px;gap:6px;align-items:center;justify-items:center;min-width:0;height:32px}.pattern-slot-controls button{padding:0;min-width:0;min-height:36px;font-size:24px}.pattern-load-actions{display:flex;gap:10px;flex-wrap:wrap}.pattern-load-actions button{min-height:44px}.pattern-slot-controls #bank{min-width:0;width:100%}

@media(min-width:1024px){.topbar .pattern-slot-label{width:208px}}

.pattern-library select{height:32px;min-height:32px}.pattern-slot-controls .pattern-nav-button{display:grid;place-items:center;justify-self:center;align-self:center;width:32px;height:32px;min-height:32px;min-width:0;margin:0;padding:0;color:#252525;border:1px solid #656565;border-radius:3px;background:linear-gradient(175deg,#f6f6f4 0%,#dfdfdd 16%,#c6c6c4 83%,#a5a5a3 100%);box-shadow:inset 0 2px 1px #fff,inset 2px 0 2px #eee,inset -2px 0 2px #b2b2b0,inset 0 -4px 1px #989896,0 2px 2px #0008;transition:box-shadow .08s,transform .08s}.pattern-slot-controls .pattern-nav-button svg{display:block;width:16px;height:16px;pointer-events:none}.pattern-slot-controls .pattern-nav-button:active{background:linear-gradient(#dededc,#bfbfbd);box-shadow:inset 0 1px 3px #999,inset 0 -2px 1px #aaa,0 1px 1px #0008;transform:translateY(1px)}.pattern-slot-controls .pattern-nav-button:focus-visible{outline:2px solid var(--cyan);outline-offset:3px}.pattern-slot-controls #bank{align-self:center;justify-self:stretch;margin:0}

.legal-info{margin-top:24px;padding-top:16px;border-top:1px solid #555}.legal-info summary{cursor:pointer;font-weight:700;min-height:44px;padding:8px 0}.legal-content h4{font-size:15px;margin:20px 0 6px}.legal-content p{font-size:14px;margin:8px 0;line-height:1.65}.legal-content a{color:var(--cyan);overflow-wrap:anywhere}.legal-link{border:0;background:none;color:var(--cyan);text-decoration:underline;text-underline-offset:3px;padding:4px 0;min-height:44px;text-align:left;font-size:14px}

#accountHeaderName{min-width:0;overflow-wrap:anywhere}.account-premium-crown{display:inline-flex;align-items:center;flex:0 0 auto;color:#f6c95b}.account-premium-crown[hidden]{display:none}.account-premium-crown svg{display:block;width:14px;height:14px}

/* Delete the selected recording while keeping the editor draft. */
.pattern-slot-controls{grid-template-columns:32px minmax(0,1fr) 32px 32px}
.pattern-delete-button:disabled{opacity:.4;cursor:default}
#patternDeleteConfirm{border-color:#b95555}
#patternDeleteFeedback{color:#e87676}
@media(min-width:1024px){.topbar .pattern-slot-label{width:246px}}

/* Generate keeps the existing instrument styling and appears inline only on desktop. */
.randomize-label{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}
.randomize-wand{display:block;width:18px;height:18px;flex-shrink:0}
#desktopRandomize[hidden]{display:none}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main{height:auto;min-height:max(100dvh,1000px);grid-template-columns:minmax(0,1fr) minmax(460px,1fr);grid-template-rows:44px minmax(44px,auto) auto minmax(120px,1fr) minmax(128px,1fr) 46px 64px 44px 18px}
 main>header{grid-column:1/-1;grid-row:1}main>.topbar{grid-column:1/-1;grid-row:2;flex-wrap:wrap;row-gap:8px}
 main>.scope-panel{grid-column:1;grid-row:3;min-height:240px}
 main>#desktopRandomize{grid-column:2;grid-row:3;min-width:0;display:flex}
 main>.sequencer{grid-column:1/-1;grid-row:4}main>.lower{grid-column:1/-1;grid-row:5}main>.sound{grid-column:1/-1;grid-row:6}main>.distortion{grid-column:1/-1;grid-row:7}main>.transport{grid-column:1/-1;grid-row:8}main>.foot{grid-column:1/-1;grid-row:9}
 #desktopRandomize .generator-settings{width:100%;margin:0;padding:12px;border-radius:3px;background:#202020;border:1px solid var(--line)}
 html[data-shell="translucent"] #desktopRandomize .generator-settings{background:linear-gradient(140deg,#ffffff0a,#00000016),#0c1410b8;border-color:#ffffff40;box-shadow:inset 0 1px 0 #ffffff12,0 2px 5px #00000018}
 #desktopRandomize h3{font-size:16px;margin:0 0 6px}
 #desktopRandomize .generator-fields{grid-template-columns:repeat(12,minmax(0,1fr));gap:8px 12px}
 #desktopRandomize .generator-fields>label{grid-column:span 4;font-size:14px;min-width:0;gap:3px}
 #desktopRandomize .generator-fields>label:nth-child(-n+2){grid-column:span 6}
 #desktopRandomize .generator-fields>label:nth-child(3),#desktopRandomize .generator-fields>label:nth-child(4){grid-column:span 3}
 #desktopRandomize .generator-note-count{grid-column:span 6;gap:3px;min-width:0}
 #desktopRandomize .generator-fields select{min-height:36px;height:36px;font-size:14px;padding:4px}
 #desktopRandomize .note-count-controls{gap:5px}#desktopRandomize .note-count-controls button,#desktopRandomize .note-count-controls input{height:36px;min-height:36px}#desktopRandomize .note-count-controls button{width:36px}#desktopRandomize .note-count-controls input{width:64px}
 #desktopRandomize .generator-note-count small{font-size:12px}
 #desktopRandomize .generator-ties-hint{grid-column:1/-1;font-size:12px;line-height:1.4}
 #desktopRandomize .generator-settings p{font-size:14px;line-height:1.4;margin:7px 0}
 #desktopRandomize .generator-context{display:none}
 #desktopRandomize .generator-actions button{min-height:38px}
 #desktopRandomize #genFeedback{font-size:12px;margin-bottom:0}
}
@media(orientation:landscape) and (max-width:1000px){.topbar .randomize-label{gap:3px}.topbar .randomize-wand{width:14px;height:14px}}
.tempo{align-items:center}
.tempo-label{color:#151515;text-align:center;align-self:center;line-height:1.2;font-weight:600;letter-spacing:.7px;background:#d5d5d2;border-radius:3px;padding:6px 8px}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){.tempo{align-self:center;justify-content:center}.tempo-label{display:inline-flex;align-items:center;justify-content:center;min-height:28px}}

.tempo-dial{display:contents}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .tempo-dial{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;flex-shrink:0}
 .tempo-dial .tempo-label{font-size:12px;line-height:14px;min-height:18px;padding:2px 6px;margin:0;text-align:center}
 .tempo-dial .tempo-knob{align-self:center;margin:0}
}

.topbar-actions{display:contents}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .topbar-actions{display:flex;align-items:center;justify-content:flex-start;gap:8px;flex:0 0 auto;max-width:100%}
 .topbar .topbar-actions :is(#genQuick,#play,#save,#help){margin:0;align-self:center;flex-shrink:0}
 .topbar .topbar-actions #help{display:grid;place-items:center;width:40px;min-width:40px;height:40px;min-height:40px;padding:0;line-height:1;font-size:18px}
}

/* Deliberate desktop toolbar rows; no detached help or action buttons. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main>.topbar{display:grid;grid-template-columns:minmax(350px,1fr) minmax(340px,1fr);gap:12px 20px;align-items:end;padding:8px 0}
 .topbar .pattern-library{grid-column:1;grid-row:1;display:grid;grid-template-columns:56px 56px minmax(0,1fr);gap:8px;max-width:430px;width:100%;align-items:end}
 .topbar .pattern-library label{font-size:12px;line-height:14px;gap:4px;min-width:0;width:auto}
 .topbar .pattern-library select{width:100%;height:40px;min-height:40px;margin:0;padding:4px 6px}
 .topbar .pattern-slot-controls{height:40px;grid-template-columns:40px minmax(0,1fr) 40px 40px;gap:4px}
 .topbar .pattern-slot-controls .pattern-nav-button{height:40px;min-height:40px;width:40px;margin:0}
 .topbar .tempo{grid-column:1;grid-row:2;align-items:flex-end;justify-content:flex-start;gap:8px;margin:0}
 .topbar .tempo-value{height:44px;align-items:center}.topbar #bpm{height:44px;min-height:44px;text-align:center}
 .topbar .tempo-adjust{align-items:center;gap:4px}.topbar .tempo-adjust button{height:44px;min-height:44px;margin:0}
 .topbar .tempo-label{color:#151515}
 .topbar .kick-control{grid-column:2;grid-row:2;justify-self:end;align-self:end;width:min(100%,420px);height:44px;min-height:44px;gap:6px;padding:5px 8px;margin:0;justify-content:space-between}
 .topbar .kick-control .switch-state{display:none}.topbar .kick-control #drumVolume{min-width:40px;width:auto;flex:1}.topbar .kick-control output{font-size:12px;min-width:32px}
 .topbar .topbar-actions{grid-column:2;grid-row:1;justify-self:end;align-self:end;gap:8px;margin:0}
 .topbar .topbar-actions :is(#genQuick,#play,#save,#help){height:44px;min-height:44px;margin:0}
 .topbar .topbar-actions #genQuick{padding:4px 10px;font-size:14px}.topbar .topbar-actions #save{padding:4px 10px}
 .topbar .topbar-actions #play{width:44px;flex-basis:44px}.topbar .topbar-actions #help{width:44px;min-width:44px}
}
@media(min-width:1400px) and (hover:hover) and (pointer:fine){
 main>.topbar{grid-template-columns:minmax(340px,380px) 246px minmax(270px,1fr) max-content;gap:12px;align-items:end}
 .topbar .pattern-library{grid-column:1;grid-row:1}.topbar .tempo{grid-column:2;grid-row:1}.topbar .kick-control{grid-column:3;grid-row:1;justify-self:stretch;width:100%}.topbar .topbar-actions{grid-column:4;grid-row:1}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize h3{display:none}
 .topbar .topbar-actions #genQuick{display:none}
}
@media(min-width:1280px) and (hover:hover) and (pointer:fine){
 main>.topbar{grid-template-columns:minmax(340px,380px) 246px minmax(270px,1fr) max-content;gap:12px;align-items:end}
 .topbar .pattern-library{grid-column:1;grid-row:1}.topbar .tempo{grid-column:2;grid-row:1}.topbar .kick-control{grid-column:3;grid-row:1;justify-self:stretch;width:100%}.topbar .topbar-actions{grid-column:4;grid-row:1}
}
.tempo-dial .tempo-label{background:#171717;color:#fff}

/* Outline favorites share the instrument's simple icon language. */
.generator-favorite-control{display:flex;align-items:center;gap:6px;min-width:0;width:100%}
.generator-favorite-control select{flex:1;min-width:0;width:0}
.generator-favorite-control .favorite-button{display:grid;place-items:center;flex:0 0 38px;width:38px;height:44px;min-height:44px;padding:0;color:#aaa;background:#252525}
.favorite-button svg{display:block;pointer-events:none}
.favorite-button[aria-pressed="true"]{color:var(--orange);border-color:var(--orange)}
.favorite-button[aria-pressed="true"] svg{fill:color-mix(in srgb,var(--orange) 18%,transparent)}
.randomize-quota-screen{display:none}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-favorite-control{gap:4px}
 #desktopRandomize .generator-favorite-control .favorite-button{flex-basis:28px;width:28px;height:30px;min-height:30px}
 #desktopRandomize .favorite-button svg{width:18px;height:18px}
 #desktopRandomize .generator-status{display:flex;justify-content:flex-end;min-height:30px;flex-shrink:0}
 #desktopRandomize #genQuotaNote{display:none}
 #desktopRandomize .randomize-quota-screen{display:flex;align-items:center;gap:10px;padding:3px 8px;border:1px solid #555;border-radius:3px;background:linear-gradient(#0d0d0d,#171717);box-shadow:inset 0 2px 5px #0009;height:30px;min-width:126px}
 .randomize-quota-screen .quota-caption{font-size:12px;letter-spacing:.7px;color:#bbb}
 .randomize-quota-screen .library-display{width:34px;min-width:34px;padding:0;color:#4ee168;font:18px monospace}
 .randomize-quota-screen[data-empty="true"] .library-display{color:#ff353f}
}

/* Clean library displays; the transparent native select remains the interactive control. */
.library-select{position:relative;display:block;width:100%;height:40px;min-width:0;border:1px solid #555;border-radius:3px;background:linear-gradient(#0d0d0d,#171717);box-shadow:inset 0 2px 5px #0009}
.library-select::after{content:'⌄';position:absolute;right:4px;top:50%;transform:translateY(-55%);font-family:Arial,sans-serif;font-size:14px;line-height:1;color:#aaa;pointer-events:none}
.pattern-library .library-select select{position:absolute;inset:0;z-index:1;width:100%;height:100%;min-height:0;margin:0;padding:0;opacity:0;cursor:pointer;color:#fff;background:#252525}
.library-select:focus-within{outline:2px solid var(--cyan);outline-offset:2px}
.library-select[data-ready="false"]{opacity:.5}
.library-display{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:5px 13px 5px 5px;pointer-events:none;color:#ff353f}
.library-display[data-saved="true"]{color:#4ee168}
.library-display svg{display:block;height:100%;max-width:100%;width:auto;overflow:visible}
.library-display .lit{fill:currentColor;filter:drop-shadow(0 0 1px currentColor)}.library-display .unlit{fill:#303030;opacity:.45}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .topbar .pattern-library{grid-template-columns:60px 60px minmax(0,1fr);max-width:330px}
 .topbar .pattern-slot-label{width:auto}
 .pattern-slot-controls .pattern-digital-select{height:40px;width:100%;min-width:0}
 .topbar .pattern-library .library-select select{height:100%;min-height:0;padding:0}
 .topbar .pattern-slot-controls{grid-template-columns:36px minmax(48px,1fr) 36px 36px}
 .topbar .pattern-slot-controls .pattern-nav-button{width:36px;height:40px}
}
@media(hover:none) and (pointer:coarse) and (max-width:1023px) and (orientation:portrait){.library-select{height:44px}.library-display{padding-top:6px;padding-bottom:6px}}
@media(hover:none) and (pointer:coarse) and (max-width:1023px) and (orientation:landscape){.library-select{height:28px}.library-display{padding:4px 8px 4px 3px}.library-select::after{font-size:11px;right:1px}}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .topbar .pattern-library{padding:10px;background:linear-gradient(145deg,#292929,#141414);border:1px solid #555;border-radius:5px;box-shadow:inset 0 1px 0 #ffffff20,0 2px 3px #0003;grid-template-columns:64px 64px minmax(0,1fr);max-width:380px;gap:8px}
 .topbar .pattern-library label{color:#c8c8c8;font-size:12px;letter-spacing:.7px}
 .topbar .pattern-library .library-select{height:64px;border-color:#3f3f3f;border-radius:4px;box-shadow:inset 0 3px 7px #000b,inset 0 -1px 0 #ffffff0e}
 .topbar .pattern-library .pattern-slot-controls{height:64px;grid-template-columns:28px minmax(58px,1fr) 28px 28px;gap:3px}
 .topbar .pattern-slot-controls .pattern-nav-button{width:28px;height:36px;min-height:36px}
 .topbar .pattern-library .library-display{padding:9px 11px 9px 5px}
 .topbar .pattern-library .library-select::after{right:3px;font-size:12px}
}

/* Saving belongs to the selected library slot, beside deletion. */
.pattern-slot-controls{grid-template-columns:32px minmax(0,1fr) 32px 32px 32px}
.topbar .pattern-slot-controls #save{display:grid;place-items:center;grid-column:auto;grid-row:auto;width:32px;height:32px;min-height:32px;min-width:0;margin:0;padding:0;align-self:center;font-size:inherit}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .topbar .pattern-library .pattern-slot-controls{grid-template-columns:28px minmax(48px,1fr) 28px 28px 28px}
 .topbar .pattern-slot-controls #save{width:28px;height:36px;min-height:36px}
}

/* Desktop controls share one horizontal axis; transport is the rightmost action. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main>.topbar{align-items:center;row-gap:28px}
 .topbar .pattern-library,.topbar .tempo,.topbar .kick-control,.topbar .topbar-actions{align-self:center}
 .topbar .tempo{align-items:center;height:44px;gap:8px}
 .topbar .tempo-dial{position:relative;display:flex;flex-direction:row;height:44px;width:44px;gap:0}
 .topbar .tempo-dial .tempo-label{position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);white-space:nowrap}
 .topbar .tempo-dial .tempo-knob{height:44px;width:44px;min-height:44px}
 .topbar .tempo-value,.topbar .tempo-adjust{height:44px;align-items:center}
 .topbar .kick-control{height:44px;min-height:44px;align-items:center}
 .topbar .topbar-actions{align-items:center;gap:12px}
 .topbar .topbar-actions #help{order:1}
 .topbar .topbar-actions #play{order:2;width:72px;height:72px;min-height:72px;flex-basis:72px}
 .topbar .topbar-actions #play .transport-mark{max-width:52px;max-height:52px}
}
@media(min-width:1280px) and (hover:hover) and (pointer:fine){main>.topbar{row-gap:12px}}

.scope-panel #scope{border:1px solid #ffffff12;border-radius:3px;background-color:#0d1512;background-image:radial-gradient(ellipse at center,#19251f55,transparent 78%),linear-gradient(transparent calc(50% - .5px),#51675a55 calc(50% - .5px),#51675a55 calc(50% + .5px),transparent calc(50% + .5px)),repeating-linear-gradient(0deg,transparent 0,transparent 25px,#6073671c 25px,#6073671c 26px),repeating-linear-gradient(90deg,transparent 0,transparent 49px,#6073671c 49px,#6073671c 50px);box-shadow:inset 0 1px 8px #0006}

/* The desktop instrument is one viewport; canvas intrinsic size never grows its row. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 body{height:100dvh;min-height:0}
 main{height:100dvh;min-height:0;max-height:100dvh;padding:8px 16px;gap:6px;grid-template-rows:36px 96px minmax(0,1fr) 100px 96px 52px 40px 18px}
 main>.scope-panel{grid-row:3;min-height:0;min-width:0;overflow:hidden}
 main>.scope-panel #scope{flex:1 1 0;height:0;min-height:0;min-width:0;max-height:100%;contain:size}
 main>#desktopRandomize{grid-row:3;min-height:0;min-width:0;overflow:hidden}
 main>.sound{grid-column:1;grid-row:6;gap:12px}
 main>.distortion{grid-column:2;grid-row:6;min-height:0;grid-template-columns:minmax(96px,.9fr) repeat(3,minmax(0,1fr));gap:8px;padding:4px 8px}
 main>.transport{grid-row:7;grid-column:1/-1}
 main>.foot{grid-row:8;grid-column:1/-1}
 main>.topbar{grid-template-columns:minmax(276px,340px) 246px minmax(240px,1fr) max-content;grid-template-rows:1fr;gap:10px;padding:0;align-items:center}
 .topbar .pattern-library{grid-column:1;grid-row:1;grid-template-columns:48px 48px minmax(0,1fr);padding:8px;gap:6px;max-width:340px}
 .topbar .pattern-library .library-select,.topbar .pattern-library .pattern-slot-controls{height:48px}
 .topbar .pattern-library .pattern-slot-controls{grid-template-columns:24px minmax(40px,1fr) 24px 24px 24px;gap:2px}
 .topbar .pattern-slot-controls .pattern-nav-button,.topbar .pattern-slot-controls #save{width:24px;height:32px;min-height:32px}
 .topbar .pattern-library .library-display{padding:6px 8px 6px 3px}
 .topbar .tempo{grid-column:2;grid-row:1}
 .topbar .kick-control{grid-column:3;grid-row:1;width:100%;min-width:0;gap:5px;padding:4px 6px}
 .topbar .kick-control .kick-label{font-size:12px;letter-spacing:0}.topbar .kick-control .hat-label{margin-left:0}
 .topbar .kick-control .distortion-toggle{width:44px;min-width:44px;height:28px;min-height:28px;padding:3px}
 .topbar .kick-control .switch-thumb{width:22px;height:22px}.topbar .kick-control .distortion-toggle[aria-checked="true"] .switch-thumb{transform:translateX(16px)}
 .topbar .kick-control #drumVolume{min-width:24px}.topbar .kick-control output{min-width:28px}
 .topbar .topbar-actions{grid-column:4;grid-row:1;gap:8px}
 .topbar .topbar-actions #help{width:32px;min-width:32px;height:36px;min-height:36px}
 .topbar .topbar-actions #play{width:64px;height:64px;min-height:64px;flex-basis:64px}
 #desktopRandomize .generator-settings{height:100%;min-height:0;padding:8px;display:flex;flex-direction:column;gap:5px}
 #desktopRandomize .generator-fields{grid-template-columns:repeat(16,minmax(0,1fr));gap:5px 7px}
 #desktopRandomize .generator-fields>label{grid-column:span 5;font-size:12px;gap:2px;letter-spacing:0}
 #desktopRandomize .generator-fields>label:nth-child(-n+2){grid-column:span 4}
 #desktopRandomize .generator-fields>label:nth-child(3){grid-column:span 2}
 #desktopRandomize .generator-fields>label:nth-child(4){grid-column:span 3}
 #desktopRandomize .generator-note-count{grid-column:span 3;gap:2px}
 #desktopRandomize .generator-note-count>label{font-size:12px;letter-spacing:0;white-space:nowrap}
 #desktopRandomize .generator-fields>label:last-of-type{grid-column:span 6}
 #desktopRandomize .generator-fields select{height:30px;min-height:30px;font-size:14px;padding:3px}
 #desktopRandomize .note-count-controls{gap:3px}
 #desktopRandomize .note-count-controls button{width:24px;height:30px;min-height:30px;padding:0}
 #desktopRandomize .note-count-controls input{width:40px;height:30px;min-height:30px;font-size:14px;padding:2px;text-align:center}
 #desktopRandomize .generator-fields input[type=range]{height:24px;min-height:24px}
 #desktopRandomize :is(#genNotesHint,#genTiesHint){display:none}
 #desktopRandomize .generator-settings p{font-size:12px;line-height:16px;margin:0}
 #desktopRandomize #genDescription{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:16px}
 #desktopRandomize .generator-actions{gap:6px;margin-top:auto;flex-wrap:nowrap}
 #desktopRandomize .generator-actions button{height:32px;min-height:32px;padding:4px 6px;font-size:14px}
 #desktopRandomize #genFeedback{font-size:12px;line-height:14px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:850px){
 main{padding:6px 12px;gap:4px;grid-template-rows:32px 86px minmax(0,1fr) 84px 82px 44px 36px 16px}
 header .yellow-smiley{width:32px;height:32px}header h1{font-size:24px}header p{font-size:10px;line-height:10px;margin-top:2px}
 .header-controls .theme-button,.header-controls .access-button{height:32px;min-height:32px;padding-top:3px;padding-bottom:3px}
 .sequencer{padding:5px 8px}.sequencer .section-title{margin-bottom:3px}.steps{min-height:0;gap:4px}
 .step{grid-template-rows:16px minmax(16px,1fr) 10px 7px}.step .count{line-height:16px}.step strong{font-size:15px;line-height:16px}.step .n{font-size:10px;line-height:10px}
 .legend{margin-top:3px;font-size:12px;line-height:12px;min-height:12px}
 .lower>section{padding:4px 8px}.editor{grid-template-rows:14px 28px minmax(24px,1fr);gap:3px}
 .note-controls select,.note-controls button{height:28px;min-height:28px;padding:2px 5px}.flags button{min-height:24px;font-size:16px}.flags span{font-size:12px}
 .keyboard-panel .section-title{margin-bottom:3px}.keyboard{min-height:0}.key.white,.key.black{padding-bottom:2px}
 .sound,.distortion{padding-top:2px;padding-bottom:2px}.sound input,.distortion .dist-control input{height:20px;min-height:20px}
 .distortion h2{font-size:12px}.distortion .dist-switch-control{gap:4px}
 .transport :is(#send,#wavQuick){height:34px;min-height:34px;font-size:13px;padding:4px 10px}
 .foot{font-size:12px;line-height:16px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .note-count-controls input{flex:1;min-width:26px;width:0;max-width:44px}
 #desktopRandomize .note-count-controls button{flex:0 0 22px;width:22px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:850px){
 #desktopRandomize .generator-settings{padding:6px;gap:3px}
 #desktopRandomize #genDescription{display:none}
 #desktopRandomize .generator-fields{row-gap:4px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:700px){
 main{padding:4px 12px;gap:3px;grid-template-rows:28px 72px minmax(0,1fr) 76px 76px 40px 32px 14px}
 header .yellow-smiley{width:28px;height:28px}header h1{font-size:22px}header p{display:none}
 .header-controls .theme-button,.header-controls .access-button{height:28px;min-height:28px}
 .topbar .pattern-library{padding:6px}.topbar .pattern-library .library-select,.topbar .pattern-library .pattern-slot-controls{height:40px}
 .topbar .topbar-actions #play{width:56px;height:56px;min-height:56px;flex-basis:56px}
 .topbar .topbar-actions #play .transport-mark{max-width:44px;max-height:44px}
 .editor{grid-template-rows:12px 26px minmax(22px,1fr);gap:2px}.note-controls select,.note-controls button{height:26px;min-height:26px}
 .flags button{min-height:22px}.steps{grid-template-rows:1fr}.step .n{display:none}
 .transport :is(#send,#wavQuick){height:30px;min-height:30px}.foot{font-size:12px;line-height:14px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:620px){#desktopRandomize .generator-settings{overflow:auto}}

/* Phosphor-style oscilloscope screen, separate from the machine colour theme. */
.scope-panel #scope{border-color:#39675c70;border-radius:4px;background-color:#030d0b;background-image:radial-gradient(ellipse at center,#17413788 0%,#102c2570 55%,#00000055 100%),linear-gradient(transparent calc(50% - .5px),#6da58d55 calc(50% - .5px),#6da58d55 calc(50% + .5px),transparent calc(50% + .5px)),linear-gradient(90deg,#618c7830 1px,transparent 1px),linear-gradient(#618c7830 1px,transparent 1px),linear-gradient(90deg,#618c7810 1px,transparent 1px),linear-gradient(#618c7810 1px,transparent 1px);background-size:100% 100%,100% 100%,10% 100%,100% 12.5%,2% 100%,100% 2.5%;background-position:center;box-shadow:inset 0 0 20px #0008,inset 0 1px 3px #000b}

/* Every library caption is anchored to its own display, with room for the brand. */
.library-caption{display:block;min-width:0;line-height:16px}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main{grid-template-rows:64px 96px minmax(0,1fr) 100px 96px 52px 40px 18px}
 main>header{display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:center;gap:16px;height:100%;min-height:0}
 header .brand{min-width:0;gap:12px;align-items:center;height:100%}
 header .brand .yellow-smiley{width:64px;height:64px;flex:0 0 64px;align-self:center}
 header .brand-copy{min-width:0}
 header .brand h1{margin:0;font-size:26px;line-height:1.15}
 header .brand .brand-caption{display:flex;flex-wrap:wrap;gap:2px 6px;font-size:11px;line-height:15px;margin:4px 0 0}
 .topbar{min-width:0}
 main>.topbar{grid-template-columns:minmax(320px,380px) 246px minmax(240px,1fr) max-content}
 .topbar .pattern-library{grid-template-columns:60px 60px minmax(0,1fr);max-width:380px;column-gap:8px}
 .topbar .pattern-library label{flex-direction:column;align-items:stretch;gap:4px;min-width:0;width:100%;text-align:center;letter-spacing:0;font-size:12px;line-height:16px}
 .topbar .pattern-library .library-caption{min-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .topbar .pattern-library .pattern-slot-label{display:grid;grid-template-columns:24px minmax(40px,1fr) 24px 24px 24px;column-gap:2px;row-gap:4px}
 .topbar .pattern-slot-label>.library-caption{grid-column:2;grid-row:1}
 .topbar .pattern-slot-label>.pattern-slot-controls{grid-column:1/-1;grid-row:2}
 .topbar .tempo-label{line-height:18px}
 #desktopRandomize .generator-fields>label,#desktopRandomize .generator-note-count>label{line-height:16px}
 #desktopRandomize .generator-note-count>label{white-space:normal;overflow-wrap:normal}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:850px){
 main{grid-template-rows:56px 78px minmax(0,1fr) 76px 78px 40px 36px 16px}
 header .brand .yellow-smiley{width:56px;height:56px;flex-basis:56px}
 header .brand h1{font-size:24px}header .brand .brand-caption{font-size:10px;line-height:13px;margin-top:3px;display:flex}
 .topbar .pattern-library{padding:6px}.topbar .pattern-library .library-select,.topbar .pattern-library .pattern-slot-controls{height:42px}
 .editor{grid-template-rows:12px 26px minmax(22px,1fr);gap:2px}.note-controls select,.note-controls button{height:26px;min-height:26px;padding:2px 5px}.flags button{min-height:22px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:700px){
 main{grid-template-rows:56px 76px minmax(0,1fr) 68px 72px 36px 30px 14px}
 .topbar .pattern-library .library-select,.topbar .pattern-library .pattern-slot-controls{height:40px}
 .transport :is(#send,#wavQuick){height:28px;min-height:28px}
}

/* Desktop: scope, selected step and Generate share the same upper row. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main{grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:64px 96px clamp(248px,31dvh,300px) 100px minmax(0,1fr) 64px 18px}
 main>header,main>.topbar{grid-column:1/-1}
 main>.scope-panel{grid-column:1/5;grid-row:3}
 main>.lower{display:contents}
 main>.lower>.editor{grid-column:5/8;grid-row:3;min-width:0;min-height:0;display:grid;grid-template-rows:18px 60px minmax(0,1fr);padding:8px;gap:6px}
 main>#desktopRandomize{grid-column:8/13;grid-row:3}
 main>.sequencer{grid-column:1/-1;grid-row:4}
 main>.lower>.keyboard-panel{grid-column:1/10;grid-row:5;min-width:0;min-height:0}
 main>.sound{grid-column:1/7;grid-row:6}
 main>.distortion{grid-column:7/13;grid-row:6}
 main>.transport{grid-column:10/13;grid-row:5;display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:8px;min-width:0;min-height:0;margin:0}
 main>.transport :is(#send,#wavQuick){flex:0 1 56px;width:100%;height:56px;min-height:36px;margin:0;padding:6px 10px;font-size:14px}
 main>.foot{grid-column:1/-1;grid-row:7}
 .editor .section-title{padding:0;margin:0;min-width:0;gap:6px}
 .editor .note-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr)) 32px 32px;gap:6px;align-items:end;min-width:0}
 .editor .note-controls label{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0;line-height:16px;font-size:12px;letter-spacing:0}
 .editor .note-controls select{width:100%;height:32px;min-height:32px;padding:3px 5px}
 .editor .note-controls button{width:32px;height:32px;min-height:32px;padding:0;margin:0}
 .editor .flags{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:6px;min-width:0;min-height:0;margin:0}
 .editor .flags button{min-width:0;min-height:32px;font-size:20px;gap:5px;padding:4px;white-space:nowrap}
 .editor .flags span{font-size:12px;line-height:16px;letter-spacing:0}
 #desktopRandomize .generator-fields{grid-template-columns:repeat(12,minmax(0,1fr));gap:5px 8px}
 #desktopRandomize .generator-fields>label{grid-column:span 4}
 #desktopRandomize .generator-fields>label:nth-child(-n+2){grid-column:span 6}
 #desktopRandomize .generator-fields>label:nth-child(3),#desktopRandomize .generator-fields>label:nth-child(4){grid-column:span 3}
 #desktopRandomize .generator-note-count{grid-column:span 6}
 #desktopRandomize .generator-fields>label:last-of-type{grid-column:span 4}
 #desktopRandomize .note-count-controls input{flex:none;width:44px;max-width:44px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:850px){
 main{grid-template-rows:56px 78px 244px 80px minmax(0,1fr) 56px 16px}
 main>.transport :is(#send,#wavQuick){flex-basis:48px;height:48px;min-height:32px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:700px){
 main{grid-template-rows:56px 80px 212px 76px minmax(0,1fr) 48px 14px}
 main>.lower>.editor{grid-template-rows:16px 52px minmax(0,1fr);gap:5px}
 .editor .flags{gap:5px}
 main>.transport :is(#send,#wavQuick){flex-basis:44px;height:44px;min-height:30px}
}

/* Put the desktop legend beside the heading, giving the keys the full lower row. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main>.sequencer{padding:4px 8px;display:grid;grid-template-columns:max-content minmax(0,1fr) max-content;grid-template-rows:16px minmax(0,1fr);column-gap:12px;row-gap:5px;min-height:0}
 .sequencer>.section-title{display:contents}
 .sequencer>.section-title h2{grid-column:1;grid-row:1;align-self:center;white-space:nowrap;margin:0}
 .sequencer>.section-title>span{grid-column:3;grid-row:1;align-self:center;white-space:nowrap;font-size:12px;line-height:16px}
 .sequencer>.legend{grid-column:2;grid-row:1;display:flex;justify-content:center;align-items:center;flex-wrap:nowrap;gap:14px;min-height:0;margin:0;font-size:12px;line-height:16px;white-space:nowrap}
 .sequencer>.legend span{flex-shrink:0}.sequencer>.legend span:last-child{display:flex}
 .sequencer>.steps{grid-column:1/-1;grid-row:2;min-height:0;height:100%;align-items:stretch}
 .sequencer .step{min-height:0;overflow:hidden;grid-template-rows:18px minmax(18px,1fr) 12px;padding:0 0 3px}
 .sequencer .step>.count{grid-row:1;line-height:18px;padding:0}
 .sequencer .step>strong{grid-row:2;min-height:0;align-self:center;line-height:18px;margin:0}
 .sequencer .step>.n{display:none}
 .sequencer .step>.lights{grid-row:3;align-items:center;min-height:12px;gap:5px;margin:0}
 .sequencer .step>.lights i{width:5px;height:5px;flex:none}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:700px){
 .sequencer{padding:4px 8px;row-gap:3px}
 .sequencer .step{grid-template-rows:14px minmax(18px,1fr) 10px;padding-bottom:2px}
 .sequencer .step>.count{line-height:14px}
 .sequencer .step>.lights{min-height:10px}
 .sequencer>.legend{gap:10px}
}

/* A quiet red illumination identifies written notes; playback and selection stay distinct. */
.step.has-note:not(.playing){background:linear-gradient(180deg,#483237,#34282b);box-shadow:inset 0 0 12px #ff405518}
.step.has-note:not(.selected):not(.playing){border-color:#76545a}
.step.has-note.selected:not(.playing){box-shadow:inset 0 -3px var(--orange),inset 0 0 12px #ff405518}

/* Shared drum volume: below the switches on touch screens, inline on desktop. */
.kick-control{display:grid;grid-template-rows:auto auto;align-content:center}
.drum-switches{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0}
.drum-volume{display:flex;align-items:center;gap:8px;min-width:0;width:100%}
.kick-control .drum-volume #drumVolume{flex:1;width:0;min-width:0;height:22px;min-height:22px;margin:0}
.drum-volume output{flex:none;min-width:32px;text-align:right;font-size:12px;white-space:nowrap}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main>.topbar{grid-template-columns:minmax(276px,380px) 246px 80px minmax(286px,1fr) 32px;gap:8px}
 .topbar .topbar-actions{display:contents}
 .topbar .kick-control{grid-column:4;grid-row:1;display:grid;grid-template-columns:max-content minmax(80px,1fr);grid-template-rows:1fr;height:44px;min-height:44px;gap:8px;padding:6px 8px}
 .topbar .kick-control .drum-switches{gap:6px}
 .topbar .kick-control .drum-volume{gap:6px}
 .topbar .topbar-actions #play{grid-column:3;grid-row:1;align-self:center;justify-self:center;width:80px;height:80px;min-height:80px;flex:none}
 .topbar .topbar-actions #play .transport-mark{width:50px;height:50px;max-width:50px;max-height:50px}
 .topbar .topbar-actions #help{grid-column:5;grid-row:1;align-self:center;justify-self:end}
 .sound label,.distortion .dist-control{min-width:0}
 main>.distortion{grid-template-columns:190px repeat(3,minmax(0,1fr))}
 .distortion .dist-switch-control{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:6px;min-width:0}
 .distortion .dist-switch-control h2{flex:none;white-space:nowrap;letter-spacing:.4px}
 .distortion .dist-switch-control .switch-state{flex:none;width:24px;line-height:16px}
 .distortion #distSwitch{flex:0 0 58px;box-sizing:border-box;width:58px;min-width:58px;max-width:58px;height:32px;min-height:32px;max-height:32px;padding:3px;transform:none}
 .distortion #distSwitch:active{transform:none}
 .distortion #distSwitch .switch-thumb{width:26px;height:26px;flex:none;transform:translateX(0)}
 .distortion #distSwitch[aria-checked="true"] .switch-thumb{transform:translateX(26px)}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:620px){
 main{grid-template-rows:48px 80px 172px 76px minmax(0,1fr) 44px 14px}
 header .brand .yellow-smiley{width:48px;height:48px;flex-basis:48px}
 main>.lower>.editor{grid-template-rows:16px 48px minmax(0,1fr);gap:4px}
 .editor .flags button{min-height:28px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:540px){
 main{grid-template-rows:40px 76px 148px 72px minmax(0,1fr) 40px 14px}
 header .brand .yellow-smiley{width:40px;height:40px;flex-basis:40px}
 header .brand .brand-caption{display:none}
 .topbar .topbar-actions #play{width:72px;height:72px;min-height:72px}
}
@media(max-width:1023px){
 main>.topbar{display:grid;grid-template-columns:minmax(84px,1fr) 80px minmax(160px,1.8fr);align-items:center;gap:10px 8px}
 .topbar .pattern-library{grid-column:1/-1;grid-row:1;max-width:none;width:100%}
 .topbar .tempo{grid-column:1/3;grid-row:2;justify-self:start;margin:0}
 .topbar .topbar-actions{display:contents}
 .topbar .topbar-actions #genQuick{grid-column:1;grid-row:3;min-width:0;width:100%;height:80px;min-height:80px;margin:0;padding:4px;font-size:14px}
 .topbar .topbar-actions #genQuick .randomize-label{flex-direction:column;gap:4px}
 .topbar .topbar-actions #play{grid-column:2;grid-row:3;align-self:center;justify-self:center;width:80px;height:80px;min-height:80px;margin:0}
 .topbar .topbar-actions #play .transport-mark{width:48px;height:48px}
 .topbar .topbar-actions #help{grid-column:3;grid-row:2;align-self:center;justify-self:end;width:40px;height:40px;min-height:40px;margin:0}
 .topbar .kick-control{grid-column:3;grid-row:3;display:grid;width:100%;height:84px;min-height:84px;gap:4px;padding:6px;justify-content:stretch}
 .drum-switches .switch-state{display:none}
}

/* The guide uses the browser's top layer, and coordinates from the visible viewport. */
.tutorial-overlay{inset:auto;top:0;left:0;width:100%;height:100%;margin:0;border:0;background:transparent;color:inherit;overflow:hidden;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
.tutorial-overlay::backdrop{background:transparent;pointer-events:none}
.tutorial-card{inset:auto;right:auto;bottom:auto;max-width:none;margin:0;overscroll-behavior:contain}
.tutorial-card[data-edge]{bottom:auto}
.tutorial-actions{position:sticky;bottom:-16px;padding:8px 0;background:#222}
@media(orientation:landscape) and (max-height:500px){.tutorial-actions{bottom:-10px;padding:5px 0}}

@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:850px){
 main>.sequencer{row-gap:3px}
 .sequencer .step{grid-template-rows:14px minmax(18px,1fr) 10px;padding-bottom:2px}
 .sequencer .step>.count{line-height:14px}
 .sequencer .step>.lights{min-height:10px}
}

/* One clean scope screen; audio control stays inside its existing panel. */
.scope-panel{position:relative}
.scope-panel #enableAudio{position:absolute;z-index:1;top:16px;right:16px;display:grid;place-items:center;width:44px;min-width:44px;height:44px;min-height:44px;margin:0;padding:10px;border:1px solid #769e8c55;border-radius:6px;background:#07150fe6;color:#b8ccc4;box-shadow:0 1px 4px #0004}
.scope-panel #enableAudio svg{display:block;width:24px;height:24px;pointer-events:none}
.scope-panel #enableAudio .audio-waves{display:none}
.scope-panel #enableAudio.ready{color:#91ffdc;border-color:#629c8570}
.scope-panel #enableAudio.ready .audio-waves{display:block}
.scope-panel #enableAudio.ready .audio-slash{display:none}
.scope-panel .scope-caption{display:flex;justify-content:space-between;gap:8px;flex:0 0 auto;margin-top:6px;font:12px/14px monospace;color:#8aab98}
@media(max-width:1023px) and (orientation:portrait){.scope-panel #scope{height:168px}}

/* Pitch arrows sit beside the note selector; step navigation stays separate. */
.editor .step-note-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.editor .step-note-input{display:grid;grid-template-columns:minmax(0,1fr) 30px;gap:4px;align-items:stretch;min-width:0}
.editor .step-note-input select{width:100%;min-width:0}
.editor .step-note-arrows{display:grid;grid-template-rows:repeat(2,minmax(0,1fr));gap:2px;min-width:0}
.editor .note-controls .step-note-arrows button{display:grid;place-items:center;width:100%;height:100%;min-width:0;min-height:0;padding:0;margin:0;font-size:0;line-height:1}
.editor .step-note-arrows svg{display:block;width:14px;height:14px;pointer-events:none}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .editor .note-controls{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr) 32px 32px}
}
/* First-visit welcome uses the instrument's existing smiley. */
.tutorial-welcome-logo[hidden]{display:none}
.tutorial-overlay[data-welcome="true"]{background:radial-gradient(ellipse at 50% 35%,#30302b,#171717 72%);pointer-events:auto}
.tutorial-overlay[data-welcome="true"] .tutorial-card{padding:24px;border:0;background:transparent;box-shadow:none;text-align:center}
.tutorial-overlay[data-welcome="true"] .tutorial-welcome-logo{display:block;width:clamp(100px,30vw,180px);height:auto;margin:0 auto 24px;filter:drop-shadow(0 8px 16px #0005)}
.tutorial-overlay[data-welcome="true"] h2{font-size:clamp(24px,5vw,32px);line-height:1.2;margin:0 0 12px;overflow-wrap:anywhere}
.tutorial-overlay[data-welcome="true"] #tutorialBody{font-size:16px;margin-bottom:24px}
.tutorial-overlay[data-welcome="true"] .tutorial-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;position:static;width:min(300px,100%);margin:0 auto;padding:0;background:transparent}
.tutorial-overlay[data-welcome="true"] .tutorial-actions button{min-height:44px;font-size:16px}
.tutorial-overlay[data-welcome="true"] #tutorialNext{order:-1}
@media(max-height:500px){
 .tutorial-overlay[data-welcome="true"] .tutorial-card{padding:12px}
 .tutorial-overlay[data-welcome="true"] .tutorial-welcome-logo{width:76px;margin-bottom:12px}
 .tutorial-overlay[data-welcome="true"] #tutorialBody{margin-bottom:12px}
}

/* The same compact help icon on desktop and phone. */
.topbar .topbar-actions #help{display:grid;place-items:center}
#help .help-lifebuoy{display:block;width:22px;height:22px;pointer-events:none}
.help-install{margin-top:24px;padding:0;border:0;background:transparent}
#helpDialog .help-install h3{margin-top:0}
.help-install h4{font-size:16px;margin:18px 0 6px}
.help-install ol{padding-left:24px;margin:6px 0}
.help-install li{margin:6px 0}
.help-install-sources{font-size:14px}
.help-install a{color:var(--cyan);text-underline-offset:3px}
@media(hover:none) and (pointer:coarse) and (max-width:1023px) and (orientation:landscape){#help .help-lifebuoy{width:18px;height:18px}}

.settings-touch-icon{display:none}

/* Welcome must fit embedded iPhone browsers as well as Safari. */
.tutorial-overlay[data-welcome="true"] .tutorial-card{min-width:0;max-width:calc(100% - 24px);box-sizing:border-box;overflow-x:hidden}
.tutorial-overlay[data-welcome="true"] :is(h2,#tutorialBody){min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.tutorial-overlay[data-welcome="true"] .tutorial-actions{min-width:0;max-width:100%}

/* TD-3 sound row: ordered metal dials, separate master volume and distortion. */
.sound{grid-template-columns:repeat(7,minmax(0,1fr));gap:10px}
.sound .sound-dial-control{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;text-align:center;letter-spacing:.3px}
.sound-dial{display:flex;flex-direction:column;align-items:center;gap:3px}
.sound .sound-knob,.distortion .sound-knob{width:62px;height:62px;min-height:62px;padding:7px;background:repeating-conic-gradient(from -135deg,currentColor 0deg 1.5deg,transparent 1.5deg 18deg)}
.sound-knob::before{inset:7px;background:repeating-conic-gradient(#b8b8b5 0deg 2deg,#777 2deg 4deg);box-shadow:0 3px 5px #0009,inset 0 1px 2px #fff}
.sound-knob .knob-cap{border:3px solid #aaa;background:linear-gradient(180deg,#fafafa 0%,#d1d1cf 30%,#a8a8a6 32%,#c7c7c5 90%);box-shadow:inset 1px 2px 3px #fff,0 2px 4px #0007}
.sound-knob .knob-cap i{top:0;left:50%;transform:translateX(-50%);height:10px;width:3px;background:#eee;border-color:#777}
.sound-knob-value{font:12px monospace;color:var(--muted);white-space:nowrap}
.distortion .dist-control{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0}
.distortion .sound-knob{width:48px;height:48px;min-height:48px;padding:6px}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 main>.sound{grid-column:1/9;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;padding:6px}
 main>.distortion{grid-column:9/13}
 main{grid-template-rows:58px 76px minmax(0,1fr) 100px minmax(64px,.4fr) 112px 18px}
 .sound .sound-dial-control{font-size:12px}
}
@media(hover:none) and (pointer:coarse) and (orientation:portrait){.sound{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 8px}.sound .sound-dial-control{font-size:12px}.sound .sound-knob{width:64px;height:64px;min-height:64px}}
@media(hover:none) and (pointer:coarse) and (orientation:landscape){.sound{grid-template-columns:repeat(4,minmax(0,1fr));gap:2px 4px}.sound .sound-knob{width:30px;height:30px;min-height:30px;padding:4px}.sound .sound-dial-control{font-size:10px;line-height:12px;gap:0}.sound-knob-value{font-size:10px;line-height:11px}.distortion .sound-knob{width:30px;height:30px;min-height:30px;padding:4px}.sound-dial{gap:0}}

.sound-tune-heading{display:flex;align-items:center;justify-content:center;gap:4px;height:20px}
#waveformSwitch{width:26px;height:20px;min-height:20px;padding:2px;border-radius:3px;display:inline-flex;align-items:center;justify-content:center;background:var(--panel);color:inherit}
#waveformSwitch svg{width:22px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
@media(hover:none) and (pointer:coarse) and (orientation:landscape){.sound-tune-heading{height:14px}#waveformSwitch{height:14px;min-height:14px;width:20px}#waveformSwitch svg{width:18px;height:10px}}

/* Functional up/down arrows inside the pattern display; the number still opens its menu. */
.topbar .pattern-library .pattern-digital-select::after{display:none}
.topbar .pattern-library .pattern-digital-select select{width:calc(100% - 22px)}
.topbar .pattern-library .pattern-digital-select .library-display{padding-right:24px;padding-left:3px}
.pattern-stepper{position:absolute;inset:0 0 0 auto;width:22px;display:grid;grid-template-rows:1fr 1fr;z-index:2;border-left:1px solid #444}
.topbar .pattern-stepper button{display:grid;place-items:center;width:100%;height:100%;min-height:0;margin:0;padding:1px;border:0;border-radius:0;background:#242424;color:#ccc}
.topbar .pattern-stepper button:first-child{border-bottom:1px solid #444;border-top-right-radius:2px}
.topbar .pattern-stepper button:last-child{border-bottom-right-radius:2px}
.pattern-stepper svg{width:14px;height:9px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.topbar .pattern-stepper button:hover{background:#383838;color:white}
.topbar .pattern-stepper button:disabled{opacity:.3}
@media(hover:none) and (pointer:coarse) and (orientation:landscape){.pattern-stepper{width:18px}.topbar .pattern-library .pattern-digital-select select{width:calc(100% - 18px)}.topbar .pattern-library .pattern-digital-select .library-display{padding-right:19px}.pattern-stepper svg{width:12px;height:8px}}

/* Pattern display and its two actions now use the space freed by side arrows. */
.topbar .pattern-library{--pattern-action-width:32px;--pattern-action-gap:6px}
.topbar .pattern-library .pattern-slot-label{display:grid;grid-template-columns:minmax(48px,1fr) var(--pattern-action-width) var(--pattern-action-width);column-gap:var(--pattern-action-gap);row-gap:4px;min-width:0}
.topbar .pattern-library .pattern-slot-label>.library-caption{grid-column:1;grid-row:1;text-align:center}
.topbar .pattern-library .pattern-slot-controls{grid-column:1/-1;grid-row:2;grid-template-columns:minmax(48px,1fr) var(--pattern-action-width) var(--pattern-action-width);gap:var(--pattern-action-gap);width:100%}
.topbar .pattern-library .pattern-slot-controls .pattern-nav-button,.topbar .pattern-library .pattern-slot-controls #save{width:var(--pattern-action-width);margin:0}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){.topbar .pattern-library{--pattern-action-width:28px;--pattern-action-gap:6px}}

/* Desktop Generate: stable rows and room for complete density labels. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-settings{gap:6px;overflow:hidden}
 #desktopRandomize .generator-fields{flex:none;row-gap:7px;column-gap:8px}
 #desktopRandomize .generator-fields>label:nth-child(3){grid-column:span 2}
 #desktopRandomize .generator-fields>label:nth-child(4){grid-column:span 5}
 #desktopRandomize .generator-note-count{grid-column:span 5}
 #desktopRandomize .generator-fields>label,#desktopRandomize .generator-note-count{min-width:0;line-height:16px}
 #desktopRandomize .generator-fields select{width:100%;min-width:0;font-size:12px}
 #desktopRandomize .generator-actions{flex:none;gap:8px;padding-top:4px;margin-top:auto}
 #desktopRandomize .generator-actions button{flex:1 1 0;min-width:0;white-space:nowrap}
 #desktopRandomize #genFeedback{flex:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:14px;max-height:14px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (max-height:700px){
 #desktopRandomize .generator-settings{gap:4px}
 #desktopRandomize .generator-fields{row-gap:5px}
 #desktopRandomize .generator-fields>label,#desktopRandomize .generator-note-count>label{font-size:11px;line-height:14px}
 #desktopRandomize .generator-fields select,#desktopRandomize .note-count-controls :is(button,input){height:26px;min-height:26px}
 #desktopRandomize .generator-fields input[type=range]{height:20px;min-height:20px}
 #desktopRandomize .generator-actions button{height:30px;min-height:30px;font-size:12px}
}

:is(#genGenerate,#genQuick,#genVariant):disabled{background:#353535;color:#aaa;border-color:#555;cursor:not-allowed;opacity:.65}

/* Keep the primary action visible even in short desktop windows. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-settings{display:grid;grid-template-rows:minmax(0,1fr) 34px 14px;gap:6px;overflow:hidden;min-height:0;height:100%}
 #desktopRandomize .generator-settings>h3,#desktopRandomize #genDescription,#desktopRandomize .generator-context{display:none}
 #desktopRandomize .generator-fields{grid-row:1;min-height:0;overflow:auto;align-content:start;scrollbar-width:thin}
 #desktopRandomize .generator-actions{grid-row:2;display:flex;align-items:stretch;margin:0;padding:0;min-height:34px;overflow:visible}
 #desktopRandomize .generator-actions button{display:inline-flex;align-items:center;justify-content:center;visibility:visible;height:34px;min-height:34px}
 #desktopRandomize #genFeedback{grid-row:3;margin:0;min-height:14px;max-height:14px;line-height:14px}
}

/* Small beta marker beside the instrument name and first-visit welcome title. */
.brand h1 .app-beta-label,.tutorial-overlay[data-welcome="true"] h2::after{display:inline-block;vertical-align:middle;margin-left:8px;padding:3px 5px;border:1px solid currentColor;border-radius:4px;font:600 12px/1 Arial,sans-serif;letter-spacing:.04em;opacity:.8}
.tutorial-overlay[data-welcome="true"] h2::after{content:"BETA"}

/* Desktop instructions use the existing Generate action and leave touch layouts intact. */
.generator-prompt{display:none}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-settings{grid-template-rows:minmax(0,1fr) 34px 30px 14px}
 #desktopRandomize .generator-prompt{display:grid;grid-row:3;grid-template-columns:max-content minmax(0,1fr);align-items:center;gap:8px;min-width:0}
 #desktopRandomize .generator-prompt label{font-size:12px;letter-spacing:.5px;white-space:nowrap}
 #desktopRandomize #genPrompt{box-sizing:border-box;width:100%;min-width:0;height:30px;min-height:30px;padding:4px 8px;font-size:14px;border:1px solid var(--line);border-radius:3px;background:#111a;color:#eee}
 #desktopRandomize #genPrompt:focus-visible{outline:2px solid var(--orange);outline-offset:1px}
 #desktopRandomize #genFeedback{grid-row:4}
}

/* v0.120: every desktop generator control is visible on opening. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-settings{grid-template-rows:minmax(88px,1fr) 32px 28px 14px;gap:4px;padding:6px}
 #desktopRandomize .generator-fields{grid-template-columns:repeat(20,minmax(0,1fr));grid-template-rows:40px 44px;gap:4px 6px;overflow:visible;align-content:start;min-height:88px}
 #desktopRandomize .generator-fields>label{font-size:12px;line-height:14px;letter-spacing:0;gap:2px;min-width:0}
 #desktopRandomize .generator-fields>label:nth-child(1){grid-column:1/9;grid-row:1;justify-content:flex-end}
 #desktopRandomize .generator-fields>label:nth-child(2){grid-column:9/17;grid-row:1;justify-content:flex-end}
 #desktopRandomize .generator-fields>label:nth-child(3){grid-column:17/21;grid-row:1}
 #desktopRandomize .generator-fields>label:nth-child(4){grid-column:1/7;grid-row:2}
 #desktopRandomize .generator-note-count{grid-column:7/12;grid-row:2;gap:2px;min-width:0}
 #desktopRandomize .generator-fields>label:nth-child(6){grid-column:12/15;grid-row:2}
 #desktopRandomize .generator-fields>label:nth-child(7){grid-column:15/18;grid-row:2}
 #desktopRandomize .generator-fields>label:nth-child(8){grid-column:18/21;grid-row:2}
 #desktopRandomize .generator-fields>label:nth-child(n+6){font-size:11px;white-space:nowrap}
 #desktopRandomize .generator-fields select{height:26px;min-height:26px;font-size:12px;padding:2px 3px}
 #desktopRandomize .generator-fields input[type=range]{height:26px;min-height:26px;width:100%;margin:0}
 #desktopRandomize .generator-favorite-control .favorite-button{height:26px;min-height:26px;flex-basis:24px;width:24px}
 #desktopRandomize .generator-note-count>label{font-size:11px;line-height:14px;white-space:nowrap;letter-spacing:0}
 #desktopRandomize .note-count-controls{gap:3px;min-width:0}
 #desktopRandomize .note-count-controls button{width:22px;min-width:22px;height:26px;min-height:26px;padding:0}
 #desktopRandomize .note-count-controls input{width:36px;max-width:36px;min-width:0;height:26px;min-height:26px;padding:2px;font-size:13px}
 #desktopRandomize :is(#genNotesHint,#genTiesHint){display:none}
 #desktopRandomize .generator-actions,#desktopRandomize .generator-actions button{height:32px;min-height:32px}
 #desktopRandomize #genPrompt{height:28px;min-height:28px}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-settings{grid-template-columns:minmax(0,1fr) 140px;grid-template-rows:minmax(92px,1fr) 32px 28px 26px}
 #desktopRandomize .generator-fields{grid-column:1/-1;grid-template-rows:44px 44px;min-height:92px}
 #desktopRandomize .generator-actions,#desktopRandomize .generator-prompt{grid-column:1/-1}
 #desktopRandomize #genFeedback{grid-column:1;grid-row:4;align-self:center}
 #desktopRandomize .generator-status{grid-column:2;grid-row:4;min-height:26px;height:26px;align-self:center;min-width:0}
 #desktopRandomize .randomize-quota-screen{height:26px;min-height:26px;min-width:0;width:140px;padding:2px 6px;gap:6px}
 #desktopRandomize .randomize-quota-screen .quota-caption{font-size:11px}
}

/* v0.121: distribute desktop controls through the available field area. */
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 #desktopRandomize .generator-fields{grid-template-rows:repeat(2,minmax(44px,1fr));align-content:stretch;align-items:center}
 #desktopRandomize .generator-fields>label:nth-child(-n+2){justify-content:center}
 #desktopRandomize .generator-note-count{align-self:center}
}
@media(min-width:1024px) and (hover:hover) and (pointer:fine) and (min-height:851px){
 #desktopRandomize .generator-settings{grid-template-rows:minmax(140px,1fr) 32px 28px 26px}
 #desktopRandomize .generator-fields{grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:repeat(3,minmax(44px,1fr));min-height:140px;gap:4px 10px}
 #desktopRandomize .generator-fields>label:nth-child(1){grid-column:1/6;grid-row:1}
 #desktopRandomize .generator-fields>label:nth-child(2){grid-column:6/11;grid-row:1}
 #desktopRandomize .generator-fields>label:nth-child(3){grid-column:11/13;grid-row:1}
 #desktopRandomize .generator-fields>label:nth-child(4){grid-column:1/7;grid-row:2}
 #desktopRandomize .generator-note-count{grid-column:7/13;grid-row:2}
 #desktopRandomize .generator-fields>label:nth-child(6){grid-column:1/5;grid-row:3}
 #desktopRandomize .generator-fields>label:nth-child(7){grid-column:5/9;grid-row:3}
 #desktopRandomize .generator-fields>label:nth-child(8){grid-column:9/13;grid-row:3}
 #desktopRandomize .generator-fields>label,#desktopRandomize .generator-note-count>label{font-size:12px}
 #desktopRandomize .note-count-controls{gap:6px}
 #desktopRandomize .note-count-controls button{width:28px;min-width:28px}
 #desktopRandomize .note-count-controls input{width:44px;max-width:44px}
}

.desktop-subscription{display:none}@media(min-width:1024px) and (hover:hover) and (pointer:fine){.header-controls .desktop-subscription{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:3px;color:inherit;font-size:14px;text-decoration:none;white-space:nowrap}.desktop-subscription:hover{border-color:var(--orange);color:var(--orange)}.desktop-subscription:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}}
