:root {
  --ink: #141414;
  --gold: #ffc400;
  --orange: #f04800;
  --ribbon: #f06000;
  --violet: #e070f0;
  --green: #7cff14;
  --dash: #ffe14a;
  color: var(--ink);
  font-family: Nunito, "Avenir Next", "Segoe UI", sans-serif;
  /* Titles: Adobe Fonts' Neighbor (kit vrr2pti), Black. */
  --title: "neighbor", "Lilita One", sans-serif;
  background: #3a3a3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #3a3a3a;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

#stage {
  width: min(100%, 480px);
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 30%, #f3f0ea 0%, #d7d2c8 55%, #c4beb2 100%);
  color: var(--ink);
}

@media (min-width: 840px) {
  #stage {
    height: min(100dvh - 24px, 920px);
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }
}

#stage::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 26px;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 6;
}

#wash, #mirror {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#wash { opacity: 0; }
/* Not mirrored: the hand pictures are drawn as someone facing you sees a sign, so the camera shows you the same way. */
#mirror { opacity: 0; }
#cam {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#stage.live[data-phase="attract"] #wash,
#stage.live[data-phase="summary"] #wash { opacity: 1; }
#stage.live[data-phase="play"] #mirror { opacity: 1; }

.frost {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.78) 0%,
    rgba(255, 255, 255, 0.35) 18%,
    rgba(255, 255, 255, 0) 40%
  );
}

#stage.pop .frost {
  background: linear-gradient(
    to bottom,
    rgba(255, 214, 70, 0.82) 0%,
    rgba(255, 196, 40, 0.48) 46%,
    rgba(255, 186, 20, 0.28) 100%
  );
}

/* Halftone dots fading up from the bottom, like the design's home and summary screens. */
.dots {
  position: absolute;
  inset: 52% 0 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 3.2px, transparent 3.6px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 75%);
  mask-image: linear-gradient(to bottom, transparent, #000 75%);
  opacity: 0;
  transition: opacity 300ms;
}
#stage[data-phase="attract"] .dots,
#stage[data-phase="summary"] .dots,
#stage.win .dots { opacity: 1; }
#stage[data-phase="attract"] .frost {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 30%),
    linear-gradient(to top, rgba(255, 190, 60, 0.5), rgba(255, 190, 60, 0) 30%);
}

/* Success: the camera stays visible; green rises from the bottom and the card's border glows. */
#stage.win .frost {
  background: linear-gradient(to bottom, rgba(124, 255, 20, 0) 50%, rgba(124, 255, 20, 0.5) 78%, rgba(124, 255, 20, 0.92) 100%);
  animation: wash 300ms ease-out;
}
#stage.win::after { border-color: #efffe0; box-shadow: 0 0 16px 2px var(--green), inset 0 0 16px 2px var(--green); transition: box-shadow 200ms; }
@keyframes wash { from { opacity: 0; } to { opacity: 1; } }

#hud, #frame, #panel, #pop, #fx { position: absolute; z-index: 3; }

#hud {
  top: calc(18px + env(safe-area-inset-top));
  left: 22px;
  right: 22px;
}

