/* 「マゼてみよう」— TOP 冒頭の合成体験 */

.mazeru {
  --mazeru-head: 61px;
  position: relative;
  margin-top: calc(var(--mazeru-head) * -1);
}

.mazeru-track {
  position: relative;
}

.mazeru-stage {
  --lp: 0;
  --slots-y: 64px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  color: #fff;
}

/* 進み具合のバー・スキップ・ハムレス */

.mazeru-progress {
  position: absolute;
  top: var(--mazeru-head);
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(157, 252, 255, 0.15);
  z-index: 3;
}
.mazeru-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-text-cyan), var(--color-yellow));
  transform-origin: 0 50%;
  transform: scaleX(0);
  box-shadow: 0 0 10px rgba(157, 252, 255, 0.6);
  will-change: transform;
}

.mazeru-skip {
  position: absolute;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  z-index: 3;
  min-height: 36px;
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid rgba(157, 252, 255, 0.5);
  background: rgba(8, 18, 48, 0.75);
  box-shadow: 0 0 12px rgba(0, 169, 255, 0.3);
  color: var(--color-text-cyan-light);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-micro);
  cursor: pointer;
}
.mazeru-progress,
.mazeru-skip,
.mazeru-guide {
  transition: opacity 0.3s, visibility 0.3s;
}
.mazeru:not(.is-ready) .mazeru-progress,
.mazeru:not(.is-ready) .mazeru-skip,
.mazeru:not(.is-ready) .mazeru-intro-cue {
  opacity: 0;
  visibility: hidden;
}
.mazeru-intro-cue {
  transition: opacity 0.3s, visibility 0.3s;
}
.mazeru-stage[data-phase="intro"] .mazeru-guide,
.mazeru-stage[data-phase="done"] .mazeru-progress,
.mazeru-stage[data-phase="done"] .mazeru-skip,
.mazeru-stage[data-phase="done"] .mazeru-guide {
  opacity: 0;
  visibility: hidden;
}

.mazeru-guide {
  position: absolute;
  top: calc(var(--mazeru-head) + 13px);
  left: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 520px;
}
.mazeru-guide img {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-text-cyan);
  background: #fff;
}
.mazeru-guide-text {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(8, 18, 48, 0.82);
  border: 1px solid rgba(157, 252, 255, 0.35);
  font-weight: 700;
  font-size: var(--fs-micro);
  line-height: 1.65;
}

.mazeru-kv,
.mazeru-intro,
.mazeru-select,
.mazeru-crt,
.mazeru-capsule {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
}
.mazeru-stage[data-phase="intro"] .mazeru-kv,
.mazeru-stage[data-phase="intro"] .mazeru-intro,
.mazeru-stage[data-phase="select"] .mazeru-select,
.mazeru-stage[data-phase="crt"] .mazeru-crt,
.mazeru-stage[data-phase="reveal"] .mazeru-capsule,
.mazeru-stage[data-phase="done"] .mazeru-capsule {
  opacity: 1;
  visibility: visible;
}

/* 導入: キービジュアルを背景に敷く */

.mazeru-kv {
  position: absolute;
  inset: 0;
  top: var(--mazeru-head);
  overflow: hidden;
}
.mazeru-kv picture {
  display: block;
  width: 100%;
  height: 100%;
}
.mazeru-kv picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  animation: mazeru-kv-settle 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transform: scale(calc(1 + var(--lp) * 0.08));
  opacity: calc(1 - var(--lp) * 0.45);
  will-change: transform, opacity;
}
@keyframes mazeru-kv-settle {
  from { scale: 1.08; }
  to { scale: 1; }
}

