/* Zero — path sidecar + lesson streak peek. Companion chrome is inert; the figure is the hit target. */

.zero-companion,
.zero-streak,
.zero-success {
  pointer-events: none;
  user-select: none;
}

/* Full-screen win moment — one style for the sim overlay and the host. */
.zero-celebrate {
  --zero-celebrate-bg: #16383e;
  --zero-celebrate-title: var(--ry-coral, #FC5B62);
  --zero-celebrate-ink: #f6f3ec;
  --zero-celebrate-muted: rgba(246, 243, 236, 0.78);
  box-sizing: border-box;
  color: var(--zero-celebrate-ink);
  background: var(--zero-celebrate-bg);
  font-family: var(--ry-font, "Nunito", system-ui, sans-serif);
}

/* Hidden unless .on — do not pair display:grid with the un-won selector.
   That used to paint the coral/teal wash over the workspace on every load. */
.zero-celebrate.scrim {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: none;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(16px, 3vh, 36px);
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 18% 0%, rgba(252, 91, 98, 0.55), transparent 52%),
    radial-gradient(80% 60% at 92% 18%, rgba(63, 164, 179, 0.48), transparent 54%),
    radial-gradient(70% 50% at 50% 100%, rgba(63, 164, 179, 0.42), transparent 56%),
    var(--zero-celebrate-bg);
}

.zero-celebrate.scrim.on {
  display: grid;
}

.zero-celebrate__fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.zero-celebrate__wash {
  position: absolute;
  inset: -28%;
  background: conic-gradient(from 140deg, #FC5B62, #3FA4B3, #ffc86a, #FC5B62);
  opacity: 0.22;
  filter: blur(52px);
  animation: zero-celebrate-wash 14s linear infinite;
}

.zero-celebrate__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.7;
  will-change: transform;
}

.zero-celebrate__blob--a {
  top: -24%;
  left: -16%;
  width: 56vmax;
  height: 56vmax;
  background: #FC5B62;
  animation: zero-celebrate-blob-a 11s ease-in-out infinite alternate;
}

.zero-celebrate__blob--b {
  right: -20%;
  bottom: -18%;
  width: 52vmax;
  height: 52vmax;
  background: #3FA4B3;
  animation: zero-celebrate-blob-b 13s ease-in-out infinite alternate;
}

.zero-celebrate__stars,
.zero-celebrate__shots {
  position: absolute;
  inset: 0;
}

.zero-celebrate__stars i,
.zero-celebrate__shots i {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #fff8e8;
  opacity: 0.7;
}

.zero-celebrate__stars i {
  width: 3px;
  height: 3px;
  box-shadow: 0 0 6px rgba(255, 248, 232, 0.8);
  animation: zero-celebrate-twinkle 4.8s ease-in-out infinite;
}

.zero-celebrate__stars i:nth-child(1) { top: 12%; left: 8%; animation-delay: 0s; }
.zero-celebrate__stars i:nth-child(2) { top: 22%; left: 78%; width: 2px; height: 2px; animation-delay: -1.2s; }
.zero-celebrate__stars i:nth-child(3) { top: 38%; left: 18%; animation-delay: -2.4s; }
.zero-celebrate__stars i:nth-child(4) { top: 16%; left: 54%; width: 4px; height: 4px; animation-delay: -0.8s; }
.zero-celebrate__stars i:nth-child(5) { top: 62%; left: 86%; animation-delay: -3.1s; }
.zero-celebrate__stars i:nth-child(6) { top: 74%; left: 12%; width: 2px; height: 2px; animation-delay: -1.8s; }
.zero-celebrate__stars i:nth-child(7) { top: 48%; left: 92%; animation-delay: -2.8s; }
.zero-celebrate__stars i:nth-child(8) { top: 8%; left: 36%; animation-delay: -0.4s; }
.zero-celebrate__stars i:nth-child(9) { top: 82%; left: 62%; width: 2px; height: 2px; animation-delay: -3.6s; }
.zero-celebrate__stars i:nth-child(10) { top: 28%; left: 44%; animation-delay: -2s; }

.zero-celebrate__shots i {
  width: 72px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff6d8 45%, #fff);
  opacity: 0;
  transform: rotate(-28deg);
  animation: zero-celebrate-shot 7.5s linear infinite;
}

