/* =====================================================================
   J1407B · Real-Time WebGL2 Genesis Trilogy Stage (V20)
   Wide Luxury Typography · Poetic Single-Line Beats · Zero 9px Micro-Text
   ===================================================================== */

/* ---------------------------------------------------------------------
   Minimal Orbital Crosshair Cursor & Right-Edge 5-Act Story Rail
   --------------------------------------------------------------------- */
.has-custom-cursor,
.has-custom-cursor * { cursor: none !important; }

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 960;
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: transform;
}
.cursor-dot {
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--flame);
}
.cursor-ring {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 1px solid rgba(var(--flame-rgb), 0.72);
  transition: width 0.22s var(--ease-expo), height 0.22s var(--ease-expo),
              margin 0.22s var(--ease-expo), border-color 0.2s ease, opacity 0.2s ease;
}
.cursor-ring.is-hover {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
}
.cursor-ring.is-drag {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-color: var(--gold);
}
.cursor-ring.is-cyan {
  border-color: rgba(140, 226, 255, 0.80);
}

/* Whisper-thin right-edge 5-act story progress rail */
.depth-needle {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 450;
  width: 16px;
  height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: auto;
  transition: opacity 0.6s var(--ease-cinema);
}
.depth-needle.is-intro-hidden {
  opacity: 0;
  pointer-events: none;
  transition: none;
}
.depth-rail-line {
  position: absolute;
  right: 1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(246, 241, 232, 0.14);
  pointer-events: none;
}
.depth-needle-thumb {
  position: absolute;
  right: 0;
  top: 0;
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--flame));
  box-shadow: 0 0 12px rgba(var(--flame-rgb), 0.55);
  pointer-events: none;
  will-change: transform;
}
.depth-tick {
  position: relative;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  opacity: 0.44;
  transition: opacity 0.22s ease;
}
.depth-tick::before {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s var(--ease-expo);
}
.depth-tick::after {
  content: "";
  width: 6px;
  height: 1px;
  background: var(--ink-light);
  transition: width 0.24s var(--ease-expo), background-color 0.2s ease;
}
.depth-tick:hover,
.depth-tick.is-active {
  opacity: 1;
}
.depth-tick:hover::before {
  opacity: 0.95;
  transform: translateY(-50%) translateX(0);
}
.depth-tick:hover::after,
.depth-tick.is-active::after {
  width: 13px;
  background: var(--gold);
}

/* ---------------------------------------------------------------------
   Whisper-Clean Top Corner Framing + Minimal Audio Waveform Toggle
   --------------------------------------------------------------------- */
.site-frame {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  padding: 28px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-light);
  pointer-events: none;
  transition: opacity 0.6s var(--ease-cinema);
}
.site-frame.is-intro-hidden { opacity: 0; transition: none; }
.site-frame a,
.site-frame button { pointer-events: auto; }
.frame-brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28em;
}
.frame-right {
  display: inline-flex;
  align-items: center;
  gap: 24px;
}
.frame-gh {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--ink-light);
  opacity: 0.86;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.frame-gh:hover { opacity: 1; color: var(--gold); }