.mazeru-kv-loop { display: none; }
html[data-kv="loop"] .mazeru-kv picture { display: none; }
html[data-kv="loop"] .mazeru-kv-loop {
  --kv-loop-sec: 75s;
  display: flex;
  height: 100%;
  animation: mazeru-kv-settle 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transform: scale(calc(1 + var(--lp) * 0.08));
  opacity: calc(1 - var(--lp) * 0.45);
  will-change: transform, opacity;
}
.mazeru-kv-loop img {
  flex: none;
  width: auto;
  max-width: none;
  height: 100%;
  animation: mazeru-kv-loop var(--kv-loop-sec) linear infinite;
  will-change: transform;
}
@keyframes mazeru-kv-loop {
  to { transform: translateX(-100%); }
}
.mazeru-stage:not([data-phase="intro"]) .mazeru-kv-loop img { animation-play-state: paused; }
.mazeru-kv::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(18, 26, 64, 0.2) 0%,
    rgba(18, 26, 64, 0.05) 35%,
    rgba(18, 26, 64, 0.8) 72%,
    rgba(18, 26, 64, 0.95) 100%
  );
}

@media (max-aspect-ratio: 4 / 5) {
  .mazeru-kv {
    bottom: auto;
    height: 86%;
    -webkit-mask-image: linear-gradient(#000 90%, transparent);
    mask-image: linear-gradient(#000 90%, transparent);
  }
  .mazeru-kv picture img { object-position: 50% 35%; }
  .mazeru-kv::after {
    background: linear-gradient(to bottom, rgba(18, 26, 64, 0.2), rgba(18, 26, 64, 0) 30%, rgba(18, 26, 64, 0) 76%, rgba(18, 26, 64, 0.65) 100%);
  }
  .mazeru-intro-cue { text-shadow: 0 0 3px rgba(3, 0, 64, 0.95), 0 1px 8px rgba(3, 0, 64, 0.9); }
  .mazeru-intro-cue::after { filter: drop-shadow(0 0 3px rgba(3, 0, 64, 0.95)); }
}

.mazeru-intro {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--slots-y) + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
.mazeru-intro-copy {
  margin: 0;
  font-family: var(--font-title-text);
  font-weight: 400;
  font-size: clamp(1.9rem, 8.4vw, 3.4rem);
  line-height: 1.45;
  text-shadow: 0 0 22px var(--color-shadow-blue), 3px 3px 0 rgba(0, 0, 0, 0.55);
  transform: translateY(calc(var(--lp) * -30px));
  will-change: transform;
}
.mazeru-intro-cue {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-caption);
  color: var(--color-text-cyan-light);
}
.mazeru-intro-cue::after {
  content: "";
  width: 14px;
  height: 14px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  rotate: 45deg;
  animation: mazeru-cue 1.4s ease-in-out infinite;
}
@keyframes mazeru-cue {
  0%, 100% { translate: 0 0; opacity: 0.5; }
  50% { translate: 0 8px; opacity: 1; }
}

.mazeru-down {
  --slot-h: calc((min(94vw, 440px) - 24px) / 4 * 3.7 / 3);
  position: absolute;
  left: 50%;
  bottom: calc(var(--slots-y) + var(--slot-h) + 24px);
  z-index: 3;
  width: 26px;
  height: 30px;
  margin-left: -13px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
  filter: drop-shadow(0 0 6px rgba(77, 250, 255, 0.8));
}
.mazeru-down::before,
.mazeru-down::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-right: 3px solid var(--color-text-cyan-light);
  border-bottom: 3px solid var(--color-text-cyan-light);
  rotate: 45deg;
}
.mazeru-down::before { top: 0; }
.mazeru-down::after { top: 11px; }
.mazeru-stage:is([data-phase="pillar"], [data-phase="crt"]):not(.is-scrolling, .is-playing) .mazeru-down {
  opacity: 1;
  visibility: visible;
}
.mazeru-stage:is([data-phase="pillar"], [data-phase="crt"]):not(.is-scrolling, .is-playing) .mazeru-down::before {
  animation: mazeru-down 1.2s ease-in-out infinite;
}
.mazeru-stage:is([data-phase="pillar"], [data-phase="crt"]):not(.is-scrolling, .is-playing) .mazeru-down::after {
  animation: mazeru-down 1.2s ease-in-out 0.15s infinite;
}
@keyframes mazeru-down {
  0%, 100% { translate: 0 0; opacity: 0.35; }
  50% { translate: 0 6px; opacity: 1; }
}

