@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("assets/fonts/fredoka-500-700-latin.woff2?v=99bce245e996") format("woff2");
}

:root {
  --ink: #183547;
  --cream: #fff7dd;
  --pink: #ef4f8b;
  --pink-dark: #a9265d;
  --aqua: #28c8df;
  --blue: #167caa;
  --sand: #f4cc78;
  --panel: rgba(255, 250, 230, 0.9);
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img, video, canvas {
  -webkit-user-drag: none;
  user-drag: none;
}

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Fredoka", "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 14% 12%, #fff29a 0 46px, #ffd95c 47px 70px, transparent 72px),
    linear-gradient(160deg, #8ceaff 0%, #28bddd 50%, #067da5 100%);
  overflow: hidden;
}

button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.arcade {
  position: relative;
  width: 100%;
  height: 100%;
}

.game-loader {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  color: #17425a;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.42), transparent 30%),
    linear-gradient(180deg, #75bdf0 0%, #61afea 56%, #f4d28d 100%);
  transition: opacity 320ms ease, visibility 320ms ease;
}

.game-loader.is-ready {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: grid;
  justify-items: center;
  width: min(260px, 82vw);
  padding: 28px 26px 24px;
  border: 3px solid rgba(255,255,255,.88);
  border-radius: 26px;
  background: rgba(255, 248, 222, .9);
  box-shadow: 0 14px 0 rgba(33, 113, 140, .16), 0 24px 48px rgba(19, 83, 112, .18);
}

.loader-bone {
  display: block;
  width: 132px;
  margin: 2px 0 17px;
  filter: drop-shadow(0 5px 3px rgba(111, 72, 29, .18));
  animation: loader-hop 900ms ease-in-out infinite alternate;
  will-change: transform;
}

.loader-bone img {
  display: block;
  width: 100%;
  height: auto;
}

.loader-copy {
  margin: 0 0 13px;
  color: var(--pink-dark);
  font-size: .78rem;
  font-weight: 1000;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.loader-track {
  width: 100%;
  height: 11px;
  overflow: hidden;
  border: 2px solid #b78346;
  border-radius: 999px;
  background: #ead7a8;
}

.loader-progress {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4f8b, #ff83ac);
  transform: scaleX(.04);
  transform-origin: left center;
  transition: transform 180ms ease;
}

@keyframes loader-hop {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-9px) rotate(3deg); }
}

.asset-picture { display: contents; }

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  padding: 0;
  background: linear-gradient(180deg, #73cdec 0%, #64c7e7 48%, #f0cf91 72%, #d7a45e 100%);
  transition: opacity 420ms ease, visibility 420ms ease, transform 420ms cubic-bezier(.2,.8,.2,1);
}

.start-background-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  object-position: center;
  transform: scale(.94);
  transform-origin: center;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 4.5%, #000 93%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 4.5%, #000 93%, transparent 100%);
  transition:
    top 680ms cubic-bezier(.2, .78, .22, 1),
    bottom 680ms cubic-bezier(.2, .78, .22, 1),
    height 680ms cubic-bezier(.2, .78, .22, 1),
    transform 680ms cubic-bezier(.2, .78, .22, 1),
    object-position 680ms cubic-bezier(.2, .78, .22, 1);
  will-change: top, bottom, height, transform;
  pointer-events: none;
}

.start-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.025);
}


.start-screen::before,
.start-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.start-screen::before {
  background: linear-gradient(
    180deg,
    rgba(115, 205, 236, .98) 0%,
    rgba(115, 205, 236, .42) 7%,
    transparent 15%,
    transparent 80%,
    rgba(231, 191, 124, .34) 90%,
    rgba(215, 164, 94, .96) 100%
  );
  transition: opacity 440ms ease;
}
.start-screen::after {
  background: linear-gradient(110deg, rgba(255, 237, 188, .07), transparent 48%);
}

