/* =====================================================================
   Perfect Pour (id "pgpour") — the bar-tap timing game.
   The bar itself is drawn on a canvas (js/pg-pour.js); this styles the
   panel, HUD, hold button, cards and leaderboard around it. Every selector
   is prefixed .pgpour- so nothing collides with the shared Peanut Games
   styles. Theme: navy #0C2340, gold #f4b400, white text. Animations live
   only inside prefers-reduced-motion: no-preference.
   ===================================================================== */

.pgpour { display: grid; gap: 12px; color: #fff; -webkit-font-smoothing: antialiased; }
.pgpour-center { justify-items: center; }

.pgpour-panel {
  width: 100%; max-width: 460px; margin: 0 auto; box-sizing: border-box;
  background: #0C2340; border: 1px solid rgba(244, 180, 0, .28); border-radius: 16px;
  padding: 12px; box-shadow: 0 10px 30px rgba(12, 35, 64, .28);
}

/* ------------------------------ HUD (fits at 320 px) --------------------- */
.pgpour-hud { display: grid; grid-template-columns: 1.25fr 1fr 1.25fr; gap: 6px; margin-bottom: 10px; }
.pgpour-stat { min-width: 0; background: rgba(255, 255, 255, .07); border: 1px solid rgba(244, 180, 0, .22); border-radius: 10px; padding: 6px 4px; text-align: center; }
.pgpour-stat-label { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 255, 255, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgpour-stat-val { display: block; font-size: 1.2rem; font-weight: 900; line-height: 1.2; color: #f4b400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pgpour-stat-val.is-white { color: #fff; }
.pgpour-lives { display: block; font-size: 1rem; letter-spacing: 1px; line-height: 1.45; white-space: nowrap; }
.pgpour-mug { display: inline-block; }
.pgpour-mug.is-lost { filter: grayscale(1); opacity: .25; }

/* ------------------------------ The bar ---------------------------------- */
.pgpour-stage { position: relative; border-radius: 12px; overflow: hidden; background: #1b130d; }
.pgpour-canvas { display: block; max-width: 100%; }
.pgpour-call {
  position: absolute; text-align: right; white-space: nowrap; pointer-events: none;
  font-weight: 900; line-height: 1.05; text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
.pgpour-call-word { display: block; transform-origin: right center; }
.pgpour-call-word.is-perfect { color: #ffd34d; }
.pgpour-call-word.is-great { color: #fff; }
.pgpour-call-word.is-sloppy { color: #ffb86b; }
.pgpour-call-word.is-low, .pgpour-call-word.is-high, .pgpour-call-word.is-spill { color: #ff8a7a; }
.pgpour-call-pts { display: block; margin-top: 2px; font-size: .75em; font-weight: 800; color: #fff; }

/* ------------------------------ Hold to pour ----------------------------- */
/* The only thing that pours. Hardened for a long press on a phone: no
   scroll, zoom, text selection, callout or tap flash. */
.pgpour-hold {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: 84px; margin-top: 10px; font: inherit; color: #0C2340; cursor: pointer;
  background: linear-gradient(180deg, #ffc933, #f4b400); border: 0; border-radius: 14px;
  box-shadow: 0 4px 0 #b07f00, 0 6px 14px rgba(0, 0, 0, .35);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.pgpour-hold-main { font-size: 1.15rem; font-weight: 900; }
.pgpour-hold-sub { font-size: .8rem; font-weight: 700; opacity: .8; }
.pgpour-hold-sub:empty { display: none; }
.pgpour-hold.is-down { transform: translateY(3px); background: linear-gradient(180deg, #f4b400, #e0a500); box-shadow: 0 1px 0 #b07f00, 0 2px 6px rgba(0, 0, 0, .35); }
.pgpour-hold.is-waiting { background: #13355c; color: rgba(255, 255, 255, .5); box-shadow: none; cursor: default; }
.pgpour-hold:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.pgpour-keyhint { display: none; text-align: center; font-size: .74rem; color: rgba(255, 255, 255, .5); margin-top: 6px; }
@media (hover: hover) and (pointer: fine) { .pgpour-keyhint { display: block; } }
.pgpour-debug { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: rgba(255, 255, 255, .7); text-align: center; margin-top: 6px; min-height: 1.4em; }

/* ------------------------------ Start and game-over cards --------------- */
.pgpour-card {
  width: 100%; max-width: 440px; box-sizing: border-box; text-align: center;
  background: #0C2340; border: 1px solid rgba(244, 180, 0, .28); border-radius: 18px;
  padding: 18px; box-shadow: 0 10px 30px rgba(12, 35, 64, .28);
}
.pgpour-emoji { font-size: 46px; line-height: 1; }
.pgpour-title { font-size: 28px; font-weight: 800; color: #fff; margin: 6px 0 2px; }
.pgpour-rules p { color: #c5d3e6; font-size: 14px; line-height: 1.45; margin: 8px 0; }
.pgpour-name-input {
  width: 100%; max-width: 280px; margin: 14px auto 4px; display: block; box-sizing: border-box;
  padding: 11px 14px; text-align: center; font-size: 15px;
  color: #fff; background: #081a30;
  border: 1px solid rgba(244, 180, 0, .45); border-radius: 10px;
}
.pgpour-name-input::placeholder { color: #6f86a3; }
.pgpour-name-input:focus { outline: 2px solid #f4b400; outline-offset: 1px; border-color: #f4b400; }
.pgpour-btn {
  font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; min-height: 46px;
  border-radius: 10px; border: 1px solid transparent; padding: 12px 30px;
}
.pgpour-btn:active { transform: scale(.97); }
.pgpour-btn:focus-visible { outline: 2px solid #f4b400; outline-offset: 2px; }
.pgpour-btn-gold { background: #f4b400; color: #0C2340; box-shadow: 0 3px 10px rgba(244, 180, 0, .28); }
.pgpour-btn-gold:hover { background: #ffc21f; }
.pgpour-start-btn { margin-top: 14px; }
.pgpour-again-btn { margin-top: 16px; }

.pgpour-over-title { margin: 0; font-size: 27px; font-weight: 800; line-height: 1.2; color: #fff; }
.pgpour-over-title:focus { outline: none; }   /* focused only so screen readers announce it */
.pgpour-over-label { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: #9fb4cf; margin-top: 10px; }
.pgpour-over-score { font-size: 44px; font-weight: 800; color: #f4b400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pgpour-over-perfects { color: #c5d3e6; font-size: 14px; margin-top: 2px; }
.pgpour-over-best { color: #7ee0a1; font-weight: 800; margin-top: 6px; }
.pgpour-over-rank { color: rgba(223, 232, 244, .8); font-size: .9rem; font-weight: 600; margin-top: 4px; }

/* ------------------------------ Leaderboard ----------------------------- */
.pgpour-lb-host { width: 100%; text-align: left; }
.pgpour-card .pgpour-lb-host { margin-top: 16px; }
.pgpour-lb-host.is-play { max-width: 460px; margin: 0 auto; }
.pgpour-lb { background: #13355c; border-radius: 12px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .06); }
/* Below the play panel it sits on the light page, so it carries the panel's navy. */
.is-play .pgpour-lb { background: #0C2340; border-color: rgba(244, 180, 0, .28); }
.pgpour-lb-title { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: #f4b400; margin-bottom: 6px; }
.pgpour-lb-row { display: flex; gap: 8px; align-items: center; padding: 4px 6px; font-size: 13px; color: #dfe8f4; border-radius: 6px; }
.pgpour-lb-row + .pgpour-lb-row { border-top: 1px solid rgba(255, 255, 255, .06); }
.pgpour-lb-rank { width: 30px; color: #9fb4cf; font-variant-numeric: tabular-nums; }
.pgpour-lb-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgpour-lb-score { color: #f4b400; font-weight: 700; font-variant-numeric: tabular-nums; }
.pgpour-lb-row.is-you { background: rgba(244, 180, 0, .16); box-shadow: inset 0 0 0 1px rgba(244, 180, 0, .5); }
.pgpour-lb-row.is-you .pgpour-lb-name { color: #fff; font-weight: 800; }
.pgpour-lb-empty { font-size: 12px; color: #9fb4cf; padding: 4px 6px; }

/* ------------------------------ Motion ---------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .pgpour-call.is-show .pgpour-call-word { animation: pgpour-pop .22s ease-out; }
  .pgpour-call.is-show .pgpour-call-pts { animation: pgpour-fade .7s ease-in forwards; }
  .pgpour-hold.is-pulse { animation: pgpour-pulse 1.2s ease-out infinite; }
  .pgpour-mug.is-shake { animation: pgpour-shake .3s ease-in-out; }
}
@keyframes pgpour-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
/* The points hold still, then fade and sink a little. Rising 14 px (the spec's
   first idea) ran them straight into the word above while it was being read. */
@keyframes pgpour-fade { 0%, 55% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(4px); } }
@keyframes pgpour-pulse {
  from { box-shadow: 0 4px 0 #b07f00, 0 6px 14px rgba(0, 0, 0, .35), 0 0 0 0 rgba(244, 180, 0, .6); }
  to   { box-shadow: 0 4px 0 #b07f00, 0 6px 14px rgba(0, 0, 0, .35), 0 0 0 10px rgba(244, 180, 0, 0); }
}
@keyframes pgpour-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px) rotate(-8deg); } 75% { transform: translateX(3px) rotate(8deg); } }