/* えらぶ */

.mazeru-select {
  position: absolute;
  left: 0;
  right: 0;
  top: 27%;
  text-align: center;
}
.mazeru-step {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}
.mazeru-step-num {
  display: inline-block;
  margin-right: 2px;
  font-size: 2rem;
  color: var(--color-yellow);
  text-shadow: 0 0 14px rgba(255, 210, 63, 0.5);
}

.mazeru-reel-wrap {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}
.mazeru-reel {
  list-style: none;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 18px calc(50% - 66px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.mazeru-reel::-webkit-scrollbar { display: none; }
.mazeru-reel > li {
  flex: 0 0 auto;
  scroll-snap-align: center;
}

.mazeru-reel-item {
  width: 132px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
  transform: scale(0.86);
  transition: transform 0.25s, opacity 0.25s;
}
.mazeru-reel-item.is-current {
  opacity: 1;
  transform: scale(1.06);
}
.mazeru-reel-item:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 4px;
  border-radius: 12px;
}

.mazeru-plate-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(157, 252, 255, 0.18), rgba(8, 30, 70, 0.7));
  border: 1px solid rgba(157, 252, 255, 0.45);
  box-shadow: inset 0 0 14px rgba(0, 169, 255, 0.25);
}
.mazeru-reel-item.is-current .mazeru-plate-face {
  border-color: var(--color-yellow);
  box-shadow: 0 0 22px rgba(255, 210, 63, 0.45), inset 0 0 14px rgba(0, 169, 255, 0.35);
}
.mazeru-plate-icon {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(157, 252, 255, 0.1);
}
.mazeru-plate-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.mazeru-plate-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.mazeru-hint {
  margin: 4px 0 0;
  font-size: var(--fs-micro);
  color: var(--color-text-cyan-pale);
}
.mazeru-hint::before,
.mazeru-hint::after {
  content: "‹‹";
  margin: 0 8px;
  color: var(--color-text-cyan);
}
.mazeru-hint::after { content: "››"; }

.mazeru-reel-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .mazeru-reel-nav {
    position: absolute;
    top: 50%;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    translate: 0 -50%;
    border-radius: 50%;
    border: 1px solid rgba(157, 252, 255, 0.5);
    background: rgba(8, 18, 48, 0.85);
    color: var(--color-text-cyan-light);
    cursor: pointer;
  }
  .mazeru-reel-nav.prev { left: calc(50% - 200px); }
  .mazeru-reel-nav.next { right: calc(50% - 200px); }
  .mazeru-reel-nav::before {
    content: "";
    width: 10px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
  }
  .mazeru-reel-nav.prev::before { rotate: -135deg; translate: 2px 0; }
  .mazeru-reel-nav.next::before { rotate: 45deg; translate: -2px 0; }
}

/* スロット */

.mazeru-slots {
  position: absolute;
  left: 50%;
  bottom: var(--slots-y);
  translate: -50% 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(94vw, 440px);
  margin: 0;
  padding: 0;
  list-style: none;
  transition: opacity 0.35s;
}
.mazeru-stage[data-phase="intro"] .mazeru-slots { opacity: 0; }
.mazeru-stage[data-phase="crt"] .mazeru-slots,
.mazeru-stage[data-phase="reveal"] .mazeru-slots,
.mazeru-stage[data-phase="done"] .mazeru-slots { opacity: 0; }