.start-scene {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  padding:
    max(20px, env(safe-area-inset-top))
    max(26px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(26px, env(safe-area-inset-left));
  opacity: 1;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.start-screen.video-playing .start-scene {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-skip-stage {
  display: none;
}

.intro-subtitle {
  display: none;
}

.start-logo-art {
  position: absolute;
  left: 50%;
  top: 22%;
  display: block;
  width: min(58vw, 760px);
  max-width: calc(100% - 36px);
  max-height: 38vh;
  object-fit: contain;
  translate: -50% -50%;
  filter: drop-shadow(0 13px 14px rgba(72, 42, 26, .2));
  animation: logo-arrive 700ms cubic-bezier(.2,.9,.25,1.15) both;
}

.start-stage {
  position: absolute;
  left: 50%;
  bottom: max(clamp(34px, 7vh, 76px), env(safe-area-inset-bottom));
  width: auto;
  max-width: calc(100% - 36px);
  display: flex;
  align-items: center;
  justify-content: center;
  translate: -50% 0;
  animation: ruby-arrive 680ms 100ms cubic-bezier(.2,.9,.25,1.12) both;
}

.start-button-art {
  min-width: 238px;
  padding: 14px 38px 15px;
  border: 5px solid #a9215b;
  border-radius: 28px;
  color: #fff7e7;
  background: linear-gradient(180deg, #ff72aa 0%, #ed4387 56%, #d52c70 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, .34),
    inset 0 -5px 0 rgba(151, 22, 79, .25),
    0 7px 0 #8f1e50,
    0 12px 22px rgba(82, 44, 34, .22);
  font-size: clamp(1.7rem, 2.8vw, 2.45rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: .035em;
  text-shadow: 0 2px 0 rgba(136, 31, 74, .34);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.start-button-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

.start-button-rays {
  position: absolute;
  top: 50%;
  width: 58px;
  height: 58px;
  transform: translateY(-50%);
  pointer-events: none;
}
.start-button-rays-left { right: calc(100% + 5px); }
.start-button-rays-right {
  left: calc(100% + 5px);
  transform: translateY(-50%) scaleX(-1);
}
.start-button-rays i {
  position: absolute;
  right: 0;
  width: 31px;
  height: 8px;
  border: 2px solid #a9215b;
  border-radius: 999px;
  background: #f65394;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35);
}
.start-button-rays i:nth-child(1) {
  top: 4px;
  transform: rotate(38deg);
  transform-origin: right center;
}
.start-button-rays i:nth-child(2) {
  top: 25px;
  right: 8px;
}
.start-button-rays i:nth-child(3) {
  bottom: 4px;
  transform: rotate(-38deg);
  transform-origin: right center;
}

/* Announce the action once the loader reveals it; replay when Home is shown. */
.start-announcing .start-button-wrap {
  animation: start-ta-da 850ms 360ms cubic-bezier(.2, .8, .25, 1) both;
}
.start-announcing .start-button-rays i {
  --ray-angle: 0deg;
  --ray-open-angle: 0deg;
  --ray-lift: 0px;
  transform-origin: right center;
  animation: start-ray-fan 850ms 360ms ease-in-out both;
}
.start-announcing .start-button-rays i:nth-child(1) {
  --ray-angle: 38deg;
  --ray-open-angle: 44deg;
  --ray-lift: -2px;
}
.start-announcing .start-button-rays i:nth-child(3) {
  --ray-angle: -38deg;
  --ray-open-angle: -44deg;
  --ray-lift: 2px;
}

@keyframes start-ta-da {
  0%, 100% { transform: translateY(0) scale(1) rotate(0); }
  20% { transform: translateY(3px) scale(.94, .9) rotate(-2deg); }
  45% { transform: translateY(-10px) scale(1.1, 1.08) rotate(2deg); }
  68% { transform: translateY(1px) scale(.98, .96) rotate(-1deg); }
  84% { transform: translateY(-3px) scale(1.025) rotate(0); }
}

@keyframes start-ray-fan {
  0%, 100% { transform: translateX(0) rotate(var(--ray-angle)); }
  45% { transform: translate(-5px, var(--ray-lift)) rotate(var(--ray-open-angle)); }
}

@media (prefers-reduced-motion: reduce) {
  .start-announcing .start-button-wrap,
  .start-announcing .start-button-rays i { animation: none !important; }
}

.start-button-art:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, .36),
    inset 0 -5px 0 rgba(151, 22, 79, .25),
    0 9px 0 #8f1e50,
    0 15px 24px rgba(82, 44, 34, .24);
}

.start-button-art:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .25),
    inset 0 -3px 0 rgba(151, 22, 79, .18),
    0 2px 0 #8f1e50,
    0 7px 14px rgba(82, 44, 34, .2);
}

.start-button-art:focus-visible {
  outline: 5px solid #fff;
  outline-offset: 5px;
}

@keyframes prop-float {
  from { translate: 0 0; }
  to { translate: 0 -7px; }
}

.start-layout {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(150px, 34vh) minmax(280px, 1fr);
  place-items: center;
}

.game-logo {
  display: block;
  width: min(610px, 92vw);
  height: min(25vh, 235px);
  object-fit: contain;
  filter: drop-shadow(0 12px 13px rgba(73, 38, 34, .2));
  animation: logo-arrive 700ms cubic-bezier(.2,.9,.25,1.15) both;
}

.start-action {
  position: absolute;
  left: 0;
  bottom: clamp(28px, 4.5vh, 54px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ruby-showcase {
  --ruby-contact-opacity: .88;
  --ruby-contact-scale: 1;
  position: relative;
  align-self: center;
  width: min(310px, 68vw);
  max-height: 100%;
  aspect-ratio: 192 / 208;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: ruby-arrive 680ms 120ms cubic-bezier(.2,.9,.25,1.12) both;
}

.ruby-showcase::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 1.5%;
  width: 94%;
  height: 11.5%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(91, 70, 40, .36) 0%, rgba(111, 82, 43, .24) 38%, rgba(128, 94, 48, .09) 62%, transparent 74%);
  filter: blur(2.2px);
  opacity: var(--ruby-contact-opacity);
  transform: translateX(-50%) scale(var(--ruby-contact-scale), calc(var(--ruby-contact-scale) - .08));
  transform-origin: center;
  transition: opacity 90ms linear, transform 90ms linear;
  pointer-events: none;
}

.ruby-showcase::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -.5%;
  width: 96%;
  height: 8.5%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 2%, rgba(255, 226, 166, .96) 0 33%, rgba(246, 207, 132, .78) 48%, rgba(224, 175, 91, .22) 65%, transparent 74%);
  filter: blur(.45px);
  transform: translateX(-50%);
  pointer-events: none;
}

