/* PUSSYCOIN v12 — 8 chapters · new scene art · full 3D motion */
:root {
  --lime: #b6ff00;
  --lime2: #d8ff66;
  --ink: #04060c;
  --panel: rgba(8, 12, 22, 0.8);
  --stroke: rgba(182, 255, 0, 0.42);
  --text: #eef6ff;
  --muted: #9bb0c9;
  --pink: #ff6ad5;
}
* {
  box-sizing: border-box;
}
html {
  overflow-x: clip;
}
html,
body {
  margin: 0;
  padding: 0;
  background: #02040a;
  color: var(--text);
  font-family: "Zen Maru Gothic", "M PLUS Rounded 1c", system-ui, sans-serif;
  overflow-x: clip;
}
img {
  max-width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
a {
  color: inherit;
  text-decoration: none;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 9999;
  background: var(--lime);
  color: #000;
  padding: 8px;
  border-radius: 999px;
}

/* BG VIDEO — untouched wiring */
.chip-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #010308;
}
.chip-bg-video,
.chip-bg-fallback,
.chip-bg-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  filter: saturate(1.4) contrast(1.18) brightness(1.05);
  transform: scale(1.12);
  animation: bgDrift 32s ease-in-out infinite alternate;
}
.chip-bg-fallback {
  z-index: 0;
}
.chip-bg-video {
  z-index: 1;
}
.chip-bg.has-video .chip-bg-fallback {
  opacity: 0;
  visibility: hidden;
}
@keyframes bgDrift {
  from {
    transform: scale(1.1);
  }
  to {
    transform: scale(1.18) translate(-1.8%, 1.2%) rotate(0.35deg);
  }
}
.chip-bg-dim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(
      ellipse 70% 60% at 50% 42%,
      rgba(4, 10, 18, 0.08),
      rgba(2, 4, 10, 0.5) 62%,
      rgba(0, 0, 0, 0.82)
    ),
    linear-gradient(
      180deg,
      rgba(2, 4, 10, 0.2),
      rgba(2, 4, 10, 0.42) 40%,
      rgba(2, 4, 10, 0.78)
    );
}
.chip-bg-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
      ellipse 90% 80% at 50% 50%,
      transparent 35%,
      rgba(0, 0, 0, 0.55)
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.35),
      transparent 18%,
      transparent 82%,
      rgba(0, 0, 0, 0.35)
    );
}
.chip-bg-grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) {
  .chip-bg-video {
    display: none;
  }
  .chip-bg-fallback {
    opacity: 1 !important;
    visibility: visible !important;
  }
  .chip-bg-video,
  .chip-bg-fallback,
  .chip-bg-gif {
    animation: none !important;
  }
}

main,
.tape,
.dock,
.toast,
.pre,
.ticker {
  position: relative;
  z-index: 2;
}

main,
.tape,
.dock,
.toast,
.pre {
  position: relative;
  z-index: 2;
}
:root {
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.2, 1.6, 0.3, 1);
}

