/* Riffsmith: the riff generator, styled with the site theme (light and dark follow the site toggle).
   One screen on a phone: the settings summary, the tab in a two-row window, and a panel pinned above
   the dock with the sound, tempo and buttons. Settings, guitar, pedals, band and tab symbols open in sheets. */

/* ---- Shared controls ---- */
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.lbl{font-size:12px;font-weight:600;color:var(--mut);text-transform:uppercase;letter-spacing:.05em}
select{font:inherit;font-size:15px;color:var(--fg);background:var(--card);border:1px solid var(--line);
  border-radius:10px;padding:8px 30px 8px 10px;min-height:44px;appearance:none;-webkit-appearance:none;width:100%;
  background-image:linear-gradient(45deg,transparent 50%,var(--mut) 50%),linear-gradient(135deg,var(--mut) 50%,transparent 50%);
  background-position:calc(100% - 15px) 52%,calc(100% - 10px) 52%;background-size:5px 5px;background-repeat:no-repeat}
.seg{display:flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--card)}
.seg button{flex:1 1 auto;font:inherit;font-size:15px;border:0;border-right:1px solid var(--line);background:transparent;color:var(--fg);
  padding:6px 10px;min-height:44px;cursor:pointer}
.seg button:last-child{border-right:0}
.seg button:first-child{border-radius:9px 0 0 9px}
.seg button:last-child{border-radius:0 9px 9px 0}
.seg button:only-child{border-radius:9px}
.seg button[aria-checked="true"]{background:var(--fg);color:var(--card)}
.seg button:hover:not([aria-checked="true"]){background:var(--bg)}
.btn{font:inherit;font-size:15px;font-weight:600;border:1px solid var(--line);background:var(--card);color:var(--fg);
  border-radius:10px;padding:8px 14px;min-height:44px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.btn:hover{border-color:var(--mut)}
.btn.primary{background:var(--acc);border-color:var(--acc);color:#fff}
.btn.primary:hover{filter:brightness(1.07)}
.btn[disabled]{opacity:.45;cursor:default}
.btn svg{width:15px;height:15px;fill:currentColor}
#practice svg,#saveRiff svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round}
.btn.big{min-height:48px;font-size:17px;font-weight:700}
.rsPanel .btn{min-height:44px}
.rsPanel .btn.big{min-height:48px}
.btn.big.primary{box-shadow:0 2px 0 color-mix(in srgb,var(--acc) 55%,#000)}
.btn.practice{border-color:var(--ok);color:var(--ok)}
/* Playing and looping are blue and see-through, so orange stays for New riff and the selected note */
#play.on{background:color-mix(in srgb,var(--f1) 12%,var(--card));border-color:var(--f1);color:var(--f1)}
.tempo{display:flex;align-items:center;gap:10px;font-size:15px}
.tempo input{flex:1;min-width:0;accent-color:var(--f1)}
.tempo output{font-family:ui-monospace,Menlo,Consolas,monospace;min-width:3ch;text-align:right}
.check{display:flex;align-items:center;gap:8px;font-size:15px;cursor:pointer;min-height:44px}
.check input{accent-color:var(--f1);width:18px;height:18px}
.iconBtn{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;border:0;background:transparent;
  color:var(--mut);border-radius:10px;cursor:pointer}
.iconBtn:hover{color:var(--fg)}
.iconBtn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
kbd{font-family:ui-monospace,Menlo,monospace;font-size:12px;border:1px solid var(--line);border-radius:4px;padding:1px 5px;background:var(--card)}
button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid var(--acc);outline-offset:2px}

/* ---- The page keeps room for the pinned panel ---- */
main{padding-top:12px;padding-bottom:calc(var(--dock) + var(--rsPanel,230px) + 12px)}
.rs{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.rsCard{background:var(--card);border:1px solid var(--line);border-radius:12px}

/* Settings summary: tap to change */
.sumBtn{font:inherit;color:inherit;text-align:left;display:flex;align-items:center;gap:12px;padding:7px 14px;min-height:52px;width:100%;cursor:pointer}
.sumBtn:hover{border-color:var(--mut)}
.sumText{display:flex;flex-direction:column;flex:1;min-width:0}
.sumTop{font-weight:700;font-size:15px}
.sumSub{font-size:13px;color:var(--mut);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sumGo{display:flex;align-items:center;gap:2px;color:var(--f1);font-weight:600;font-size:14px;flex:none}
.sumGo svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2}

/* The tab card */
.tabCard{padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-width:0}
.tabHead{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:-6px -8px -6px 0}
.desc{margin:0;font-size:14px;min-width:0}
.desc .mut{color:var(--mut)}
.looper{display:flex;align-items:center;flex-wrap:wrap;gap:8px 10px}
.looper[hidden]{display:none}
.looper [hidden]{display:none}
.looper .seg button[aria-checked="true"]{background:color-mix(in srgb,var(--f1) 14%,var(--card));color:var(--f1);box-shadow:inset 0 0 0 1px var(--f1)}
.looper .seg button{min-height:38px;padding:4px 12px;font-size:14px;min-width:40px}
.loopSpeed{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--mut);flex:1 1 200px}
.loopSpeed[hidden]{display:none}
.loopSpeed input{flex:1;min-width:80px;accent-color:var(--f1)}
.loopSpeed output{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:13px;color:var(--fg);white-space:nowrap}

/* The two-row window: swipe through it when stopped; while playing, the row being played is on top */
#tab{position:relative;margin:0 -6px}
#tab.win{height:calc(var(--rowH) * 2);overflow-y:auto;scroll-snap-type:y mandatory;overscroll-behavior:contain;scrollbar-width:thin}
#tab.slots{height:calc(var(--rowH) * var(--rows,2));overflow:hidden}
#tab .bar{scroll-snap-align:start;padding:2px 6px 6px;border-radius:8px;box-sizing:border-box}
#tab.slots .bar{min-height:var(--rowH)}
.slotIn{transition:transform .28s ease-out}
#tab .bar.now{background:color-mix(in srgb,var(--f1) 8%,transparent)}
.barLbl{display:flex;gap:6px;font-size:12px;font-weight:600;color:var(--mut);line-height:18px}
#tab .bar.now .barLbl{color:var(--f1)}
.bs::before{content:'· '}
#tab:not(.slots) .bs{display:none}
.tabScroll{overflow-x:auto}
pre.tab{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:14px;line-height:1.25;margin:0;color:var(--mut);white-space:pre}
pre.tab .n{color:var(--fg);font-weight:600}
pre.tab .k{color:var(--acc);font-weight:600}
pre.tab .nm{color:var(--fg)}
pre.tab .count{color:var(--mut)}
pre.tab .pm{color:var(--mut)}
pre.tab .c.on{background:color-mix(in srgb,var(--f1) 24%,transparent)}
#tab .c.lp{background:color-mix(in srgb,var(--f1) 9%,transparent)}   /* the looped bar */
#tab .c.lp.on{background:color-mix(in srgb,var(--f1) 30%,transparent)}
.edtip{font-size:12px;color:var(--mut);margin:0}
.saveMsg{font-size:14px;color:var(--ok);margin:0}
@media (max-width:640px){
  pre.tab{font-size:13px;line-height:1.25}
  .looper{flex-wrap:nowrap}
  #loopLbl,.sbpm{display:none}
  .looper .seg button{min-width:34px;padding:4px 6px}
  .loopSpeed{flex:1 1 0;min-width:0;gap:6px}
  .loopSpeed input{min-width:40px}
  .edtip:not(.active){display:none}   /* the help sheet explains editing; the line shows while dragging */
}
@media (prefers-reduced-motion:reduce){.slotIn{transition:none}}

/* ---- The panel pinned above the dock ---- */
.rsPanel{position:fixed;left:0;right:0;bottom:calc(var(--dock) + env(safe-area-inset-bottom,0px));z-index:14;
  background:var(--card);border-top:1px solid var(--line);box-shadow:0 -6px 16px rgba(0,0,0,.06)}
.panelIn{max-width:640px;margin:0 auto;padding:8px 16px 10px}
.panelMain{display:flex;flex-direction:column;gap:8px}
.rsPanel.editing .panelMain{display:none}
.rsPanel.playing .more{display:none}
.rsPanel.playing .acts{grid-template-columns:repeat(2,minmax(0,1fr))}
.sndRow{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.sndBtn{font:inherit;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:44px;padding:4px 10px;
  border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--fg);cursor:pointer;text-align:left;min-width:0}
.sndBtn:hover{border-color:var(--mut)}
.sndBtn .lbl{font-size:10px;line-height:14px}
.sndVal{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.rsPanel .tempo{min-height:36px;font-size:14px}
.bpm{white-space:nowrap;font-size:13px}
.pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.acts{display:flex;flex-direction:column;gap:8px}
@media (min-width:700px){   /* wide screens: Loop, New riff, Practice and Save on one row */
  .acts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
  .acts .pair{display:contents}
  .acts .btn{min-height:48px}
}
.sndStatus{font-size:13px;color:var(--mut)}
.sndStatus:empty{display:none}

/* The note editor takes the panel's place */
.editor{display:flex;flex-direction:column;gap:8px}
.editor[hidden]{display:none}
.edrow{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.edwhere{font-weight:700;font-size:14px;margin-right:auto}
.edDone{min-height:40px;padding:6px 18px}
.edsteps{justify-content:space-between}
.fretbox{display:inline-flex;align-items:center;gap:4px}
.fretbox .lbl{margin-right:2px;font-size:10px}
#edFret{width:42px;min-height:40px;padding:4px;font-size:16px;text-align:center;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--fg)}
.edbtn{padding:7px 11px;border-radius:10px;border:1px solid var(--line);background:var(--card);color:var(--fg);font:inherit;font-size:14px;cursor:pointer;touch-action:manipulation}
.edbtn.sq{width:38px;height:40px;padding:0;font-size:18px;line-height:1}
.edlen{min-width:3.6em;text-align:center;color:var(--fg);font-size:13px;font-variant-numeric:tabular-nums}
.edgrid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.edgrid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.edgrid .edbtn{min-height:44px;padding:4px;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.edgrid .wide{grid-column:1 / -1}
.edgrid .edbtn[hidden]{display:none}
.edhint:empty{display:none}

/* ---- Sheets (settings, guitar, pedals, band, tab symbols) ---- */
/* centred on every screen, with the shared modal look (css/base.css): not a bottom sheet that blends into the page */
dialog.rsSheet{box-sizing:border-box;width:calc(100% - 28px);max-width:520px;max-height:calc(100% - 40px);margin:auto;padding:0 16px 16px;
  border-radius:16px;color:var(--fg);overflow:auto;overscroll-behavior:contain}
dialog.rsSheet[open]{display:flex;flex-direction:column;gap:14px}
.shHead{display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:1;background:var(--modal);padding:10px 0 2px;margin-right:-8px}
.shHead h2{font-size:18px;margin:0}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.shNote{font-size:13px;color:var(--mut);margin:0}
.field[hidden]{display:none}
#driveField input{width:100%;min-height:44px;accent-color:var(--f1)}
#driveOut{font-family:ui-monospace,Menlo,Consolas,monospace;text-transform:none;letter-spacing:0;color:var(--fg);margin-left:4px}
.barsSeg button{font-size:14px;padding:4px 2px;white-space:nowrap;min-width:0}   /* Length sits in the column beside Tuning */
.checks{display:flex;gap:20px}
.bandName{margin:0;font-weight:600}
.bandName.flash{animation:bandflash 1.2s ease-out}
@keyframes bandflash{from{color:var(--acc)}to{color:var(--fg)}}
@media (prefers-reduced-motion:reduce){.bandName.flash{animation:none}}
.legend{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;margin:0;font-size:14px;color:var(--mut)}
.legend div{display:flex;gap:8px}
.legend dt{font-family:ui-monospace,Menlo,monospace;color:var(--fg);font-weight:600;min-width:2.6em}
.legend dd{margin:0}
.hint{font-size:13px;color:var(--mut);margin:0}
@media (max-width:380px){.legend{grid-template-columns:1fr}}

/* ---- Editing the riff ---- */
#tab .c{cursor:pointer;border-radius:2px}
#tab .c:hover{background:color-mix(in srgb,var(--acc) 14%,transparent)}
#tab .c.sel{background:var(--acc);color:#fff;outline:2px solid var(--acc)}
#tab .c.sel .n,#tab .c.sel .k{color:#fff}
.edbtn[aria-pressed="true"]{background:var(--acc);border-color:var(--acc);color:#fff}
.edbtn:disabled{opacity:.45;cursor:default}
.edbtn.danger{border-color:#e5383b;color:#e5383b}
.edhint{font-size:13px;color:#e5383b;margin:0}

/* Dragging notes in the tab */
#tab .c.nt{cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none}
#tab.dragging,#tab.dragging .c{cursor:grabbing}
#tab .c.dragfrom{opacity:.35}
#tab .c.drop{background:color-mix(in srgb,var(--acc) 22%,transparent);outline:2px dashed var(--acc);outline-offset:-1px}
#tab .c.dropbad{background:color-mix(in srgb,var(--bad) 18%,transparent);outline:2px dashed var(--bad);outline-offset:-1px}
.edtip.bad{color:var(--bad)}
.dragGhost{position:fixed;z-index:50;transform:translate(-50%,-140%);pointer-events:none;
  font:700 15px/1 ui-monospace,Menlo,Consolas,monospace;padding:6px 9px;border-radius:8px;
  background:var(--acc);color:#fff;box-shadow:0 3px 10px rgba(0,0,0,.3)}
.dragGhost.bad{background:var(--bad)}

/* Save riff message */
.saveMsg:empty{display:none}
.saveMsg.bad{color:var(--bad)}
.saveMsg a{color:var(--acc)}
/* Note length: the length readout in the editor, and the "stop here" dot in the tab */
pre.tab .k.st{font-weight:800}
/* Someone else's Community riff: only Play and Practice, and no settings or note editing */
.rsView #gen,.rsView #saveRiff,.rsView .sumGo,.rsView .edtip{display:none}
.rsView .sumBtn{cursor:default}
.rsView .acts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.rsView .acts .pair{display:contents}
.rsView .rsPanel.playing .acts{grid-template-columns:1fr}
.rsView .rsPanel.playing .more{display:none}          /* while playing: just Stop, as usual */
.rsView #tab .c,.rsView #tab .c.nt{cursor:default;touch-action:auto}
.rsView #tab .c:not(.lp):hover{background:none}
/* A Community riff: the back link, then who made it, when, and its rating in the
   riff card, kept short so the two-bar tab still fits above the panel */
.pubTop{margin-top:-4px}
/* the page title, kept tight so the tab still fits above the panel */
.rsHead{margin-bottom:0}
.pubTop .back{color:var(--mut);font-size:14px;text-decoration:none;white-space:nowrap}
.pubTop .back:hover{color:var(--fg)}
.rsView main{padding-top:8px}
.rsView .rs{margin-top:4px}
.pubInfo{display:flex;flex-wrap:wrap;align-items:center;gap:0 12px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.pubName{flex-basis:100%;font-size:17px;margin:0;line-height:1.3;overflow-wrap:anywhere}
.pubBy{margin:0;font-size:13px;color:var(--mut);line-height:28px}
a.pubUser{color:var(--acc);font-weight:600;text-decoration:none}
a.pubUser:hover{text-decoration:underline}
.pubRate{flex-basis:100%;display:flex;flex-wrap:wrap;align-items:center;gap:0 12px}   /* its own line, under the name and date */
.pubScore{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--mut);line-height:28px}
.pubScore b{color:var(--fg)}
.pubRow{display:flex;align-items:center;gap:4px}
.pubMut{font-size:13px;color:var(--mut)}
a.pubMut{color:var(--acc);text-decoration:none}
.pubRate .stars{position:relative;display:inline-block;font-size:14px;line-height:1;letter-spacing:1px;color:var(--line)}
.pubRate .stars::before{content:"★★★★★"}
.pubRate .stars .fill{position:absolute;inset:0 auto 0 0;overflow:hidden;white-space:nowrap;color:#e8a400}
.pubRate .stars .fill::before{content:"★★★★★"}
.pubRate .rate{display:flex}
.pubRate .rate button{font-size:21px;line-height:1;width:30px;height:30px;padding:0;border:0;background:none;color:var(--line);cursor:pointer;border-radius:8px}
.pubRate .rate button.on{color:#e8a400}
@media (hover:hover){.pubRate .rate:hover button{color:#e8a400}.pubRate .rate button:hover~button{color:var(--line)}}
.pubRate .rate button:focus-visible{outline:2px solid var(--f1);outline-offset:-2px}
.pubRate .rate button[disabled]{opacity:.5}
.pubMsg{flex-basis:100%;margin:0;font-size:13px;color:var(--ok)}
.pubMsg:empty{display:none}
.pubMsg.bad{color:var(--bad)}