.zero-celebrate__shots i:nth-child(1) { top: 18%; left: -8%; animation-delay: 0s; }
.zero-celebrate__shots i:nth-child(2) { top: 46%; left: -12%; animation-delay: -2.6s; width: 56px; }
.zero-celebrate__shots i:nth-child(3) { top: 68%; left: -10%; animation-delay: -4.8s; width: 64px; }

.zero-celebrate__stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vh, 16px);
  width: min(100%, 36rem);
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  text-align: center;
}

.zero-celebrate__mascot {
  display: grid;
  justify-items: center;
  margin-bottom: 4px;
  pointer-events: none;
}

.zero-figure--hero .zero-sprite {
  width: min(72vw, 405px, 46vh);
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.28));
}

.zero-celebrate__title {
  margin: 0;
  color: var(--zero-celebrate-title);
  font-family: var(--ry-font, "Nunito", system-ui, sans-serif);
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.98;
  text-wrap: balance;
}

.zero-celebrate__title .en:empty {
  display: none;
}

.zero-celebrate__sub {
  margin: 0 0 10px;
  max-width: 28ch;
  color: var(--zero-celebrate-muted);
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
}

.zero-celebrate__sub .en:empty {
  display: none;
}

.zero-celebrate__acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
}

.zero-celebrate .zero-celebrate__mascot:nth-of-type(n + 2),
.zero-celebrate .zero-figure--hero ~ .zero-figure,
.zero-streak.is-win-hidden {
  display: none !important;
}

.zero-celebrate__acts .ry-btn {
  min-width: 8.5rem;
}

.zero-celebrate.on .zero-celebrate__stage,
.zero-celebrate:not([hidden]) .zero-celebrate__stage {
  animation: zero-celebrate-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes zero-celebrate-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes zero-celebrate-wash {
  to { transform: rotate(360deg); }
}

@keyframes zero-celebrate-blob-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(10%, 8%, 0) scale(1.12); }
}

@keyframes zero-celebrate-blob-b {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to   { transform: translate3d(-8%, -6%, 0) scale(0.92); }
}

@keyframes zero-celebrate-twinkle {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 0.85; }
}

@keyframes zero-celebrate-shot {
  0%   { transform: translate3d(0, 0, 0) rotate(-28deg); opacity: 0; }
  8%   { opacity: 0.7; }
  28%  { transform: translate3d(120vw, 42vh, 0) rotate(-28deg); opacity: 0; }
  100% { transform: translate3d(120vw, 42vh, 0) rotate(-28deg); opacity: 0; }
}

@media (max-height: 820px) {
  .zero-figure--hero .zero-sprite {
    width: min(49vw, 297px, 38vh);
  }

  .zero-celebrate__title {
    font-size: clamp(1.7rem, 5vw, 2.5rem);
  }
}