.ruby-3d {
  position: absolute;
  z-index: 3;
  top: 1%;
  left: 50%;
  width: 92%;
  height: 84%;
  filter: drop-shadow(4px 7px 7px rgba(83, 65, 40, .14));
  transform: translateX(-50%);
  transition: transform 180ms cubic-bezier(.2,.9,.3,1.4);
  pointer-events: none;
}

.ruby-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  background: transparent;
  transition: opacity 160ms ease;
}

.ruby-3d.ready canvas { opacity: 1; visibility: visible; }

.ruby-3d-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 160ms ease;
}

.ruby-3d.ready .ruby-3d-fallback { opacity: 0; }

.start-bone {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 1%;
  width: 112%;
  height: auto;
  filter: sepia(.06) saturate(.88) brightness(.99) blur(.15px) drop-shadow(3px 4px 3px rgba(86, 67, 39, .16));
  transform: translateX(-50%);
  transition: transform 180ms cubic-bezier(.2,.9,.3,1.4), filter 180ms ease;
  pointer-events: none;
}

.ruby-showcase:hover .ruby-3d { transform: translateX(-50%) translateY(-4px) scale(1.015); }
.ruby-showcase.boop .ruby-3d { transform: translateX(-50%) translateY(-10px) scale(1.045) rotate(1deg); }
.ruby-showcase.boop .start-bone { transform: translateX(-50%) translateY(1px) scaleX(1.008) scaleY(.985); }

.start-footer {
  width: auto;
  margin-top: -12px;
  padding-bottom: 2px;
  text-align: center;
  animation: footer-arrive 620ms 240ms ease-out both;
}

.start-footer .play-button {
  width: auto;
  min-width: 0;
  padding: 11px 23px;
  border-radius: 13px;
  font-size: 1.5rem;
  white-space: nowrap;
}

@keyframes logo-arrive { from { opacity: 0; transform: translateY(-24px) scale(.9) rotate(-2deg); } }
@keyframes ruby-arrive { from { opacity: 0; transform: translateY(36px) scale(.88); } }
@keyframes footer-arrive { from { opacity: 0; transform: translateY(18px); } }

.cabinet {
  position: relative;
  width: 100%;
  height: 100%;
}

.cabinet::before {
  content: none;
}

.screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #74e0f5;
  contain: layout paint;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
  width: min(230px, calc(100% - 36px));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 18px;
  background: rgba(17, 54, 74, .5);
  box-shadow: 0 8px 26px rgba(8, 48, 68, .18);
  backdrop-filter: blur(14px) saturate(1.1);
  pointer-events: none;
}

