/* Pour: the playful layer on top of Today. Drink buttons take their drink's color and
   fill up like a glass, taps throw particles (drawn by drink-art.js on .drink-fx), and
   cameos.js sends characters in now and then. */

/* ---------- drink buttons ---------- */
.drink-btn {
  --c: var(--accent);
  background: var(--c); color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 35%, transparent), inset 0 -5px 0 rgb(0 0 0 / .14);
  transition: transform .18s cubic-bezier(.3, 1.8, .5, 1);
}
.drink-btn:active { transform: scale(.9); transition-duration: .06s; }
.drink-btn > .emoji, .drink-btn > .name, .drink-btn > .n { position: relative; z-index: 1; }
.drink-btn .name { text-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.drink-btn .n { background: #fff; color: var(--c); }
.drink-grid.solo .drink-btn { box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 40%, transparent), inset 0 -6px 0 rgb(0 0 0 / .14); }

/* The glass: a lighter layer that rises with today's count, with a sloshing top edge. */
.drink-btn .fill { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.drink-btn .fill i {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--level, 0%);
  background: rgb(255 255 255 / .2); transition: height .6s cubic-bezier(.3, 1.5, .5, 1);
}
.drink-btn .fill i::before {
  content: ""; position: absolute; left: -50%; top: -7px; width: 200%; height: 8px;
  background: radial-gradient(circle at 12px 8px, rgb(255 255 255 / .2) 8px, transparent 9px) 0 0 / 24px 8px repeat-x;
  animation: slosh 1.4s linear infinite;
}
.drink-btn:not(.filled) .fill i::before { display: none; }
@keyframes slosh { to { transform: translateX(24px); } }
.drink-btn.slapped { animation: slapped .45s ease; }
@keyframes slapped {
  15% { transform: translateX(-7px) rotate(-5deg); } 35% { transform: translateX(6px) rotate(4deg); }
  55% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(2px); }
}

/* The word and +1 that jump out of a tapped button. */
.pop-art { z-index: 3; }
.pop-art .pop-word {
  font-weight: 900; font-size: 1.35rem; line-height: 1; white-space: nowrap; color: #fff;
  -webkit-text-stroke: 5px var(--c); paint-order: stroke fill; letter-spacing: -.01em;
}
.pop-art .pop-plus { color: var(--c); }

/* Particles draw on one canvas over the whole screen. */
.drink-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* ---------- streak and combo ---------- */
.today-chips { display: flex; justify-content: center; gap: 8px; min-height: 30px; margin-top: 8px; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 6px; border-radius: 999px;
  background: var(--chip); color: var(--chip-ink); font-weight: 800; font-size: .875rem;
}
.streak-chip svg { width: 18px; height: 18px; }
.streak-chip.bump { animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
.combo {
  display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--pop); color: #fff;
  font-weight: 900; font-size: .875rem; letter-spacing: .02em;
  opacity: 0; transform: scale(.5); transition: opacity .15s, transform .3s cubic-bezier(.3, 1.8, .5, 1); pointer-events: none;
}
.combo.on { opacity: 1; transform: scale(1) rotate(-4deg); }
.sound-btn { text-decoration: none; }

/* ---------- cameos ---------- */
.cameo { position: fixed; z-index: 70; pointer-events: none; }
.cameo svg { display: block; overflow: visible; }
.cameo-bubble {
  position: absolute; bottom: calc(100% - 4px); left: 50%; translate: -50% 0; white-space: nowrap;
  background: #fff; color: #2a1d14; font-weight: 800; font-size: .875rem; padding: 6px 10px; border-radius: 14px;
  box-shadow: 0 3px 0 rgb(0 0 0 / .12), 0 6px 16px rgb(0 0 0 / .12);
  animation: bubble-in .3s .35s cubic-bezier(.3, 1.8, .5, 1) both;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.7); } }

