/* Sound Buttons Pro v0.2.1: visual identity and synchronized Theme Studio palettes.
 * All colors use the same site-local Theme Studio selection, without modifying
 * each saved key color. Pure CSS brand mark: no old SoundboardMax image. */
.sbpsp-brand-mark{
  display:grid; grid-template-columns:repeat(2, 12px); grid-template-rows:repeat(2, 12px);
  gap:3px; flex:none; align-items:center; justify-content:center;
  width:38px; height:38px; border-radius:11px; padding:6px;
  background:linear-gradient(145deg,var(--panel-2),var(--panel));
  border:1px solid var(--line); box-shadow:0 3px 8px #0003;
}
.sbpsp-brand-mark i{height:12px;width:12px;border-radius:4px;display:block;border:1px solid #ffffff8a;box-shadow:inset 0 2px 2px #ffffff70,inset 0 -3px 1px #0005,0 2px 0 #0007}
.sbpsp-brand-mark i:nth-child(1){background:#EF4444}
.sbpsp-brand-mark i:nth-child(2){background:#38BDF8}
.sbpsp-brand-mark i:nth-child(3){background:#FACC15}
.sbpsp-brand-mark i:nth-child(4){background:#A855F7}
.sbpsp-brand-mini{transform:scale(.68);transform-origin:center center;margin:-6px;}

/* Theme selector lives beside My Decks, away from the busy playback toolbar. */
.sbpsp-theme-control{position:relative;min-width:0;z-index:41;margin-left:auto}
.sbpsp-workspace .sbpsp-theme-control > button{display:flex;gap:8px;align-items:center;border-color:var(--accent);color:var(--text);background:var(--panel-2);min-height:42px;max-width:min(330px,90vw);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sbpsp-theme-panel[hidden]{display:none!important}
.sbpsp-theme-panel{position:absolute;top:calc(100% + 9px);right:0;width:min(375px,calc(100vw - 24px));z-index:99;background:var(--panel);color:var(--text);border:1px solid var(--line);padding:16px;border-radius:15px;box-shadow:0 18px 52px #0008;}
.sbpsp-theme-panel-head{display:flex;align-items:center;justify-content:space-between;gap:9px;margin-bottom:6px}
.sbpsp-theme-panel-head b{font-size:15px;font-weight:850}
.sbpsp-workspace .sbpsp-theme-panel-head button{width:38px;min-height:38px;padding:0;border-radius:9px;font-size:24px;flex:none}
.sbpsp-theme-panel p{margin:2px 0 15px;font-size:12.5px;line-height:1.45;color:var(--muted)}
.sbpsp-theme-panel label:not(.sbpsp-theme-check){display:block;font-weight:800;font-size:12px;margin:0 0 6px}
.sbpsp-workspace .sbpsp-theme-panel select{display:block;width:100%;max-width:100%;font-size:14px;flex:auto;margin-bottom:12px;color:var(--text);background:var(--panel-2);border-color:var(--line)}
.sbpsp-theme-check{display:flex;align-items:center;gap:9px;font-size:13px;line-height:1.35;font-weight:700;cursor:pointer;margin:6px 0 13px}
.sbpsp-theme-check input{width:19px;height:19px;min-height:19px;accent-color:var(--accent);flex:none}
.sbpsp-theme-check input:disabled{opacity:.5}
.sbpsp-theme-swatches{display:flex;gap:5px;margin:8px 0}
.sbpsp-theme-swatches i{flex:1;height:18px;border-radius:5px;border:1px solid #ffffff4a;box-shadow:inset 0 1px #ffffff44}
.sbpsp-theme-hint{display:block;margin-top:8px;font-size:11.5px;line-height:1.4;color:var(--muted)}
.sbpsp-theme-panel button:focus-visible,.sbpsp-theme-panel select:focus-visible,.sbpsp-theme-control > button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(max-width:768px){
  .sbpsp-theme-control{margin-left:0;flex:1 1 100%;}
  .sbpsp-workspace .sbpsp-theme-control > button{max-width:100%;width:100%;justify-content:center}
  .sbpsp-theme-panel{position:fixed;top:auto;bottom:calc(7px + env(safe-area-inset-bottom));left:8px;right:8px;width:auto;max-height:86dvh;overflow:auto;border-radius:18px;padding:15px;}
}

/* Fullscreen / Deck Mode and its HUD inherit the active selected theme. */
body.deckonly,body.deckonly .deckwrap,body.deckonly .dmhud,body.deckonly .dmbottom{background:var(--bg)!important}
body.deckonly .dmbottom .dmstrip,body.deckonly .dmrecent{border-color:var(--line)}

/* Optional Theme Studio matching for sound keys: only visual, stored color remains unchanged. */
:root.sbpsp-theme-key-match{--sbpsp-key-current:var(--sbpsp-pad-1)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n+1){--sbpsp-key-current:var(--sbpsp-pad-1)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n+2){--sbpsp-key-current:var(--sbpsp-pad-2)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n+3){--sbpsp-key-current:var(--sbpsp-pad-3)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n+4){--sbpsp-key-current:var(--sbpsp-pad-4)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n+5){--sbpsp-key-current:var(--sbpsp-pad-5)}
:root.sbpsp-theme-key-match .cell:not(.empty):nth-child(6n){--sbpsp-key-current:var(--sbpsp-pad-6)}
:root.sbpsp-theme-key-match .cell:not(.empty){background:linear-gradient(158deg,color-mix(in srgb,var(--sbpsp-key-current) 84%,#121429 16%),color-mix(in srgb,var(--sbpsp-key-current) 69%,#060912 31%))!important;color:#fff}
:root.sbpsp-theme-key-match .cell:not(.empty).playing{--keyc:var(--sbpsp-key-current)}
:root.sbpsp-theme-key-match .cell:not(.empty) .nm{text-shadow:0 1px 3px #000a}

/* High contrast light palettes while retaining dark red destructive controls. */
:root.sbpsp-theme-light .tbtn.stop,:root.sbpsp-theme-light .page-tab.del,:root.sbpsp-theme-light .btn.danger,:root.sbpsp-theme-light .mb-stop{
  background:#FCE9EE;color:#9B1C32;border-color:#F0B7C2;
}
:root.sbpsp-theme-light .page-tab.del.armed{background:var(--danger);color:#fff}
:root.sbpsp-theme-light .cell.empty{background:var(--panel-2);border-color:var(--line)}
:root.sbpsp-theme-light .dmnavbtn,:root.sbpsp-theme-light .dmbtn,:root.sbpsp-theme-light .dmchip{background:var(--panel-2);border-color:var(--line);color:var(--text)}
:root.sbpsp-theme-light .dmclockbox #dmClock,:root.sbpsp-theme-light .dmpagename{color:var(--text)}

@media(prefers-reduced-motion:reduce){.sbpsp-theme-panel{scroll-behavior:auto}}
