/* ───────────────────────── tokens ───────────────────────── */
:root {
  --ink: #1d1b3a;
  --paper: #fffdf7;
  --yellow: #ffd23f;
  --green: #2fd67b;
  --red: #ff4545;
  --skin: #ffd23f;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;

  /* sizes that shrink on short screens (see media queries at the bottom) */
  --bottom-h: 248px;
  --card-h: 204px;
  --row-h: 38px;
  --prompt-h: 108px;
  --prompt-size: 17px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  background: #0f0e22;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button { font: inherit; color: inherit; }

/* ───────────────────────── app shell ───────────────────────── */
#app {
  --bg: #3d5afe;
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  overflow: clip; /* never scrollable, even when cards and banners fly off-screen */
  background-color: var(--bg);
  background-image: linear-gradient(rgba(255, 255, 255, .14), rgba(0, 0, 0, .24));
  transition: background-color .6s;
}
#app[data-day="1"] { --bg: #7c4dff; }
#app[data-day="2"] { --bg: #ff7a3d; }
#app[data-day="3"] { --bg: #10b3a3; }
#app[data-day="4"] { --bg: #ff4f8b; }
#app[data-day="bonus"] { --bg: #8a5536; } /* coffee break */

/* drifting dots */
#app::before {
  content: "";
  position: absolute;
  inset: -30px;
  pointer-events: none;
  background: radial-gradient(rgba(255, 255, 255, .13) 2.5px, transparent 3px) 0 0 / 26px 26px;
  animation: bg-drift 9s linear infinite;
}
@keyframes bg-drift { to { translate: 26px 26px; } }

/* red pulse in the last seconds */
#app.danger::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  box-shadow: inset 0 0 70px 14px rgba(255, 40, 40, .6);
  animation: vignette .45s ease-in-out infinite alternate;
}
@keyframes vignette { from { opacity: .45; } to { opacity: 1; } }

.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
#app[data-screen="title"] .screen-title,
#app[data-screen="game"] .screen-game,
#app[data-screen="end"] .screen-end { display: flex; }

.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { translate: -2px 1px; }
  20%, 80% { translate: 4px -2px; }
  30%, 50%, 70% { translate: -9px 2px; }
  40%, 60% { translate: 9px -1px; }
}