/* ================= BUTTONS (bloom / diamond / chipcut, iridescent rims, 3D) ================= */
.btn {
  --pad-y: 12px;
  --pad-x: 22px;
  --tx: 0px;
  --ty: 0px;
  --rx: 0deg;
  --ry: 0deg;
  --s: 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Fredoka", "M PLUS Rounded 1c", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: var(--pad-y) var(--pad-x);
  border: 0;
  cursor: pointer;
  color: var(--lime);
  background: transparent;
  text-decoration: none;
  line-height: 1;
  isolation: isolate;
  overflow: hidden;
  transform: perspective(500px) translate3d(var(--tx), var(--ty), 0)
    rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  transition: transform 0.35s var(--spring), box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.55), 0 10px 24px rgba(0, 0, 0, 0.4);
  will-change: transform;
}
.btn::before {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: -2;
  background: conic-gradient(
    from 0deg,
    var(--lime),
    var(--pink),
    #6af,
    #ffe566,
    var(--lime)
  );
  animation: spinHue 4.5s linear infinite;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(160deg, #141c30, #0a1020 60%, #101828);
}
.btn .shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn:hover .shine,
.btn:focus-visible .shine {
  transform: translateX(120%);
}
.btn.lime {
  color: #06100a;
}
.btn.lime::after {
  background: linear-gradient(
    145deg,
    var(--lime2),
    var(--lime) 45%,
    #8fd400 80%,
    #c8ff44
  );
}
.btn.ghost {
  color: var(--text);
}
.btn.ghost::after {
  background: rgba(10, 14, 24, 0.85);
}
.btn.xl {
  --pad-y: 18px;
  --pad-x: 36px;
  font-size: 1.25rem;
}
.btn.sm {
  --pad-y: 9px;
  --pad-x: 14px;
  font-size: 0.85rem;
}
.btn.pill,
.btn.bloom {
  border-radius: 999px;
}
.btn.bloom {
  box-shadow: 0 6px 0 #4d6b00, 0 14px 40px rgba(182, 255, 0, 0.35);
}
.btn.bloom.lime {
  box-shadow: 0 6px 0 #3f5800, 0 16px 46px rgba(182, 255, 0, 0.55),
    0 0 0 5px rgba(182, 255, 0, 0.14);
}
.btn:hover {
  --s: 1.06;
  filter: brightness(1.08);
}
.btn:active,
.btn.pressed {
  --s: 0.94;
  --ty: 4px !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4) !important;
  transition-duration: 0.08s;
}
.btn:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}
.btn.diamond {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 11px;
  --rz: 45deg;
  transform: perspective(500px) translate3d(var(--tx), var(--ty), 0)
    rotateX(var(--rx)) rotateY(var(--ry)) rotate(45deg) scale(var(--s));
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}
.btn.diamond > span {
  transform: rotate(-45deg);
}
.btn.chipcut {
  border-radius: 4px;
  clip-path: polygon(
    0 14%,
    10% 0,
    88% 0,
    100% 12%,
    100% 86%,
    90% 100%,
    12% 100%,
    0 88%
  );
}
.btn.slam {
  animation: slamBeat 0.36s var(--spring);
}
@keyframes slamBeat {
  35% {
    scale: 0.86;
  }
  70% {
    scale: 1.1;
  }
}
.btn.mega-buy {
  --pad-y: 22px;
  --pad-x: 48px;
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  animation: limePulse 2.6s ease-in-out infinite;
}
@keyframes spinHue {
  to {
    transform: rotate(360deg);
  }
}
@keyframes limePulse {
  50% {
    scale: 1.035;
  }
}
.burst {
  position: fixed;
  z-index: 400;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  background: var(--c, #b6ff00);
  box-shadow: 0 0 10px var(--c, #b6ff00);
  animation: burst 0.7s var(--ease) forwards;
}
@keyframes burst {
  from {
    transform: translate(-50%, -50%) translate3d(0, 0, 0) rotate(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) translate3d(var(--dx), var(--dy), 0)
      rotate(540deg) scale(0.2);
    opacity: 0;
  }
}

/* ================= PRELOADER — spinning 3D cube ================= */
.pre {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #04060c;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  transition: opacity 0.6s, visibility 0.6s, transform 0.8s var(--ease);
  perspective: 800px;
}
.pre.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.15);
}
.pre-cube {
  width: 90px;
  height: 90px;
  position: relative;
  transform-style: preserve-3d;
  animation: cube 3s linear infinite;
}
.pre-cube i {
  position: absolute;
  inset: 0;
  border: 2px solid var(--lime);
  background: rgba(182, 255, 0, 0.08) url(/assets/chips3d/die.webp) center/70%
    no-repeat;
  box-shadow: 0 0 24px rgba(182, 255, 0, 0.45) inset;
}
.pre-cube i:nth-child(1) {
  transform: translateZ(45px);
}
.pre-cube i:nth-child(2) {
  transform: rotateY(180deg) translateZ(45px);
}
.pre-cube i:nth-child(3) {
  transform: rotateY(90deg) translateZ(45px);
}
.pre-cube i:nth-child(4) {
  transform: rotateY(-90deg) translateZ(45px);
}
.pre-cube i:nth-child(5) {
  transform: rotateX(90deg) translateZ(45px);
}
.pre-cube i:nth-child(6) {
  transform: rotateX(-90deg) translateZ(45px);
}
@keyframes cube {
  to {
    transform: rotateX(360deg) rotateY(720deg);
  }
}
.pre-k {
  font-family: "Fredoka", sans-serif;
  letter-spacing: 0.18em;
  color: var(--lime);
  font-size: 12px;
}
.pre-n {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-weight: 800;
  font-size: clamp(56px, 12vw, 88px);
  color: var(--lime);
  line-height: 1;
  text-shadow: 0 0 28px rgba(182, 255, 0, 0.45);
}