.score-card, .best-card {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  color: #fff;
  background: transparent;
  text-align: center;
}

.best-card { border-left: 1px solid rgba(255,255,255,.3); }

.score-card small, .best-card small {
  display: block;
  white-space: nowrap;
  color: #ffe08d;
  font-size: .62rem;
  font-weight: 1000;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.score-card strong, .best-card strong {
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  font-family: "Fredoka", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.screen-actions {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 14;
  display: flex;
  gap: 6px;
}

.arcade:not(.playing) #pauseButton { display: none; }

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 55, 76, .36);
  box-shadow: 0 4px 14px rgba(8, 48, 68, .11);
  font-size: .88rem;
  backdrop-filter: blur(9px);
  cursor: pointer;
}

.icon-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .icon-state-play {
  fill: currentColor;
  stroke: none;
  transform: translateX(0);
}

.icon-button .icon-state-pause {
  fill: currentColor;
  stroke: none;
}

.icon-button .icon-state-sound path:first-child,
.icon-button .icon-state-muted path:first-child {
  fill: currentColor;
  stroke: none;
}

#soundButton[data-icon="sound"] .icon-state-muted,
#soundButton[data-icon="muted"] .icon-state-sound,
#pauseButton[data-icon="pause"] .icon-state-play,
#pauseButton[data-icon="play"] .icon-state-pause {
  display: none;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(255,255,255,.92);
  background: rgba(15, 55, 76, .58);
  outline: 0;
}

.icon-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 224, 141, .72), 0 4px 14px rgba(8, 48, 68, .18);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 13;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(180deg, rgba(19, 80, 113, .1), rgba(4, 64, 92, .38));
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  overflow-y: auto;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.card {
  width: min(320px, 100%);
  padding: 26px 24px 22px;
  border: 6px solid #fff;
  border-radius: 34px;
  text-align: center;
  background: #fffae6;
  box-shadow: 0 5px 0 rgba(121, 204, 235, .65), 0 18px 32px rgba(1, 42, 61, .28);
  transform: none;
}

