/* Bii Bocce (public/arcade/bocce.js). The stage is the Lobby in first person, your own theme; the only DOM over it is
   kept to hard black slips in the arcade's Jersey type: the rack (balls left, top left), the measuring tape (the corner
   map, top right), the call ("You're in", in the ball's colour), the ground under your aim, and in your turn the
   walking stick (lower left, white ball only) and the throw slot (right edge under the map: Roll / Toss, then a tall
   slot your ball slides down as you pull, like the pool cue). */
.ag-stage[data-kind="bocce"] { touch-action: none; -webkit-user-select: none; user-select: none; background: #fff; overflow: hidden; cursor: grab; }
.ag-stage[data-kind="bocce"]:active { cursor: grabbing; }
.ag-stage[data-kind="bocce"]::before { content: "Setting up the court"; position: absolute; left: 0; right: 0; top: 46%; text-align: center;
  font: 400 30px/1 var(--ac-pixel, "Jersey 10"); color: #b8111b; }
.ag-stage[data-kind="bocce"].ready::before { content: none; }
.bc { position: absolute; inset: 0; font-family: var(--ac-pixel, "Jersey 10"); color: #fbeeee; }
.bc [hidden] { display: none !important; }
.bc p { margin: 0; }
.bc-view { position: absolute; inset: 0; }

/* the rack: whose balls are left (filled) and thrown (hollow) */
.bc-rack { position: absolute; left: max(10px, env(safe-area-inset-left)); top: 10px; padding: 6px 10px 7px; background: #000c; pointer-events: none; }
.bc-end { font-size: 18px; line-height: 1; color: #c69ea3; margin-bottom: 5px; white-space: nowrap; }
.bc-row { display: flex; align-items: center; gap: 4px; height: 22px; }
.bc-row span { min-width: 4ch; max-width: 9ch; margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; line-height: 1; }
.bc-row.up span { color: var(--c); }
.bc-row b { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--c); box-sizing: border-box; }
.bc-row b.on { background: var(--c); }

/* the measuring tape */
.bc-map { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 10px; width: 112px; height: 112px; pointer-events: none; }

/* the call: who's in, a splash, the end's points */
.bc-call { position: absolute; left: 12px; right: 12px; top: 26%; text-align: center; pointer-events: none; opacity: 0;
  font-size: 54px; line-height: 1; color: var(--c, #fff); -webkit-text-stroke: 6px #000; paint-order: stroke fill; }
.bc-call.big { font-size: 64px; }
.bc-call.on { animation: bc-call 1.7s cubic-bezier(.2, .9, .3, 1) forwards; }
.bc-call.big.on { animation-duration: 3.2s; }
@keyframes bc-call { 0% { opacity: 0; transform: translateY(14px) scale(.7); } 12% { opacity: 1; transform: none; } 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-12px); } }

/* the ground under the middle of the view */
.bc-ground { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 3px 10px 4px; background: #000c; font-size: 20px; line-height: 1;
  white-space: nowrap; pointer-events: none; }

/* the walking stick: where your thumb landed */
.bc-joy { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid #fff9; background: #0004; pointer-events: none; }
.bc-joy i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: #fffc; }

/* the throw slot (like the pool cue's): a tall black slot down the right edge under the map, Roll / Toss on top. Grab
   it anywhere and pull down: your ball slides down it and the power fills in behind, felt red to white at full. */
.bc-hand { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 132px; bottom: 14px; width: 60px; display: flex; flex-direction: column; gap: 6px; }
.bc.short .bc-hand { top: 10px; right: calc(max(10px, env(safe-area-inset-right)) + 120px); }
.bc-lob { display: flex; flex-direction: column; gap: 2px; }
.bc-lob button { height: 34px; padding: 0; border: 0; border-radius: 0; background: #000c; color: #c69ea3; font: 400 21px/1 var(--ac-pixel, "Jersey 10"); cursor: pointer; }
.bc-lob button[aria-pressed="true"] { background: #fff5f5; color: #000; }
.bc-pad { --p: 0; --bs: 44px; position: relative; flex: 1; min-height: 120px; width: 100%; padding: 0; border: 2px solid #000; border-radius: 0; background: #000c;
  overflow: hidden; touch-action: none; cursor: ns-resize; }
.bc-hand.jack .bc-pad { --bs: 26px; }
.bc-pad b { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--p) * 100%); background: linear-gradient(#b8111b, #ff3b44 70%, #fff5f5); }
.bc-pad i { position: absolute; left: 50%; top: calc(8px + var(--p) * (100% - 16px - var(--bs))); width: var(--bs); height: var(--bs); margin-left: calc(var(--bs) / -2);
  border-radius: 50%; background: var(--c, #e0161f); box-shadow: inset -5px -7px 0 #0003, 0 0 0 2px #000; transition: top .18s cubic-bezier(.3, 1.4, .5, 1); }
.bc-hand.pulling .bc-pad i { transition: none; }
/* chevrons at the foot: pull down */
.bc-pad s, .bc-pad s::after { position: absolute; left: 50%; bottom: 22px; width: 12px; height: 12px; margin-left: -6px; border: solid #fff8; border-width: 0 2px 2px 0;
  transform: rotate(45deg); animation: bc-bob 1.6s ease-in-out infinite; }
.bc-pad s::after { content: ""; left: auto; right: -11px; bottom: -11px; margin: 0; transform: none; animation: none; }
.bc-hand.pulling .bc-pad s { display: none; }
@keyframes bc-bob { 50% { translate: 0 5px; } }

.bc-note { position: absolute; left: 20px; right: 20px; top: 38%; text-align: center; color: #2e0b0f; font: 700 17px/1.4 var(--font); }

@media (prefers-reduced-motion: reduce) {
  .bc-call.on, .bc-call.big.on { animation-name: bc-fade; }
  @keyframes bc-fade { 0%, 100% { opacity: 0; } 8%, 88% { opacity: 1; } }
  .bc-pad i { transition: none; }
  .bc-pad s { animation: none; }
}