/* ================= TAPE NAV — gentle 3D sway ================= */
.tape {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  background: repeating-linear-gradient(
    -12deg,
    rgba(182, 255, 0, 0.12) 0 8px,
    rgba(10, 14, 24, 0.9) 8px 18px
  );
  border: 2px dashed rgba(182, 255, 0, 0.55);
  border-radius: 4px 20px 6px 24px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(182, 255, 0, 0.15);
  backdrop-filter: none;
  transform: perspective(900px) rotateX(4deg) rotateZ(-0.6deg);
  transform-origin: top;
  animation: sway 7s ease-in-out infinite;
}
@keyframes sway {
  50% {
    transform: perspective(900px) rotateX(-3deg) rotateY(1.5deg) rotateZ(0.5deg);
  }
}
.tape-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lime);
}
.tape-logo img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--lime);
  animation: coinSpin 6s linear infinite;
}
@keyframes coinSpin {
  to {
    transform: rotateY(360deg);
  }
}
.tape-chapters {
  display: flex;
  gap: 4px;
  perspective: 400px;
}
.tape-chapters a {
  font-family: "Fredoka";
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 7px;
  border-radius: 7px;
  background: rgba(182, 255, 0, 0.08);
  border: 1px solid rgba(182, 255, 0, 0.35);
  transition: transform 0.35s var(--spring), background 0.2s;
  display: inline-block;
}
.tape-chapters a:hover,
.tape-chapters a.on {
  transform: translateZ(30px) rotateX(-20deg);
  background: var(--lime);
  color: #06100a;
}
.tape-cta {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ================= LAYOUT ================= */
.story {
  padding-top: 96px;
}
.ch {
  position: relative;
  padding: clamp(60px, 9vw, 130px) clamp(16px, 5vw, 70px);
  overflow: clip;
  perspective: 1400px;
  --sp: 0;
}
.stage {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  gap: clamp(18px, 3vw, 40px);
  transform-style: preserve-3d;
}
.stage > * {
  transform-style: preserve-3d;
}

/* chapter-specific grids */
.hero .stage {
  grid-template-columns: 1fr 1.15fr;
  align-items: center;
  min-height: calc(100vh - 140px);
}
.lay-r .stage {
  grid-template-columns: 1.3fr 1fr;
  grid-template-areas: "head head" "scene body";
}
.lay-l .stage {
  grid-template-columns: 1fr 1.3fr;
  grid-template-areas: "head head" "body scene";
}
.lay-r .ch-head,
.lay-l .ch-head,
.lay-duo .ch-head,
.lay-memo .ch-head,
.lay-wide .ch-head,
.lay-poster .ch-head {
  grid-area: head;
}
.lay-r .scene,
.lay-l .scene {
  grid-area: scene;
}
.lay-r .ch-body,
.lay-l .ch-body {
  grid-area: body;
  align-self: center;
}
.lay-l .ch-head {
  justify-self: end;
  text-align: right;
}
.lay-duo .stage {
  grid-template-columns: 1.2fr 1fr;
  grid-template-areas: "head sB" "sA sB" "sA body";
}
.lay-duo .sA {
  grid-area: sA;
}
.lay-duo .sB {
  grid-area: sB;
  align-self: end;
  margin-top: 40px;
}
.lay-duo .ch-body {
  grid-area: body;
}
.lay-wide .stage {
  grid-template-columns: repeat(12, 1fr);
  grid-template-areas: "head head head head head head head head head head head head" "scene scene scene scene scene scene scene scene scene scene scene scene";
}
.lay-wide .scene {
  grid-area: scene;
}
.lay-wide .ch-body {
  grid-column: 7/13;
  grid-row: 3;
  margin-top: -140px;
  z-index: 3;
}
.lay-memo .stage {
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "head head" "scene memo";
}
.lay-memo .scene {
  grid-area: scene;
  transform: rotateZ(-2deg);
}
.lay-memo .memo {
  grid-area: memo;
  margin-left: -60px;
  margin-top: 80px;
  z-index: 3;
}
.lay-poster .stage {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: "head head sB" "sA body body" "sA body body";
}
.lay-poster .sA {
  grid-area: sA;
}
.lay-poster .sB {
  grid-area: sB;
}
.lay-poster .ch-body {
  grid-area: body;
  align-self: center;
}

/* ================= 3D TITLES — extruded + boot reveal ================= */
.ch-head {
  position: relative;
  z-index: 4;
}
.ch-num {
  display: inline-block;
  font-family: "Fredoka";
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: 0.9rem;
  color: #06100a;
  background: var(--lime);
  padding: 6px 12px;
  border-radius: 6px 16px 6px 16px;
  box-shadow: 0 0 22px rgba(182, 255, 0, 0.5);
  transform: rotateZ(-4deg) translateZ(40px);
}
.t3d {
  position: relative;
  margin: 0.25em 0 0;
  font-family: "M PLUS Rounded 1c", "Zen Maru Gothic", sans-serif;
  font-weight: 800;
  line-height: 0.95;
  color: #f4ffe0;
  text-shadow: 0 1px 0 #a8ec00, 0 2px 0 #96d400, 0 3px 0 #84bc00,
    0 4px 0 #72a300, 0 5px 0 #608a00, 0 6px 0 #4e7100, 0 7px 0 #3c5800,
    0 10px 18px rgba(0, 0, 0, 0.6), 0 0 40px rgba(182, 255, 0, 0.35);
  transform: rotateX(calc(var(--sp) * 14deg)) rotateY(calc(var(--sp) * -6deg))
    translateZ(30px);
  transform-style: preserve-3d;
}
.t3d::before,
.t3d::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.ch.in .t3d::before {
  animation: glitchA 2.4s steps(1) 0.6s 1;
  color: var(--pink);
  mix-blend-mode: screen;
}
.ch.in .t3d::after {
  animation: glitchB 2.4s steps(1) 0.6s 1;
  color: #6af;
  mix-blend-mode: screen;
}
@keyframes glitchA {
  0%,
  100% {
    opacity: 0;
  }
  10% {
    opacity: 0.9;
    transform: translate(-6px, 2px);
    clip-path: inset(10% 0 60% 0);
  }
  20% {
    opacity: 0.9;
    transform: translate(5px, -2px);
    clip-path: inset(55% 0 10% 0);
  }
  30% {
    opacity: 0;
  }
}
@keyframes glitchB {
  0%,
  100% {
    opacity: 0;
  }
  12% {
    opacity: 0.9;
    transform: translate(6px, -1px);
    clip-path: inset(30% 0 40% 0);
  }
  24% {
    opacity: 0.9;
    transform: translate(-4px, 3px);
    clip-path: inset(70% 0 5% 0);
  }
  34% {
    opacity: 0;
  }
}
.ch-title {
  font-size: clamp(2.1rem, 6.2vw, 5.2rem);
  max-width: 16ch;
}
.mega {
  font-size: clamp(3.4rem, 11vw, 9.5rem);
  letter-spacing: -0.02em;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.1em;
}
.mega .mega-b {
  color: var(--lime);
  text-shadow: 0 1px 0 #fff, 0 2px 0 #e8ffb0, 0 3px 0 #c6f05a, 0 4px 0 #9ccd00,
    0 5px 0 #78a000, 0 6px 0 #557300, 0 8px 0 #2f4200,
    0 14px 26px rgba(0, 0, 0, 0.6), 0 0 60px rgba(182, 255, 0, 0.6);
}
.boot-ch {
  display: inline-block;
  transform-origin: 50% 100%;
  transform: rotateX(-100deg) translateZ(0);
  opacity: 0;
  transition: transform 0.9s var(--spring), opacity 0.4s;
  transition-delay: calc(var(--i) * 38ms + 150ms);
  white-space: pre;
}
.ch.in .boot-ch {
  transform: none;
  opacity: 1;
}

/* ================= SCENE CARDS — layered 3D planes, tilt, rim light ================= */
.scene {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  position: relative;
  margin: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s var(--ease);
  will-change: transform;
}
.scene.tilting {
  transition: transform 0.08s linear;
}
.scene-frame {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  transform: translateZ(0);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(182, 255, 0, 0.5),
    0 0 50px rgba(182, 255, 0, 0.25);
}
.scene-frame::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 3;
  border-radius: inherit;
  padding: 3px;
  background: conic-gradient(
    from var(--ang, 0deg),
    var(--lime),
    var(--pink),
    #6af,
    #ffe566,
    var(--lime)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
@property --ang {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@keyframes rimSpin {
  to {
    --ang: 360deg;
  }
}
.scene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.14)
    translate3d(var(--px, 0px), calc(var(--sp) * -34px + var(--py, 0px)), 0);
  transition: transform 0.5s var(--ease);
}
.scene.tilting .scene-img {
  transition: transform 0.08s linear;
}
.scene-scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0 2px,
    transparent 2px 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}