/* Confetti sits above the dimmer, below the opaque record card. */
.celebration-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.celebration-confetti i {
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 15px;
  border-radius: 2px;
}
.overlay .card { position: relative; z-index: 1; }
.result-ruby { display: none; }
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) {
  padding-top: 90px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .card {
  width: min(360px, 100%);
  padding: 20px 24px 22px;
  margin: auto;
}
.overlay[data-kind="pause"] .paused-ruby,
.overlay[data-kind="record"] .record-trophy,
.overlay[data-kind="result"] .retry-ruby {
  display: block;
  width: min(250px, 34vh);
  height: auto;
  margin: -94px auto 8px;
}

.card .kicker {
  margin: 0 0 14px;
  color: var(--pink-dark);
  font-size: .7rem;
  font-weight: 1000;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.card h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .03em;
  margin: 0;
  color: #17425a;
  font-family: "Fredoka", "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: clamp(2.3rem, 10vw, 4.2rem);
  line-height: .9;
  letter-spacing: -.06em;
}

.help-visuals { display: none; }

.overlay[data-kind="help"] .card {
  width: min(400px, 100%);
  padding: 24px 24px 26px;
  margin: auto;
  transform: none;
}

.overlay[data-kind="help"] .card h2 {
  color: #ef3f83;
  font-size: clamp(1.8rem, 7.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.1;
  text-transform: uppercase;
}

.overlay[data-kind="help"] .help-visuals {
  display: grid;
  place-items: center;
  height: clamp(160px, 23vh, 218px);
  margin: 0 auto 22px;
}

.help-phone-ruby { position: relative; display: block; width: min(280px, 100%); aspect-ratio: 1; filter: drop-shadow(0 8px 6px #0d3a731c); }
.help-phone-base { display: block; width: 100%; height: 100%; background: url("assets/images/ruby-help-phone-speech-v4.png?v=99bce245e996") 0 0 / 300% 100% no-repeat; }
.help-phone-screen { position: absolute; left: 38.6%; top: 50%; width: 22.3%; height: 42.1%; display: flex; align-items: center; pointer-events: none; }
.help-phone-cue { display: grid; place-items: center; width: 50%; color: #fff; font: 700 clamp(15px, 4.5vw, 23px)/1 sans-serif; opacity: .2; text-shadow: 0 1px 3px #124f7370; }
.help-demonstrating .help-phone-cue { animation: help-phone-arrow 4s ease-in-out infinite; }
.help-demonstrating .help-phone-right { animation-delay: -2s; }
@keyframes help-phone-arrow { 0%, 40%, 100% { opacity: .2; } 12%, 28% { opacity: 1; } }

.card p {
  margin: 14px 0 18px;
  font-weight: 750;
  line-height: 1.45;
  text-wrap: pretty;
}

.overlay[data-kind="help"] #overlayCopy {
  max-width: 30ch;
  margin: 16px auto 24px;
  color: #183547;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.play-button {
  width: 100%;
  padding: 13px 20px 14px;
  border: 4px solid #a9215b;
  border-radius: 22px;
  color: #fff7e7;
  background: linear-gradient(180deg, #ff72aa 0%, #ed4387 56%, #d52c70 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .34),
    inset 0 -4px 0 rgba(151, 22, 79, .25),
    0 6px 0 #8f1e50,
    0 10px 18px rgba(82, 44, 34, .2);
  font-size: 1.18rem;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: .04em;
  text-shadow: 0 2px 0 rgba(136, 31, 74, .34);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.play-button:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .36),
    inset 0 -4px 0 rgba(151, 22, 79, .25),
    0 8px 0 #8f1e50,
    0 13px 20px rgba(82, 44, 34, .22);
}
.play-button:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .25),
    inset 0 -2px 0 rgba(151, 22, 79, .18),
    0 2px 0 #8f1e50,
    0 6px 12px rgba(82, 44, 34, .18);
}
.play-button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

.home-link {
  display: block;
  margin: 17px auto 0;
  padding: 3px 9px;
  border: 0;
  color: var(--pink-dark);
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .035em;
  cursor: pointer;
  opacity: .88;
  transition: color 120ms ease, opacity 120ms ease;
}
.home-link:hover { color: #9e2458; opacity: 1; }
.home-link:focus-visible { outline: 3px solid rgba(223, 63, 123, .42); outline-offset: 3px; border-radius: 5px; }
.home-link.hidden { display: none; }

@media (min-width: 781px) {
  .start-logo-art {
    top: 22%;
    width: min(58vw, 760px);
    max-height: 38vh;
  }
  .start-stage {
    bottom: max(clamp(34px, 7vh, 76px), env(safe-area-inset-bottom));
  }
  .game-logo {
    width: min(700px, 92vw);
    height: min(28vh, 270px);
  }
}

@media (max-width: 780px) {
  .hud {
    top: max(14px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: min(168px, calc(100% - 118px));
    border-color: rgba(255,255,255,.34);
    border-radius: 13px;
    background: rgba(15, 55, 76, .34);
    box-shadow: 0 5px 16px rgba(8, 48, 68, .11);
    backdrop-filter: blur(9px) saturate(1.05);
  }
  .score-card, .best-card { padding: 6px 8px 7px; }
  .best-card { border-left-color: rgba(255,255,255,.2); }
  .score-card small, .best-card small {
    font-size: .5rem;
    letter-spacing: .085em;
  }
  .score-card strong, .best-card strong {
    margin-top: 2px;
    font-size: clamp(.92rem, 4vw, 1.06rem);
  }
  .screen-actions {
    top: max(14px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    gap: 5px;
  }
}

@media (max-aspect-ratio: 5 / 6) {
  .start-screen {
    --intro-video-top: clamp(42px, 6svh, 64px);
    --intro-video-bottom: clamp(64px, 8svh, 92px);
    background: linear-gradient(
      180deg,
      #86d4ef 0%,
      #78cfea 16%,
      #71cbe8 50%,
      #efd293 78%,
      #dfb56d 100%
    );
  }
  .start-background-video {
    inset: var(--intro-video-top) 0 var(--intro-video-bottom);
    width: 100%;
    height: calc(100% - var(--intro-video-top) - var(--intro-video-bottom));
    object-position: center 48%;
    transform: none;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 7%, #000 92%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 7%, #000 92%, transparent 100%);
  }
  .start-screen::before {
    background: linear-gradient(
      180deg,
      rgba(134, 212, 239, 1) 0%,
      rgba(134, 212, 239, .74) 6%,
      transparent 14%,
      transparent 82%,
      rgba(239, 210, 147, .42) 91%,
      rgba(223, 181, 109, 1) 100%
    );
  }
  .start-scene {
    padding:
      max(14px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .start-logo-art {
    top: 18%;
    width: min(82vw, 500px);
    max-height: 29vh;
  }
  .start-stage {
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(48px, 7vh, 76px));
  }
  .start-button-art {
    min-width: min(210px, 64vw);
    padding: 11px 24px;
    border-width: 3px;
    border-radius: 20px;
    font-size: clamp(1.45rem, 7vw, 2rem);
  }
  .start-button-rays {
    scale: .76;
  }
}

@media (min-width: 600px) and (max-width: 1100px) and (max-aspect-ratio: 5 / 6) {
  .start-screen {
    --intro-video-top: clamp(250px, 32svh, 430px);
    --intro-video-bottom: clamp(160px, 18svh, 210px);
    --playing-video-bottom: clamp(220px, 23svh, 270px);
    background: linear-gradient(
      180deg,
      #61afea 0%,
      #61afea 32%,
      #69b8e8 57%,
      #efd293 78%,
      #dfb56d 100%
    );
  }
  .start-screen::before {
    background: linear-gradient(
      180deg,
      rgba(97, 175, 234, 1) 0%,
      rgba(97, 175, 234, .72) 18%,
      transparent 31%,
      transparent 82%,
      rgba(239, 210, 147, .42) 91%,
      rgba(223, 181, 109, 1) 100%
    );
  }
  .start-logo-art {
    left: 50%;
    top: 16%;
    width: min(58vw, 480px);
    max-height: 25vh;
  }
  .start-stage {
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(72px, 8vh, 96px));
  }
  .start-background-video {
    object-position: 51.5% 48%;
  }
  .start-screen.video-playing .start-background-video {
    inset: 0 0 var(--playing-video-bottom);
    width: 100%;
    height: calc(100% - var(--playing-video-bottom));
    object-position: 51.5% center;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 91%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 91%, transparent 100%);
  }
  .start-screen.video-playing::before {
    opacity: 0;
  }
  .intro-skip-stage {
    z-index: 3;
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    animation: none;
    transition: opacity 220ms ease, visibility 220ms ease, transform 280ms cubic-bezier(.2, .8, .2, 1);
  }
  .intro-subtitle {
    position: absolute;
    left: 7%;
    right: 7%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(72px, 8vh, 96px) + clamp(92px, 9.5svh, 112px));
    z-index: 4;
    display: block;
    margin: 0;
    color: #694132;
    font-size: clamp(1.25rem, 3vw, 1.55rem);
    font-weight: 700;
    line-height: 1.12;
    text-align: center;
    text-wrap: balance;
    text-shadow: 0 2px 0 rgba(255, 247, 221, .88), 0 4px 10px rgba(103, 64, 40, .18);
    opacity: 0;
    visibility: hidden;
    transition: opacity 140ms ease, visibility 140ms ease;
    pointer-events: none;
  }
  .intro-subtitle.visible {
    opacity: 1;
    visibility: visible;
  }
  .start-screen.video-playing .intro-skip-stage {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 420ms;
  }
}

@media (max-width: 599px) and (max-aspect-ratio: 5 / 6) {
  .start-screen {
    --intro-video-top: clamp(192px, 30svh, 255px);
    --intro-video-bottom: clamp(112px, 18svh, 152px);
    --playing-video-bottom: clamp(150px, 22svh, 205px);
    background: linear-gradient(
      180deg,
      #61afea 0%,
      #61afea 32%,
      #69b8e8 57%,
      #efd293 78%,
      #dfb56d 100%
    );
  }
  .start-screen::before {
    background: linear-gradient(
      180deg,
      rgba(97, 175, 234, 1) 0%,
      rgba(97, 175, 234, .72) 18%,
      transparent 31%,
      transparent 82%,
      rgba(239, 210, 147, .42) 91%,
      rgba(223, 181, 109, 1) 100%
    );
  }
  .start-logo-art {
    left: 50%;
    top: 14.8%;
    width: min(68vw, 330px);
    max-height: 23vh;
  }
  .start-stage {
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(48px, 6.5svh, 68px));
  }
  .start-background-video {
    object-position: 51.5% 48%;
  }
  .start-screen.video-playing .start-background-video {
    inset: 0 0 var(--playing-video-bottom);
    width: 100%;
    height: calc(100% - var(--playing-video-bottom));
    object-position: 51.5% center;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 91%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 91%, transparent 100%);
  }
  .start-screen.video-playing::before {
    opacity: 0;
  }
  .intro-skip-stage {
    z-index: 3;
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    animation: none;
    transition: opacity 220ms ease, visibility 220ms ease, transform 280ms cubic-bezier(.2, .8, .2, 1);
  }
  .intro-subtitle {
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(48px, 6.5svh, 68px) + clamp(78px, 11.5svh, 98px));
    z-index: 4;
    display: block;
    margin: 0;
    color: #694132;
    font-size: clamp(1.05rem, 4.8vw, 1.25rem);
    font-weight: 700;
    line-height: 1.12;
    text-align: center;
    text-wrap: balance;
    text-shadow: 0 2px 0 rgba(255, 247, 221, .88), 0 4px 10px rgba(103, 64, 40, .18);
    opacity: 0;
    visibility: hidden;
    transition: opacity 140ms ease, visibility 140ms ease;
    pointer-events: none;
  }
  .intro-subtitle.visible {
    opacity: 1;
    visibility: visible;
  }
  .start-screen.video-playing .intro-skip-stage {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 420ms;
  }
  .start-button-art {
    position: relative;
    z-index: 1;
    min-width: min(160px, 44vw);
    padding: 9px 16px;
    font-size: clamp(1.32rem, 5.8vw, 1.58rem);
  }
  .start-button-rays {
    z-index: 0;
    top: calc(50% - 10px);
    scale: .48;
  }
  .start-button-rays-left { right: calc(100% - 10px); }
  .start-button-rays-right { left: calc(100% - 10px); }
}

