/* Gentle, contextual click feedback from the first story through the finale. */
.story-echo {
  position: fixed;
  z-index: 72;
  width: 0;
  height: 0;
  pointer-events: none;
  color: rgb(255 236 199 / 94%);
  contain: layout style;
}

.story-echo__line {
  position: absolute;
  left: 0;
  bottom: 1.15rem;
  width: max-content;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.58rem 0.82rem;
  color: rgb(255 246 227 / 96%);
  font-family: var(--font-hand, "KaiTi", "STKaiti", serif);
  font-size: clamp(0.9rem, 1.15vw, 1.08rem);
  line-height: 1.55;
  letter-spacing: 0.025em;
  text-align: center;
  text-wrap: balance;
  background: linear-gradient(135deg, rgb(20 24 38 / 86%), rgb(47 35 42 / 78%));
  border: 1px solid rgb(255 236 199 / 22%);
  border-radius: 999px;
  box-shadow: 0 0.9rem 2.8rem rgb(4 7 16 / 34%);
  backdrop-filter: blur(0.75rem);
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  animation: story-echo-line 2400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.story-echo__mark {
  position: absolute;
  top: 0;
  left: 0;
  color: rgb(244 195 112 / 90%);
  font: 600 1rem/1 var(--font-editorial, serif);
  text-shadow: 0 0 1.1rem rgb(244 195 112 / 58%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(var(--echo-scale));
  animation: story-echo-mark 1700ms cubic-bezier(0.22, 1, 0.36, 1) var(--echo-delay) both;
}

.story-echo--coco .story-echo__mark,
.story-echo--light .story-echo__mark,
.story-echo--horseshoe .story-echo__mark {
  color: rgb(151 211 222 / 92%);
  text-shadow: 0 0 1.1rem rgb(113 190 210 / 62%);
}

.story-echo--routes .story-echo__mark,
.story-echo--poaching .story-echo__mark,
.story-echo--finale .story-echo__mark {
  color: rgb(190 218 164 / 92%);
  text-shadow: 0 0 1.1rem rgb(136 185 139 / 58%);
}

.story-echo__live {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@keyframes story-echo-line {
  0% { opacity: 0; filter: blur(0.28rem); transform: translate(-50%, 0.6rem) scale(0.96); }
  16%, 72% { opacity: 1; filter: blur(0); transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; filter: blur(0.16rem); transform: translate(-50%, -0.65rem) scale(0.99); }
}

@keyframes story-echo-mark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.55); }
  22% { opacity: 0.95; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--echo-x)), calc(-50% + var(--echo-y))) scale(var(--echo-scale));
  }
}

@media (max-width: 760px) {
  .story-echo__line {
    max-width: calc(100vw - 1.5rem);
    padding: 0.52rem 0.72rem;
    border-radius: 1rem;
    font-size: max(0.9rem, 3.7vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-echo__line {
    animation: story-echo-line-reduced 1800ms ease both;
  }

  .story-echo__mark {
    display: none;
  }
}

@keyframes story-echo-line-reduced {
  0%, 100% { opacity: 0; }
  15%, 78% { opacity: 1; }
}
