/* ==========================================================================
   Run-A-Ton · play.css
   Portrait 9:16 game. On phones it fills the screen (100dvh, clear of the
   notch); on desktop it is a centred 9:16 frame on the brand yellow.
   ========================================================================== */

:root {
  --yellow: #FCC230;
  --red: #EF4225;
  --blue: #4080FB;
  --purple: #AD69FF;
  --pink: #F57EB4;
  --green: #22AC5F;
  --cream: #F2E3D0;
  --ink: #0C0E0F;
  --tape: #FFE23A;
  --paper: #FFF8EE;
  --font-display: "Bangers", Impact, "Arial Narrow", sans-serif;
  --font-tape: "Titan One", "Arial Black", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;          /* no pull-to-refresh */
  background: var(--yellow);
}

body {
  color: var(--ink);
  font-family: var(--font-tape);
  touch-action: none;                 /* no pinch zoom or scrolling */
  -webkit-user-select: none;
  user-select: none;                  /* no text selection */
  -webkit-touch-callout: none;        /* no long-press menu */
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #E9D3AE;
}

/* Wider than a phone in portrait: a centred 9:16 frame */
@media (min-aspect-ratio: 10/16) {
  .stage {
    width: calc(100vh * 9 / 16);
    width: calc(100dvh * 9 / 16);
  }
}
@media (min-aspect-ratio: 10/16) and (min-height: 640px) {
  .stage {
    height: calc(100dvh - 48px);
    width: calc((100dvh - 48px) * 9 / 16);
    border: 3px solid var(--ink);
    border-radius: 22px;
    box-shadow: 8px 8px 0 var(--ink);
  }
}