.mazeru-slot {
  position: relative;
  aspect-ratio: 3 / 3.7;
  border-radius: 10px;
  border: 1.5px dashed rgba(157, 252, 255, 0.4);
  background: rgba(2, 10, 30, 0.55);
  box-shadow: inset 0 -10px 18px rgba(0, 169, 255, 0.18);
}
.mazeru-slot-no {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: rgba(157, 252, 255, 0.35);
}
.mazeru-stage[data-phase="select"][data-slot="0"] .mazeru-slot:nth-child(1),
.mazeru-stage[data-phase="select"][data-slot="1"] .mazeru-slot:nth-child(2),
.mazeru-stage[data-phase="select"][data-slot="2"] .mazeru-slot:nth-child(3),
.mazeru-stage[data-phase="select"][data-slot="3"] .mazeru-slot:nth-child(4) {
  border-style: solid;
  border-color: var(--color-yellow);
  box-shadow: 0 0 16px rgba(255, 210, 63, 0.4), inset 0 -10px 18px rgba(255, 210, 63, 0.15);
}
.mazeru-slot.is-filled { border-style: solid; border-color: rgba(157, 252, 255, 0.7); }
.mazeru-slot.is-filled .mazeru-slot-no { opacity: 0; }

.mazeru-plate {
  position: absolute;
  inset: 4px;
}
.mazeru-slot .mazeru-plate-face {
  height: 100%;
  padding: 6px 2px 4px;
  gap: 2px;
  justify-content: center;
}
.mazeru-slot .mazeru-plate-icon { width: 70%; height: auto; aspect-ratio: 1; }
.mazeru-slot .mazeru-plate-name { min-height: 2.4em; font-size: 0.68rem; }

.mazeru-slot.is-in .mazeru-plate {
  animation: mazeru-land 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
@keyframes mazeru-land {
  from { transform: scale(1.18); }
  55% { transform: scale(0.95); }
  to { transform: none; }
}

.mazeru-fly {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
}
.mazeru-stage.is-flying[data-phase="select"] .mazeru-fly {
  opacity: 1;
  visibility: visible;
}
.mazeru-fly .mazeru-plate-face,
.mazeru-land .mazeru-plate-face {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-color: var(--color-yellow);
  box-shadow: 0 0 22px rgba(255, 210, 63, 0.45), inset 0 0 14px rgba(0, 169, 255, 0.35);
}
.mazeru-stage.is-flying .mazeru-reel-item.is-current {
  opacity: 0.25;
}

html.mazeru-snap,
html.mazeru-snap body {
  scroll-snap-type: y mandatory;
}
.mazeru-snap-point {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  pointer-events: none;
}

.mazeru-step .mazeru-stage[data-phase="select"] .mazeru-reel-item.is-current {
  transform: translateY(calc(var(--t, 0) * 12px)) scale(1.06);
}
.mazeru-step .mazeru-slot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(255, 210, 63, 0.8), inset 0 0 16px rgba(255, 210, 63, 0.35);
  opacity: 0;
  pointer-events: none;
}
.mazeru-step .mazeru-stage[data-phase="select"][data-slot="0"] .mazeru-slot:nth-child(1)::after,
.mazeru-step .mazeru-stage[data-phase="select"][data-slot="1"] .mazeru-slot:nth-child(2)::after,
.mazeru-step .mazeru-stage[data-phase="select"][data-slot="2"] .mazeru-slot:nth-child(3)::after,
.mazeru-step .mazeru-stage[data-phase="select"][data-slot="3"] .mazeru-slot:nth-child(4)::after {
  opacity: var(--t, 0);
}