/* Minimal 4-bar audio waveform toggle (supports click + drag-and-drop local audio!) */
.audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 28px;
  height: 22px;
  opacity: 0.56;
  transition: opacity 0.22s ease, transform 0.22s var(--ease-expo);
}
.audio-toggle:hover,
.audio-toggle.is-playing,
.audio-toggle.is-drop {
  opacity: 1;
}
.audio-toggle.is-armed {
  opacity: 0.85;
}
.audio-toggle.is-armed i {
  background: var(--gold);
}
.audio-toggle.is-drop {
  transform: scale(1.22);
}
.audio-toggle i {
  display: block;
  width: 1.6px;
  height: 6px;
  border-radius: 1px;
  background: var(--ink-light);
  transition: height 0.22s ease, background-color 0.22s ease;
}
.audio-toggle i:nth-child(1) { height: 5px; }
.audio-toggle i:nth-child(2) { height: 10px; }
.audio-toggle i:nth-child(3) { height: 7px; }
.audio-toggle i:nth-child(4) { height: 4px; }
.audio-toggle.is-playing i {
  background: var(--gold);
  animation: waveBar 1.15s ease-in-out infinite;
}
.audio-toggle.is-playing i:nth-child(1) { animation-delay: 0.00s; }
.audio-toggle.is-playing i:nth-child(2) { animation-delay: 0.22s; }
.audio-toggle.is-playing i:nth-child(3) { animation-delay: 0.44s; }
.audio-toggle.is-playing i:nth-child(4) { animation-delay: 0.14s; }
@keyframes waveBar {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* Compact glassmorphic autoplay prompt docked beside top-right waveform toggle */
.audio-prompt {
  position: fixed;
  top: 66px;
  right: 44px;
  z-index: 460;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 15px;
  border-radius: 14px;
  background: rgba(11, 11, 18, 0.84);
  border: 1px solid rgba(var(--gold-rgb), 0.24);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translate3d(0, -8px, 0) scale(0.96);
  pointer-events: none;
  transition: opacity 0.32s var(--ease-expo), transform 0.38s var(--ease-expo);
}
.audio-prompt::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 98px;
  width: 9px;
  height: 9px;
  background: rgba(11, 11, 18, 0.92);
  border-top: 1px solid rgba(var(--gold-rgb), 0.24);
  border-left: 1px solid rgba(var(--gold-rgb), 0.24);
  transform: rotate(45deg);
}
.audio-prompt.is-open {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}
.audio-prompt-text {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(246, 241, 232, 0.90);
  white-space: nowrap;
}
.audio-prompt-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.audio-prompt-btn {
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: transform 0.18s var(--ease-expo), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.audio-prompt-btn:hover { transform: translateY(-1px); }
.audio-prompt-btn:active { transform: scale(0.96); }
.audio-prompt-btn.is-yes {
  background: rgba(var(--gold-rgb), 0.18);
  border: 1px solid rgba(var(--gold-rgb), 0.52);
  color: var(--gold);
}
.audio-prompt-btn.is-yes:hover {
  background: rgba(var(--gold-rgb), 0.28);
  color: #ffffff;
}
.audio-prompt-btn.is-no {
  background: rgba(246, 241, 232, 0.06);
  border: 1px solid rgba(246, 241, 232, 0.16);
  color: rgba(246, 241, 232, 0.72);
}
.audio-prompt-btn.is-no:hover {
  background: rgba(246, 241, 232, 0.12);
  color: var(--ink-light);
}

/* ---------------------------------------------------------------------
   Single Fixed 3D Stage (Zero Native-Scroll Stutter on PC & Mobile!)
   --------------------------------------------------------------------- */
.scroll-track {
  display: none;
}

.world-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--void);
  z-index: 10;
  cursor: grab;
  touch-action: none;
}
.world-stage.is-dragging { cursor: grabbing; }

.world-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.world-back { z-index: 1; }
.world-gl-back { z-index: 2; }
.world-mid { z-index: 3; }
.world-gl-front { z-index: 4; }
.world-front { z-index: 5; }

/* ---------------------------------------------------------------------
   Clean, Confident Typographic Beats + Single Poetic Film Subtitles
   --------------------------------------------------------------------- */
.beat-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
}

/* Act 00 · Hero Identity Bar */
.beat-hero {
  display: flex;
  align-items: flex-end;
  padding: 0 44px 34px;
}
.hero-ledger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.ledger-loc {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: rgba(246, 241, 232, 0.72);
}
.ledger-role {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ink-light);
}
.ledger-role em {
  font-style: normal;
  color: var(--flame);
  margin: 0 10px;
}

/* Acts 01–03 · Asymmetric Story Titles in Clean Visual Pockets */
.beat-side {
  display: flex;
  flex-direction: column;
  padding: 112px 60px 72px;
}
.beat-stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 10px 30px rgba(3, 5, 14, 0.85));
}
.beat-top-left {
  justify-content: flex-start;
  align-items: flex-start;
}
.beat-top-left .beat-stack { align-items: flex-start; }

.beat-bottom-left {
  justify-content: flex-end;
  align-items: flex-start;
}
.beat-bottom-left .beat-stack { align-items: flex-start; }

.beat-bottom-right {
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  padding-right: 72px;
}
.beat-bottom-right .beat-stack { align-items: flex-end; }
.beat-bottom-right .beat-title { align-items: flex-end; }