@media (max-width: 540px) {
  .zero-figure--hero .zero-sprite {
    width: min(72vw, 284px, 40vh);
  }

  .zero-celebrate__acts .ry-btn {
    min-width: 7.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zero-celebrate.on .zero-celebrate__stage,
  .zero-celebrate:not([hidden]) .zero-celebrate__stage,
  .zero-celebrate__wash,
  .zero-celebrate__blob,
  .zero-celebrate__stars i,
  .zero-celebrate__shots i {
    animation: none;
  }

  .zero-celebrate__shots i {
    opacity: 0;
  }
}

.zero-companion[hidden] {
  display: none !important;
}

.zero-figure {
  display: grid;
  justify-items: center;
  gap: 0;
}

.zero-companion .zero-figure,
.zero-companion .zero-hit {
  pointer-events: auto;
}

.zero-hit {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  min-width: 48px;
  min-height: 48px;
  pointer-events: auto;
  line-height: 0;
  cursor: pointer;
}

a.zero-figure,
a.zero-figure .zero-hit {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.zero-hit > .zero-still,
.zero-hit > .zero-clip {
  grid-area: 1 / 1;
  pointer-events: none;
}

.zero-hit .zero-clip {
  visibility: hidden;
  opacity: 0;
}

.is-video-play .zero-still {
  visibility: hidden;
  opacity: 0;
}

.is-video-play .zero-hit .zero-clip {
  display: block;
  visibility: visible;
  opacity: 1;
}

.is-fallback .zero-still,
.zero-loop.is-fallback .zero-still {
  visibility: visible;
  opacity: 1;
}

.is-fallback .zero-hit .zero-clip {
  visibility: hidden;
  opacity: 0;
}

.zero-sprite {
  display: block;
  width: 112px;
  height: auto;
  filter: drop-shadow(0 10px 10px rgba(39, 49, 63, 0.12));
}

video.zero-clip,
img.zero-still,
img.zero-sprite {
  display: block;
  background: transparent;
  object-fit: contain;
}

.zero-figure--celebrate .zero-sprite,
.zero-figure--success .zero-sprite {
  width: 178px;
}

.zero-figure--hero.zero-figure--celebrate .zero-sprite {
  width: min(72vw, 405px, 46vh);
}

.zero-ground {
  display: grid;
  justify-items: center;
  margin-top: -10px;
}

.zero-base {
  width: 62px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(39, 49, 63, 0.28), rgba(39, 49, 63, 0.08) 58%, transparent 72%);
}

/* No contact card anywhere the keyed sprite sits on sky / wash. */
.path-inlet .zero-base,
.path-inlet .zero-ground,
.zero-figure--path .zero-base,
.zero-figure--path .zero-ground,
.zero-figure--meet .zero-base,
.zero-figure--meet .zero-ground,
.zero-figure--celebrate .zero-base,
.zero-figure--celebrate .zero-ground,
.zero-figure--success .zero-base,
.zero-figure--success .zero-ground,
.zero-figure--hero .zero-base,
.zero-figure--hero .zero-ground,
.zero-companion .zero-base,
.zero-streak .zero-base,
.zero-streak .zero-ground,
#successCard .zero-base,
#successCard .zero-ground {
  display: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.zero-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 1px;
}

.zero-companion .zero-stars.is-interactive {
  pointer-events: auto;
}

.zero-stars i {
  display: block;
  width: 11px;
  height: 11px;
  background: #c5d0da;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0.55;
}

.zero-stars i:nth-child(2) {
  width: 12px;
  height: 12px;
}

.zero-stars i.is-filled {
  background: #ffc800;
  opacity: 1;
}

.zero-stars i.is-next {
  background: #ffc800;
  opacity: 0.4;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(255, 200, 0, 0.22);
}

.zero-stars i.is-empty.is-locked {
  background: #c5d0da;
  opacity: 0.4;
  cursor: default;
}

.zero-stars.is-interactive i:not(.is-locked) {
  cursor: pointer;
}

.zero-stars.is-interactive i:not(.is-locked):hover,
.zero-stars.is-interactive i:not(.is-locked):focus-visible {
  outline: 0;
  transform: scale(1.2);
}

.zero-companion {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 148px;
  pointer-events: none;
}

.zero-companion.is-placed {
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1), top 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.zero-companion .zero-hit,
.path-inlet .zero-hit,
.zero-figure--path .zero-hit,
.zero-figure--meet .zero-hit {
  min-width: 200px;
  min-height: 264px;
  padding: 6px 10px 0;
}

.zero-companion .zero-sprite,
.path-inlet .zero-sprite,
.zero-figure--path .zero-sprite,
.zero-figure--meet .zero-sprite {
  width: 189px;
}

.zero-companion .zero-base {
  width: 56px;
  height: 14px;
}

.zero-companion.is-left .zero-sprite,
.zero-companion.is-right .zero-sprite {
  transform-origin: 50% 100%;
}

.zero-companion.is-trail {
  width: 118px;
  z-index: 4;
  opacity: 0.92;
}

.zero-companion.is-trail .zero-hit {
  min-width: 118px;
  min-height: 168px;
  padding: 8px 10px 2px;
}

.zero-companion.is-trail .zero-sprite {
  width: 110px;
}

.zero-companion.is-trail .zero-base {
  width: 44px;
  height: 11px;
}

.zero-companion[data-clip="jump"] .zero-sprite,
.path-inlet [data-clip="jump"] .zero-sprite,
.zero-figure--path[data-clip="jump"] .zero-sprite {
  width: 200px;
}

.zero-companion.is-trail[data-clip="jump"] .zero-sprite {
  width: 118px;
}

.lesson-stage {
  position: relative;
  overflow: visible;
}

