/* Minigames: the sheet over the night, and pool in it. Theme tokens only;
   the balls' own colours are drawn on the canvas (pool/draw.rs). */

.mg-open { position: relative; }
.mg-open .mg-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sig); box-shadow: 0 0 0 2px var(--paper); display: none; }
.mg-open.calls .mg-dot { display: block; }
.mg-open[aria-expanded="true"] { color: var(--fg); background: var(--raise); }

.mg { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.mg[hidden] { display: none; }
.mg-sheet { width: min(1120px, 96vw); height: min(780px, 94dvh); background: var(--paper); color: var(--ink); border: 1px solid var(--rule-2); border-radius: 10px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.mg-h { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--rule); flex: none; }
.mg-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.mg-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--mute); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; }
.mg-tab[aria-pressed="true"] { color: var(--ink); background: var(--well); border-color: var(--rule); }
.mg-tab:hover { color: var(--ink); }
.mg-body { flex: 1; min-height: 0; display: flex; }

.pool { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.pool-bar, .pool-acts { flex: none; min-width: 0; }
.pool-felt { position: relative; flex: 1; min-height: 120px; display: grid; place-items: center; overflow: hidden; }
.pool-felt canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }

.pool-plates { display: flex; align-items: stretch; gap: 8px; }
.pool-plate { flex: 1 1 0; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--well); }
.pool-plate b { font: 700 14px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pool-plate.up { border-color: var(--sig); background: var(--sig-bg); }
.pool-plate.won { border-color: var(--ok); background: var(--ok-bg); }
.pool-vs { align-self: center; color: var(--mute); font: 12px var(--mono); }
.pool-balls { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.pool-sw { display: block; }
.pool-sw.gone { opacity: .2; }
.pool-tag { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 999px; border: 1px solid var(--rule-2); color: var(--ink-2); white-space: nowrap; }
.pool-tag.bad { color: var(--err); border-color: var(--err); background: var(--err-bg); }

.pool-acts { display: flex; flex-direction: column; gap: 8px; }
.pool-btns { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.pool-acts .btn { display: inline-flex; align-items: center; gap: 6px; }
.pool-say { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.pool-result { font-size: 16px; }
.pool-owe { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--ink-2); font: 13px var(--mono); }
.pool-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; }
.pool-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pool-k { font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); min-width: 44px; }
.pool-chip { height: 30px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 999px; background: var(--paper); color: var(--ink); font: 13px var(--font); cursor: pointer; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-chip[aria-pressed="true"] { background: var(--sig); color: var(--on-sig); border-color: var(--sig); }
.pool-pick .btn { margin-left: auto; }

/* The table's colours, read by the canvas. */
.pool-probes { position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden; }
.pool-c-felt { color: color-mix(in oklab, var(--sig) 62%, var(--well-2)); }
.pool-c-cushion { color: color-mix(in oklab, var(--sig) 76%, var(--ink)); }
.pool-c-rail { color: color-mix(in oklab, var(--panel) 70%, var(--ink) 30%); }
.pool-c-edge { color: var(--rule-2); }
.pool-c-hole { color: color-mix(in oklab, var(--ink) 15%, black); }
.pool-c-mark { color: var(--on-sig); }
.pool-c-stick { color: color-mix(in oklab, var(--warn) 55%, var(--ink) 45%); }

@media (max-width: 640px) {
  .mg-sheet { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .pool { padding: 8px; gap: 6px; }
  .pool-plate { padding: 4px 8px; }
  .pool-plate b { font-size: 13px; }
  .pool-pick .btn { margin-left: 0; }
}

/* Hover cards over the sheet. */
body.mg-on .tip { z-index: 80; }

/* Whose shot, or why not: big, over the table. */
.pool-status { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 32px; text-align: center; }
.pool-status b { font: 800 20px var(--font); letter-spacing: .01em; }
.pool-status b.go { color: var(--ink); }
.pool-status b.wait { color: var(--mute); font-weight: 700; }
.pool-status b.hint { color: var(--ink-2); font-weight: 700; }
.pool-status b.bad { color: var(--err); }

/* The Shoot button's controls: nudge, power, shoot. */
.pool-ctl { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pool-ctl[hidden] { display: none; }
.pool-ctl.idle { visibility: hidden; }
.pool-power { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 160px; max-width: 360px; min-width: 0; font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.pool-power input { flex: 1; min-width: 0; accent-color: var(--sig); height: 28px; }
.pool-power b { min-width: 4.2em; text-align: right; color: var(--ink); font: 700 13px var(--mono); }
.pool-ctl .btn { display: inline-flex; align-items: center; gap: 6px; }
.pool-shoot { min-width: 104px; justify-content: center; }
@media (max-width: 640px) {
  .pool-status b { font-size: 18px; }
  .pool-ctl { gap: 6px; }
}
/* Each side's tag wears its balls' colour (the 2 and the 10). */
.pool-side { font: 700 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; color: #fff; white-space: nowrap; }
.pool-side.blue { background: #1f5fd6; }
.pool-side.red { background: #c8102e; }

/* A game's drinks (minigames/mod.rs): each a share of the drinker's
   drink; on the winner's device, a chip per player to hand a sip to. */
.mg-drinks { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-right: auto; min-width: 0; color: var(--ink-2); font: 13px var(--mono); }
.mg-drinks:empty { display: none; }
.mg-sip, .mg-give { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mg-sip b, .mg-give b { color: var(--ink); }
.mg-sip.given { color: var(--mute); }
.mg-give { flex-wrap: wrap; white-space: normal; }
.mg-give-to { max-width: 230px; }
.mg-give-to i { font: 11px var(--mono); font-style: normal; margin-left: 6px; color: var(--mute); }