.logo {
  margin: 6px 0 0;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(34px, 6vh, 48px);
  letter-spacing: -0.04em;
  color: var(--ink);
  animation: rise 500ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

/* Every new thing comes in through an animation. */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes scalein { 0% { transform: scale(0); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes drop { 0% { opacity: 0; transform: translateY(-26px); } 60% { opacity: 1; transform: translateY(5px); } 100% { transform: none; } }

/* Leaderboard, home: striped pills stepping down in width, each a little tilted. */
.board { list-style: none; margin: 0; padding: 0; }
.board.home {
  margin: 18px auto 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(100%, 330px);
}
.board.home li {
  --c: var(--gold);
  display: flex;
  align-items: center;
  gap: 18px;
  width: calc(100% - var(--i, 0) * 24px);
  min-height: 56px;
  padding: 6px 22px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background:
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.22) 0 7px, transparent 7px 16px),
    var(--c);
  box-shadow: 0 6px 0 var(--ink);
  transform: rotate(-1.5deg) translateX(calc(var(--i, 0) * 6px));
  animation: rise 500ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(150ms + var(--i, 0) * 120ms);
  animation-fill-mode: backwards;
}
.board.home li:nth-child(2) { --c: var(--orange); transform: rotate(1deg) translateX(10px); min-height: 50px; }
.board.home li:nth-child(3) { --c: var(--violet); transform: rotate(-1deg); min-height: 44px; }
.board.home li.empty { justify-content: center; font-weight: 900; font-size: 18px; }
.board .rank, .board .who {
  font-family: var(--title);
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  letter-spacing: 0.01em;
}
.board.home .rank { font-size: 30px; }
.board.home .who { font-size: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board.home li:nth-child(2) .rank, .board.home li:nth-child(2) .who { font-size: 24px; }
.board.home li:nth-child(3) .rank, .board.home li:nth-child(3) .who { font-size: 21px; }

/* Leaderboard, summary: colored outlined text, no pills. */
.board.list { display: grid; justify-items: center; gap: 2px; margin: 10px 0 0; }
.board.list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  animation: rise 450ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  animation-delay: calc(900ms + var(--i, 0) * 120ms);
}
.board.list .rank, .board.list .who { font-size: 30px; -webkit-text-stroke: 4px var(--ink); }
.board.list li:nth-child(1) .rank, .board.list li:nth-child(1) .who { color: var(--violet); }
.board.list li:nth-child(2) .rank, .board.list li:nth-child(2) .who { color: var(--orange); }
.board.list li:nth-child(3) .rank, .board.list li:nth-child(3) .who { color: var(--green); }
.board.list li:nth-child(4) { margin-top: 6px; }
.board.list li:nth-child(4) .rank, .board.list li:nth-child(4) .who { color: #fff; font-size: 26px; }
.board.list li.you { animation: rise 450ms backwards, you 900ms 1.2s ease-in-out 3; }
.board.list li.empty { font-weight: 900; }
@keyframes you { 50% { transform: scale(1.12); } }

/* Score sits top-left in play, and bumps when the flying +points lands. */
.score {
  /* Only as wide as its text, so the flying +points can aim at the number's end. */
  width: fit-content;
  margin: 8px 0 0;
  text-align: left;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(36px, 6vh, 52px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 2px 3px 0 var(--ink);
  letter-spacing: 0.01em;
  transform-origin: left center;
}
/* As +points flies in the score leans in for it, then gulps it down. */
.score.hungry { transform: scale(1.1); transition: transform 300ms cubic-bezier(0.3, 1.4, 0.5, 1); }
.score.gulp { animation: gulp 460ms cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes gulp {
  0% { transform: scale(1.1); }
  25% { transform: scale(1.32, 0.78); }
  55% { transform: scale(0.9, 1.14); }
  80% { transform: scale(1.06, 0.96); }
  100% { transform: none; }
}

#frame {
  left: 50%;
  width: min(86%, 390px);
  transform: translateX(-50%);
  pointer-events: none;
}

#stage[data-phase="attract"] #frame { top: 47%; height: 30%; }
#stage[data-phase="play"] #frame { top: 21%; height: 40%; }
#stage[data-phase="summary"] #frame,
#stage[data-phase="summary"] #hud,
#stage[data-phase="summary"] #pop,
#stage[data-phase="summary"] #fx { display: none; }

#ghost {
  position: absolute;
  inset: 2% 6% 4%;
  display: grid;
  place-items: center;
}

/* The hand: white picture, colored edge, and a dashed outline that keeps marching. */
.sign { display: block; width: min(86%, 270px); height: auto; overflow: visible; }
.sign.enter { animation: scalein 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.sign .pic {
  --edge: var(--dash);
  filter: invert(1) drop-shadow(1.2px 0 0 var(--edge)) drop-shadow(-1.2px 0 0 var(--edge)) drop-shadow(0 1.2px 0 var(--edge)) drop-shadow(0 -1.2px 0 var(--edge));
}
.sign .dash {
  fill: none;
  stroke: var(--dash);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 4.5;
  animation: march 900ms linear infinite;
}
@keyframes march { to { stroke-dashoffset: -19; } }
.sign.almost .pic { --edge: var(--orange); }
.sign.almost .dash { stroke: var(--orange); }
.sign.ok .pic { filter: url(#edge); }
.sign.ok .dash { display: none; }
#stage.win .sign.ok { animation: scalein 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.br {
  position: absolute;
  width: 28%;
  height: 22%;
  border: 7px solid #fff;
  border-radius: 18px;
}

/* Corners show what the camera sees: hand found, sign right, sign close. */
#frame .br { transition: border-color 120ms; }
#frame[data-mode="hot"] .br { border-color: var(--dash); }
#frame[data-mode="ok"] .br { border-color: var(--green); }
#frame[data-mode="almost"] .br { border-color: var(--orange); }
#stage.win #frame .br { opacity: 0; transition: opacity 150ms; }

.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.rb { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* Success effects layer: swooshes draw themselves in then slither off, confetti flies out of the hand. */
#fx { inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.swoosh { position: absolute; left: 0; top: 14%; width: 100%; height: 58%; }
.swoosh path, .swoosh circle {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  filter: drop-shadow(0 0 4px rgba(124, 255, 20, 0.7));
  animation: slither 1250ms cubic-bezier(0.4, 0.1, 0.3, 1) forwards;
}
.swoosh .dot { fill: var(--green); stroke: none; animation: twinkle 900ms 200ms both; transform-box: fill-box; transform-origin: center; }
.swoosh :nth-child(3n) { animation-delay: 80ms; }
.swoosh :nth-child(3n + 1) { animation-delay: 160ms; }
/* The head draws the line in, then the tail chases it off: the stroke slides away like a snake. */
@keyframes slither { 0% { stroke-dashoffset: 400; } 45% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -400; } }
@keyframes twinkle { 0% { transform: scale(0); } 30% { transform: scale(1.4); } 60% { transform: scale(0.9); } 100% { transform: scale(0); } }

/* Confetti: each bit bursts out fast, then tumbles and drifts down as it fades. */
.confetti { position: absolute; left: 50%; top: 40%; width: 0; height: 0; perspective: 400px; }
.confetti i {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 16px;
  background: var(--c);
  border-radius: 2px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--c) 70%, transparent);
  opacity: 0;
  animation: confetti var(--t) var(--d) cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
.confetti .dot { width: 11px; height: 11px; border-radius: 50%; }
.confetti .star { width: 18px; height: 18px; border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); box-shadow: none; filter: drop-shadow(0 0 4px var(--c)); }
.confetti .squiggle { width: 22px; height: 8px; background: none; border: 3px solid var(--c); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: none; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.2) rotate(0deg); }
  30% { opacity: 1; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(calc(var(--r) * 0.35)) rotateX(180deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx) * 1.25), calc(-50% + var(--dy) + 170px)) scale(0.8) rotate(var(--r)) rotateX(900deg); }
}
/* The letter (or word) just signed, big and glowing under the hand. */
.bigsign {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  margin: 0;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(80px, 13vh, 120px);
  line-height: 1;
  color: var(--green);
  -webkit-text-stroke: 3px #3fae00;
  paint-order: stroke fill;
  filter: drop-shadow(0 0 10px var(--green)) drop-shadow(0 0 3px #fff);
  animation: scalein 420ms 120ms cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}
.bigsign.word { font-size: clamp(54px, 9vh, 80px); letter-spacing: 0.06em; }

/* +points: pops above the hand, then flies into the score's number. */
#pop {
  top: 17%;
  left: 50%;
  margin: 0;
  white-space: nowrap;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(44px, 7vh, 62px);
  color: #fff;
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink), 0 0 18px var(--green);
  transform: translateX(-50%) rotate(-8deg);
  z-index: 5;
  animation: popin 420ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