.scene-scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(182, 255, 0, 0.18),
    transparent
  );
  animation: scan 4.5s linear infinite;
}
@keyframes scan {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(400%);
  }
}
.scene-rim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--mx) var(--my),
    rgba(220, 255, 140, 0.35),
    transparent 45%
  );
  mix-blend-mode: screen;
}
.scene-cap {
  position: absolute;
  left: 14px;
  bottom: -16px;
  z-index: 5;
  font-family: "Fredoka";
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: #06100a;
  background: var(--lime);
  padding: 7px 12px;
  border-radius: 4px;
  transform: translateZ(70px) rotateZ(-2deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.pop {
  position: absolute;
  z-index: 6;
  transform: translateZ(var(--z, 60px)) rotateZ(var(--r, 0deg));
}
.sticker {
  font-family: "Fredoka";
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 8px 12px;
  border-radius: 999px;
  background: #0a1020;
  color: var(--lime);
  border: 2px solid var(--lime);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 18px rgba(182, 255, 0, 0.35);
  white-space: nowrap;
}
.sticker.pink {
  color: var(--pink);
  border-color: var(--pink);
}
.sticker.soft {
  color: #ffe0f4;
  border-color: #ffb3e3;
}
.sticker.stamp {
  font-size: 1.4rem;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(255, 40, 80, 0.12);
  color: #ff3d6e;
  border: 3px solid #ff3d6e;
  letter-spacing: 0.2em;
}
.scene .pop.sticker {
  top: 10%;
  right: -12px;
}
.scene .pop.sticker + .pop.sticker {
  top: auto;
  bottom: 18%;
  right: auto;
  left: -14px;
}
.s-hero .pop.live {
  top: auto;
  bottom: 12%;
  left: -16px;
  right: auto;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  margin-right: 6px;
  box-shadow: 0 0 10px var(--lime);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0.2;
  }
}
.chip-pop {
  width: clamp(70px, 10vw, 130px);
  top: -40px;
  right: 8%;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 20px rgba(182, 255, 0, 0.5));
}
.spin3d {
  animation: spin3d 7s linear infinite;
}
.spin3d.slow {
  animation-duration: 12s;
  top: auto;
  bottom: -30px;
  right: auto;
  left: 6%;
}
@keyframes spin3d {
  from {
    transform: translateZ(var(--z)) rotateY(0) rotateX(12deg);
  }
  to {
    transform: translateZ(var(--z)) rotateY(360deg) rotateX(12deg);
  }
}