.mazeru-step .mazeru-reel.is-new > li {
  animation: mazeru-reel-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes mazeru-reel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
.mazeru-step .mazeru-step-num.is-pop {
  animation: mazeru-num-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes mazeru-num-pop {
  from { transform: scale(1.6); }
  to { transform: none; }
}
.mazeru-step .mazeru-guide-text.is-swap {
  animation: mazeru-guide-swap 0.3s ease-out both;
}
@keyframes mazeru-guide-swap {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.mazeru-land {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
}
.mazeru-land.is-on {
  opacity: 1;
  visibility: visible;
}
.mazeru-slot.is-waiting .mazeru-plate {
  opacity: 0;
  animation: none;
}

/* マゼる: 光の柱 */

.mazeru-machine {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mazeru-pillar {
  position: absolute;
  left: 50%;
  bottom: var(--slots-y);
  translate: -50% 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(94vw, 440px);
  height: calc(100% - var(--slots-y));
  opacity: 0;
}
.mazeru-pillar span {
  will-change: transform;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(0deg, rgba(157, 252, 255, 0.75), rgba(157, 252, 255, 0.25) 55%, transparent);
  box-shadow: 0 0 24px rgba(157, 252, 255, 0.45);
  transform-origin: 50% 100%;
  transform: scaleY(min(1, calc(var(--lp) * 3)));
}
.mazeru-stage[data-phase="pillar"] .mazeru-pillar {
  opacity: min(1, calc(var(--lp) * 5));
}
.mazeru-stage[data-phase="pillar"] .mazeru-slot .mazeru-plate {
  will-change: transform, opacity;
}
.mazeru-stage[data-phase="pillar"] .mazeru-slot .mazeru-plate {
  animation: none;
  transform: translateY(calc(var(--lp) * var(--lp) * -70vh)) scale(calc(1 - var(--lp) * 0.45));
  opacity: calc(1.3 - var(--lp));
}
.mazeru-stage[data-phase="pillar"] .mazeru-slot {
  border-color: rgba(157, 252, 255, 0.9);
  box-shadow: 0 0 22px rgba(157, 252, 255, 0.5), inset 0 -10px 18px rgba(157, 252, 255, 0.3);
}

.mazeru-inside .to-top {
  display: none;
}

.mazeru-stage.is-instant,
.mazeru-stage.is-instant * {
  transition: none !important;
}

.mazeru-stage.is-away * {
  animation-play-state: paused !important;
}

/* 解析: CRT */

.mazeru-crt {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -42%;
  width: min(90vw, 460px);
  min-height: 230px;
  padding: 18px 18px 20px;
  border-radius: 16px;
  border: 2px solid rgba(120, 255, 170, 0.55);
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at center, #0c3a22, #03140b 80%);
  box-shadow: 0 0 34px rgba(80, 255, 150, 0.25), inset 0 0 30px rgba(80, 255, 150, 0.18);
}
.mazeru-stage[data-phase="crt"] .mazeru-crt {
  animation: mazeru-crt-on 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes mazeru-crt-on {
  from { transform: scale(1.05, 0.02); opacity: 0.4; }
  60% { transform: scale(1, 1.04); opacity: 1; }
  to { transform: none; }
}
.mazeru-crt-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "M PLUS 1", monospace;
  font-size: 0.82rem;
  line-height: 1.75;
  color: #8dffb4;
  text-shadow: 0 0 8px rgba(141, 255, 180, 0.6);
}

/* 誕生: カプセルのリングとカード */

.mazeru-capsule {
  --cw: min(84vw, 42svh);
  --rd: min(88vw, 58svh);
  --small: 0.5;
  position: absolute;
  left: 50%;
  top: 53%;
  width: 0;
  height: 0;
}
.mazeru-rays,
.mazeru-ring,
.mazeru-sparks {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
}

.mazeru-rays {
  will-change: opacity, scale;
  width: min(170vw, 104svh);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(234, 255, 255, 0.95) 0, rgba(157, 252, 255, 0.7) 22%, rgba(0, 169, 255, 0.5) 40%, transparent 66%),
    repeating-conic-gradient(from 0deg, rgba(157, 252, 255, 0.8) 0deg 4deg, rgba(0, 169, 255, 0.3) 4deg 7deg, transparent 7deg 15deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, rgba(0, 0, 0, 0.6) 70%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 40%, rgba(0, 0, 0, 0.6) 70%, transparent 100%);
  opacity: 0;
}
.mazeru-stage[data-phase="reveal"] .mazeru-rays {
  opacity: calc(var(--lp) * 0.4);
  scale: 0.6;
}
.mazeru-stage[data-phase="done"] .mazeru-rays {
  opacity: 1;
  animation:
    mazeru-rays-in 0.6s ease-out both,
    mazeru-spin 30s linear infinite;
}
@keyframes mazeru-rays-in {
  from { opacity: 0.4; scale: 0.6; }
  to { opacity: 1; scale: 1; }
}
@keyframes mazeru-spin {
  to { rotate: 360deg; }
}

.mazeru-ring {
  width: var(--rd);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff3cd2, #9d5bff, #00a9ff, #9dfcff, var(--color-yellow), #ff3cd2);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 11px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 11px));
  filter: drop-shadow(0 0 18px rgba(255, 60, 210, 0.6));
  transform: rotate(calc(var(--lp) * 720deg));
  will-change: transform;
}
.mazeru-stage[data-phase="done"] .mazeru-ring {
  animation: mazeru-shock 0.8s cubic-bezier(0.1, 0.7, 0.3, 1) both;
}
@keyframes mazeru-shock {
  from { scale: 1; opacity: 1; }
  to { scale: 2.6; opacity: 0; }
}

.mazeru-sparks {
  width: 0;
  height: 0;
}
.mazeru-sparks span {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--z);
  height: var(--z);
  margin: calc(var(--z) / -2) 0 0 calc(var(--z) / -2);
  background: #fff;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
}
.mazeru-sparks span:nth-child(3n) { background: var(--color-yellow); }
.mazeru-sparks span:nth-child(3n + 1) { background: #9dfcff; }
.mazeru-stage[data-phase="done"] .mazeru-sparks span {
  animation: mazeru-spark 1.3s cubic-bezier(0.15, 0.8, 0.3, 1) var(--t) both;
}
@keyframes mazeru-spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(0.3); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(1) rotate(90deg); }
}

.mazeru-card {
  --flip: clamp(0, (var(--lp) - 0.3) * 2, 1);
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  aspect-ratio: 1276 / 2008;
  margin: calc(var(--cw) * -0.787) 0 0 calc(var(--cw) * -0.5);
  perspective: 1200px;
  scale: calc(var(--small) * (0.86 + var(--flip) * 0.14));
  opacity: min(1, calc(var(--lp) * 5));
  will-change: scale, opacity;
}
.mazeru-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc((1 - var(--flip)) * 180deg));
  will-change: transform;
}
.mazeru-card-inner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 6%;
  backface-visibility: hidden;
  box-shadow: 0 0 30px rgba(0, 169, 255, 0.45);
}
.mazeru-card-back { transform: rotateY(180deg); }