/* The pop-in animation has to let go of transform so the flight (a Web Animation) can take over. */
#pop.fly { animation: none; }
#pop[hidden] { display: none; }
@keyframes popin { from { transform: translateX(-50%) rotate(-8deg) scale(0); } to { transform: translateX(-50%) rotate(-8deg) scale(1); } }

#panel {
  left: 18px;
  right: 18px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

#stage[data-phase="summary"] #panel {
  top: 0;
  left: 0;
  right: 0;
  padding: 0 18px 18px;
  overflow: auto;
  align-content: start;
  gap: 4px;
}

/* Letter platforms for the current word: blanks until signed, dropping in 400 ms apart. */
.platforms {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 10px;
  min-height: 62px;
}
.slot { display: grid; justify-items: center; gap: 4px; width: 54px; }
.slot.fresh { animation: drop 520ms cubic-bezier(0.2, 1.5, 0.4, 1) backwards; animation-delay: calc(var(--i) * 400ms); }
.slot b {
  font-family: var(--title);
  font-weight: 900;
  font-size: 44px;
  line-height: 1;
  min-height: 44px;
  color: var(--dash);
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}
.slot.in b { animation: scalein 360ms cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.slot i { display: block; width: 100%; height: 9px; border-radius: 6px; background: var(--ink); }
.slot.now i { background: var(--dash); box-shadow: 0 0 0 3px var(--ink); }

.wordcall {
  margin: 2.5vh 0 0;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(30px, 5.4vh, 46px);
  line-height: 1.05;
  color: #fff;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  animation: rise 500ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.wordbig {
  margin: 0;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(56px, 10vh, 80px);
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--dash);
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  animation: scalein 460ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.meterwrap { display: grid; gap: 8px; }

.meter {
  height: 28px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: repeating-linear-gradient(-55deg, #fff 0 8px, #ececec 8px 16px);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--dash);
  border-radius: 14px;
  transition: width 400ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

/* Under the bar, bottom right. */
.mult {
  justify-self: end;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--ink);
  padding: 4px 14px;
  font-weight: 900;
  font-size: 18px;
}

.mult.on {
  background: #fff7c2;
  box-shadow: 0 5px 0 var(--ink), 0 0 22px 6px var(--dash);
  animation: scalein 400ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

.coach {
  margin: 0 auto;
  max-width: 330px;
  background: #fff;
  border-radius: 20px;
  padding: 14px 18px;
  text-align: center;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.25;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  animation: rise 360ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.coach em { color: var(--orange); font-style: normal; }

/* Bottom row in play: publish what you have, and a peek at the next word. */
.foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; }
.pubnow {
  border: 3px solid var(--ink);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 0 var(--ink);
  font-weight: 900;
  font-size: 15px;
  padding: 8px 14px;
  animation: rise 400ms backwards;
}
.pubnow span { color: #9a9a9a; }
.nextword {
  margin: 0 -18px 0 0;
  background: #fff;
  border: 3px solid var(--ink);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 5px 0 #6b5cff;
  padding: 7px 16px;
  font-size: 18px;
  font-weight: 800;
  color: #9a9a9a;
  animation: rise 400ms 120ms backwards;
}
.nextword b { color: #6b5cff; font-weight: 900; }

/* Success banner: slides in, and its torn edges flicker fast so it feels like action. */
.banner {
  margin: 0 -18px -16px;
  background: var(--green);
  padding: 22px 26px 30px;
  text-align: center;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0 3px, transparent 3.5px);
  background-size: 18px 18px;
  animation: slidein 320ms cubic-bezier(0.2, 1.2, 0.4, 1) backwards, torn 140ms steps(1) infinite;
}
@keyframes slidein { from { transform: translateX(-110%) skewX(-12deg); } to { transform: none; } }
@keyframes torn {
  0% { clip-path: polygon(0 10%, 6% 2%, 12% 9%, 20% 1%, 27% 8%, 35% 0, 43% 9%, 51% 2%, 59% 8%, 67% 0, 75% 9%, 83% 1%, 91% 8%, 100% 3%, 100% 100%, 0 100%); }
  50% { clip-path: polygon(0 4%, 7% 10%, 14% 2%, 21% 9%, 29% 1%, 37% 8%, 45% 0, 53% 9%, 61% 1%, 69% 8%, 77% 0, 85% 9%, 93% 2%, 100% 8%, 100% 100%, 0 100%); }
}

.banner p {
  margin: 0 0 10px;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(46px, 8vh, 64px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 5px #2b7a00;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #2b7a00;
}

.bannerbar {
  height: 24px;
  margin: 0 10px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: repeating-linear-gradient(-55deg, #fff 0 8px, #ececec 8px 16px);
  overflow: hidden;
}
.bannerbar span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 20px; animation: fill 1500ms linear forwards; }
@keyframes fill { to { width: 100%; } }

/* Ribbon button, Frame 34: a tilted striped band with a notched right end, a light bevel on top,
   a hard black shadow, pinstripes with diamonds, and a thick colored outline on the label.
   On the home page its three variants (Match up! / Learn ASL! / Hand-writing!) take turns. */
.match {
  position: relative;
  display: grid;
  /* As in Frame 34: the left end runs off the screen, the notched right end stays in view. */
  width: calc(100% + 44px);
  margin: 0 0 18px -54px;
  border: 0;
  padding: 0;
  background: none;
  transform-origin: 50% 60%;
  animation: rise 500ms backwards;
}
.face {
  grid-area: 1 / 1;
  display: grid;
  filter: drop-shadow(0 8px 0 var(--ink));
  transform: rotate(-4deg);
}
.face .body {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(100px, 14vh, 128px);
  /* Centre the label on the part of the band that's on screen. */
  padding: 0 8% 0 60px;
  background:
    linear-gradient(90deg, transparent 15%, var(--c2) 72%),
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.2) 0 20px, transparent 20px 46px) 0 0 / 200% 100%,
    linear-gradient(90deg, var(--c1), var(--c2));
  box-shadow: inset 0 6px 0 var(--bevel), inset 0 -6px 0 var(--deep);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%);
}
.face .body::before, .face .body::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 9%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fff 12%, #fff 88%, transparent);
}
.face .body::before { top: 19%; }
.face .body::after { bottom: 19%; }
.gem { position: absolute; left: calc(50% + 24px); width: 15px; height: 15px; background: #fff; transform: translateX(-50%) rotate(45deg); z-index: 1; }
.gem.top { top: calc(19% - 6px); }
.gem.bottom { bottom: calc(19% - 6px); }
.face .label {
  color: #fff;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(40px, 7vh, 58px);
  line-height: 1;
  white-space: nowrap;
  -webkit-text-stroke: 9px var(--line);
  paint-order: stroke fill;
}
.face.yellow .label { font-size: clamp(34px, 6vh, 48px); }
.face.orange { --c1: #f59a31; --c2: #ec6223; --bevel: #fbb46c; --deep: #c94d16; --line: #e5541a; }
.face.violet { --c1: #ec9ff0; --c2: #d878df; --bevel: #f6c9f8; --deep: #a94cb3; --line: #b552c4; }
.face.yellow { --c1: #ffe56b; --c2: #f8c51c; --bevel: #fff3a8; --deep: #c99300; --line: #e39a0c; }
/* Timer between variants, as in the prototype: each band scoots in from the left, holds ~1.2 s,
   then scoots out to the right as the next one comes in behind it. */
.match.cycle .face { transform: rotate(-4deg) translateX(-120%); animation: variant 4.8s calc(var(--n) * 1.6s) infinite backwards; }
@keyframes variant {
  0% { transform: rotate(-4deg) translateX(-120%); animation-timing-function: cubic-bezier(0.2, 1, 0.3, 1); }
  8%, 30% { transform: rotate(-4deg) translateX(0); animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.4); }
  36%, 100% { transform: rotate(-4deg) translateX(120%); }
}
  39%, 100% { opacity: 0; }
}

.hold {
  border: 3px solid var(--ink);
  background: #fff;
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 800;
  font-size: 16px;
  padding: 12px 14px;
}

.hint {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
  padding: 6px 8px;
}

/* Summary */
.sumribbon {
  position: relative;
  margin: 0 -40px 6px;
  padding: 34px 40px 30px;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(36px, 6.4vh, 52px);
  line-height: 1;
  color: #fff;
  background:
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.18) 0 18px, transparent 18px 40px),
    linear-gradient(to bottom, #ffe34a, var(--gold));
  transform: rotate(-5deg) translateY(-6px);
  filter: drop-shadow(0 7px 0 var(--ink));
  animation: slidein 420ms cubic-bezier(0.2, 1.2, 0.4, 1) backwards;
}
.sumribbon span { display: block; -webkit-text-stroke: 3px #b37400; paint-order: stroke fill; text-shadow: 0 4px 0 #b37400; }
.sumribbon::before, .sumribbon::after { content: ""; position: absolute; left: 6%; right: 6%; height: 2px; background: rgba(255, 255, 255, 0.95); }
.sumribbon::before { top: 16%; }
.sumribbon::after { bottom: 14%; }

/* Points badge: striped gold pill, total on top, what made it underneath. */
.sumbadge {
  justify-self: center;
  width: min(100%, 330px);
  margin: 18px 0 6px;
  padding: 10px 16px 12px;
  text-align: center;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background:
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.25) 0 14px, transparent 14px 30px),
    linear-gradient(to bottom, #ffe34a, #ffb000);
  box-shadow: 0 6px 0 var(--ink);
  animation: rise 450ms 300ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}
.sumbadge .pts {
  margin: 0;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(34px, 6vh, 46px);
  line-height: 1.05;
  color: #fff;
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
}
.sumbadge .parts { margin: 4px 0 0; display: flex; justify-content: center; gap: 10px; font-weight: 800; font-size: 16px; }
.sumbadge .parts b { font-weight: 900; }

/* The quote, big, and who said it on a tilted tag hanging off the left edge. */
.sumquote {
  margin: 22px 0 6px;
  text-align: center;
  font-family: var(--title);
  font-weight: 900;
  font-size: clamp(34px, 6vh, 46px);
  line-height: 1.1;
  color: #fff;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  animation: rise 450ms 450ms cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}
.sumby {
  justify-self: start;
  margin: 6px 0 18px -18px;
  padding: 6px 16px 6px 40px;
  background: #fff;
  border: 3px solid var(--ink);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: 0 5px 0 var(--ink);
  font-weight: 800;
  font-size: 16px;
  transform: rotate(-3deg);
  animation: slidein 420ms 650ms cubic-bezier(0.2, 1.2, 0.4, 1) backwards;
}

.nameform { display: grid; gap: 10px; animation: rise 400ms 850ms backwards; }
.name {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  text-align: center;
  font: 800 30px Nunito, sans-serif;
  color: var(--ink);
}
.name::placeholder { color: #a6a6a6; }
.name:focus { outline: 4px solid var(--dash); }
.publish {
  justify-self: center;
  border: 4px solid var(--ink);
  background: var(--green);
  border-radius: 18px;
  box-shadow: 0 6px 0 #2a4fd0;
  padding: 10px 34px 12px;
  font-family: var(--title);
  font-weight: 900;
  font-size: 34px;
  color: #fff;
  -webkit-text-stroke: 3px #2b7a00;
  paint-order: stroke fill;
}
#stage[data-phase="summary"] .match { margin-top: 10px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* After a screen's first appearance, rebuilds of it don't replay the intro animations. */
#stage:not(.fresh) .logo,
#stage:not(.fresh) .board li,
#stage:not(.fresh) .sumribbon,
#stage:not(.fresh) .sumbadge,
#stage:not(.fresh) .sumquote,
#stage:not(.fresh) .sumby,
#stage:not(.fresh) .nameform { animation: none; }
#stage:not(.fresh) .match { animation: none; }

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