.sb-builder { margin-block: 0 3rem; --sb-border: 2px solid var(--ink); }
.sb-builder button, .sb-builder select, .sb-builder input { color: var(--ink); }
.sb-builder button { cursor: pointer; }
.sb-builder button:disabled { cursor: default; opacity: .5; }
.sb-builder :is(button, input, select, a):focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.sb-heading, .sb-toolbar, .sb-deck-heading, .sb-inspector-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sb-heading { align-items: end; margin-bottom: 1.2rem; }
.sb-heading h2 { font-size: clamp(1.8rem, 3vw, 2.7rem); }
.sb-heading p { margin-bottom: 0; }
.sb-heading .eyebrow { margin-bottom: .5rem; }
.sb-save { max-width: 12rem; color: var(--muted); text-align: right; font-size: .75rem; }
.sb-toolbar { flex-wrap: wrap; padding: .7rem; border: var(--sb-border); border-radius: 1rem; background: var(--card); }
.sb-contexts, .sb-options, .sb-filters, .sb-edit-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.sb-contexts button, .sb-options button, .sb-edit-actions button, .sb-filters button { min-height: 44px; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--card); font-size: .8rem; font-weight: 800; }
.sb-contexts button[aria-pressed="true"] { background: var(--yellow); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.sb-options label, .sb-edit-actions label { font-size: .78rem; font-weight: 750; }
.sb-builder select { min-height: 44px; padding: .35rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); }
.sb-context-note { margin: .6rem 0 1rem; font-size: .8rem; color: var(--muted); }
.sb-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.1rem; align-items: start; }
.sb-deck { min-width: 0; border: var(--sb-border); border-radius: 1.1rem; background: var(--soft-violet); overflow: hidden; }
.sb-deck-heading { padding: .9rem 1rem; }
.sb-deck-heading h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.sb-deck-heading h3 span { margin-left: .35rem; color: var(--muted); font-size: .75rem; font-weight: 600; }
.sb-deck-heading > span { color: var(--muted); font-size: .72rem; }
.sb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; padding: 0 .85rem 1rem; }
.sb-slot { position: relative; min-width: 0; border: 2px solid var(--line); border-radius: .8rem; background: var(--card); overflow: hidden; }
.sb-slot.is-selected { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.sb-slot.is-contextual { background: #fffbe6; }
.sb-slot.is-playing { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink); }
.sb-slot.is-drop-target { outline: 4px solid var(--cyan); outline-offset: -4px; }
.sb-slot-top { position: absolute; top: 0; right: 0; left: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: .15rem; height: 44px; padding-left: .65rem; pointer-events: none; }
.sb-slot-number { font-size: .7rem; font-weight: 850; color: var(--muted); font-variant-numeric: tabular-nums; }
.sb-slot-top button { min-width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; font-weight: 900; pointer-events: auto; }
.sb-context-tag { padding: .2rem; background: var(--yellow); border-radius: .2rem; font-size: .56rem; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
.sb-pad { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; min-height: 125px; padding: .9rem .55rem .55rem; border: 0; background: transparent; text-align: center; }
.sb-pad img { width: 64px; height: 64px; object-fit: contain; mix-blend-mode: multiply; }
.sb-pad strong { display: grid; align-items: center; min-height: 2.8em; margin-top: .4rem; font-size: .78rem; line-height: 1.25; font-weight: 850; letter-spacing: -.015em; }
.sb-pad-play { position: absolute; top: 3.5rem; left: calc(50% + 1rem); display: grid; place-items: center; width: 1.75rem; height: 1.75rem; background: var(--yellow); border: 1.5px solid var(--ink); border-radius: 50%; font-size: .65rem; }
.sb-pad:hover .sb-pad-play, .sb-pad[aria-pressed="true"] .sb-pad-play { background: var(--pink); color: white; }
.sb-pool-button { display: flex; flex-direction: column; justify-content: center; gap: .12rem; width: 100%; min-height: 44px; padding: .35rem .5rem; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.sb-pool-button span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .65rem; font-weight: 750; }
.sb-pool-button small { color: var(--muted); font-size: .6rem; }
.sb-slot-empty { min-height: 205px; border-style: dashed; background: transparent; }
.sb-slot-empty button { display: grid; align-content: center; justify-items: center; gap: .65rem; width: 100%; height: 100%; min-height: 205px; border: 0; background: transparent; font-size: .75rem; }
.sb-slot-empty .sb-slot-number { position: absolute; top: .5rem; left: .65rem; }
.sb-slot-empty strong { color: var(--violet); font-size: 1.8rem; font-weight: 400; }
.sb-player { display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem; border-block: 1px solid var(--line); background: var(--ink); color: white; }
.sb-player button { min-height: 44px; flex-shrink: 0; padding: .45rem .8rem; border: 0; border-radius: .5rem; background: var(--yellow); font-weight: 800; font-size: .8rem; }
.sb-player p { flex: 1; margin: 0; font-size: .75rem; line-height: 1.4; }
.sb-player label { display: grid; gap: .2rem; width: 5.5rem; font-size: .65rem; }
.sb-player input { width: 100%; min-height: 24px; accent-color: var(--yellow); }
.sb-inspector { padding: 1.15rem; background: var(--card); }
.sb-inspector-heading { align-items: start; flex-wrap: wrap; }
.sb-inspector .eyebrow { margin-bottom: .4rem; font-size: .6rem; }
.sb-inspector h3 { margin-bottom: .7rem; font-size: 1.15rem; line-height: 1.2; }
.sb-inspector > p { color: var(--muted); font-size: .8rem; }
.sb-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.sb-choice { display: flex; min-width: 0; border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; }
.sb-choice button { border: 0; background: var(--card); }
.sb-choice button:first-child { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: .25rem; min-width: 0; padding: .65rem; text-align: left; }
.sb-choice button:first-child[aria-pressed="true"] { background: var(--soft-violet); box-shadow: inset 3px 0 var(--violet); }
.sb-choice button:first-child span { font-size: .78rem; font-weight: 800; overflow-wrap: anywhere; }
.sb-choice small { font-size: .65rem; color: var(--muted); }
.sb-choice button + button, .sb-choice a { display: grid; place-items: center; width: 44px; flex-shrink: 0; min-height: 44px; text-decoration: none; font-size: .85rem; }
.sb-situation-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: .5rem; font-size: .8rem; font-weight: 750; }
.sb-library { min-width: 0; border: var(--sb-border); border-radius: 1rem; background: var(--card); overflow: hidden; }
.sb-library-heading { padding: 1rem 1rem .5rem; }
.sb-library-heading h3 { font-size: 1.15rem; }
.sb-library-heading > p { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.sb-library input { width: 100%; min-height: 44px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--paper); font-size: .85rem; }
.sb-filters { margin-top: .6rem; gap: .4rem; }
.sb-filters button { min-width: 44px; padding: .4rem .7rem; }
.sb-filters button[aria-pressed="true"] { color: white; background: var(--violet); border-color: var(--violet); }
.sb-library-count { margin: .6rem 0 0; font-size: .65rem !important; }
.sb-library-list { max-height: 790px; overflow-y: auto; overscroll-behavior: contain; padding: .5rem; }
.sb-library-item { display: flex; align-items: center; gap: .55rem; padding: .5rem .3rem; border-bottom: 1px solid var(--line); cursor: grab; }
.sb-library-item img { width: 43px; height: 43px; flex-shrink: 0; object-fit: contain; }
.sb-library-item > div { flex: 1; min-width: 0; }
.sb-library-item strong { display: block; font-size: .76rem; line-height: 1.25; }
.sb-library-item small { display: block; margin-top: .3rem; color: var(--muted); font-size: .65rem; }
.sb-library-item button { flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: .6rem; background: var(--soft-violet); color: var(--violet); font-size: 1.3rem; }
.sb-library-item button:hover { background: var(--yellow); color: var(--ink); }
.sb-art-fallback { display: grid; place-items: center; width: 64px; height: 64px; color: var(--violet); font-size: 2rem; }
.sb-no-results { padding: 1rem; color: var(--muted); font-size: .85rem; }
.sb-jump-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .75rem; font-weight: 750; }
@media (max-width: 1000px) {
  .sb-workspace { grid-template-columns: minmax(0, 1fr) 16rem; }
  .sb-grid { gap: .45rem; padding-inline: .55rem; }
  .sb-pad strong { font-size: .72rem; }
}
@media (max-width: 760px) {
  .sb-workspace { grid-template-columns: minmax(0, 1fr); }
  .sb-heading { align-items: start; }
  .sb-save { max-width: 7rem; flex-shrink: 0; font-size: .65rem; }
  .sb-library-list { max-height: 340px; }
  .sb-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .sb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; padding-inline: .7rem; }
  .sb-heading { display: block; }
  .sb-save { display: block; max-width: none; margin-top: .6rem; text-align: left; }
  .sb-pad strong { font-size: .8rem; }
  .sb-choices { grid-template-columns: minmax(0, 1fr); }
  .sb-player { flex-wrap: wrap; }
  .sb-player p { min-width: 9rem; }
  .sb-player label { display: flex; align-items: center; gap: .65rem; width: 100%; }
  .sb-player input { max-width: 9rem; }
}