/* shapes */
.shape-chip .scene-frame {
  border-radius: 6px;
  clip-path: polygon(
    0 6%,
    6% 0,
    94% 0,
    100% 6%,
    100% 94%,
    94% 100%,
    6% 100%,
    0 94%
  );
}
.shape-chip .scene-frame,
.shape-round .scene-frame,
.shape-wide .scene-frame,
.shape-slant .scene-frame {
  aspect-ratio: 4/3;
}
.shape-round .scene-frame {
  border-radius: 40px 8px 40px 8px;
}
.shape-wide .scene-frame {
  aspect-ratio: 16/8;
  border-radius: 28px;
}
.shape-slant .scene-frame {
  clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
  border-radius: 0;
}
.shape-phone .scene-frame {
  aspect-ratio: 4/3;
  border-radius: 36px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 10px #0c1222,
    0 0 0 12px rgba(255, 179, 227, 0.6), 0 0 60px rgba(255, 106, 213, 0.25);
}
.shape-poster .scene-frame {
  aspect-ratio: 3/4;
  border-radius: 12px;
}
.shape-coin .scene-frame {
  aspect-ratio: 1;
  border-radius: 50%;
}
.shape-coin {
  animation: coinWobble 6s ease-in-out infinite;
}
@keyframes coinWobble {
  50% {
    transform: rotateY(18deg) rotateX(-8deg);
  }
}
.lay-duo .sB .scene-frame {
  aspect-ratio: 16/9;
}

/* orbiting chips */
.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(70deg) rotateZ(0);
  animation: orbit 14s linear infinite;
  z-index: 7;
  pointer-events: none;
}
.orbit img {
  position: absolute;
  width: clamp(56px, 7vw, 96px);
  left: calc(clamp(56px, 7vw, 96px) / -2);
  top: calc(clamp(56px, 7vw, 96px) / -2);
  filter: drop-shadow(0 0 14px rgba(182, 255, 0, 0.6));
}
.orbit img:nth-child(1) {
  transform: rotateZ(0deg) translateX(min(34vw, 330px)) rotateX(-70deg);
}
.orbit img:nth-child(2) {
  transform: rotateZ(120deg) translateX(min(34vw, 330px)) rotateZ(-120deg)
    rotateX(-70deg);
}
.orbit img:nth-child(3) {
  transform: rotateZ(240deg) translateX(min(34vw, 330px)) rotateZ(-240deg)
    rotateX(-70deg);
}
.o-final img:nth-child(n) {
  width: 64px;
}
.o-final {
  animation-duration: 10s;
}
@keyframes orbit {
  from {
    transform: rotateX(70deg) rotateZ(0);
  }
  to {
    transform: rotateX(70deg) rotateZ(360deg);
  }
}