@media (min-width: 1101px), (min-width: 600px) and (min-height: 600px) and (orientation: landscape) {
  .start-screen {
    --wide-logo-centre-y: max(clamp(225px, calc(20vh + 50px), 265px), calc(env(safe-area-inset-top, 0px) + 180px));
    background: #61afea;
  }
  .start-screen::before,
  .start-screen::after {
    background: none;
    opacity: 0;
  }
  .start-background-video,
  .start-screen.video-playing .start-background-video {
    inset: 0;
    width: 100%;
    height: 100%;
    object-position: center;
    transform: none;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .start-logo-art {
    left: max(80px, calc(env(safe-area-inset-left, 0px) + 80px));
    top: var(--wide-logo-centre-y);
    width: clamp(420px, 33.7vw, 580px);
    height: auto;
    max-width: none;
    max-height: 42vh;
    translate: 0 -50%;
  }
  .start-stage {
    top: auto;
    right: max(80px, calc(env(safe-area-inset-right, 0px) + 80px));
    bottom: max(76px, calc(env(safe-area-inset-bottom, 0px) + 76px));
    left: auto;
    max-width: none;
    translate: 0 0;
  }
  .start-button-art {
    min-width: clamp(160px, 14.7vw, 205px);
    padding: 10px 26px 11px;
    border-width: 4px;
    border-radius: 22px;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
  }
  .start-button-rays {
    scale: .62;
  }
  .start-screen.video-playing .start-scene {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
  }
  .start-screen.video-playing .start-scene .start-stage {
    opacity: 0;
    visibility: hidden;
  }
  .intro-skip-stage {
    z-index: 3;
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    animation: none;
    transition: opacity 220ms ease, visibility 220ms ease, transform 280ms cubic-bezier(.2, .8, .2, 1);
  }
  .start-screen.video-playing .intro-skip-stage {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 220ms;
  }
}

@media (max-height: 620px) and (min-aspect-ratio: 5 / 6) {
  .start-scene {
    padding-block: 12px;
  }
  .start-logo-art {
    width: min(62vw, 520px);
    max-height: 25vh;
  }
  .start-button-art {
    min-width: 160px;
    padding: 9px 24px;
    font-size: 1.45rem;
  }
}

@media (min-height: 940px) {
  .start-action { bottom: clamp(50px, calc(17vh - 117.5px), 110px); }
}

@media (max-height: 650px) {
  .start-layout { grid-template-rows: minmax(110px, 30vh) minmax(280px, 1fr); }
  .game-logo { height: min(23vh, 170px); }
  .start-action { bottom: clamp(18px, 3.5vh, 28px); }
  .ruby-showcase { width: min(240px, 54vw); }
  .play-button { padding-block: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .start-screen {
    background: #36bde3 url("assets/images/start-screen-story-desktop-v1.png?v=99bce245e996") center / cover no-repeat;
  }
  .start-background-video { display: none; }
  .ruby-showcase { --ruby-contact-opacity: .88 !important; --ruby-contact-scale: 1 !important; }
  .help-phone-cue { animation: none !important; opacity: 1; }

}

@media (prefers-reduced-motion: reduce) and (max-width: 599px) and (max-aspect-ratio: 5 / 6) {
  .start-screen { background-image: url("assets/images/start-screen-story-mobile-v1.png?v=99bce245e996"); }
}

@media (prefers-reduced-motion: reduce) and (min-width: 600px) and (max-width: 1100px) and (max-aspect-ratio: 5 / 6) {
  .start-screen { background-image: url("assets/images/start-screen-story-tablet-v1.png?v=99bce245e996"); }
}

/* Result cards share the same expressive typography and overlapping portrait. */
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .kicker {
  color: #ef3f83;
  font-size: clamp(1.5rem, 6.8vw, 2rem);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.1;
  margin: 2px 0 12px;
}
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) h2 {
  color: #12394f;
  font-size: clamp(3.1rem, 14vw, 4.6rem);
  letter-spacing: -.045em;
  line-height: 1;
}
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) #overlayCopy {
  max-width: 23ch;
  margin: 14px auto 22px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  color: #183547;
}
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .play-button {
  min-height: 58px;
  font-size: 1.4rem;
  border-radius: 24px;
}
.overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .home-link {
  font-size: 1.05rem;
  color: #cf326c;
}
@media (max-height: 650px) {
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) { padding-top: 68px; }
  .overlay[data-kind="pause"] .paused-ruby,