.zero-streak {
  position: absolute;
  z-index: 8;
  top: 28%;
  width: 202px;
  opacity: 0;
  transition: transform 0.48s cubic-bezier(0.18, 0.89, 0.32, 1.15), opacity 0.36s ease;
}

.zero-streak.is-right {
  right: 4px;
  transform: translateX(92px);
}

.zero-streak.is-left {
  left: 4px;
  transform: translateX(-92px);
}

.zero-streak.is-in {
  opacity: 1;
  transform: translateX(0);
}

.zero-streak.is-out {
  opacity: 0;
}

.zero-streak::before,
.zero-streak::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background:
    linear-gradient(#ffc800, #ffc800) center / 2px 10px no-repeat,
    linear-gradient(#ffc800, #ffc800) center / 10px 2px no-repeat;
  opacity: 0;
}

.zero-streak.is-in::before,
.zero-streak.is-in::after {
  opacity: 0.85;
  animation: zero-spark 0.7s ease-out 0.12s both;
}

.zero-streak::before {
  top: 8%;
  left: 8%;
}

.zero-streak::after {
  top: 18%;
  right: 6%;
  background:
    linear-gradient(#b65cff, #b65cff) center / 2px 8px no-repeat,
    linear-gradient(#b65cff, #b65cff) center / 8px 2px no-repeat;
}

.zero-success {
  display: grid;
  justify-items: center;
  margin: 0 auto 6px;
}

@keyframes zero-spark {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@media (max-width: 540px) {
  .zero-companion {
    width: 128px;
  }

  .zero-companion .zero-hit {
    min-width: 128px;
    min-height: 184px;
    padding: 8px 10px 2px;
  }

  .zero-companion .zero-sprite {
    width: 120px;
  }

  .zero-figure--celebrate .zero-sprite,
  .zero-figure--success .zero-sprite {
    width: 151px;
  }

  .zero-figure--hero.zero-figure--celebrate .zero-sprite {
    width: min(72vw, 284px, 40vh);
  }

  .zero-streak {
    width: 167px;
    top: 26%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zero-companion,
  .zero-streak {
    transition: none;
  }

  .zero-streak.is-in::before,
  .zero-streak.is-in::after {
    animation: none;
    opacity: 0.7;
  }
}

/* Zero window — RoboCoach overlay and dedicated /zero.html page. */
body.zero-teach-open {
  overflow: hidden;
}

.zero-teach-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100dvh - env(safe-area-inset-bottom));
  margin: 0;
  overflow: hidden;
  background: var(--ry-canvas, #fff8f4);
}

body.zero-teach-page .app-shell {
  align-items: stretch;
  padding: 0;
  min-height: 100dvh;
}

.zero-teach-window {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  background: var(--ry-canvas, #fff8f4);
}

.zero-teach-window[hidden] {
  display: none !important;
}

.zero-teach-bar {
  display: flex;
  align-items: center;
  gap: var(--ry-space-2, 12px);
  flex: 0 0 auto;
  min-height: var(--ry-chrome, 52px);
  padding: 6px var(--ry-gutter, 16px);
  border-bottom: 3px solid var(--ry-teal, #3fa4b3);
  background: color-mix(in srgb, var(--ry-canvas, #fff8f4) 78%, transparent);
}

.zero-teach-bar h1 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--ry-font, "Nunito", system-ui, sans-serif);
  font-size: var(--ry-fs-heading, 1.1rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zero-teach-back,
.zero-teach-close {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  color: var(--ry-muted, #5a6674);
  border: 0;
  background: none;
  font-family: var(--ry-font, "Nunito", system-ui, sans-serif);
  font-size: var(--ry-fs-label, 0.85rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.zero-teach-back:hover,
.zero-teach-close:hover {
  color: var(--ry-ink, #1a2330);
}

.zero-teach-back:focus-visible,
.zero-teach-close:focus-visible {
  outline: 2px solid var(--ry-ink, #1a2330);
  outline-offset: 2px;
}

.zero-teach-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #f1f5f9;
}

.zero-teach-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 24px;
  color: #334155;
  font-family: var(--ry-font, "Nunito", system-ui, sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

.zero-teach-frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.next-zero .zero-figure {
  pointer-events: auto;
  cursor: pointer;
}