.game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* HUD ----------------------------------------------------------------------- */
.hud {
  position: absolute;
  top: calc(var(--safe-t) + 10px);
  left: calc(var(--safe-l) + 12px);
  right: calc(var(--safe-r) + 12px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.is-running .hud { opacity: 1; }

.hud__score-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.hud__score {
  font-family: var(--font-display);
  font-size: clamp(38px, 11.5vw, 58px);
  letter-spacing: 0.03em;
  color: var(--tape);
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.04em 0.06em 0 var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hud__mult {
  margin-top: 2px;
  padding: 2px 11px 3px;
  font-size: 15px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
}
.hud__mult.is-doubled { background: #FF8A3D; color: var(--paper); text-shadow: 1px 1px 0 var(--ink); }
.hud__mult.is-bump { animation: hud-bump 0.45s cubic-bezier(.2, 1.6, .4, 1); }

/* "+150 SQUASHED": floats up from under the multiplier */
.hud__gain {
  position: absolute;
  top: 100%;
  margin-top: 6px;
  padding: 2px 9px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--ink);
  background: var(--tape);
  border: 2px solid var(--ink);
  border-radius: 999px;
  opacity: 0;
}
.hud__gain.is-on { animation: hud-gain 1.1s ease-out; }

@keyframes hud-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes hud-gain {
  0% { opacity: 0; transform: translateY(6px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.06); }
  70% { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-12px) scale(1); }
}

.hud__left {
  position: absolute;
  top: 6px;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.hud__sparkles {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 8px;
  font-size: 17px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
}
.hud__sparkles svg { fill: #FADD02; stroke: var(--ink); stroke-width: 7; stroke-linejoin: round; overflow: visible; }

/* Active power-ups: icon and a bar for the time left */
.hud__powers {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.power {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px 3px 4px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  animation: power-in 0.35s cubic-bezier(.2, 1.6, .4, 1);
}
.power svg { display: block; overflow: visible; fill: var(--c, #FCC230); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.power svg .i-line { fill: none; }
.power svg .i-thick { stroke-width: 2.6; stroke: var(--c); }
.power svg .i-dot { fill: var(--d, #FFFFFF); }
.power svg .i-ink { fill: var(--ink); stroke: none; }
.power svg .i-win { fill: #8FD3FF; }
.power__bar {
  position: relative;
  width: 44px;
  height: 8px;
  overflow: hidden;
  background: rgba(12, 14, 15, 0.12);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.power__bar i {
  position: absolute;
  inset: 0;
  background: var(--c, #FCC230);
  transform-origin: left center;
  will-change: transform; /* the bar shrinks every frame: keep it off the main thread's paint */
}
.power.is-ending { animation: power-blink 0.3s steps(2, jump-none) infinite; }
.power[data-kind="coffee"] { --c: #EF4225; --d: #FFF8EE; }
.power[data-kind="shield"] { --c: #4080FB; --d: #FFE23A; }
.power[data-kind="magnet"] { --c: #AD69FF; }
.power[data-kind="duck"] { --c: #FFE23A; --d: #FF8A3D; }
.power[data-kind="pizza"] { --c: #FFC23D; --d: #EF4225; }
.power[data-kind="rocket"] { --c: #FFFFFF; --d: #EF4225; }
.power[data-kind="rocket"] .power__bar i { background: #EF4225; }
@keyframes power-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes power-blink { 50% { opacity: 0.35; } }

/* Tip card: the first times something new comes down the aisle */
.toast {
  position: absolute;
  top: calc(var(--safe-t) + 118px);
  left: 50%;
  width: min(80%, 290px);
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 9px 14px 10px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast[hidden] { display: none; }
.toast.is-in { animation: toast-in 0.4s cubic-bezier(.2, 1.5, .4, 1); }
.toast.is-out { animation: toast-out 0.3s ease-in forwards; }
.toast__tag {
  padding: 1px 9px 2px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink, #FFF8EE);
  background: var(--accent, #FCC230);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.toast__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0.03em;
}
.toast__hint { font-size: 13px; line-height: 1.25; }
@keyframes toast-in { from { transform: translateX(-50%) translateY(-14px) scale(0.85); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(-50%) translateY(-10px) scale(0.92); opacity: 0; } }

/* Level-up banner */
.levelup {
  position: absolute;
  top: 34%;
  left: 0;
  right: 0;
  display: grid;
  justify-items: center;
  line-height: 1;
  pointer-events: none;
}
.levelup[hidden] { display: none; }
.levelup b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 14vw, 68px);
  letter-spacing: 0.04em;
  color: var(--tape);
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.05em 0.07em 0 var(--ink);
}
.levelup span {
  margin-top: 4px;
  padding: 3px 12px;
  font-size: 15px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.levelup.is-on { animation: levelup 1.7s ease-out forwards; }
@keyframes levelup {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  14% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  24% { transform: scale(1) rotate(-1deg); }
  80% { transform: scale(1) rotate(-1deg); opacity: 1; }
  100% { transform: scale(1.05) translateY(-16px) rotate(-1deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .levelup.is-on, .toast.is-in, .toast.is-out, .hud__mult.is-bump, .power, .hud__gain.is-on { animation-duration: 0.01s; }
  .levelup.is-on { animation: none; }
  .hud__gain.is-on { animation: none; opacity: 1; }
  .power.is-ending { animation: none; opacity: 0.6; }
}

.hud__btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  fill: currentColor;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  pointer-events: auto;
  cursor: pointer;
}
.hud__btn:focus-visible,
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* Overlay card -------------------------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(12, 14, 15, 0.18);
}
.overlay[hidden] { display: none; }
.overlay[data-place="top"] { place-items: start center; padding-top: calc(var(--safe-t) + 120px); background: none; }
.overlay[data-place="bottom"] { place-items: end center; padding-bottom: calc(var(--safe-b) + 28px); background: none; }

.card {
  width: min(100%, 340px);
  padding: 22px 20px 20px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
}

.card__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 10vw, 44px);
  line-height: 1;
  letter-spacing: 0.02em;
}

.card__text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.35;
}

.card__badge {
  display: inline-block;
  margin: -6px 0 8px;
  padding: 3px 12px 4px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--tape);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-4deg);
  animation: hud-bump 0.6s cubic-bezier(.2, 1.6, .4, 1) 0.2s both;
}
.card__badge[hidden], .card__score[hidden], .card__stats[hidden], .card__text[hidden] { display: none; }

.card__score {
  margin: -2px 0 6px;
  font-family: var(--font-display);
  font-size: clamp(44px, 14vw, 60px);
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--tape);
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.04em 0.06em 0 var(--ink);
  font-variant-numeric: tabular-nums;
}

.card__stats {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 0 16px;
}
.card__stats > div {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px 5px;
  background: #F4E8D6;
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.card__stats dd { margin: 0; font-size: 17px; line-height: 1.1; }
.card__stats dt { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; }

.card__slot:empty { display: none; }
.card__slot { margin: 0 0 14px; }

.btn {
  display: inline-block;
  min-width: 160px;
  padding: 12px 22px;
  font: 18px var(--font-tape);
  color: var(--ink);
  text-decoration: none;
  background: var(--tape);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.debug {
  position: absolute;
  left: calc(var(--safe-l) + 8px);
  bottom: calc(var(--safe-b) + 8px);
  padding: 2px 6px;
  font: 600 11px ui-monospace, monospace;
  color: #fff;
  background: rgba(12, 14, 15, 0.6);
  border-radius: 4px;
  pointer-events: none;
}
.debug:empty { display: none; }

/* ==========================================================================
   Start screen
   ========================================================================== */
.title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 12px);
  pointer-events: none;           /* the scene behind stays tappable... */
  overflow: hidden;
}
.title[hidden] { display: none; }
.title > * { pointer-events: auto; } /* ...except where the start screen has something */
.title > .title__burst, .title > .title__head { pointer-events: none; }
.title.is-leaving { animation: title-out 0.35s ease-in forwards; }
.title.is-leaving > * { pointer-events: none; }

/* sunburst behind the logo, turning slowly */
.title__burst {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-t) + 170px);
  width: 840px;
  height: 840px;
  margin: -420px 0 0 -420px;
  background: center / 100% 100% no-repeat; /* the rays are drawn once into an image (menu.js) */
  will-change: transform;
  animation: burst-spin 60s linear infinite, fade-in 1.2s ease-out 1.6s both;
}

.title__top {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: drop-in 0.6s cubic-bezier(.2, 1.4, .4, 1) 1.9s both;
}
.title__event {
  width: clamp(118px, 36vw, 156px);
  height: auto;
  margin-top: 2px;
  filter: drop-shadow(2px 3px 0 rgba(12, 14, 15, 0.85));
}
.title__presents {
  margin: 0;
  font-size: clamp(11px, 3.1vw, 13px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper);
  -webkit-text-stroke: 0.22em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 var(--ink);
}

.title__head {
  position: relative;
  margin-top: 4px;
  text-align: center;
  flex: 1 1 auto;
}
.title__logo {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: 0.01em;
  transform: rotate(-5deg);
}
.title__word {
  display: inline-block;
  font-size: clamp(66px, 24vw, 122px);
  color: var(--tape);
  -webkit-text-stroke: 0.075em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.045em 0.06em 0 var(--red), 0.085em 0.11em 0 var(--ink);
  animation: word-in 0.75s cubic-bezier(.2, 1.7, .4, 1) both, word-bob 3.2s ease-in-out infinite;
  will-change: transform, translate;
}
.title__word--a { animation-delay: 1.75s, 2.6s; }
.title__word--b {
  margin: 0 -0.02em;
  font-size: clamp(34px, 11vw, 58px);
  color: var(--paper);
  text-shadow: 0.05em 0.07em 0 var(--blue), 0.09em 0.12em 0 var(--ink);
  animation-delay: 1.9s, 2.75s;
  --tilt: 10deg;
}
.title__word--c { animation-delay: 2.02s, 2.9s; }
.title__tag {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 14px 5px;
  font-size: clamp(12px, 3.6vw, 15px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 var(--red);
  animation: drop-in 0.5s cubic-bezier(.2, 1.5, .4, 1) 2.25s both;
}

.title__foot {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: rise-in 0.6s cubic-bezier(.2, 1.3, .4, 1) 2.15s both;
}
.title__best {
  margin: 0;
  padding: 3px 14px 4px;
  font-size: 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
}
.title__best[hidden] { display: none; }
.title__best b { font-family: var(--font-display); font-weight: 400; font-size: 20px; letter-spacing: 0.04em; }
.title__row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.title__when {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--paper);
  text-shadow: 0 1px 2px rgba(12, 14, 15, 0.9);
  text-align: center;
}
/* Back to the Make-A-Ton site */
.title__home {
  display: inline-block;
  padding: 6px 2px;          /* a bigger tap target than the 11px text */
  margin: -6px 0;
  color: var(--tape);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.title__home:focus-visible { outline: 2px solid var(--tape); outline-offset: 2px; border-radius: 4px; }

/* The same link beside the framed game on wide screens */
.home-pill { display: none; }
@media (min-aspect-ratio: 1/1) and (min-height: 640px) {
  .home-pill {
    position: fixed;
    top: 24px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 8px 12px;
    font-size: 15px;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 999px;
    box-shadow: 4px 4px 0 var(--ink);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
  }
  .home-pill svg { fill: currentColor; flex: none; }
  .home-pill:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
  .home-pill:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
  .home-pill:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
}

.btn--play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: min(80vw, 300px);
  padding: 8px 30px 10px 22px;
  font: 400 clamp(42px, 13vw, 56px)/1 var(--font-display);
  letter-spacing: 0.07em;
  color: var(--ink);
  background: var(--tape);
  border: 4px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 7px 0 var(--ink), 0 14px 26px rgba(12, 14, 15, 0.35);
  overflow: hidden;
  animation: play-pulse 1.5s ease-in-out infinite;
  will-change: scale;
}
.btn--play svg { fill: var(--red); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; overflow: visible; }
.btn--play::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.8) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: shine 3s ease-in-out 2.8s infinite;
  pointer-events: none;
  will-change: transform;
}
.btn--play:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); animation: none; }

.btn--ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 14px;
  font-size: 15px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}
.btn--ghost svg { fill: currentColor; flex: none; }
.btn--sm { padding: 6px 11px; font-size: 13px; }

/* Mascot icons: cells of one sprite (assets/play/avatars.webp, 6 x 2) */
.avatar {
  --s: 40px;
  --col: 0;
  --row: 0;
  flex: none;
  display: inline-block;
  width: var(--s);
  height: var(--s);
  background: #FFF0C2 url(../assets/play/avatars.webp) no-repeat;
  background-size: calc(var(--s) * 6) calc(var(--s) * 2);
  background-position: calc(var(--col) * var(--s) * -1) calc(var(--row) * var(--s) * -1);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.avatar--empty { position: relative; background: #E9DFCF; }
.avatar--empty::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 calc(var(--s) * 0.66)/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

/* Short messages (email confirmed, signed in...) */
.notice {
  position: absolute;
  top: calc(var(--safe-t) + 64px);
  left: 50%;
  max-width: min(88%, 320px);
  padding: 8px 14px;
  font-size: 14px;
  text-align: center;
  background: var(--tape);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: translateX(-50%);
  z-index: 40;
  animation: toast-in 0.4s cubic-bezier(.2, 1.5, .4, 1);
}
.notice[hidden] { display: none; }

/* ==========================================================================
   Panels: leaderboard, profile, how to play
   ========================================================================== */
.sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 8px);
  background: rgba(12, 14, 15, 0.5);
  z-index: 30;
  animation: fade-in 0.2s ease-out;
}
.sheet[hidden] { display: none; }
.sheet__card {
  position: relative;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 18px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink);
  -webkit-user-select: text;
  user-select: text;
  animation: sheet-in 0.34s cubic-bezier(.2, 1.25, .4, 1);
}
.sheet__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.sheet__close svg { fill: currentColor; }
.sheet__title {
  margin: 2px 48px 12px 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.03em;
}
.sheet__body { font-size: 14px; line-height: 1.35; }
.sheet__body h3 { margin: 16px 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: 0.03em; }
.sheet__body p { margin: 0 0 10px; }
.sheet .muted { opacity: 0.72; font-size: 13px; }
.sheet .msg { margin: 10px 0 0; padding: 8px 10px; font-size: 13px; background: #FFE9A8; border: 2px solid var(--ink); border-radius: 10px; }
.sheet .msg--bad { background: #FFD3C9; }
.sheet .msg--good { background: #CFF3D9; }
.sheet .msg:empty { display: none; }

/* leaderboard */
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb__row {
  display: grid;
  grid-template-columns: 34px 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.lb__row.is-me { background: #FFF1B8; box-shadow: 3px 3px 0 var(--ink); }
.lb__rank {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font: 400 18px/1 var(--font-display);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.lb__rank--1 { background: #FFD84A; }
.lb__rank--2 { background: #D9DEE6; }
.lb__rank--3 { background: #E7A86A; }
.lb__name { min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb__score { font: 400 20px/1 var(--font-display); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.lb__me { margin: 10px 0 0; padding: 8px 10px; text-align: center; background: #FFF1B8; border: 2px solid var(--ink); border-radius: 12px; }
.lb__empty { padding: 18px 8px; text-align: center; }
.lb__skeleton { height: 48px; border-radius: 14px; background: linear-gradient(90deg, #efe6d6 25%, #f7f0e4 50%, #efe6d6 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* forms */
.tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 14px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.tabs button { padding: 8px 6px; font: 15px var(--font-tape); color: var(--ink); background: var(--paper); border: 0; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--tape); }
.tabs button + button { border-left: 3px solid var(--ink); }
.form { display: grid; gap: 10px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 13px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  font: 16px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* 16px: phones don't zoom in */
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
.field input:focus { outline: 3px solid var(--blue); outline-offset: 1px; }
.field small { font-size: 12px; opacity: 0.75; }
.form .btn { justify-self: stretch; min-width: 0; }
.form .btn[disabled] { opacity: 0.6; cursor: default; }
.linkish { padding: 0; font: inherit; font-size: 13px; color: var(--ink); text-decoration: underline; background: none; border: 0; cursor: pointer; justify-self: center; }

/* "Continue with Google" over the email form, split off by an "or with email" rule */
.oauth { display: grid; gap: 12px; margin: 0 0 12px; }
.btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  font-size: 17px;
  background: #fff;
}
.btn--google svg { flex: none; }
.btn--google[disabled] { opacity: 0.6; cursor: default; }
.oauth__or { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 13px; opacity: 0.72; }
.oauth__or::before,
.oauth__or::after { content: ""; flex: 1; border-top: 2px dashed currentColor; }
.sheet .msg.oauth-note { margin: 0 0 12px; }

.picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.picker button {
  display: grid;
  place-items: center;
  padding: 3px;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.picker .avatar { --s: 44px; transition: transform 0.15s; }
.picker button[aria-checked="true"] .avatar { box-shadow: 0 0 0 3px var(--tape), 0 0 0 5px var(--ink); transform: scale(1.08); }
.picker button:focus-visible { outline: 3px solid var(--blue); }

.me-card { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; }
.me-card .avatar { --s: 64px; border-width: 3px; }
.me-card b { display: block; font: 400 26px/1 var(--font-display); letter-spacing: 0.03em; }

/* how to play */
.howto-moves { display: grid; gap: 8px; margin: 0 0 4px; }
.howto-move { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.howto-move svg { width: 44px; height: 44px; }
.cast-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cast-item { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; padding: 6px 8px 6px 4px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.cast-item b { display: block; font-weight: 400; font-size: 13px; line-height: 1.15; }
.cast-item small { display: block; font-size: 11px; line-height: 1.2; opacity: 0.75; }
.cast {
  width: 52px;
  height: 52px;
  background: url(../assets/play/cast.webp) no-repeat;
  background-size: 312px 156px;
}

/* the online part of the game-over card */
.card__slot .result { margin: 14px 0 0; padding: 10px 8px 2px; border-top: 2px dashed rgba(12, 14, 15, 0.3); }
.result__line { margin: 0 0 8px; font-size: 14px; }
.result__line b { font-family: var(--font-display); font-weight: 400; font-size: 20px; letter-spacing: 0.04em; }
.result__row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

@keyframes burst-spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes title-out { to { opacity: 0; transform: scale(1.06); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-40px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
@keyframes word-in {
  0% { opacity: 0; transform: translateY(-120%) scale(1.6) rotate(var(--tilt, 0deg)); }
  60% { opacity: 1; transform: translateY(6%) scale(0.95) rotate(var(--tilt, 0deg)); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--tilt, 0deg)); }
}
@keyframes word-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -4px; }
}
@keyframes play-pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.045; }
}
@keyframes shine {
  0% { transform: translateX(-130%); }
  35%, 100% { transform: translateX(130%); }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .title__burst, .title__word, .btn--play, .btn--play::after { animation: none !important; }
  .title__top, .title__foot, .title__tag, .sheet__card, .notice { animation-duration: 0.01s !important; animation-delay: 0s !important; }
}