/* redaction bars */
.bars {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.bars i {
  position: absolute;
  height: 9%;
  background: #000;
  box-shadow: 0 0 0 1px rgba(182, 255, 0, 0.4);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.9s var(--ease);
}
.bars i:nth-child(1) {
  left: 6%;
  top: 14%;
  width: 34%;
  transition-delay: 0.8s;
}
.bars i:nth-child(2) {
  right: 8%;
  left: auto;
  top: 58%;
  width: 28%;
  transition-delay: 1s;
  transform-origin: right;
}
.bars i:nth-child(3) {
  left: 20%;
  bottom: 8%;
  width: 22%;
  transition-delay: 1.2s;
}
.ch.in .bars i {
  transform: scaleX(1);
}

/* ================= PANELS — 3D tilt + shine ================= */
.panel {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: clamp(18px, 2.6vw, 30px);
  border-radius: 20px 6px 22px 8px;
  background: linear-gradient(
    150deg,
    rgba(14, 22, 38, 0.92),
    rgba(6, 10, 20, 0.88)
  );
  border: 1px solid rgba(182, 255, 0, 0.4);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 40px rgba(182, 255, 0, 0.12);
  backdrop-filter: blur(8px);
  transform: translateZ(50px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s var(--ease);
  transform-style: preserve-3d;
}
.panel.tilting {
  transition: transform 0.08s linear;
}
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
      circle at var(--mx) var(--my),
      rgba(182, 255, 0, 0.16),
      transparent 50%
    ),
    linear-gradient(
        115deg,
        transparent 40%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 60%
      )
      no-repeat;
  background-size: 100% 100%, 250% 100%;
  background-position: 0 0, 150% 0;
  transition: background-position 1.2s var(--ease);
}
.ch.in .panel::after,
.panel:hover::after {
  background-position: 0 0, -150% 0;
}
.panel p {
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  line-height: 1.7;
  color: #dbe8f7;
  margin: 0.6em 0;
}
.panel b {
  color: var(--lime);
}
.ch-kicker {
  font-family: "Fredoka";
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem !important;
  color: var(--lime) !important;
  margin-top: 0 !important;
}
.punch {
  font-family: "M PLUS Rounded 1c";
  font-weight: 800;
  font-size: clamp(1.1rem, 1.7vw, 1.4rem) !important;
  color: #fff !important;
  border-left: 4px solid var(--lime);
  padding-left: 12px;
  transform: translateZ(30px);
}
.panel.soft {
  border-color: rgba(255, 179, 227, 0.5);
}
.panel.soft .punch {
  border-color: #ffb3e3;
}
.panel.hot {
  border-color: var(--lime);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55), 0 0 60px rgba(182, 255, 0, 0.3);
}
.panel-label {
  font-family: "Fredoka";
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}
.memo {
  background: linear-gradient(160deg, #f3f7e8, #dfe8cc);
  color: #162010;
  border: 0;
  border-radius: 4px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 12px 12px 0 rgba(182, 255, 0, 0.4);
}
.memo p {
  color: #1f2c14;
}
.memo .punch {
  color: #000 !important;
  border-color: #5d8a00;
}
.memo h3 {
  font-family: "M PLUS Rounded 1c";
  font-weight: 800;
  font-size: 1.8rem;
  margin: 0.3em 0;
}
.memo-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Fredoka";
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  border-bottom: 2px dashed #5d8a00;
  padding-bottom: 10px;
}
.pill-tag {
  background: #ff3d6e;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
}

/* hero */
.status-chip {
  display: inline-block;
  font-family: "Fredoka";
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--lime);
  border: 1px solid var(--lime);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(182, 255, 0, 0.08);
  transform: translateZ(40px);
}
.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  color: #dbe8f7;
  max-width: 34ch;
  transform: translateZ(20px);
}
.lede b {
  color: var(--lime);
}
.ca-scrap {
  margin-top: 18px;
  max-width: 560px;
}
.ca-addr,
.ca-inline {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  color: var(--lime);
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(182, 255, 0, 0.5);
  padding: 10px 14px;
  border-radius: 10px;
  margin: 8px 0 14px;
  letter-spacing: 0.12em;
}
.hero-actions,
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  transform: translateZ(40px);
  transform-style: preserve-3d;
}
.anti {
  font-size: 0.82rem !important;
  color: var(--muted) !important;
  margin-bottom: 0 !important;
}
.cta-stack {
  display: grid;
  gap: 16px;
  justify-items: start;
  margin-top: 14px;
}

/* ================= 3D MARQUEE BANDS ================= */
.band {
  position: relative;
  z-index: 2;
  overflow: clip;
  padding: 24px 0;
  perspective: 700px;
}
.band-track {
  display: flex;
  width: max-content;
  font-family: "M PLUS Rounded 1c";
  font-weight: 800;
  font-size: clamp(1.3rem, 3.4vw, 2.4rem);
  color: #06100a;
  background: var(--lime);
  padding: 12px 0;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.45), 0 0 40px rgba(182, 255, 0, 0.4);
  animation: marq 26s linear infinite;
  transform-origin: center;
}
.band-track span {
  white-space: nowrap;
  padding-right: 1em;
}
.b1 {
  transform: rotateZ(-2.5deg);
}
.b1 .band-track {
  --tilt: rotateX(28deg) rotateY(-8deg);
}
.b2 {
  transform: rotateZ(2deg);
}
.b2 .band-track {
  --tilt: rotateX(-24deg) rotateY(10deg);
  background: #0a1020;
  color: var(--lime);
  border-block: 2px solid var(--lime);
}
.b3 {
  transform: rotateZ(-1.5deg);
}
.b3 .band-track {
  --tilt: rotateX(30deg) rotateY(6deg);
  background: var(--pink);
  color: #1a0414;
}
.b4 {
  transform: rotateZ(2.5deg);
}
.b4 .band-track {
  --tilt: rotateX(-30deg) rotateY(-8deg);
  background: #000;
  color: #fff;
  border-block: 2px solid #ff3d6e;
}
.band.rev .band-track {
  animation-direction: reverse;
}
@keyframes marq {
  from {
    transform: var(--tilt) translateX(0);
  }
  to {
    transform: var(--tilt) translateX(-50%);
  }
}

