/* =====================================================================
   THE BAKERY · Playback mode (batch 2, Raz 2026-10-13)
   The playback mediums are the output options for beats made on the BKRY-MS
   in BAKER, so the panel is built like the BKRY-MS: black-finish frame,
   charcoal dot-grain face, a black screen with phosphor line art, round
   dark caps with a red corner light that flashes on the beat (PO-33 style),
   green LEDs for anything switched on, a 16-step level meter.
   Tokens (--bk-*) come from analog.css.
   ===================================================================== */
#pb-panel {
  width: min(880px, calc(100vw - 24px)); z-index: 46;
  border: 12px solid transparent !important; border-radius: 16px !important; color: var(--bk-ink-hi);
  background:
    var(--bk-screw) 8px 8px / 10px 10px no-repeat padding-box,
    var(--bk-screw) calc(100% - 8px) 8px / 10px 10px no-repeat padding-box,
    var(--bk-screw) 8px calc(100% - 8px) / 10px 10px no-repeat padding-box,
    var(--bk-screw) calc(100% - 8px) calc(100% - 8px) / 10px 10px no-repeat padding-box,
    var(--bk-grain) padding-box,
    var(--bk-body) padding-box,
    linear-gradient(90deg, #0c0c0b 0%, #1f1f1e 50%, #0c0c0b 100%) left top / 12px 100% no-repeat border-box,
    linear-gradient(90deg, #0c0c0b 0%, #1f1f1e 50%, #0c0c0b 100%) right top / 12px 100% no-repeat border-box,
    linear-gradient(180deg, #121211 0%, #0b0b0a 100%) border-box !important;
  box-shadow: 0 24px 54px rgba(0,0,0,.8), 0 6px 14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--bk-ring), 0 0 0 1px #000 !important;
}
#pb-panel .pb-inner { padding: 14px 16px 16px; gap: 12px; }
#pb-panel .pb-header { flex-wrap: nowrap; }
#pb-panel .eq-panel-title { color: var(--bk-ink-hi); white-space: nowrap; }
#pb-panel .eq-action-btn { color: var(--bk-ink); }

/* medium selector: a row of keys, the chosen one raised with a green LED */
.pb-mediums { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: #0b0b0a; box-shadow: inset 0 1px 3px rgba(0,0,0,.8), 0 0 0 1px var(--bk-ring); }
.pb-med { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--bk-ink); font: 800 10.5px/1 system-ui, -apple-system, "Helvetica Neue", sans-serif; letter-spacing: 1.2px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; }
.pb-med svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pb-med:hover { color: var(--bk-ink-hi); background: rgba(255,255,255,.04); }
.pb-med.is-on { background: var(--bk-cap); color: #fff; box-shadow: 0 2px 0 #050505, inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px #000; }
.pb-med.is-on::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--bk-led-on); box-shadow: 0 0 5px rgba(134,199,155,.8); }
.pb-med:focus-visible { outline: 2px solid var(--bk-glow); outline-offset: 2px; }

