/* Beat Bounce: risograph sheet music. Paper, ink, four spot colours. */
.bb{--paper:#F0E7D3;--paper2:#E6DBC1;--ink:#1D1B1A;--red:#DD4430;--teal:#14776A;--mustard:#E3A32A;--blue:#2C3E73;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.bb-stage{position:relative;width:100%;aspect-ratio:9/13;min-height:380px;max-height:calc(100vh - 170px);max-height:calc(100svh - 170px);
  background:var(--paper);border:3px solid var(--ink);border-radius:14px;overflow:hidden;touch-action:none;overscroll-behavior:none;
  box-shadow:5px 5px 0 var(--ink);cursor:pointer;margin:0 0 8px}
.bb-stage canvas{position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.bb-ico{position:absolute;top:3px;width:44px;height:44px;border:0;background:transparent;color:var(--ink);padding:0;display:flex;align-items:center;justify-content:center;
  cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;z-index:3}
.bb-ico[hidden]{display:none}
.bb-pause{left:3px}.bb-mute{right:3px}
.bb-ico svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.bb-mute .x{display:none}.bb-mute.is-off .x{display:inline}.bb-mute.is-off .wave{display:none}
.bb-ico:focus-visible,.bb-btn:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
.bb-panel{position:absolute;left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom,0px));z-index:2;background:var(--paper);border:3px solid var(--ink);
  border-radius:12px;box-shadow:4px 4px 0 var(--ink);padding:14px;max-height:calc(100% - 70px);overflow:auto;cursor:default;display:flex;flex-direction:column;gap:9px;
  animation:bb-in .22s ease-out}
.bb-panel[hidden]{display:none}
.bb-result,.bb-pause{bottom:auto;top:50%;transform:translateY(-50%)}
.bb-songs{top:56px;bottom:calc(10px + env(safe-area-inset-bottom,0px));max-height:none;touch-action:pan-y}
.bb-h{margin:0;font-size:1.7rem;line-height:1;font-weight:900;letter-spacing:-.02em}
.bb-h2{margin:0;font-size:1.25rem;font-weight:900}
.bb-sub{margin:0;font-size:.92rem;line-height:1.35}
.bb-stat{margin:0;font-size:.8rem;opacity:.78;line-height:1.3}
.bb-row{display:flex;gap:8px}.bb-row .bb-btn{flex:1}
.bb-top{display:flex;align-items:center;justify-content:space-between}
.bb-btn{font:inherit;font-weight:800;min-height:48px;padding:8px 12px;border:3px solid var(--ink);border-radius:10px;background:var(--paper2);color:var(--ink);
  cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;box-shadow:3px 3px 0 var(--ink);font-size:.95rem}
.bb-btn:active{transform:translate(2px,2px);box-shadow:1px 1px 0 var(--ink)}
.bb-primary{background:var(--red);color:#fff;font-size:1.05rem;min-height:54px;text-shadow:0 1px 0 rgba(0,0,0,.25)}
.bb-ghost{background:transparent;box-shadow:none;font-weight:700;min-height:44px;font-size:.85rem}
.bb-small{min-height:44px;padding:4px 14px}
.bb-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;overflow:auto}
.bb-cell{min-height:52px;padding:2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:1.1;box-shadow:2px 2px 0 var(--ink)}
.bb-n{font-size:1.05rem}.bb-dots{font-size:.65rem;min-height:.8em;font-weight:900}
.bb-m1{background:#d9a07a}.bb-m2{background:#cfd4d6}.bb-m3{background:var(--mustard)}
.bb-locked{opacity:.4;box-shadow:none;cursor:default}
.bb-medal{margin:0;align-self:flex-start;padding:3px 12px;border:3px solid var(--ink);border-radius:20px;font-weight:900;background:var(--paper2)}
.bb-stats{display:flex;flex-direction:column;gap:3px}
.bb-line{display:flex;justify-content:space-between;border-bottom:1.5px dotted rgba(29,27,26,.4);padding:2px 0;font-size:.95rem}
@keyframes bb-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.bb-result,.bb-pause{animation:none}
.bb-note{font-size:.85rem;margin:.5rem 0 0;line-height:1.4}
@media (prefers-reduced-motion:reduce){.bb-panel{animation:none}.bb-btn:active{transform:none}}
@media (max-width:360px){.bb-h{font-size:1.4rem}}

/* Full screen (native and immersive both add html.pip-immersive): the stage is .game-wrap, fill it with the board. */
html.pip-immersive .game-wrap{display:flex;flex-direction:column;max-width:none;padding:0}
html.pip-immersive .game-wrap>.game-title,html.pip-immersive .game-wrap>.facts,html.pip-immersive .game-wrap>.pip-actions,html.pip-immersive .game-wrap>.bb-note,html.pip-immersive .game-wrap>.bb>.bb-note{display:none}
html.pip-immersive .bb{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
html.pip-immersive .bb-stage{flex:1 1 auto;aspect-ratio:auto;width:100%;min-height:0;max-height:none;margin:0;border-width:0;border-radius:0;box-shadow:none}
html.pip-immersive .bb-ico{top:calc(3px + env(safe-area-inset-top,0px))}
html.pip-immersive .bb-panel{max-height:calc(100% - 70px)}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .bb-panel{left:50%;right:auto;width:min(440px,calc(100% - 20px));transform:translateX(-50%);padding:10px;gap:6px}
  html.pip-immersive .bb-result,html.pip-immersive .bb-pause{transform:translate(-50%,-50%)}
  html.pip-immersive .bb-h{font-size:1.3rem}
  html.pip-immersive .bb-songs{top:50px}
  html.pip-immersive .bb-grid{grid-template-columns:repeat(8,1fr)}
}