/* Peeks up from the bottom edge, stares, blinks, sinks back. */
/* Peekers and Bean sit under the tab bar (z-index 5) so they rise out from behind it. */
.cameo-peek { z-index: 4; bottom: 0; animation: peek 2.6s cubic-bezier(.3, 1.4, .5, 1) both; }
.cameo-peek.left { left: 12px; }
.cameo-peek.right { right: 12px; }
.cameo-peek.right svg { transform: scaleX(-1); }
/* Keep the bubble on screen: it hangs toward the middle from whichever edge Bean is on. */
.cameo-peek.left .cameo-bubble { left: 0; translate: 0 0; }
.cameo-peek.right .cameo-bubble { left: auto; right: 0; translate: 0 0; }
.cameo-peek .eye-lids { transform-box: fill-box; transform-origin: center; animation: blink 2.6s steps(1) both; }
.cameo-peek .pupil { animation: look 2.6s ease-in-out both; }
@keyframes peek { 0% { transform: translateY(100%); } 18%, 78% { transform: translateY(38%); } 100% { transform: translateY(110%); } }
@keyframes blink { 0%, 52%, 58% { transform: none; } 55% { transform: scaleY(.1); } }
@keyframes look { 0%, 30% { transform: none; } 45%, 100% { transform: translate(1px, -4px); } }

/* Pops in beside the button and swings an arm at it. */
.cameo-slap { animation: slap-in 1.9s cubic-bezier(.3, 1.6, .5, 1) both; }
.cameo-slap.left svg { transform: none; }
.cameo-slap.right svg { transform: scaleX(-1); }
.cameo-slap .arm { transform-box: fill-box; transform-origin: left bottom; animation: swing .5s .25s ease-in both; }
@keyframes slap-in { 0% { opacity: 0; transform: scale(.3); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(.6) translateY(20px); } }
@keyframes swing { 0% { transform: rotate(-60deg); } 60% { transform: rotate(25deg); } 100% { transform: rotate(10deg); } }
.cameo-pow {
  position: absolute; top: 16px; font-weight: 900; font-size: 1.1rem; color: #ffd23f;
  -webkit-text-stroke: 4px #2a1d14; paint-order: stroke fill; animation: pow .5s .4s cubic-bezier(.3, 2, .5, 1) both;
}
.cameo-slap.left .cameo-pow { right: -24px; }
.cameo-slap.right .cameo-pow { left: -24px; }
@keyframes pow { from { opacity: 0; transform: scale(.2) rotate(-20deg); } to { transform: rotate(-10deg); } }

/* Wobbles across the bottom of the screen. */
.cameo-dizzy { bottom: 16px; left: 0; animation: wander 3.6s linear both; }
.cameo-dizzy svg { animation: wobble .4s ease-in-out infinite alternate; }
@keyframes wander { from { transform: translateX(-110px); } to { transform: translateX(calc(100vw + 10px)); } }
@keyframes wobble { from { transform: rotate(-10deg) translateY(0); } to { transform: rotate(10deg) translateY(-8px); } }