/* the device face */
.pb-face { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 16px; padding: 12px 30px 12px 12px; border-radius: 10px;
  background: var(--bk-grain), radial-gradient(130% 100% at 25% 0%, #262625 0%, #191918 55%, #111110 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 0 0 1px var(--bk-ring), 0 0 0 1px #000, 0 3px 0 rgba(0,0,0,.6); }
.pb-screen { position: relative; display: flex; flex-direction: column; height: 300px; min-width: 0; border-radius: 10px; overflow: hidden;
  background: repeating-linear-gradient(0deg, transparent 0 24px, rgba(120,170,135,.045) 24px 25px), #060807;
  box-shadow: inset 0 0 0 2px #000, 0 0 0 1px #33332f, inset 0 0 24px rgba(0,0,0,.85); }
.pb-canvas { display: block; flex: 1; min-height: 0; width: 100%; }
.pb-readout { flex: none; height: 30px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border-top: 1px solid #121a15;
  font: 700 11px/1 var(--bk-mono); letter-spacing: .4px; white-space: nowrap; }
.pb-ro-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #3a1512; box-shadow: inset 0 1px 1px rgba(0,0,0,.6); }
.pb-ro-dot.on { background: radial-gradient(circle at 40% 35%, #ffd2c8, #ff3b26 55%, #c41a0c); box-shadow: 0 0 7px 2px rgba(255,60,38,.75); }
.pb-ro-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #cfe9d7; }
.pb-ro-side { flex: none; color: #e0b84a; text-transform: uppercase; }

/* the keys: round dark caps; a red light in the corner of Play flashes on the beat */
.pb-side { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-width: 0; padding: 8px 0 2px; }
.pb-caps { flex: 1; display: grid; grid-template-columns: repeat(3, 64px); justify-content: space-between; align-content: center; row-gap: 18px; }
.pb-cap-wrap { position: relative; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.pb-cap { position: relative; width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 1px solid #000; cursor: pointer; color: #d9d5cc;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, #5a5a57, #3a3a38 70%, #2a2a28);
  box-shadow: 0 4px 0 #0a0a09, 0 6px 9px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.14);
  transition: transform .05s, box-shadow .05s, filter .2s; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; touch-action: manipulation; }
.pb-cap svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pb-cap:hover { color: #fff; }
.pb-cap:active, .pb-cap[aria-pressed="true"] { transform: translateY(3px); box-shadow: 0 1px 0 #0a0a09, 0 2px 3px rgba(0,0,0,.5), inset 0 1px 3px rgba(0,0,0,.4); }
.pb-cap:focus-visible { outline: 2px solid var(--bk-glow); outline-offset: 3px; }
.pb-cap--power { background: var(--bk-red); border-color: #3a0d0a; color: #fff; box-shadow: 0 4px 0 #5a1612, 0 6px 9px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25); }
.pb-cap--power[aria-pressed] { transform: none; box-shadow: 0 4px 0 #5a1612, 0 6px 9px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25); }
.pb-cap--power:active { transform: translateY(3px); box-shadow: 0 1px 0 #5a1612, inset 0 1px 3px rgba(0,0,0,.35); }
.pb-panel.pb-power-off .pb-cap--power { filter: brightness(.6) saturate(.8); }
.pb-cap-led { position: absolute; top: -5px; right: -5px; width: 8px; height: 6px; border-radius: 2px; pointer-events: none;
  background: #2a1f1c; box-shadow: inset 0 1px 1px rgba(0,0,0,.7), 0 0 0 1px #000; }
.pb-cap.is-on .pb-cap-led { background: var(--bk-led-on); box-shadow: 0 0 6px 1px rgba(134,199,155,.75), 0 0 0 1px #000; }
.pb-cap-led.beat { background: radial-gradient(circle at 40% 35%, #ffd2c8, #ff3b26 55%, #c41a0c) !important; box-shadow: 0 0 8px 2px rgba(255,60,38,.85), 0 0 0 1px #000 !important; }

/* 16-step level meter, like the BKRY-MS step row */
.pb-meter { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; padding: 5px; border-radius: 6px; background: #060807; box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #33332f; }
.pb-meter i { height: 12px; border-radius: 2px; background: #161b18; }
.pb-meter i.on { background: #86c79b; box-shadow: 0 0 5px rgba(134,199,155,.55); }
.pb-meter i.hot { background: #e0b84a; box-shadow: 0 0 5px rgba(224,184,74,.6); }
.pb-meter i.clip { background: #ff4a3d; box-shadow: 0 0 5px rgba(255,74,61,.7); }
.pb-cheek { position: absolute; right: 8px; top: 12px; bottom: 12px; width: 14px; display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl;
  font: 800 9px/1 system-ui, -apple-system, sans-serif; letter-spacing: 2.6px; color: var(--bk-cheek-ink); opacity: .8; pointer-events: none; white-space: nowrap; }

/* Make small: a mini card above the bar that keeps animating */
.pb-mini { display: none; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; cursor: pointer; }
#pb-panel.pb-small { width: 290px !important; left: auto !important; right: 84px !important; top: auto !important; transform: none !important;
  bottom: calc(var(--np-bar-h, 72px) + 12px) !important; max-height: none !important; border-width: 8px !important; border-radius: 12px !important; }
#pb-panel.pb-small .pb-inner { display: none !important; }
#pb-panel.pb-small .pb-mini { display: flex; }
.pb-mini-canvas { width: 88px; height: 52px; flex: none; border-radius: 6px; background: #060807; box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #33332f; }
.pb-mini-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pb-mini-txt b { font-size: 12px; color: var(--bk-ink-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-mini-txt span { font: 700 9.5px/1 var(--bk-mono); color: var(--bk-glow); letter-spacing: .6px; text-transform: uppercase; }
.pb-mini-x { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--bk-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pb-mini-x:hover { color: #fff; background: rgba(255,255,255,.06); }

/* hover / long-press explanation */
.pb-tip { position: fixed; z-index: 1001; max-width: 250px; padding: 9px 11px; border-radius: 8px; pointer-events: none; display: flex; flex-direction: column; gap: 4px;
  background: var(--bk-grain) padding-box, var(--bk-body) padding-box, var(--bk-cheek) border-box; border: 1px solid #000; border-left-width: 5px; border-right-width: 5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--bk-ring), 0 12px 28px rgba(0,0,0,.7); }
.pb-tip[hidden] { display: none; }
.pb-tip b { font: 800 10.5px/1 system-ui, -apple-system, sans-serif; letter-spacing: 1.4px; text-transform: uppercase; color: #fff; }
.pb-tip span { font-size: 12px; line-height: 1.35; color: var(--bk-ink); }

/* the bar indicator */
.np-pb-badge { margin-left: 4px; cursor: pointer; background: #121211 !important; color: var(--bk-glow) !important; box-shadow: inset 0 0 0 1px rgba(134,199,155,.6); }

/* full screen: the deck gets the room */
#pb-panel.eq-panel--fullscreen { border-radius: 0 !important; }
#pb-panel.eq-panel--fullscreen .pb-inner { max-width: 1180px; margin: 0 auto; width: 100%; box-sizing: border-box; padding: 22px 20px; }
#pb-panel.eq-panel--fullscreen .pb-screen { height: min(58vh, 560px); }
#pb-panel.eq-panel--fullscreen .pb-face { grid-template-columns: minmax(0, 1fr) 260px; }
body.pb-fullscreen-open { overflow: hidden; }

/* phones: a sheet above the now-playing bar */
@media (max-width: 760px) {
  #pb-panel:not(.eq-panel--fullscreen):not(.pb-small) {
    left: 6px !important; right: 6px !important; width: auto !important; max-width: none !important; transform: none !important;
    top: auto !important; bottom: calc(var(--np-bar-h, 186px) + 6px) !important; max-height: none !important;
    z-index: 62 !important; border-width: 8px !important; border-radius: 14px !important;
  }
  #pb-panel .pb-inner { padding: 10px; gap: 10px; overflow: visible !important; }
  #pb-panel .pb-header { display: grid !important; grid-template-columns: 1fr auto; grid-template-areas: "title actions" "media media"; row-gap: 8px; align-items: center; }
  #pb-panel .pb-header .eq-panel-header-left { grid-area: title; }
  #pb-panel .pb-header .eq-panel-header-actions { grid-area: actions; gap: 0; }
  #pb-panel .pb-header .eq-action-btn { width: 36px; height: 36px; }
  #pb-panel .eq-panel-title { font-size: 16px; }
  .pb-mediums { grid-area: media; width: 100%; box-sizing: border-box; }
  .pb-med { flex: 1 1 0; min-width: 0; justify-content: center; flex-direction: column; gap: 3px; height: 46px; padding: 4px 2px; font-size: 9px; letter-spacing: .8px; }
  .pb-face { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 12px; }
  .pb-screen { height: 205px; }
  .pb-side { padding: 4px 0 0; gap: 12px; }
  .pb-caps { grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); justify-items: center; row-gap: 12px; }
  .pb-cap-wrap { width: 50px; height: 50px; }
  .pb-cap { width: 46px; height: 46px; }
  .pb-cheek { display: none; }
  .pb-readout { font-size: 10px; height: 26px; padding: 0 10px; }
  #pb-panel.pb-small { right: 64px !important; left: 8px !important; width: auto !important; }
  #pb-panel.eq-panel--fullscreen .pb-screen { height: 46vh; }
  #pb-panel.eq-panel--fullscreen .pb-face { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .pb-cap { transition: none; } }

/* round 2 (Raz 2026-10-13): a window you can move; the ON switch; the screen dims while Playback mode is OFF */
@media (min-width: 761px) and (pointer: fine) {
  #pb-panel:not(.eq-panel--fullscreen):not(.pb-small) .pb-header { cursor: grab; }
  #pb-panel.pb-dragging .pb-header { cursor: grabbing; }
  #pb-panel.pb-dragging { user-select: none; }
}
#pb-panel .pb-header .eq-panel-header-left { gap: 10px; }
#pb-panel .pb-on-btn { min-width: 42px; padding: 4px 8px; border-radius: 5px; border: 1px solid #000; font-weight: 800; letter-spacing: .8px; cursor: pointer;
  background: var(--bk-cap); color: var(--bk-ink); box-shadow: 0 2px 0 #050505, inset 0 1px 0 rgba(255,255,255,.12); }
#pb-panel .pb-on-btn.active { background: var(--bk-green); color: #fff; border-color: #0f2a1a; box-shadow: 0 2px 0 #133322, inset 0 1px 0 rgba(255,255,255,.22), 0 0 10px rgba(134,199,155,.35); }
#pb-panel .pb-canvas { transition: opacity .3s, filter .3s; }
#pb-panel.pb-off .pb-canvas { opacity: .45; filter: saturate(.4); }

/* round 3: full screen starts under the site menu (the title, mediums and window keys stay visible) and the deck fills it */
#pb-panel.eq-panel--fullscreen { top: var(--eq-top, 0px) !important; bottom: var(--np-bar-h, 72px) !important; height: auto !important; }
#pb-panel.eq-panel--fullscreen .pb-inner { height: 100%; max-height: none; overflow: hidden !important; display: flex; flex-direction: column; }
#pb-panel.eq-panel--fullscreen .pb-header { flex: none; }
#pb-panel.eq-panel--fullscreen .pb-face { flex: 1 1 auto; min-height: 0; align-items: stretch; }
#pb-panel.eq-panel--fullscreen .pb-screen { height: auto !important; min-height: 0; }
#pb-panel.eq-panel--fullscreen .pb-side { justify-content: center; gap: 28px; }
#pb-panel.eq-panel--fullscreen .pb-caps { flex: 0 0 auto; }
@media (max-width: 760px) {
  #pb-panel.eq-panel--fullscreen .pb-face { display: flex; flex-direction: column; }
  #pb-panel.eq-panel--fullscreen .pb-screen { flex: 1 1 auto; }
  #pb-panel.eq-panel--fullscreen .pb-side { flex: none; gap: 12px; }
}