/* ───────────────────────── buttons ───────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: translate .08s, box-shadow .08s;
}
.btn:active { translate: 0 4px; box-shadow: 0 2px 0 var(--ink); }
.btn.alt { background: #fff; }

/* ───────────────────────── title screen ───────────────────────── */
.screen-title {
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding-top: calc(44px + env(safe-area-inset-top));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; }
.logo-big {
  display: block;
  font-size: clamp(60px, 19.5vw, 94px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.01em;
  color: var(--yellow);
  rotate: -4deg;
  text-shadow:
    4px 0 var(--ink), -4px 0 var(--ink), 0 4px var(--ink), 0 -4px var(--ink),
    3px 3px var(--ink), -3px 3px var(--ink), 3px -3px var(--ink), -3px -3px var(--ink),
    0 11px 0 var(--ink), 3px 11px 0 var(--ink), -3px 11px 0 var(--ink);
  animation: logo-in .7s cubic-bezier(.2, 1.5, .4, 1) both, logo-wobble 2.6s 1s ease-in-out infinite;
}
.logo-sub {
  display: inline-block;
  margin-top: 22px;
  padding: 8px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: clamp(17px, 5.2vw, 22px);
  border-radius: 12px;
  rotate: 2deg;
  animation: logo-in .7s .15s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes logo-in { from { scale: .2; opacity: 0; } }
@keyframes logo-wobble { 0%, 100% { rotate: -4deg; } 50% { rotate: -1deg; scale: 1.04; } }

.title-actor { flex: none; height: min(36vh, 280px); aspect-ratio: 200 / 240; }

.title-bottom { width: 100%; display: flex; flex-direction: column; gap: 18px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  padding: 6px 11px;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .2);
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
}
.btn-play { padding: 17px 16px; font-size: 26px; border-radius: 22px; animation: btn-pulse 1.1s ease-in-out infinite; }
@keyframes btn-pulse { 50% { scale: 1.04; } }

/* ───────────────────────── HUD ───────────────────────── */
.hud { flex: none; display: flex; align-items: center; gap: 8px; height: 38px; }
.day-pill {
  flex: none;
  margin-right: auto;
  padding: 7px 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .06em;
  white-space: nowrap;
  border-radius: 999px;
}
.progress { flex: none; display: flex; gap: 4px; margin-top: 8px; }
.progress i { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .3); }
.progress i.safe { background: #fff; }
.progress i.strike { background: var(--red); }
.progress i.saved { background: var(--yellow); opacity: .75; }
.progress i.now { background: var(--yellow); animation: dot-now .6s ease-in-out infinite alternate; }
@keyframes dot-now { to { scale: 1 1.7; } }

.strikes { flex: none; display: flex; gap: 4px; }
.strike-token {
  width: 24px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 900;
  color: rgba(29, 27, 58, .55);
  background: rgba(255, 255, 255, .4);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
}
.strike-token.on { background: var(--red); color: #fff; font-size: 14px; }
.pass-pill {
  height: 28px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  rotate: -5deg;
}
.slam { animation: slam .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes slam { from { scale: 3.2; rotate: -24deg; opacity: 0; } }

.mute {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 15px;
  background: rgba(255, 255, 255, .4);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
}

/* ───────────────────────── stage ───────────────────────── */
.stage {
  position: relative;
  flex: 1 1 0;
  min-height: 150px;
  margin-top: 10px;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  container-type: size;
  background: linear-gradient(rgba(255, 255, 255, .36), rgba(255, 255, 255, .16));
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .22);
}
.stage::after { /* floor */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 12%;
  background: rgba(29, 27, 58, .22);
}
.stage-poster {
  position: absolute;
  left: 7%; top: 9%;
  width: 17%;
  width: min(17%, 30cqh); /* stays in proportion on short stages */
  aspect-ratio: 1 / 1.15;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-size: clamp(16px, 11cqh, 34px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  rotate: -4deg;
}
.stage-window {
  position: absolute;
  right: 7%; top: 9%;
  width: 25%;
  width: min(25%, 42cqh);
  aspect-ratio: 1 / 1.05;
  overflow: hidden;
  background: linear-gradient(#aee4ff, #eefbff);
  border: 3px solid var(--ink);
  border-radius: 10px;
}
.stage-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--ink), var(--ink)) 50% 0 / 3px 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 3px no-repeat;
}
.stage-window.broken::after {
  content: "";
  position: absolute;
  inset: 12%;
  background: var(--ink);
  clip-path: polygon(50% 0, 62% 30%, 100% 20%, 72% 52%, 95% 90%, 55% 68%, 20% 100%, 32% 60%, 0 40%, 38% 34%);
  animation: pop-in .25s cubic-bezier(.2, 1.6, .4, 1);
}

.actor {
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 2;
  height: 80%;
  aspect-ratio: 200 / 240;
  translate: -50% 0;
}
/* the intern pops up from behind the desk at the start of each situation */
.actor.enter > .actor-inner { animation: actor-enter .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes actor-enter { from { transform: translateY(70%) scale(.9, 1.1); } }

.desk {
  position: absolute;
  left: 7%; right: 7%; bottom: -3px;
  z-index: 3;
  height: 24%;
  background: #d99a5b;
  border: 3px solid var(--ink);
  border-radius: 12px 12px 0 0;
}
.desk::before { /* table top */
  content: "";
  position: absolute;
  left: -10px; right: -10px; top: -5px;
  height: 13px;
  background: #b97a3e;
  border: 3px solid var(--ink);
  border-radius: 8px;
}
.scene-emoji, .prop-emoji {
  position: absolute;
  bottom: 23%;
  z-index: 4;
  font-size: 46px;
  font-size: clamp(30px, 21cqh, 66px);
  line-height: 1;
}
.scene-emoji { left: 10%; }
.prop-emoji { right: 10%; opacity: 0; }
.scene-emoji.pop-in { animation: pop-in .4s cubic-bezier(.2, 1.6, .4, 1); }
.prop-emoji.show { opacity: 1; animation: prop-in .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop-in { from { scale: 0; rotate: -30deg; } }
@keyframes prop-in { 0% { scale: 0; rotate: 40deg; translate: 0 40px; } 100% { scale: 1; rotate: 0deg; translate: 0 0; } }

.fx-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.fx-emoji { position: absolute; line-height: 1; will-change: transform, opacity; }

.stamp {
  position: absolute;
  left: 50%; bottom: 3%;
  z-index: 6;
  padding: 1px 12px;
  font-weight: 900;
  font-size: 22px;
  font-size: clamp(16px, 9.5cqh, 26px);
  letter-spacing: .04em;
  white-space: nowrap;
  background: var(--paper);
  border: 3.5px solid currentColor;
  border-radius: 9px;
  translate: -50% 0;
  rotate: -3deg;
  opacity: 0;
}
.stamp.safe { color: #0f9a4b; }
.stamp.strike { color: var(--red); }
.stamp.saved { color: #2a63e8; }
.stamp.miss { color: #6d6a85; }
.stamp.show { animation: stamp-in .38s cubic-bezier(.2, 1.5, .4, 1) forwards; }
@keyframes stamp-in {
  0% { opacity: 0; scale: 3.4; }
  60% { opacity: 1; scale: .9; }
  100% { opacity: 1; scale: 1; }
}

.day-banner {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
  font-weight: 900;
  font-size: clamp(44px, 15vw, 76px);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 6px 0 var(--ink);
  background: repeating-linear-gradient(-45deg, transparent 0 28px, rgba(0, 0, 0, .1) 28px 56px), var(--bg);
  translate: -105% 0;
}
.day-banner.show { display: flex; animation: banner 1.25s cubic-bezier(.75, 0, .25, 1) both; }
.day-banner small {
  display: block;
  margin-top: 16px;
  padding: 7px 14px;
  font-size: 17px;
  letter-spacing: .1em;
  color: var(--ink);
  text-shadow: none;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  rotate: -3deg;
}
@keyframes banner {
  0% { translate: -105% 0; }
  28%, 68% { translate: 0 0; }
  100% { translate: 105% 0; }
}

/* ───────────────────────── prompt + timer ───────────────────────── */
.prompt {
  position: relative;
  flex: none;
  min-height: var(--prompt-h);
  margin-top: 14px;
  padding: 10px 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  transition: background-color .25s;
}
/* bonus round: a tag on the box, and the question the player must answer */
.prompt[data-kicker]::after {
  content: attr(data-kicker);
  position: absolute;
  top: -11px;
  left: 14px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  rotate: -3deg;
}
.prompt .prompt-ask { font-size: calc(var(--prompt-size) - 2px); font-weight: 900; color: #b4531a; }
.prompt .prompt-ask[hidden] { display: none; }
.prompt[data-kind="bonus"] { background: #fff3c4; }
.prompt[data-kind="saved"] { background: #e4edff; }
.prompt p {
  margin: 0;
  font-weight: 800;
  font-size: var(--prompt-size);
  line-height: 1.28;
  text-wrap: balance;
}
.prompt[data-kind="safe"] { background: #e3ffee; }
.prompt[data-kind="strike"] { background: #ffe6e6; }
.prompt.pop { animation: pop .32s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes pop { from { scale: .9; opacity: .3; } }

.timer {
  flex: none;
  height: 16px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(29, 27, 58, .35);
  border: 3px solid var(--ink);
  border-radius: 999px;
  transition: opacity .2s;
}
.timer.idle { opacity: 0; }
.timer-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transform-origin: 0 50%;
  transition: background-color .2s;
}
.timer.warn .timer-fill { background: var(--yellow); }
.timer.danger .timer-fill { background: var(--red); }
.timer.danger { animation: throb .45s ease-in-out infinite; }
@keyframes throb { 50% { scale: 1.02 1.3; } }

/* ───────────────────────── cards ───────────────────────── */
.bottom { position: relative; z-index: 2; flex: none; height: var(--bottom-h); margin-top: 10px; }

.hand {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 2px 10px;
}
.card {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 150px;
  height: var(--card-h);
  padding: 12px 7px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 7px 0 var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  rotate: var(--rot, 0deg);
  translate: 0 var(--ty, 0px);
  transition: scale .12s, translate .12s, box-shadow .12s;
}
.card:nth-child(1) { --rot: -4deg; --ty: 6px; }
.card:nth-child(2) { --ty: -6px; }
.card:nth-child(3) { --rot: 4deg; --ty: 6px; }

.card-emoji {
  flex: none;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  font-size: 34px;
  line-height: 1;
  background: #ffe9a8;
  border: 3px solid var(--ink);
  border-radius: 50%;
}
.card:nth-child(1) .card-emoji { background: #ffd1e3; }
.card:nth-child(3) .card-emoji { background: #bfeaff; }
.card-label {
  flex: 1;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.18;
  text-wrap: balance;
  overflow-wrap: break-word;
}

@media (hover: hover) {
  .card:hover { translate: 0 calc(var(--ty, 0px) - 6px); }
}
.card:active { scale: .96; translate: 0 calc(var(--ty, 0px) + 4px); box-shadow: 0 3px 0 var(--ink); }

.card.deal {
  animation: deal .5s cubic-bezier(.2, 1.35, .4, 1) backwards;
  animation-delay: calc(var(--i) * 90ms);
}
@keyframes deal {
  from { translate: 0 130%; rotate: calc(var(--rot, 0deg) * 5 + 12deg); opacity: 0; }
}

.card.picked { z-index: 5; pointer-events: none; animation: picked .52s cubic-bezier(.3, 0, .3, 1) forwards; }
@keyframes picked {
  30%, 62% {
    scale: 1.14;
    rotate: 0deg;
    translate: 0 -16px;
    opacity: 1;
    box-shadow: 0 14px 0 var(--ink), 0 0 0 6px var(--yellow);
  }
  100% { scale: .3; rotate: 0deg; translate: 0 -150%; opacity: 0; }
}
.card.dropped { pointer-events: none; animation: dropped .42s cubic-bezier(.5, 0, .9, .4) forwards; }
@keyframes dropped {
  to { translate: 0 160%; rotate: calc(var(--rot, 0deg) * 6 + 14deg); opacity: 0; }
}

/* ───────────────────────── crowd result ───────────────────────── */
.result { position: absolute; inset: 0; display: none; flex-direction: column; gap: 7px; }
.bottom[data-mode="result"] .hand { display: none; }
.bottom[data-mode="result"] .result { display: flex; }

.crowd-head {
  flex: none;
  min-height: 38px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
}
.crowd-pct {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--yellow);
  text-shadow:
    2px 0 var(--ink), -2px 0 var(--ink), 0 2px var(--ink), 0 -2px var(--ink),
    2px 2px var(--ink), -2px 2px var(--ink), 2px -2px var(--ink), -2px -2px var(--ink),
    0 5px 0 var(--ink);
}
.crowd-label { font-size: 15px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }

.crowd-rows { display: flex; flex-direction: column; gap: 6px; }
.crowd-row {
  position: relative;
  height: var(--row-h);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-weight: 800;
  font-size: 13.5px;
  background: rgba(255, 255, 255, .32);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  opacity: 0;
  translate: -18px 0;
}
.crowd-row.in {
  opacity: 1;
  translate: 0 0;
  transition: opacity .25s, translate .35s cubic-bezier(.2, 1.4, .4, 1);
  transition-delay: calc(var(--i) * 70ms);
}
.crowd-row .bar {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .82);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform .9s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i) * 70ms + 120ms);
}
.crowd-row.is-you .bar { background: var(--yellow); }
.crowd-row.is-top { animation: top-row .5s cubic-bezier(.2, 1.6, .4, 1); }
.crowd-row.is-top .bar { background: var(--green); transition: transform .9s cubic-bezier(.2, .8, .2, 1), background-color .2s; }
@keyframes top-row { 40% { scale: 1.05; } }
.you-tag.top-tag { padding: 1px 6px; font-size: 13px; background: #fff; border: 2px solid var(--ink); }
.crowd-row > :not(.bar) { position: relative; }
.crowd-row .em { flex: none; font-size: 18px; }
.crowd-row .lbl { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you-tag {
  flex: none;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
}
.crowd-row .pct { flex: none; min-width: 38px; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }

.btn-next {
  flex: none;
  margin-top: auto;
  margin-bottom: 6px;
  opacity: 0;
  pointer-events: none;
  translate: 0 12px;
  transition: opacity .2s, translate .3s cubic-bezier(.2, 1.4, .4, 1), box-shadow .08s;
}
.btn-next.ready { opacity: 1; pointer-events: auto; translate: 0 0; }
.btn-next.ready:active { translate: 0 4px; }

/* ───────────────────────── end screen ───────────────────────── */
.screen-end { align-items: center; justify-content: center; gap: 14px; text-align: center; }
.end-stamp {
  padding: 0 22px;
  font-size: clamp(52px, 17vw, 84px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  background: var(--paper);
  border: 7px solid currentColor;
  border-radius: 18px;
  rotate: -6deg;
}
.end-stamp.hired { color: #0f9a4b; }
.end-stamp.fired { color: var(--red); }
.end-stamp.show { animation: stamp-in .45s cubic-bezier(.2, 1.5, .4, 1) both; }
.end-sub { margin: 4px 0 0; color: #fff; font-weight: 800; font-size: 17px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }

.share-card {
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 8px 0 var(--ink);
}
.share-card.show { animation: rise .5s .25s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes rise { from { translate: 0 60px; opacity: 0; } }
.share-actor { height: 124px; aspect-ratio: 200 / 240; margin-bottom: 4px; }
.share-kicker { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.share-title { font-size: 28px; font-weight: 900; line-height: 1.05; }
.share-tagline { font-size: 15px; font-weight: 700; line-height: 1.25; opacity: .8; text-wrap: balance; }
.stats { width: 100%; margin-top: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 8px 4px; background: #f0ebff; border: 2.5px solid var(--ink); border-radius: 14px; }
.stat b { display: block; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 11px; font-weight: 800; line-height: 1.1; opacity: .7; }
.rarest { min-height: 1.2em; font-size: 13px; font-weight: 700; opacity: .75; }

.end-actions { width: 100%; display: flex; gap: 10px; margin-top: 4px; }
.end-actions .btn { flex: 1; }

/* ───────────────────────── toast, confetti ───────────────────────── */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 40;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  translate: -50% 20px;
  transition: opacity .2s, translate .3s;
}
.toast.show { opacity: 1; translate: -50% 0; }

.confetti-layer { position: absolute; inset: 0; z-index: 30; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; display: block; will-change: transform, opacity; }

/* ───────────────────────── the intern ───────────────────────── */
.actor-inner { width: 100%; height: 100%; transform-origin: 50% 100%; }
.intern {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 100%;
  animation: idle 1.7s ease-in-out infinite;
}
@keyframes idle { 50% { transform: scale(1.03, .97); } }

.i-shadow { fill: rgba(0, 0, 0, .2); }
.i-legs rect { fill: #2b2d6e; stroke: var(--ink); stroke-width: 4; }
.i-shoe { fill: var(--ink); }
.i-arm path { fill: none; stroke: var(--ink); stroke-width: 23; stroke-linecap: round; }
.i-arm .i-arm-fill { stroke: var(--skin); stroke-width: 14; }
.i-body, .i-vneck { fill: var(--skin); }
.i-body, .i-vneck, .i-arm-fill, .i-lid { transition: fill .25s, stroke .25s; }
.i-body-outline { fill: none; stroke: var(--ink); stroke-width: 5; }
.i-shirt { fill: #fff; }
.i-collar { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.i-tie { fill: #ff4f6d; stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.i-badge { fill: #4aa8ff; stroke: var(--ink); stroke-width: 3; }
.i-eye { fill: #fff; stroke: var(--ink); stroke-width: 4; }
.i-pupil { fill: var(--ink); }
.i-lid { fill: var(--skin); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.i-line { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.i-mouth { fill: var(--ink); }
.i-tongue { fill: #ff6b81; }
.i-blush ellipse { fill: #ff7aa2; opacity: .65; }
.i-sweat path { fill: #8fdcff; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.i-zzz text { fill: var(--ink); font-weight: 900; font-family: var(--font); }
.i-stars text { fill: var(--yellow); stroke: var(--ink); stroke-width: 2.5; paint-order: stroke fill; }
.i-shades path { fill: var(--ink); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.i-shades .i-shades-bar { fill: none; stroke-width: 6; stroke-linecap: round; }
.i-ice { fill: rgba(170, 226, 255, .5); stroke: #eefaff; stroke-width: 5; }

/* faces */
.i-face { display: none; }
.intern[data-face="neutral"] .f-neutral,
.intern[data-face="happy"] .f-happy,
.intern[data-face="shock"] .f-shock,
.intern[data-face="dizzy"] .f-dizzy,
.intern[data-face="sleep"] .f-sleep,
.intern[data-face="smug"] .f-smug,
.intern[data-face="sick"] .f-sick,
.intern[data-face="awkward"] .f-awkward { display: block; }

.i-blink { transform-origin: 100px 90px; animation: blink 3.4s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
.i-look { animation: look 1.5s ease-in-out infinite; }
@keyframes look { 0%, 100% { transform: translateX(-5px); } 50% { transform: translateX(7px); } }

/* extras */
.i-blush, .i-sweat, .i-zzz, .i-stars, .i-shades, .i-ice { display: none; }
.intern[data-face="happy"] .i-blush,
.intern[data-face="awkward"] .i-blush { display: block; }
.intern[data-face="awkward"] .i-sweat,
[data-react="panic"] .i-sweat { display: block; }
.i-sweat path { animation: sweat .8s ease-in infinite; }
.i-sweat path:nth-child(2) { animation-delay: .35s; }
@keyframes sweat { from { transform: translateY(-4px); opacity: 1; } to { transform: translateY(26px); opacity: 0; } }

.intern[data-face="sleep"] .i-zzz { display: block; }
.i-zzz text { animation: zzz 1.8s ease-in-out infinite; }
.i-zzz text:nth-child(2) { animation-delay: .3s; }
.i-zzz text:nth-child(3) { animation-delay: .6s; }
@keyframes zzz { 0%, 100% { opacity: .15; transform: translateY(4px); } 50% { opacity: 1; transform: translateY(-4px); } }

.intern[data-face="dizzy"] .i-stars { display: block; }
.i-stars text { animation: stars .7s ease-in-out infinite alternate; }
.i-stars text:nth-child(2) { animation-delay: -.35s; }
.i-stars text:nth-child(3) { animation-delay: -.2s; }
@keyframes stars { from { transform: translate(-12px, 3px); } to { transform: translate(12px, -3px); } }

[data-react="smug"] .i-shades { display: block; animation: shades-drop .5s .2s cubic-bezier(.3, 1.6, .5, 1) backwards; }
@keyframes shades-drop { from { transform: translateY(-110px) rotate(-20deg); opacity: 0; } }

[data-react="freeze"] .i-ice { display: block; animation: ice-in .3s ease-out; }
@keyframes ice-in { from { opacity: 0; } }

/* arms */
.i-arm { transition: transform .28s cubic-bezier(.3, 1.6, .5, 1); }
.i-arm-l { transform-origin: 50px 128px; }
.i-arm-r { transform-origin: 150px 128px; }

[data-react="celebrate"] .i-arm-l, [data-react="spin"] .i-arm-l, [data-react="fly"] .i-arm-l { transform: rotate(110deg); }
[data-react="celebrate"] .i-arm-r, [data-react="spin"] .i-arm-r, [data-react="fly"] .i-arm-r { transform: rotate(-110deg); }
[data-react="zap"] .i-arm-l, [data-react="flee"] .i-arm-l, [data-react="faceplant"] .i-arm-l { transform: rotate(72deg); }
[data-react="zap"] .i-arm-r, [data-react="flee"] .i-arm-r, [data-react="faceplant"] .i-arm-r { transform: rotate(-72deg); }
[data-react="freeze"] .i-arm-l { transform: rotate(24deg); }
[data-react="freeze"] .i-arm-r { transform: rotate(-24deg); }

[data-react="panic"] .i-arm-l { animation: flail-l .2s ease-in-out infinite alternate; }
[data-react="panic"] .i-arm-r { animation: flail-r .2s ease-in-out infinite alternate; }
@keyframes flail-l { from { transform: rotate(55deg); } to { transform: rotate(108deg); } }
@keyframes flail-r { from { transform: rotate(-108deg); } to { transform: rotate(-55deg); } }

[data-react="wave"] .i-arm-r { animation: wave .45s ease-in-out infinite alternate; }
@keyframes wave { from { transform: rotate(-92deg); } to { transform: rotate(-128deg); } }

/* reactions (body) */
[data-react="panic"] > .actor-inner { animation: r-panic .16s linear infinite; }
@keyframes r-panic { 0%, 100% { transform: translateX(-2.5%); } 50% { transform: translateX(2.5%); } }

[data-react="celebrate"] > .actor-inner { animation: r-jump .56s cubic-bezier(.3, 0, .3, 1) 3; }
.share-actor[data-react="celebrate"] > .actor-inner { animation-iteration-count: infinite; }
@keyframes r-jump {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  16% { transform: translateY(0) scale(1.14, .84); }
  50% { transform: translateY(-26%) scale(.93, 1.08); }
  84% { transform: translateY(0) scale(1.1, .9); }
}

[data-react="faceplant"] > .actor-inner { transform-origin: 50% 50%; animation: r-faceplant .7s cubic-bezier(.4, 0, .6, 1) forwards; }
@keyframes r-faceplant {
  0% { transform: rotate(0); }
  22% { transform: translateY(-8%) rotate(-14deg); }
  62% { transform: translate(6%, 2%) rotate(98deg); }
  76% { transform: translate(6%, 0) rotate(84deg); }
  100% { transform: translate(6%, 2%) rotate(90deg); }
}

[data-react="flee"] > .actor-inner { animation: r-flee .75s cubic-bezier(.5, 0, .75, .5) forwards; }
@keyframes r-flee {
  0% { transform: translateX(0); }
  30% { transform: translateX(-14%) skewX(10deg) scale(1.06, .94); }
  100% { transform: translateX(330%) skewX(-24deg); }
}

[data-react="hide"] > .actor-inner { animation: r-hide .6s cubic-bezier(.3, 0, .3, 1) forwards; }
@keyframes r-hide {
  0% { transform: translateY(0); }
  22% { transform: translateY(-7%) scale(.95, 1.06); }
  62% { transform: translateY(37%) scale(1.07, .93); }
  100% { transform: translateY(32%); }
}

[data-react="peek"] > .actor-inner { animation: r-peek 1.5s cubic-bezier(.3, 0, .3, 1) forwards; }
@keyframes r-peek {
  0% { transform: translate(0, 0); }
  18% { transform: translate(0, 42%) scale(1.06, .94); }
  30%, 58% { transform: translate(0, 40%); }
  44% { transform: translate(-22%, 40%); }
  76% { transform: translate(0, -12%) scale(.93, 1.09); }
  88% { transform: translate(0, 0) scale(1.08, .92); }
  100% { transform: translate(0, 0); }
}

[data-react="fly"] > .actor-inner { transform-origin: 50% 50%; animation: r-fly .62s cubic-bezier(.5, 0, .9, .6) forwards; }
@keyframes r-fly {
  0% { transform: translate(0, 0) rotate(0) scale(1); }
  24% { transform: translate(-10%, 6%) rotate(-12deg) scale(1.1, .9); }
  90% { opacity: 1; }
  100% { transform: translate(var(--fly-x, 80%), var(--fly-y, -40%)) rotate(520deg) scale(.06); opacity: 0; }
}

[data-react="zap"] { --skin: #5d536e; }
[data-react="zap"] > .actor-inner { animation: r-zap .1s linear 8; }
@keyframes r-zap {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-4%) rotate(-3deg); }
  75% { transform: translateX(4%) rotate(3deg); }
}

[data-react="melt"] > .actor-inner { animation: r-melt 1s cubic-bezier(.5, 0, .5, 1) forwards; }
@keyframes r-melt { to { transform: scale(1.2, .62); } }

[data-react="smug"] > .actor-inner { animation: r-smug .5s cubic-bezier(.3, 1.5, .5, 1) forwards; }
@keyframes r-smug { to { transform: rotate(-7deg); } }

[data-react="freeze"] { --skin: #a9dcff; }
[data-react="freeze"] .intern { animation: none; }
[data-react="freeze"] > .actor-inner { animation: r-shiver .09s linear infinite; }
@keyframes r-shiver { 0%, 100% { transform: translateX(-1.2%); } 50% { transform: translateX(1.2%); } }

[data-react="sick"] { --skin: #b9dd55; }
[data-react="sick"] > .actor-inner { animation: r-wobble 1.1s ease-in-out infinite; }
@keyframes r-wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

[data-react="sleep"] > .actor-inner { animation: r-sleep .8s ease forwards; }
@keyframes r-sleep { to { transform: rotate(9deg) translateY(3%); } }

[data-react="spin"] > .actor-inner { animation: r-spin 1s cubic-bezier(.4, 0, .2, 1); }
@keyframes r-spin {
  0% { transform: translateY(0) rotateY(0); }
  50% { transform: translateY(-10%) rotateY(360deg); }
  100% { transform: translateY(0) rotateY(720deg); }
}

/* ───────────────────────── short screens ───────────────────────── */
@media (max-height: 699px) {
  :root { --bottom-h: 226px; --card-h: 184px; --row-h: 34px; --prompt-h: 96px; --prompt-size: 16px; }
  .btn { padding: 10px 16px; font-size: 18px; }
  .btn-play { padding: 15px 16px; font-size: 24px; }
  .crowd-pct { font-size: 30px; }
  .card-emoji { width: 54px; height: 54px; font-size: 30px; }
  .share-actor { height: 96px; }
}
@media (max-height: 600px) {
  :root { --bottom-h: 204px; --card-h: 164px; --row-h: 30px; --prompt-h: 86px; --prompt-size: 15px; }
  .stage { min-height: 118px; }
  .card-emoji { width: 46px; height: 46px; font-size: 26px; }
  .card-label { font-size: 14px; }
  .crowd-head { min-height: 32px; }
  .crowd-pct { font-size: 26px; }
  .crowd-row { font-size: 12.5px; }
  .btn-next { padding: 8px 16px; }
  .share-actor { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
