/* Optional crab helper + status character. Remove this file and its <link>/<script>
   includes from index.html to remove the feature. */

#pageit-crab-tour-status {
  position: relative;
  z-index: 10000;
  width: 100%;
  height: 100%;
  display: none;
  overflow: visible;
  pointer-events: none;
  opacity: 1;
  transition: opacity 720ms ease;
}

#pageit-crab-tour-status.is-active {
  display: block;
}

#pageit-crab-tour-status.is-fading-out {
  opacity: 0;
}

.crab-tour-scene {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 auto;
  height: 100%;
  pointer-events: none;
}

.crab-tour-clouds,
.crab-tour-glyphs,
.crab-tour-live-entropy,
.crab-tour-waves {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.crab-tour-cloud-cluster,
.crab-tour-glyph-cluster,
.crab-tour-live-entropy-cluster,
.crab-tour-wave-cluster {
  position: absolute;
  display: inline-block;
  white-space: nowrap;
  user-select: none;
  opacity: 0;
  transition: opacity 620ms ease;
}

#pageit-crab-tour-status.scene-stage-1 [data-stage="1"],
#pageit-crab-tour-status.scene-stage-2 [data-stage="1"],
#pageit-crab-tour-status.scene-stage-2 [data-stage="2"],
#pageit-crab-tour-status.scene-stage-3 [data-stage] {
  opacity: var(--item-opacity, 1);
}

.crab-tour-cloud-cluster {
  color: #b1bed1;
  font-size: 0.72rem;
  line-height: 1;
}

.crab-tour-glyph-cluster {
  color: #8ea2ba;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.06em;
}

.crab-tour-live-entropy-cluster {
  color: #75879e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 0 0.01px currentColor;
}

.crab-tour-wave-cluster {
  color: #64a6ee;
  font-size: 0.92rem;
  line-height: 1;
}

#pageit-crab-tour-status.is-active .crab-tour-cloud-cluster {
  animation: crab-tour-cloud-drift linear infinite;
}

#pageit-crab-tour-status.is-active .crab-tour-glyph-cluster {
  animation: crab-tour-glyph-shiver linear infinite alternate;
}

#pageit-crab-tour-status.is-active .crab-tour-wave-cluster {
  animation: crab-tour-wave-drift linear infinite alternate;
}

@keyframes crab-tour-cloud-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(14px); }
}

@keyframes crab-tour-glyph-shiver {
  from { transform: translateX(0) translateY(0); }
  to   { transform: translateX(5px) translateY(-2px); }
}

@keyframes crab-tour-wave-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(11px); }
}

.crab-tour-actor {
  position: absolute;
  z-index: 2;
  bottom: 0.18rem;
  left: 0;
  width: 56px;
  height: 42px;
  display: grid;
  place-items: end center;
  opacity: 1;
  transition: left 820ms cubic-bezier(.22,.78,.27,1), bottom 820ms cubic-bezier(.22,.78,.27,1), opacity 280ms ease;
  will-change: left, bottom, opacity;
}

.crab-tour-actor.is-hidden {
  opacity: 0;
}

.crab-tour-actor.is-teleport {
  transition: none;
}

.crab-tour-crab {
  display: block;
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.18));
  transform-origin: 50% 80%;
  user-select: none;
}

.crab-tour-actor.is-moving .crab-tour-crab {
  animation: crab-tour-scuttle 180ms ease-in-out infinite alternate;
}

@keyframes crab-tour-scuttle {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-4px) rotate(5deg); }
}

.crab-tour-actor.is-realizing .crab-tour-crab {
  animation: crab-tour-realize 180ms ease-out;
}

@keyframes crab-tour-realize {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-5px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.crab-tour-bubble {
  position: absolute;
  z-index: 3;
  max-width: min(340px, calc(100% - 16px));
  min-height: 40px;
  box-sizing: border-box;
  padding: 10px 33px 10px 12px;
  border: 3px solid #171717;
  border-radius: 15px;
  background: rgba(255, 253, 246, 0.88);
  color: #171717;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.22;
  opacity: 0;
  transform: translateY(4px) scale(.98);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.crab-tour-bubble.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.crab-tour-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #171717;
  font: inherit;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
}

.crab-tour-close:hover,
.crab-tour-close:focus-visible {
  background: rgba(0, 0, 0, 0.08);
  outline: none;
}

.crab-tour-arrow-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
  z-index: 9990;
}

.crab-tour-arrow-layer.is-visible {
  opacity: 1;
}

.crab-tour-arrow-line {
  fill: none;
  stroke: #171717;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#pageit-crab-tour-status.is-error .crab-tour-bubble {
  background: rgba(255, 245, 242, 0.90);
}

@media (max-width: 700px) {
  .crab-tour-cloud-cluster,
  .crab-tour-glyph-cluster,
  .crab-tour-live-entropy-cluster { font-size: 0.62rem; }
  .crab-tour-wave-cluster { font-size: 0.78rem; }

  .crab-tour-actor {
    width: 46px;
    height: 34px;
  }

  .crab-tour-crab {
    font-size: 32px;
  }

  .crab-tour-bubble {
    /* Always leave enough horizontal room for the crab beside the bubble. */
    max-width: min(220px, calc(100% - 64px));
    padding: 7px 27px 7px 9px;
    border-width: 2px;
    border-radius: 12px;
    font-size: 11.5px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
  }

  .crab-tour-arrow-line {
    stroke-width: 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  #pageit-crab-tour-status,
  .crab-tour-actor,
  .crab-tour-bubble,
  .crab-tour-arrow-layer {
    transition: none;
  }

  #pageit-crab-tour-status.is-active .crab-tour-cloud-cluster,
  #pageit-crab-tour-status.is-active .crab-tour-glyph-cluster,
  #pageit-crab-tour-status.is-active .crab-tour-wave-cluster,
  .crab-tour-actor.is-moving .crab-tour-crab {
    animation: none;
  }
}

/* User-paced tutorial controls. The speech bubble remains visually lightweight;
   only its tiny action/close controls and the crab itself accept clicks. */
.crab-tour-action {
  display: block;
  margin: 5px 0 0 auto;
  padding: 2px 7px;
  border: 1.5px solid #171717;
  border-radius: 999px;
  background: #fffdf6;
  color: #171717;
  font: inherit;
  font-size: 0.78em;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  pointer-events: auto;
}

.crab-tour-action:hover,
.crab-tour-action:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

.crab-tour-actor {
  pointer-events: auto;
  cursor: pointer;
}

#pageit-crab-tour-status.is-generation .crab-tour-actor,
#pageit-crab-tour-status.is-terminal .crab-tour-actor {
  cursor: default;
}
.crab-tour-action[hidden] {
  display: none !important;
}