.overlay[data-kind="record"] .record-trophy,
  .overlay[data-kind="result"] .retry-ruby { width: 180px; margin-top: -72px; }
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) #overlayCopy { margin-block: 10px 16px; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) { padding: 26px; }
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .card {
    width: min(620px, 100%);
    display: grid;
    grid-template-columns: 175px 1fr;
    column-gap: 20px;
    align-items: center;
  }
  .overlay[data-kind="pause"] .paused-ruby,
.overlay[data-kind="record"] .record-trophy,
  .overlay[data-kind="result"] .retry-ruby {
    grid-column: 1;
    grid-row: 1 / 6;
    width: 175px;
    margin: 0;
  }
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) .card > :not(.result-ruby) { grid-column: 2; }
  .overlay:is([data-kind="record"], [data-kind="result"], [data-kind="pause"]) h2 { font-size: 3.4rem; }
}

/* A quiet companion to the result cards: one heading and no celebration. */
.overlay[data-kind="pause"] .kicker { display: none; }
.overlay[data-kind="pause"] h2 {
  color: #ef3f83;
  font-size: clamp(2.2rem, 10vw, 3rem);
  letter-spacing: .01em;
  text-transform: uppercase;
  margin-top: 4px;
}
.overlay[data-kind="pause"] .paused-ruby { margin-bottom: 0; }