.mazeru-stage[data-phase="done"] .mazeru-card {
  --flip: 1;
  scale: 1;
  opacity: 1;
  animation:
    mazeru-pop 0.75s cubic-bezier(0.18, 1.5, 0.4, 1) both,
    mazeru-float 3.4s ease-in-out 0.75s infinite;
}
@keyframes mazeru-pop {
  from { scale: var(--small); }
  to { scale: 1; }
}
@keyframes mazeru-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}
.mazeru-stage[data-phase="done"] .mazeru-card-front {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 50px rgba(77, 250, 255, 0.55), 0 0 110px rgba(0, 169, 255, 0.6);
}

.mazeru-born {
  position: absolute;
  left: 0;
  top: calc(var(--cw) * -0.787 - 18px);
  translate: -50% -100%;
  margin: 0;
  white-space: nowrap;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(1.9rem, 8.6vw, 3rem);
  line-height: 1.2;
  color: var(--color-white);
  text-shadow:
    0 0 18px var(--color-shadow-blue),
    1px 0 0 rgba(255, 0, 92, 0.34),
    -1px 0 0 rgba(0, 233, 255, 0.34),
    2px 2px 0 rgba(0, 0, 0, 0.45);
  opacity: 0;
}
.mazeru-stage[data-phase="done"] .mazeru-born {
  opacity: 1;
  animation: glitch-in 620ms steps(1, end) 0.25s 1 both;
}
.mazeru-stage[data-phase="done"] .mazeru-born::before {
  content: "";
  position: absolute;
  top: 6%;
  left: 0;
  width: 9%;
  height: 88%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(157, 252, 255, 0.85) 55%, #eaffff 72%, rgba(157, 252, 255, 0.3));
  filter: blur(1px) drop-shadow(0 0 10px var(--color-text-cyan));
  animation: beam-head 620ms cubic-bezier(0.2, 0.75, 0.2, 1) 0.25s 1 both;
}
.mazeru-stage[data-phase="done"] .mazeru-born::after {
  content: "";
  position: absolute;
  top: 52%;
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: none;
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, var(--color-text-cyan-light) 18%, #fff 50%, var(--color-text-cyan-light) 82%, transparent);
  box-shadow: 0 0 12px var(--color-text-cyan);
  animation: beam-line 900ms cubic-bezier(0.2, 0.75, 0.2, 1) 0.25s 1 both;
}