/* Slot machine. */
.cameo-jackpot { inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / .25); animation: fade 3.4s both; }
@keyframes fade { 0% { opacity: 0; } 8%, 88% { opacity: 1; } 100% { opacity: 0; } }
.jp-card {
  background: var(--c); border-radius: 26px; padding: 16px 18px 18px; display: grid; gap: 10px; justify-items: center;
  box-shadow: 0 0 0 5px #ffd23f, 0 20px 50px rgb(0 0 0 / .35); animation: card-in .4s cubic-bezier(.3, 1.8, .5, 1) both;
}
@keyframes card-in { from { transform: scale(.4) rotate(-8deg); } }
.jp-title { color: #fff; font-weight: 900; font-size: 1.1rem; letter-spacing: .04em; text-transform: uppercase; }
.jp-reels { display: flex; gap: 8px; }
.jp-reel { width: 64px; height: 72px; overflow: hidden; background: #fff; border-radius: 14px; box-shadow: inset 0 6px 8px rgb(0 0 0 / .15), inset 0 -6px 8px rgb(0 0 0 / .15); }
.jp-strip { display: flex; flex-direction: column; animation: spin var(--d) cubic-bezier(.2, .7, .3, 1.05) both; }
.jp-strip span { height: 72px; display: grid; place-items: center; font-size: 2.4rem; line-height: 1; }
@keyframes spin { from { transform: translateY(0); } to { transform: translateY(calc(var(--n) * -72px)); } }
.jp-win {
  font-weight: 900; font-size: 1.8rem; color: #ffd23f; -webkit-text-stroke: 5px #2a1d14; paint-order: stroke fill;
  animation: win .5s 1.65s cubic-bezier(.3, 2, .5, 1) both;
}
@keyframes win { from { opacity: 0; transform: scale(.2); } }

/* ---------- Bean, the fact mascot ---------- */
.mascot {
  position: fixed; z-index: 4; right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-h, 64px) + env(safe-area-inset-bottom, 0px) - 6px);
  display: flex; align-items: flex-end; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  transform: translateY(140%); transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); pointer-events: none;
}
.mascot.up { transform: none; pointer-events: auto; }
.mascot svg { display: block; filter: drop-shadow(0 4px 6px rgb(0 0 0 / .2)); }
.mascot.up svg { animation: bean-hop .5s .1s cubic-bezier(.3, 1.8, .5, 1); }
.mascot.talk svg { animation: bean-hop .4s cubic-bezier(.3, 1.8, .5, 1); }
.mascot-art { display: block; flex: none; }
@keyframes bean-hop { 40% { transform: translateY(-10px) rotate(-6deg); } }
.mascot-bubble {
  max-width: min(250px, calc(100vw - 110px)); margin-bottom: 44px; padding: 10px 12px; border-radius: 16px 16px 4px 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 24px rgb(0 0 0 / .15);
  font: 600 .875rem/1.35 inherit; text-align: left;
}
.mascot.talk .mascot-bubble { animation: bubble-in .3s cubic-bezier(.3, 1.8, .5, 1); }
/* Bean's eyes: bean.js blinks them, glances sideways now and then, and very rarely
   crosses them for a little chuckle. */