.beat-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-sans);
  font-size: clamp(50px, 5.8vw, 88px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: 0.06em;
  color: var(--ink-light);
}
.beat-title-en {
  font-family: var(--font-display);
  font-size: clamp(44px, 5.4vw, 80px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.02;
}
.beat-tags {
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--gold);
}
.beat-tags-cyan {
  color: #bceeff;
}
.beat-tags em {
  font-style: normal;
  color: var(--flame);
  margin: 0 8px;
}
.beat-poetic {
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.5;
  color: rgba(246, 241, 232, 0.80);
}

/* Smooth masked line rise driven by --w */
.beat-side .beat-tags,
.beat-side .beat-poetic,
.beat-line { overflow: hidden; }
.beat-line {
  display: block;
  padding: 0.14em 0.04em 0.18em 0;
  margin: -0.14em 0 -0.18em;
}
.beat-rise {
  --k: clamp(0, calc((var(--w, 0) - 0.30 - var(--d, 0)) * 2.1), 1);
  --inv: calc(1 - var(--k));
  display: block;
  transform: translateY(calc(var(--inv) * var(--inv) * 118%));
  will-change: transform;
}
.beat-title .beat-rise { --d: 0.02; }
.beat-title .beat-line + .beat-line .beat-rise { --d: 0.06; }
.beat-tags .beat-rise { --d: 0.10; }
.beat-poetic .beat-rise { --d: 0.15; }

/* Act 04 · Finale Eclipse Over Chongqing Skyline */
.beat-finale {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 96px 44px 22px;
}
.beat-finale.is-interactive a,
.beat-finale.is-interactive button { pointer-events: auto; }

.finale-center {
  position: absolute;
  left: 36px;
  right: 36px;
  top: 40%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.finale-motto {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(44px, 7vw, 110px);
  line-height: 1.04;
  letter-spacing: 0.015em;
  transform: translate3d(0, calc((1 - var(--e, 1)) * 18px), 0) scale(calc(1 + (1 - var(--e, 1)) * 0.045));
  color: var(--ink-light);
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.88);
  will-change: transform, opacity;
}

.finale-foot {
  position: relative;
  z-index: 6;
  padding-top: 12px;
  border-top: 1px solid var(--line-void);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(246, 241, 232, 0.68);
}
.finale-foot-links {
  display: inline-flex;
  gap: 24px;
  font-family: var(--font-display);
  font-weight: 600;
}
.finale-foot-links a:hover { color: var(--gold); }

.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  z-index: 970;
  padding: 9px 20px;
  background: #f2ece1;
  color: #0a0a0d;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.24s var(--ease-expo);
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .site-frame {
    padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 14px;
  }
  .frame-brand { font-size: 12.5px; letter-spacing: 0.22em; }
  .frame-right { gap: 16px; }
  .frame-gh { font-size: 11px; letter-spacing: 0.16em; }

  .beat-hero {
    padding: 0 20px calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .hero-ledger {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .ledger-loc { font-size: 11.5px; letter-spacing: 0.18em; }
  .ledger-role { font-size: 11.5px; letter-spacing: 0.10em; }
  .ledger-role em { margin: 0 6px; }

  .beat-side {
    padding: calc(74px + env(safe-area-inset-top, 0px)) 22px calc(38px + env(safe-area-inset-bottom, 0px));
  }
  .beat-bottom-right {
    padding-right: 34px;
  }
  .beat-title,
  .beat-title-en {
    font-size: clamp(38px, 11vw, 56px);
  }
  .beat-tags {
    margin-top: 10px;
    font-size: 13px;
    letter-spacing: 0.16em;
  }

  .beat-finale {
    padding: calc(74px + env(safe-area-inset-top, 0px)) 20px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .finale-center {
    top: 34%;
    left: 18px;
    right: 18px;
  }
  .finale-motto {
    font-size: clamp(30px, 8.2vw, 52px);
  }
  .finale-foot {
    font-size: 11px;
    letter-spacing: 0.15em;
  }

  /* Compact minimalist right-edge 5-act indicator on mobile */
  .depth-needle {
    right: 10px;
    height: 104px;
  }
  .depth-tick::before { display: none; }

  .audio-prompt {
    top: calc(56px + env(safe-area-inset-top, 0px));
    right: 14px;
    gap: 8px;
    padding: 8px 10px 8px 12px;
  }
  .audio-prompt::before { right: 82px; }
  .audio-prompt-text { font-size: 11.5px; }
  .audio-prompt-btn { padding: 4px 9px; font-size: 11.5px; }
}