/* ================= PER-CHAPTER 3D ENTRANCES ================= */
.ch .stage > * {
  transition: transform 1.3s var(--ease), opacity 0.9s ease, filter 1s ease;
  transition-delay: calc(var(--k, 0) * 120ms);
}
.ch .stage > *:nth-child(2) {
  --k: 1;
}
.ch .stage > *:nth-child(3) {
  --k: 2;
}
.ch .stage > *:nth-child(4) {
  --k: 3;
}
.ch:not(.in) .stage > * {
  opacity: 0;
  filter: none;
}
.ch[data-enter="fold"]:not(.in) .stage > * {
  transform: rotateX(-80deg) translateZ(-200px);
  transform-origin: 50% 0;
}
.ch[data-enter="flip"]:not(.in) .stage > * {
  transform: rotateY(85deg) translateZ(-150px);
}
.ch[data-enter="push"]:not(.in) .stage > * {
  transform: translateZ(-900px) rotateX(20deg);
}
.ch[data-enter="swing"]:not(.in) .stage > * {
  transform: rotateY(-70deg) translateX(-120px);
  transform-origin: 0 50%;
}
.ch[data-enter="drop"]:not(.in) .stage > * {
  transform: translateY(-260px) rotateX(70deg) rotateZ(-8deg);
}
.ch[data-enter="spiral"]:not(.in) .stage > * {
  transform: rotateZ(-25deg) rotateY(50deg) translateZ(-500px);
}
.ch[data-enter="zoom"]:not(.in) .stage > * {
  transform: translateZ(500px) rotateX(-10deg);
}
.ch[data-enter="rise"]:not(.in) .stage > * {
  transform: translateY(240px) rotateX(-60deg) scale(0.8);
}
.ch[data-enter="tunnel"]:not(.in) .stage > * {
  transform: translateZ(-1400px) rotateZ(-20deg);
}
/* restore element's own transforms after entrance */
.ch.in .stage > .panel {
  transform: translateZ(50px) rotateX(var(--rx)) rotateY(var(--ry));
}
.ch.in .stage > .scene {
  transform: rotateX(var(--rx)) rotateY(var(--ry));
}
.lay-memo.in .stage > .scene {
  transform: rotateZ(-2deg) rotateX(var(--rx)) rotateY(var(--ry));
}
.ch.in .stage > .scene.tilting,
.ch.in .stage > .panel.tilting {
  transition: transform 0.08s linear;
}
/* scroll depth: the scene floats against scroll */
.ch.in .stage > .ch-head {
  transform: translateZ(calc(var(--sp) * -80px + 20px));
}

/* ================= FOOTER / DOCK / TOAST ================= */
.foot {
  position: relative;
  z-index: 2;
  padding: 80px 20px 140px;
  text-align: center;
  display: grid;
  gap: 22px;
  justify-items: center;
  perspective: 900px;
}
.foot-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid var(--lime);
  box-shadow: 0 0 40px rgba(182, 255, 0, 0.5);
  animation: coinSpin 5s linear infinite;
}
.foot-chapters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.foot-chapters a {
  font-family: "Fredoka";
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(182, 255, 0, 0.4);
  transition: transform 0.35s var(--spring), background 0.2s;
}
.foot-chapters a:hover {
  transform: translateZ(40px) rotateX(-18deg);
  background: var(--lime);
  color: #06100a;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.tiny {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.6;
}
.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 95;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.9);
  border: 2px solid rgba(182, 255, 0, 0.5);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(182, 255, 0, 0.2);
  backdrop-filter: blur(8px);
  transform: translateX(-50%) perspective(700px) rotateX(10deg);
  animation: dockSway 6s ease-in-out infinite;
  transition: opacity 0.4s, translate 0.5s var(--ease);
}
@keyframes dockSway {
  50% {
    transform: translateX(-50%) perspective(700px) rotateX(-6deg) rotateY(4deg);
  }
}
.dock.hide {
  opacity: 0;
  translate: 0 140%;
  pointer-events: none;
}
.toast {
  position: fixed;
  left: 50%;
  top: 84px;
  z-index: 500;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--lime);
  color: #06100a;
  font-family: "Fredoka";
  font-weight: 700;
  opacity: 0;
  transform: translateX(-50%) perspective(600px) rotateX(-90deg);
  transform-origin: top;
  transition: transform 0.5s var(--spring), opacity 0.3s;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) perspective(600px) rotateX(0);
}
.toast.fail {
  background: #ff3d6e;
  color: #fff;
}