/* The lids start open (scaleY 0, set inline in crew.js), so his eyes show even without this stylesheet. */
.blinking .blink-lids { animation: lid-close .22s ease-in-out; }
.iris-l, .iris-r { transition: transform .25s ease-out; }
.look-left .iris-l, .look-left .iris-r { transform: translateX(-5px); }
.look-right .iris-l, .look-right .iris-r { transform: translateX(5px); }
.cross .iris-l { transform: translateX(6px); }
.cross .iris-r { transform: translateX(-6px); }
.cameo-peek .blink-lids { animation: lid-once 2.6s steps(1) both; }
.mascot-art, .crew-member { position: relative; }
.giggle svg { animation: bean-laugh .16s ease-in-out 6 alternate; }
.heh { position: absolute; top: -6px; right: -4px; font: 800 .75rem/1 var(--f-display, inherit); color: var(--ink-2); pointer-events: none; animation: heh 1.2s ease-out both; }
@keyframes lid-close { 50% { transform: scaleY(1); } }
@keyframes lid-once { 0%, 52%, 58% { transform: scaleY(0); } 55% { transform: scaleY(1); } }
@keyframes heh { from { opacity: 0; transform: translateY(4px); } 20%, 70% { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }
/* Bean's body language, picked by bean.js along with his face. */
.mascot-art svg { transform-origin: 50% 100%; }
.mascot.up .mascot-art.act-hop svg { animation: bean-hop .5s .1s cubic-bezier(.3, 1.8, .5, 1); }
.mascot.up .mascot-art.act-flex svg { animation: bean-flex 1.4s .2s ease-in-out; }
.mascot.up .mascot-art.act-stretch svg { animation: bean-stretch 1.8s .2s ease-in-out; }
.mascot.up .mascot-art.act-yawn svg { animation: bean-yawn 2s .2s ease-in-out; }
.mascot.up .mascot-art.act-shiver svg { animation: bean-shiver .12s .2s linear 12; }
.mascot.up .mascot-art.act-shake svg { animation: bean-shiver .08s .2s linear 16; }
.mascot.up .mascot-art.act-dance svg { animation: bean-dance .45s .2s ease-in-out 6 alternate; }
.mascot.up .mascot-art.act-laugh svg { animation: bean-laugh .22s .2s ease-in-out 8 alternate; }
.mascot.up .mascot-art.act-love svg { animation: bean-love .6s .2s ease-in-out 3; }
.mascot.up .mascot-art.act-wave .arm-wave { transform-box: fill-box; transform-origin: left bottom; animation: bean-wave .3s .2s ease-in-out 6 alternate; }
@keyframes bean-flex { 0%, 100% { transform: none; } 20%, 60% { transform: scale(1.06, .95); } 40%, 80% { transform: scale(1.12, 1.02) rotate(-3deg); } }
@keyframes bean-stretch { 0%, 100% { transform: none; } 35%, 65% { transform: scale(.94, 1.14); } 80% { transform: scale(1.04, .96); } }
@keyframes bean-yawn { 0%, 100% { transform: none; } 30%, 70% { transform: rotate(-6deg) scaleY(1.05); } }
@keyframes bean-shiver { 0%, 100% { transform: none; } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes bean-dance { from { transform: rotate(-8deg); } to { transform: rotate(8deg) translateY(-3px); } }
@keyframes bean-laugh { from { transform: none; } to { transform: translateY(-4px) scale(1.02, .98); } }
@keyframes bean-love { 0%, 100% { transform: none; } 30% { transform: scale(1.1); } 50% { transform: scale(1); } 70% { transform: scale(1.08); } }
@keyframes bean-wave { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }

/* ---------- the crew ---------- */
.crew h3 { margin-bottom: 0; }
.crew-row { display: flex; gap: 8px; justify-content: space-around; flex-wrap: wrap; }
.crew-member {
  flex: 1 1 0; min-width: 72px; max-width: 140px; display: grid; justify-items: center; gap: 4px; padding: 6px 2px;
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 16px;
}
.crew-member:focus-visible { outline: 3px solid var(--accent); }
.crew-member svg { overflow: visible; }
.crew-member .arm-l, .crew-member .arm-r { transform-box: fill-box; animation: wave 2.4s ease-in-out infinite; }
.crew-member .arm-l { transform-origin: right top; }
.crew-member .arm-r { transform-origin: left top; animation-delay: -1.2s; }
@keyframes wave { 0%, 70%, 100% { transform: none; } 80% { transform: rotate(-25deg); } 90% { transform: rotate(10deg); } }
.crew-member.hop svg { animation: crew-hop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes crew-hop { 30% { transform: scale(1.1, .85); } 60% { transform: translateY(-14px) scale(.95, 1.08); } }
.crew-name { font-weight: 800; font-size: .8125rem; line-height: 1.2; text-align: center; }
.crew-bar { width: 72px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.crew-bar i { display: block; height: 100%; border-radius: inherit; transition: width .5s; }
.crew-next { font-size: .6875rem; color: var(--ink-2); text-align: center; line-height: 1.2; }
.crew-svg.stage-4 .sparkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out infinite; }
.crew-svg.stage-4 .sparkle:nth-of-type(2n) { animation-delay: -.8s; }
@keyframes twinkle { 50% { transform: scale(.3); opacity: .4; } }

/* Evolution: shake, white flash, new form. */
.cameo-evolve { inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / .35); animation: fade 4.2s both; }
.ev-card { display: grid; justify-items: center; gap: 10px; padding: 20px 24px; border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 5px #ffd23f, 0 20px 50px rgb(0 0 0 / .35); animation: card-in .4s cubic-bezier(.3, 1.8, .5, 1) both; }
.ev-title, .ev-name { font-weight: 900; font-size: 1.1rem; text-align: center; max-width: 240px; }
.ev-name { animation: ev-in .5s 1.7s cubic-bezier(.3, 2, .5, 1) both; }
.ev-stage { position: relative; width: 140px; height: 160px; display: grid; place-items: center; }
.ev-stage > div { grid-area: 1 / 1; }
.ev-old { animation: ev-shake 1.4s ease-in both; }
.ev-new { opacity: 0; animation: ev-in .6s 1.45s cubic-bezier(.3, 1.8, .5, 1) forwards; }
.ev-flash { position: absolute; inset: -20px; border-radius: 50%; background: radial-gradient(#fff 40%, transparent 70%); opacity: 0; animation: ev-flash .6s 1.1s ease-out both; }
@keyframes ev-shake {
  0% { transform: none; } 20% { transform: rotate(-4deg); } 30% { transform: rotate(4deg); } 40% { transform: rotate(-6deg) scale(1.05); }
  50% { transform: rotate(6deg) scale(1.05); } 60% { transform: rotate(-8deg) scale(1.1); } 70% { transform: rotate(8deg) scale(1.1); filter: brightness(1.6); }
  80% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; filter: brightness(3); }
}
@keyframes ev-in { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes ev-flash { 0% { opacity: 0; transform: scale(.3); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); } }

/* ---------- long-press variant picker ---------- */
.variants {
  position: fixed; z-index: 65; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: min(340px, calc(100vw - 24px));
  padding: 10px; border-radius: 24px; background: var(--surface); box-shadow: 0 16px 40px rgb(0 0 0 / .25);
  transform-origin: var(--ox, 50%) var(--oy, 100%); animation: variants-in .28s cubic-bezier(.3, 1.6, .5, 1) both;
}
.variants.closing { animation: variants-out .15s ease-in both; }
@keyframes variants-in { from { opacity: 0; transform: scale(.4); } }
@keyframes variants-out { to { opacity: 0; transform: scale(.6); } }
.variants-title { width: 100%; text-align: center; font-weight: 800; font-size: .8125rem; color: var(--ink-2); }
.variant {
  --c: var(--accent); display: grid; justify-items: center; gap: 2px; width: 74px; padding: 8px 4px; border: 0; border-radius: 16px;
  background: var(--c); color: #fff; font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; position: relative;
  animation: variant-in .3s cubic-bezier(.3, 1.8, .5, 1) both; animation-delay: calc(var(--i) * 35ms);
  touch-action: manipulation;
}
.variant .emoji { font-size: 1.7rem; line-height: 1.1; }
.variant .n { position: absolute; top: -4px; right: -4px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: #fff; color: var(--c); font-size: .6875rem; font-weight: 800; }
.variant.hot, .variant:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; transform: scale(1.08); }
@keyframes variant-in { from { opacity: 0; transform: translateY(14px) scale(.5); } }
.drink-btn.pressing { animation: charge .45s ease-in both; }
@keyframes charge { to { transform: scale(.92); filter: brightness(1.15); } }
.drink-btn .more {
  position: absolute; bottom: 7px; left: 50%; translate: -50% 0; display: flex; gap: 3px; z-index: 1;
}
.drink-btn .more i { width: 4px; height: 4px; border-radius: 50%; background: rgb(255 255 255 / .8); }

@media (prefers-reduced-motion: reduce) {
  .drink-btn .fill i::before, .cameo, .cameo *, .mascot svg, .mascot-bubble, .crew-member *, .variants, .variant, .drink-btn.pressing { animation: none !important; }
}

/* Bean has paused logging: the buttons doze until the break is over. */
.drink-grid.resting .drink-btn { filter: grayscale(.7); opacity: .55; }
