/* Oink! Mahjong — end-of-hand results overlay (js/ui/results.js).
   Laid out for the 1600x900 stage: the card sits centred, the winner's pig pops over its top-left
   corner, and the effects layer (.rs-fx) draws coins and confetti above everything. */

.rs-overlay {
  --rs-cream: #fff8ec;
  --rs-paper: #fffdf8;
  --rs-sand: #f0dfc3;
  --rs-jade: #2e9e6b;
  --rs-jade-dark: #1f7a51;
  --rs-gold: #f2b632;
  --rs-gold-dark: #c98a12;
  --rs-coral: #e5484d;
  --rs-coral-dark: #b8323a;
  --rs-choc: #4a2c23;
  --rs-muted: #8a6a5c;
  --rs-display: 'Fredoka', 'Nunito', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --rs-body: 'Nunito', 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rs-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  color: var(--rs-choc);
  font-family: var(--rs-body);
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}
.rs-overlay *, .rs-overlay *::before, .rs-overlay *::after { box-sizing: border-box; }

.rs-backdrop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 42%, rgba(52, 28, 18, .38) 0%, rgba(34, 18, 11, .74) 100%);
  animation: rs-fade .32s ease-out both;
}

.rs-fx { z-index: 5; }

/* ---- the card ------------------------------------------------------------------------------ */
.rs-card {
  position: absolute;
  left: 170px;
  top: 84px;
  width: 1260px;
  height: 792px;
  border-radius: 28px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(to bottom, #fffaf1 0%, var(--rs-cream) 55%, #fdf0dc 100%);
  box-shadow:
    inset 0 0 0 3px #fff,
    0 0 0 3px rgba(242, 182, 50, .55),
    0 7px 0 #e7cfa6,
    0 30px 70px rgba(30, 14, 6, .5);
  animation: rs-card-in .52s cubic-bezier(.2, 1.3, .4, 1) both;
}
.rs-overlay.is-limit .rs-card {
  box-shadow:
    inset 0 0 0 3px #fff,
    0 0 0 4px var(--rs-gold),
    0 0 40px 8px rgba(255, 207, 90, .55),
    0 7px 0 #e7cfa6,
    0 30px 70px rgba(30, 14, 6, .5);
}

.rs-card.is-win {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 410px;
  grid-template-rows: 146px 140px minmax(0, 1fr) 58px;
  grid-template-areas:
    "hero head head"
    "hand hand hand"
    "faan faan side"
    "foot foot foot";
  column-gap: 18px;
  row-gap: 14px;
  padding: 22px 28px 22px;
}

/* ---- sticker headline ------------------------------------------------------------------------ */
.rs-sticker {
  --rs-c1: #ff9a9d;
  --rs-c2: var(--rs-coral);
  display: inline-grid;
  justify-self: start;
  font-family: var(--rs-display);
  font-weight: 700;
  font-size: 84px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  filter: drop-shadow(0 6px 0 rgba(74, 44, 35, .2));
}
.rs-sticker > span { grid-area: 1 / 1; padding: 0 .08em; }
.rs-sticker-back { color: var(--rs-choc); -webkit-text-stroke: .24em var(--rs-choc); }
.rs-sticker-mid { color: #fff; -webkit-text-stroke: .13em #fff; }
.rs-sticker-front {
  color: var(--rs-c2);
  background-image: linear-gradient(to bottom, var(--rs-c1) 10%, var(--rs-c2) 60%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.rs-sticker.is-jade { --rs-c1: #7fd6ab; --rs-c2: var(--rs-jade); }
.rs-sticker.is-gold { --rs-c1: #ffe39a; --rs-c2: #e9a21c; }
.rs-sticker.is-choc { --rs-c1: #a77a62; --rs-c2: #6b4334; }

.rs-title {
  transform-origin: 18% 75%;
  animation: rs-title-in .62s cubic-bezier(.2, 1.35, .4, 1) .28s backwards;
}
.rs-title.is-long { font-size: 64px; }
.rs-title.is-longer { font-size: 48px; }

/* ---- head: headline, how it was won, the winner's line -------------------------------------- */
.rs-head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;              /* room for descenders (the 'y' in "wins!") above the pill */
  min-width: 0;
  padding-top: 2px;
}
.rs-sub { display: flex; align-items: center; gap: 16px; min-width: 0; }

.rs-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px 0 6px;
  border-radius: 21px;
  font: 600 20px/1 var(--rs-display);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .14);
  animation: rs-pop .42s cubic-bezier(.2, 1.5, .4, 1) .55s backwards;
}
.rs-pill.is-jade { background: linear-gradient(to bottom, #3cb57f, var(--rs-jade)); padding-left: 16px; }
.rs-pill.is-coral { background: linear-gradient(to bottom, #f06a6e, var(--rs-coral)); }
.rs-pill.is-gold { background: linear-gradient(to bottom, #ffd46a, var(--rs-gold)); color: var(--rs-choc); }
.rs-pill-cn { font: 900 20px/1 var(--rs-serif); letter-spacing: .04em; }
.rs-pill .rs-portrait { box-shadow: 0 0 0 2px #fff; }

.rs-bubble {
  position: relative;
  max-width: 100%;
  padding: 8px 16px 9px;
  border-radius: 16px;
  background: #fff;
  border: 2.5px solid #f3c3cf;
  font: 800 18px/1.2 var(--rs-body);
  color: #7a3b48;
  box-shadow: 0 3px 0 rgba(74, 44, 35, .08);
}
.rs-bubble::before {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  background: #fff;
  border-left: 2.5px solid #f3c3cf;
  border-bottom: 2.5px solid #f3c3cf;
}
.rs-bubble.is-quote {
  min-width: 0;
  animation: rs-pop .42s cubic-bezier(.2, 1.5, .4, 1) .8s backwards;
}
.rs-bubble.is-quote::before { left: -8px; top: 50%; margin-top: -7px; transform: rotate(45deg); }
.rs-bubble.is-quote > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- hero pig ---------------------------------------------------------------------------------- */
.rs-hero {
  grid-area: hero;
  position: relative;
  animation: rs-hero-in .6s cubic-bezier(.2, 1.5, .4, 1) .12s backwards;
}
.rs-rays {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 440px;
  height: 440px;
  margin: -220px 0 0 -220px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 246, 214, .95) 0%, rgba(255, 238, 190, .6) 22%, rgba(255, 238, 190, 0) 44%),
    repeating-conic-gradient(from 0deg, rgba(242, 182, 50, .42) 0deg 8deg, rgba(242, 182, 50, 0) 8deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .75) 34%, rgba(0, 0, 0, 0) 68%);
  mask-image: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .75) 34%, rgba(0, 0, 0, 0) 68%);
  animation: rs-spin 26s linear infinite;
}
.rs-hero-shadow {
  position: absolute;
  left: 50%;
  top: calc(100% - 13px);
  width: 170px;
  height: 24px;
  margin-left: -85px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(74, 44, 35, .3) 0%, rgba(74, 44, 35, .12) 50%, rgba(74, 44, 35, 0) 72%);
  animation: rs-hop-shadow 1.2s ease-in-out .9s infinite;
}
.rs-hero-pig {
  position: absolute;
  left: 50%;
  top: calc(100% - 2px);
  width: 0;
  height: 0;
  z-index: 1;
  transform-origin: 0 0;
  animation: rs-hop 1.2s ease-in-out .9s infinite;
}

/* ---- hand ---------------------------------------------------------------------------------------- */
.rs-hand {
  grid-area: hand;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 20px;
  background:
    radial-gradient(90% 120% at 50% 20%, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(to bottom, #36a77a 0%, #26885f 100%);
  box-shadow: inset 0 3px 10px rgba(0, 40, 20, .35), inset 0 -2px 0 rgba(255, 255, 255, .12), 0 2px 0 #fff;
}
.rs-hand-row { display: flex; align-items: flex-end; gap: 18px; padding: 16px 20px 10px; }
.rs-group { display: flex; flex-direction: column; align-items: center; }
.rs-group-tiles { display: flex; align-items: flex-end; gap: 3px; }
.rs-group-cap {
  margin-top: 8px;
  font: 800 12px/1 var(--rs-body);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
  white-space: nowrap;
  min-height: 12px;
}
.rs-group.is-meld .rs-group-cap { color: #ffe08a; }
.rs-group.is-flowers .rs-group-cap { color: #ffc7d4; }
.rs-hand-sep {
  align-self: stretch;
  width: 2px;
  margin: 4px 2px 22px;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .45) 0, rgba(255, 255, 255, .45) 6px, rgba(255, 255, 255, 0) 6px, rgba(255, 255, 255, 0) 11px);
}

.rs-overlay .rs-hand .tile {
  --tw: var(--rs-tw, 52px);
  --th: var(--rs-th, 70px);
  --td: var(--rs-td, 7px);
  animation: rs-tile-in .46s cubic-bezier(.25, 1.35, .45, 1) backwards;
  animation-delay: calc(480ms + var(--i, 0) * 32ms);
}
.rs-overlay .rs-hand .is-flowers .tile {
  --tw: var(--rs-fw, 38px);
  --th: var(--rs-fh, 51px);
  --td: var(--rs-fd, 5px);
}
.rs-overlay .rs-hand .tile.is-winning { transform: translateY(-9px); z-index: 2; }
.rs-win-tag {
  position: absolute;
  left: 50%;
  top: -17px;
  z-index: 4;
  padding: 3px 8px 2px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: linear-gradient(to bottom, #ffd46a, var(--rs-gold));
  color: var(--rs-choc);
  font: 700 12px/1 var(--rs-display);
  letter-spacing: .06em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  transform: translateX(-50%);
  pointer-events: none;
}

/* ---- faan items -------------------------------------------------------------------------------- */
.rs-faan {
  grid-area: faan;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 18px 14px;
  border-radius: 20px;
  background: var(--rs-paper);
  border: 2px solid var(--rs-sand);
}
.rs-panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 2px 8px;
}
.rs-panel-head h2 { margin: 0; font: 600 24px/1 var(--rs-display); color: var(--rs-choc); }
.rs-panel-note { font: 800 14px/1 var(--rs-body); color: var(--rs-muted); }

.rs-items {
  list-style: none;
  margin: auto 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: var(--rs-row, 58px);
  gap: 6px;
  min-height: 0;
}
.rs-items.is-two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(var(--rs-rows, 4), var(--rs-row, 58px));
  grid-auto-flow: column;
  column-gap: 12px;
}

.rs-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main faan" "blurb faan";
  align-content: center;
  column-gap: 12px;
  row-gap: 3px;
  padding: 6px 8px 6px 14px;
  border-radius: 14px;
  background: #fff4e2;
  visibility: hidden;
}
.rs-item.is-in { visibility: visible; animation: rs-item-in .42s cubic-bezier(.2, 1.3, .4, 1) both; }
.rs-item-main { grid-area: main; display: flex; align-items: baseline; gap: 9px; min-width: 0; white-space: nowrap; }
.rs-item-name { font: 600 21px/1.05 var(--rs-display); overflow: hidden; text-overflow: ellipsis; }
.rs-item-cn { font: 700 17px/1 var(--rs-serif); color: #b0473b; flex: none; }
.rs-item-count {
  flex: none;
  padding: 2px 7px;
  border-radius: 8px;
  background: #ffe6a6;
  font: 700 14px/1.1 var(--rs-display);
  color: #9a6508;
}
.rs-item-blurb {
  grid-area: blurb;
  font: 700 14px/1.2 var(--rs-body);
  color: var(--rs-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-item-faan {
  grid-area: faan;
  align-self: center;
  min-width: 52px;
  padding: 6px 10px 5px;
  border-radius: 12px;
  background: linear-gradient(to bottom, #ffd46a, var(--rs-gold));
  box-shadow: 0 3px 0 var(--rs-gold-dark);
  font: 700 22px/1 var(--rs-display);
  color: var(--rs-choc);
  text-align: center;
}
.rs-item.is-in .rs-item-faan { animation: rs-pop .38s cubic-bezier(.2, 1.6, .4, 1) .1s backwards; }
.rs-item.is-limit { background: #ffeede; }
.rs-item.is-limit .rs-item-faan {
  background: linear-gradient(to bottom, #f06a6e, var(--rs-coral));
  box-shadow: 0 3px 0 var(--rs-coral-dark);
  color: #fff;
  font-size: 18px;
  padding: 8px 10px 7px;
}
.rs-items.is-two-col .rs-item-name { font-size: 19px; }
.rs-items.is-two-col .is-long .rs-item-cn { display: none; }
.rs-items.is-two-col .rs-item-blurb { font-size: 13px; }
.rs-items.is-roomy .rs-item { padding-left: 18px; }
.rs-items.is-roomy .rs-item-name { font-size: 24px; }
.rs-items.is-roomy .rs-item-cn { font-size: 19px; }
.rs-items.is-roomy .rs-item-blurb { font-size: 15.5px; }
/* a lone item (a limit hand, a chicken hand) gets the whole stage */
.rs-items.is-solo .rs-item { padding: 10px 16px 10px 26px; row-gap: 6px; border-radius: 18px; }
.rs-items.is-solo .rs-item-name { font-size: 32px; }
.rs-items.is-solo .rs-item-cn { font-size: 25px; }
.rs-items.is-solo .rs-item-blurb { font-size: 18px; }
.rs-items.is-solo .rs-item-faan { min-width: 76px; padding: 10px 14px 9px; font-size: 30px; border-radius: 16px; }
.rs-items.is-solo .rs-item.is-limit {
  background: radial-gradient(120% 140% at 0% 0%, #fff6d8 0%, #ffe9c2 55%, #ffd9c4 100%);
  box-shadow: inset 0 0 0 2px #f5cf7a;
}
.rs-items.is-solo .rs-item.is-limit .rs-item-faan { font-size: 24px; padding: 12px 14px 11px; }
.rs-items.is-compact .rs-item { row-gap: 1px; padding-top: 3px; padding-bottom: 3px; }
.rs-items.is-compact .rs-item-name { font-size: 17px; }
.rs-items.is-compact .rs-item-cn { font-size: 14px; }
.rs-items.is-compact .rs-item-blurb { font-size: 12px; }
.rs-items.is-compact .rs-item-faan { min-width: 44px; padding: 4px 8px 3px; font-size: 18px; }

.rs-faan-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: #fbf0dc;
  font: 800 15px/1.2 var(--rs-body);
  color: #7a5646;
  opacity: 0;
  transition: opacity .35s ease;
}
.rs-faan-foot.is-in { opacity: 1; }
.rs-faan-foot > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* unscored flowers: a soft second line explaining whose flowers they were */
.rs-faan-foot.has-note { flex-wrap: wrap; row-gap: 3px; padding-top: 7px; padding-bottom: 7px; }
.rs-faan-foot.has-note > span:first-of-type { flex: 1 1 0; min-width: 0; }
.rs-faan-foot > .rs-faan-note { flex: 1 0 100%; min-width: 0; padding-left: 29px; font-size: 13px; font-weight: 700; color: #a07f6c; }

/* ---- total medallion ------------------------------------------------------------------------- */
.rs-side { grid-area: side; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.rs-total {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: 18px;
  height: 128px;
  padding: 0 20px 0 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff3d6 0%, #ffe4a8 100%);
  border: 2px solid #f5cf7a;
}
.rs-total-rays {
  position: absolute;
  left: 68px;
  top: 64px;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(242, 182, 50, .55) 0deg 7deg, rgba(242, 182, 50, 0) 7deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, rgba(0, 0, 0, 0) 68%);
  mask-image: radial-gradient(circle, #000 20%, rgba(0, 0, 0, 0) 68%);
  opacity: 0;
  transition: opacity .4s ease;
  animation: rs-spin 18s linear infinite;
  pointer-events: none;
}
.rs-total.is-big .rs-total-rays, .rs-total.is-limit .rs-total-rays { opacity: 1; }

.rs-medal {
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff6cf 0%, #ffd965 38%, #f2b632 70%, #d9981c 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .7), inset 0 -6px 10px rgba(160, 100, 10, .35), 0 4px 0 var(--rs-gold-dark), 0 8px 16px rgba(120, 70, 10, .3);
}
.rs-medal-num { font: 700 52px/.95 var(--rs-display); color: var(--rs-choc); text-shadow: 0 2px 0 rgba(255, 255, 255, .6); }
.rs-medal-unit { font: 900 12px/1 var(--rs-body); letter-spacing: .12em; text-transform: uppercase; color: #7a4b16; margin-top: 2px; }
.rs-medal.is-bump { animation: rs-bump .28s cubic-bezier(.2, 1.6, .4, 1); }
.rs-medal.is-slam { animation: rs-slam .55s cubic-bezier(.2, 1.4, .4, 1); }
.rs-total.is-limit .rs-medal-num { font-size: 27px; letter-spacing: .02em; color: var(--rs-coral-dark); }

.rs-crown {
  position: absolute;
  left: 50%;
  top: -34px;
  width: 64px;
  height: 42px;
  margin-left: -32px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 42'%3E%3Cpath d='M6 36 L3 10 L18 22 L32 4 L46 22 L61 10 L58 36 Z' fill='%23ffd24a' stroke='%234a2c23' stroke-width='3' stroke-linejoin='round'/%3E%3Crect x='6' y='33' width='52' height='7' rx='3' fill='%23f2a91a' stroke='%234a2c23' stroke-width='3'/%3E%3Ccircle cx='32' cy='21' r='4' fill='%23e5484d'/%3E%3Ccircle cx='3' cy='9' r='3.5' fill='%23fff3c4' stroke='%234a2c23' stroke-width='2'/%3E%3Ccircle cx='32' cy='4' r='3.5' fill='%23fff3c4' stroke='%234a2c23' stroke-width='2'/%3E%3Ccircle cx='61' cy='9' r='3.5' fill='%23fff3c4' stroke='%234a2c23' stroke-width='2'/%3E%3C/svg%3E");
  opacity: 0;
  transform: translateY(-30px) rotate(-12deg);
}
.rs-total.is-limit .rs-crown { opacity: 1; transform: rotate(-8deg); animation: rs-crown-drop .6s cubic-bezier(.3, 1.6, .5, 1) .25s backwards; }

.rs-total-label { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rs-total-label b { font: 600 30px/1 var(--rs-display); }
.rs-total-label span { font: 800 16px/1.2 var(--rs-body); color: #9a6508; }

/* ---- payments ---------------------------------------------------------------------------------- */
.rs-pay { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rs-pay-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 49px;
  padding: 0 14px 0 4px;
  border-radius: 25px;
  background: var(--rs-paper);
  border: 2px solid var(--rs-sand);
}
.rs-pay-row.is-winner { background: linear-gradient(90deg, #fff0c7 0%, #fff9ea 100%); border-color: var(--rs-gold); }
.rs-pay-row.is-you .rs-pay-who b { color: var(--rs-jade-dark); }
.rs-pay-who { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.rs-pay-who b { display: flex; align-items: center; gap: 8px; min-width: 0; font: 600 19px/1.1 var(--rs-display); white-space: nowrap; }
.rs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rs-pay-who small { font: 800 12.5px/1 var(--rs-body); color: var(--rs-muted); opacity: 0; transition: opacity .3s ease; }
.rs-tag {
  flex: none;
  padding: 3px 7px 2px;
  border-radius: 8px;
  background: var(--rs-gold);
  color: var(--rs-choc);
  font: 800 10.5px/1 var(--rs-body);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.rs-pay-amt {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  font: 700 25px/1 var(--rs-display);
  opacity: 0;
  transition: opacity .25s ease;
}
.rs-pay-row.is-paid .rs-pay-amt, .rs-pay-row.is-paid .rs-pay-who small { opacity: 1; }
.rs-pay-row.is-winner .rs-pay-amt { color: var(--rs-jade-dark); }
.rs-pay-row.is-payer .rs-pay-amt { color: var(--rs-coral); }
.rs-pay-row.is-even .rs-pay-amt { color: #b9a393; }
.rs-pay-row.is-bump { animation: rs-bump .34s cubic-bezier(.2, 1.6, .4, 1); }

.rs-portrait { flex: none; }
.rs-portrait.is-flinch { animation: rs-flinch .45s ease-in-out; }
.rs-portrait.is-gulp { animation: rs-bump .34s cubic-bezier(.2, 1.6, .4, 1); }

.rs-coin {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff3b8 0%, #f6c945 45%, #c98a12 100%);
  box-shadow: inset 0 0 0 1.5px rgba(154, 101, 8, .7), 0 1px 0 rgba(0, 0, 0, .15);
}
.rs-coin::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 7px;
  width: 6px;
  height: 6px;
  background: #8a5a06;
  box-shadow: 0 0 0 1px #ffe89a;
}

/* ---- footer ----------------------------------------------------------------------------------- */
.rs-foot { grid-area: foot; display: flex; align-items: center; gap: 12px; min-width: 0; }
.rs-foot-info { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; }
.rs-chip {
  padding: 8px 14px 7px;
  border-radius: 16px;
  background: #f6e8cf;
  font: 800 15px/1 var(--rs-body);
  color: var(--rs-muted);
  white-space: nowrap;
}
.rs-chip.is-soft { background: transparent; box-shadow: inset 0 0 0 2px #f0dfc3; }

.rs-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 20px;
  font: 600 23px/1 var(--rs-display);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.rs-btn:focus { outline: none; }
.rs-btn:focus-visible { outline: 3px solid var(--rs-gold); outline-offset: 3px; }
.rs-btn.is-ghost { background: #fff; color: var(--rs-choc); box-shadow: inset 0 0 0 2px #ead7b6, 0 4px 0 #e2caa2; }
.rs-btn.is-go {
  background: linear-gradient(to bottom, #43bd86 0%, var(--rs-jade) 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 50, 25, .3);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), 0 5px 0 var(--rs-jade-dark), 0 10px 18px rgba(31, 122, 81, .35);
}
.rs-btn kbd {
  padding: 4px 7px 3px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .22);
  font: 900 11px/1 var(--rs-body);
  letter-spacing: .08em;
  text-transform: uppercase;
}
@media (hover: hover) {
  .rs-btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
}
.rs-btn:active { transform: translateY(3px); }
.rs-btn.is-go:active { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), 0 2px 0 var(--rs-jade-dark), 0 4px 8px rgba(31, 122, 81, .3); }
.rs-overlay.is-done .rs-btn.is-go { animation: rs-nudge 1.8s ease-in-out .3s infinite; }

.rs-btn[hidden] { display: none; }
.rs-btn.is-gold {
  background: linear-gradient(to bottom, #ffd35e 0%, var(--rs-gold) 100%);
  color: var(--rs-choc);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 5px 0 var(--rs-gold-dark), 0 10px 18px rgba(201, 138, 18, .3);
}

/* ---- multiplayer: the next-hand vote (results.js createVote) ---------------------------------- */
.rs-vote { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rs-vote-seats { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rs-vote-seat {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 44px;
  padding: 0 10px 0 4px;
  border-radius: 22px;
  background: #f6e8cf;
  color: var(--rs-muted);
  font: 800 15px/1 var(--rs-body);
  transition: background .25s ease, color .25s ease;
}
.rs-vote-seat .rs-portrait { flex: none; }
.rs-vote-seat.is-ready { background: #d7f1e3; color: var(--rs-jade-dark); }
.rs-vote-seat.is-you { box-shadow: inset 0 0 0 2px rgba(242, 182, 50, .7); }
.rs-vote-name { min-width: 0; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-vote-mark { flex: none; font: 900 16px/1 var(--rs-body); }
.rs-vote-seats.is-many .rs-vote-name { display: none; }
.rs-vote-seat:not(.is-ready) .rs-vote-mark { animation: rs-vote-wait 1.2s ease-in-out infinite; }
.rs-vote-clock {
  flex: none;
  padding: 8px 12px 7px;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #f0dfc3;
  font: 800 15px/1 var(--rs-body);
  color: var(--rs-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rs-vote-clock.is-low { color: var(--rs-coral); box-shadow: inset 0 0 0 2px rgba(229, 72, 77, .45); }
.rs-vote-clock[hidden] { display: none; }
.rs-waiting {
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 22px;
  border-radius: 20px;
  background: #f6e8cf;
  font: 600 20px/1 var(--rs-display);
  color: var(--rs-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 460px;
}
.rs-waiting::before {
  content: '';
  flex: none;
  width: 12px; height: 12px;
  margin-right: 12px;
  border-radius: 50%;
  background: var(--rs-jade);
  animation: rs-vote-wait 1.2s ease-in-out infinite;
}
.rs-waiting[hidden] { display: none; }
/* the draw card grows to fit the vote strip */
.rs-overlay.is-mp .rs-card.is-draw { left: 250px; width: 1100px; }
@keyframes rs-vote-wait { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- consoling pig (the human dealt in) ------------------------------------------------------- */
.rs-console {
  position: absolute;
  left: 86px;
  top: 880px;
  width: 0;
  height: 0;
  z-index: 3;
  animation: rs-peek .6s cubic-bezier(.2, 1.3, .4, 1) 1.3s backwards;
}
.rs-console-pig { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; animation: rs-sway 2.6s ease-in-out 2s infinite; }
.rs-console .rs-bubble {
  position: absolute;
  left: -70px;
  bottom: 164px;
  width: 152px;
  max-width: none;
  white-space: normal;
  text-align: center;
  font-size: 16px;
  line-height: 1.25;
  border-color: #cfd8f0;
  color: #4b5a86;
}
.rs-console .rs-bubble::before { left: 50%; bottom: -8px; margin-left: -7px; transform: rotate(-45deg); border-color: #cfd8f0; }

/* ---- exhausted wall ------------------------------------------------------------------------- */
.rs-card.is-draw {
  left: 400px;
  top: 172px;
  width: 800px;
  height: 556px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 36px 26px;
}
.rs-nap { position: relative; flex: none; width: 100%; height: 200px; }
.rs-nap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -6px;
  width: 260px;
  height: 260px;
  margin-left: -130px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #f1f2ff 0%, #e2e6fb 55%, rgba(226, 230, 251, 0) 71%);
}
.rs-nap-pig { position: absolute; left: 50%; top: 204px; width: 0; height: 0; transform-origin: 0 0; animation: rs-breathe 3.2s ease-in-out infinite; }
.rs-zzz { position: absolute; left: 50%; top: 40px; margin-left: 96px; z-index: 1; font: 700 30px/1 var(--rs-display); color: #7d8fd6; text-shadow: 2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 0 3px 6px rgba(80, 90, 160, .25); }
.rs-zzz span { position: absolute; left: 0; top: 0; opacity: 0; animation: rs-zzz 3s ease-in-out infinite; }
.rs-zzz span:nth-child(2) { animation-delay: 1s; font-size: 24px; }
.rs-zzz span:nth-child(3) { animation-delay: 2s; font-size: 36px; }
.rs-card.is-draw .rs-title { justify-self: auto; margin-top: 8px; font-size: 70px; transform-origin: 50% 75%; }
.rs-draw-sub { margin: 14px 0 0; font: 800 23px/1.3 var(--rs-body); color: var(--rs-muted); text-align: center; animation: rs-fade .4s ease-out .6s backwards; }
.rs-card.is-draw .rs-foot { width: 100%; margin-top: auto; }

.rs-seats { list-style: none; display: flex; gap: 10px; margin: 20px 0 0; padding: 0; }
.rs-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 14px 0 5px;
  border-radius: 26px;
  background: var(--rs-paper);
  border: 2px solid var(--rs-sand);
  animation: rs-pop .4s cubic-bezier(.2, 1.5, .4, 1) backwards;
  animation-delay: calc(700ms + var(--i, 0) * 90ms);
}
.rs-seat.is-you { border-color: #9fd8bb; }
.rs-seat.is-you .rs-seat-who b { color: var(--rs-jade-dark); }
.rs-seat-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rs-seat-who b { display: flex; align-items: center; gap: 6px; max-width: 130px; font: 600 17px/1.1 var(--rs-display); white-space: nowrap; }
.rs-seat-coins { display: flex; align-items: center; gap: 5px; font: 800 13px/1 var(--rs-body); color: var(--rs-muted); }
.rs-seat-coins .rs-coin { width: 14px; height: 14px; }
.rs-seat-coins .rs-coin::after { left: 5px; top: 5px; width: 4px; height: 4px; }

/* ---- fast-forward, leaving -------------------------------------------------------------------- */
.rs-overlay.is-skipped .rs-card,
.rs-overlay.is-skipped .rs-hero,
.rs-overlay.is-skipped .rs-title,
.rs-overlay.is-skipped .rs-pill,
.rs-overlay.is-skipped .rs-bubble,
.rs-overlay.is-skipped .rs-hand .tile,
.rs-overlay.is-skipped .rs-item,
.rs-overlay.is-skipped .rs-item-faan,
.rs-overlay.is-skipped .rs-console,
.rs-overlay.is-skipped .rs-draw-sub,
.rs-overlay.is-skipped .rs-seat { animation: none; }

.rs-overlay.is-leaving { pointer-events: none; animation: rs-fade-out .24s ease-in forwards; }
.rs-overlay.is-leaving .rs-card { animation: rs-card-out .24s ease-in forwards; }

@media (prefers-reduced-motion: reduce) {
  .rs-hero-pig, .rs-hero-shadow, .rs-rays, .rs-total-rays, .rs-overlay.is-done .rs-btn.is-go,
  .rs-console-pig, .rs-nap-pig, .rs-medal.is-bump, .rs-medal.is-slam, .rs-portrait.is-flinch,
  .rs-portrait.is-gulp, .rs-pay-row.is-bump, .rs-vote-seat .rs-vote-mark, .rs-waiting::before { animation: none; }
  .rs-card, .rs-hero, .rs-title, .rs-pill, .rs-bubble, .rs-overlay .rs-hand .tile, .rs-item.is-in,
  .rs-item.is-in .rs-item-faan, .rs-console, .rs-seat { animation-name: rs-fade; animation-timing-function: ease-out; }
  .rs-zzz span { animation: none; opacity: .8; }
  .rs-zzz span:nth-child(2) { transform: translate(18px, -22px); }
  .rs-zzz span:nth-child(3) { transform: translate(40px, -48px); }
}
/* The same calm set for the in-game Reduce motion setting (results.js adds .is-reduced). The fades
   skip :not(.is-skipped) so a fast-forward still lands everything at once. */
.rs-overlay.is-reduced .rs-hero-pig, .rs-overlay.is-reduced .rs-hero-shadow, .rs-overlay.is-reduced .rs-rays,
.rs-overlay.is-reduced .rs-total-rays, .rs-overlay.is-reduced.is-done .rs-btn.is-go, .rs-overlay.is-reduced .rs-console-pig,
.rs-overlay.is-reduced .rs-nap-pig, .rs-overlay.is-reduced .rs-medal.is-bump, .rs-overlay.is-reduced .rs-medal.is-slam,
.rs-overlay.is-reduced .rs-portrait.is-flinch, .rs-overlay.is-reduced .rs-portrait.is-gulp,
.rs-overlay.is-reduced .rs-pay-row.is-bump, .rs-overlay.is-reduced .rs-total.is-limit .rs-crown { animation: none; }
.rs-overlay.is-reduced:not(.is-skipped) .rs-card, .rs-overlay.is-reduced:not(.is-skipped) .rs-hero,
.rs-overlay.is-reduced:not(.is-skipped) .rs-title,
.rs-overlay.is-reduced:not(.is-skipped) .rs-pill, .rs-overlay.is-reduced:not(.is-skipped) .rs-bubble,
.rs-overlay.is-reduced:not(.is-skipped) .rs-hand .tile, .rs-overlay.is-reduced:not(.is-skipped) .rs-item.is-in,
.rs-overlay.is-reduced:not(.is-skipped) .rs-item.is-in .rs-item-faan, .rs-overlay.is-reduced:not(.is-skipped) .rs-console,
.rs-overlay.is-reduced:not(.is-skipped) .rs-seat { animation-name: rs-fade; animation-timing-function: ease-out; }
.rs-overlay.is-reduced.is-leaving .rs-card { animation: none; }
.rs-overlay.is-reduced .rs-zzz span { animation: none; opacity: .8; }
.rs-overlay.is-reduced .rs-zzz span:nth-child(2) { transform: translate(18px, -22px); }
.rs-overlay.is-reduced .rs-zzz span:nth-child(3) { transform: translate(40px, -48px); }

/* ---- keyframes -------------------------------------------------------------------------------- */
@keyframes rs-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rs-fade-out { to { opacity: 0; } }
@keyframes rs-card-in {
  0% { transform: translateY(40px) scale(.9); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes rs-card-out { to { transform: translateY(24px) scale(.96); } }
@keyframes rs-title-in {
  0% { transform: scale(.2); opacity: 0; }
  35% { transform: scale(1.18, .82); opacity: 1; }
  55% { transform: scale(.92, 1.1); }
  75% { transform: scale(1.04, .97); }
  100% { transform: none; }
}
@keyframes rs-pop {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: none; }
}
@keyframes rs-hero-in {
  0% { transform: translateY(60px) scale(.6); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes rs-hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  12% { transform: translateY(0) scale(1.07, .93); }
  38% { transform: translateY(-20px) scale(.96, 1.05); }
  62% { transform: translateY(0) scale(1.06, .94); }
  74% { transform: translateY(0) scale(.99, 1.01); }
}
@keyframes rs-hop-shadow {
  0%, 100%, 62% { transform: scale(1); opacity: 1; }
  38% { transform: scale(.78); opacity: .6; }
}
@keyframes rs-spin { to { transform: rotate(360deg); } }
@keyframes rs-tile-in {
  0% { transform: translateY(-34px) rotate(-7deg) scale(.82); opacity: 0; }
  55% { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes rs-item-in {
  0% { transform: translateX(-24px) scale(.96); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes rs-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
@keyframes rs-slam {
  0% { transform: scale(1.5) rotate(-6deg); }
  45% { transform: scale(.9) rotate(2deg); }
  70% { transform: scale(1.06); }
  100% { transform: none; }
}
@keyframes rs-crown-drop {
  0% { opacity: 0; transform: translateY(-60px) rotate(-30deg); }
  60% { opacity: 1; transform: translateY(4px) rotate(-4deg); }
  100% { opacity: 1; transform: rotate(-8deg); }
}
@keyframes rs-flinch {
  0%, 100% { transform: none; }
  20% { transform: translateX(-4px) rotate(-6deg); }
  45% { transform: translateX(4px) rotate(5deg); }
  70% { transform: translateX(-2px) rotate(-2deg); }
}
@keyframes rs-nudge {
  0%, 70%, 100% { transform: none; }
  78% { transform: translateY(-4px) scale(1.03); }
  86% { transform: translateY(0) scale(.99); }
}
@keyframes rs-peek {
  0% { transform: translateY(120px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes rs-sway {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-2.5deg); }
  70% { transform: rotate(2deg); }
}
@keyframes rs-breathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.025, .975); }
}
@keyframes rs-zzz {
  0% { transform: translate(0, 8px) scale(.6); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: .9; }
  100% { transform: translate(38px, -56px) scale(1.1); opacity: 0; }
}

/* ---- effects: lite (js/ui/perf.js): the rays hold still (a spinning masked gradient re-composites
   every frame) */
.fx-lite .rs-rays, .fx-lite .rs-total-rays { animation: none; }