/* ================= RESPONSIVE (phone-first fallbacks) ================= */
@media (max-width: 900px) {
  .tape-chapters {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }
  .tape-chapters a {
    flex: 1;
    text-align: center;
    padding: 6px 0;
  }
  .story {
    padding-top: 124px;
  }
  .hero .stage,
  .lay-r .stage,
  .lay-l .stage,
  .lay-duo .stage,
  .lay-memo .stage,
  .lay-poster .stage,
  .lay-wide .stage {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }
  .stage > * {
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .hero .stage {
    min-height: 0;
  }
  .hero .scene {
    order: -1;
  }
  .lay-l .ch-head {
    justify-self: start;
    text-align: left;
  }
  .lay-wide .ch-body {
    margin-top: -40px;
    margin-left: 16px;
  }
  .lay-memo .memo {
    margin: -40px 0 0 14px;
  }
  .lay-duo .sB {
    margin-top: 0;
    width: 86%;
    justify-self: end;
    margin-top: -30px;
  }
  .lay-poster .sB {
    width: 62%;
    justify-self: end;
    margin-top: -80px;
    z-index: 8;
  }
  .lay-poster .sA {
    width: 92%;
  }
  .orbit img:nth-child(1) {
    transform: rotateZ(0deg) translateX(42vw) rotateX(-70deg);
  }
  .orbit img:nth-child(2) {
    transform: rotateZ(120deg) translateX(42vw) rotateZ(-120deg) rotateX(-70deg);
  }
  .orbit img:nth-child(3) {
    transform: rotateZ(240deg) translateX(42vw) rotateZ(-240deg) rotateX(-70deg);
  }
  .scene .pop.sticker {
    right: -4px;
  }
  .scene .pop.sticker + .pop.sticker,
  .s-hero .pop.live {
    left: -4px;
  }
  .ch {
    perspective: 900px;
  }
  .tape-cta .btn.diamond {
    width: 36px;
    height: 36px;
  }
  .dock .btn {
    font-size: 0.85rem;
  }
}
@media (max-width: 420px) {
  .tape-logo span {
    display: none;
  }
  .tape-cta {
    gap: 7px;
  }
  .btn.xl {
    --pad-x: 24px;
    font-size: 1.05rem;
  }
}

/* paused offscreen */
.ch.off .orbit,
.ch.off .spin3d,
.ch.off .scene-scan::after,
.ch.off .scene-frame::before,
.ch.off .shape-coin {
  animation-play-state: paused;
}

/* ================= REDUCED MOTION — full fallback ================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .ch .stage > *,
  .ch:not(.in) .stage > * {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  .boot-ch {
    opacity: 1 !important;
    transform: none !important;
  }
  .scene,
  .panel,
  .t3d,
  .tape,
  .dock,
  .band,
  .band-track,
  .scene-img {
    transform: none !important;
  }
  .dock {
    transform: translateX(-50%) !important;
  }
  .orbit {
    display: none;
  }
  .bars i {
    transform: scaleX(1) !important;
  }
}

/* Preserve reveal transition until settled; do not restart delayed entrances on every gyro frame. */
.ch.settled .stage > * {
  transition-delay: 0s;
}
.ch.settled .stage > .scene,
.ch.settled .stage > .panel {
  transition: transform 0.45s var(--ease);
  transition-delay: 0s;
}
.ch.in .stage > .scene.tilting,
.ch.in .stage > .panel.tilting {
  transition: transform 0.08s linear;
  transition-delay: 0s;
}
@media (max-width: 900px) {
  .ch.settled .stage > .scene,
  .ch.settled .stage > .panel,
  .ch.settled .scene-img {
    transition: none;
  }
}

.boot-word {
  display: inline-block;
  white-space: nowrap;
}
.hero {
  padding-top: 40px;
  padding-bottom: 60px;
}
.hero .stage {
  min-height: calc(100svh - 220px);
}
@media (min-width: 901px) {
  .ch08 .sB {
    width: min(100%, 260px);
    justify-self: end;
  }
  .ch08 .ch-title {
    font-size: clamp(2.5rem, 5vw, 4.7rem);
    max-width: 18ch;
  }
}
@media (max-width: 900px) {
  .hero {
    padding-top: 36px;
  }
  .hero .stage {
    min-height: 0;
  }
  .hero .scene .pop.sticker {
    font-size: 0.65rem;
    padding: 6px 8px;
    right: 4px;
  }
  .hero .scene .pop.live {
    left: 4px;
    right: auto;
  }
}

.ambient-off .band-track,
.ambient-off .foot-logo {
  animation-play-state: paused;
}

/* Reduced motion uses the static poster, never animated GIF/WebP fallbacks. */
@media (prefers-reduced-motion: reduce) {
  .chip-bg-video,
  .chip-bg-fallback {
    display: none !important;
  }
  .chip-bg {
    background: #010308 url("/assets/bg/nvidia-chip-poster.jpg") center 45% /
      cover no-repeat;
  }
}

/* v13 — generated scene footage keeps the same 3D/parallax plane as the stills. */
.scene-video {
  display: block;
  object-fit: cover;
  pointer-events: none;
}
.scene-poster {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}
.scene-video[data-failed] + .scene-poster {
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .scene-video {
    display: none !important;
  }
  .scene-poster {
    display: block !important;
  }
}