/* Ruby overlaps the help card just like the result and pause portraits. */
.overlay[data-kind="help"] { padding-top: 90px; }
.overlay[data-kind="help"] .kicker { display: none; }
.overlay[data-kind="help"] .help-visuals { height: auto; margin: -94px auto 12px; }
.overlay[data-kind="help"] .play-button { min-height: 58px; font-size: 1.4rem; border-radius: 24px; }
@media (max-height: 650px) {
  .overlay[data-kind="help"] { padding: 72px 20px 20px; }
  .overlay[data-kind="help"] .card { padding: 18px 20px 22px; }
  .overlay[data-kind="help"] .help-visuals { margin: -76px auto 8px; }
  .help-phone-ruby { width: 210px; }
  .overlay[data-kind="help"] #overlayCopy { margin-block: 12px 18px; font-size: 1.02rem; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .overlay[data-kind="help"] { padding: 20px; }
  .overlay[data-kind="help"] .card { width: min(660px, 100%); display: grid; grid-template-columns: 170px 1fr; gap: 0 24px; align-items: center; }
  .overlay[data-kind="help"] .help-visuals { grid-column: 1; grid-row: 1 / 4; margin: 0; }
  .help-phone-ruby { width: 170px; }
  .overlay[data-kind="help"] h2, .overlay[data-kind="help"] #overlayCopy, .overlay[data-kind="help"] .play-button { grid-column: 2; }
}