.mazeru-card-shine {
  position: absolute;
  inset: 0;
  border-radius: 6%;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
.mazeru-card-shine::before {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -45%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7) 50%, transparent);
  transform: skewX(-12deg);
}
.mazeru-stage[data-phase="done"] .mazeru-card-shine { opacity: 1; }
.mazeru-stage[data-phase="done"] .mazeru-card-shine::before {
  animation: mazeru-shine 1s ease-in-out 0.45s 1 both;
}
@keyframes mazeru-shine {
  from { translate: 0 0; }
  to { translate: 450% 0; }
}

.mazeru-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 53%;
  height: 3px;
  translate: 0 -50%;
  background: linear-gradient(90deg, transparent, var(--color-text-cyan-light) 20%, #fff 50%, var(--color-text-cyan-light) 80%, transparent);
  box-shadow: 0 0 14px var(--color-text-cyan), 0 0 28px var(--color-shadow-blue);
  opacity: 0;
}
.mazeru-stage[data-phase="done"] .mazeru-beam {
  animation: mazeru-beam 0.8s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}
@keyframes mazeru-beam {
  0% { transform: scaleX(0); opacity: 1; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1) scaleY(0.3); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mazeru-kv picture img,
  html[data-kv="loop"] .mazeru-kv-loop,
  .mazeru-kv-loop img,
  .mazeru-stage[data-phase="crt"] .mazeru-crt,
  .mazeru-stage[data-phase="done"] .mazeru-rays,
  .mazeru-stage[data-phase="done"] .mazeru-ring,
  .mazeru-stage[data-phase="done"] .mazeru-sparks span,
  .mazeru-stage[data-phase="done"] .mazeru-card,
  .mazeru-stage[data-phase="done"] .mazeru-card-shine::before,
  .mazeru-stage[data-phase="done"] .mazeru-born,
  .mazeru-stage[data-phase="done"] .mazeru-born::before,
  .mazeru-stage[data-phase="done"] .mazeru-born::after,
  .mazeru-stage[data-phase="done"] .mazeru-beam {
    animation: none;
  }
  .mazeru-stage[data-phase="done"] .mazeru-ring { opacity: 0; }
}

@media (max-height: 600px) {
  .mazeru-intro-copy { font-size: clamp(1.4rem, 5vw, 2rem); }
  .mazeru-select { top: 22%; }
}

@media (prefers-reduced-motion: reduce) {
  .mazeru-intro-cue::after { animation: none; }
  .mazeru-down::before,
  .mazeru-down::after { animation: none !important; }
  .mazeru-step .mazeru-reel.is-new > li,
  .mazeru-step .mazeru-step-num.is-pop,
  .mazeru-step .mazeru-guide-text.is-swap { animation: none; }
  .mazeru-reel-item,
  .mazeru-intro,
  .mazeru-select,
  .mazeru-crt,
  .mazeru-capsule { transition: none; }
  .mazeru-slot.is-in .mazeru-plate { animation: none; }
}
