/* Homepage Hero Motion v4: single-take, chronological 30-frame character motion. */
.duel-hero {
  --blue-energy: 0;
  --orange-energy: 0;
}

.hero-side {
  --side-energy: 0;
}

.hero-side-blue { --side-energy: var(--blue-energy); }
.hero-side-orange { --side-energy: var(--orange-energy); }

.hero-character {
  top: 8%;
  left: 0;
  width: 100%;
  height: 94%;
  transform: none !important;
  transition: opacity 70ms linear, filter 55ms linear;
  will-change: opacity, filter;
}

.sequence-canvas {
  z-index: 4;
  display: block;
  opacity: 0;
}

.sequence-fallback.neutral-frame { opacity: 1; }
.sequence-fallback.reach-frame { opacity: 0; }
.sequence-fallback.neutral-frame.frame-hidden { opacity: 0; }
.sequence-fallback.reach-frame.frame-visible { opacity: 1; }

.hero-side.sequence-ready .sequence-canvas { opacity: 1; }
.hero-side.sequence-ready .sequence-fallback { opacity: 0 !important; }

.hero-side.is-active .hero-stage-bg {
  filter: brightness(calc(0.9 + var(--side-energy) * 0.16)) saturate(calc(0.94 + var(--side-energy) * 0.12));
}

.hero-side.is-inactive .hero-stage-bg {
  filter: brightness(0.52) saturate(0.58);
}

.hero-side.is-active .hero-character { filter: brightness(1) saturate(1.02); }
.hero-side.is-inactive .hero-character { filter: brightness(0.55) saturate(0.64); }
.hero-side.swap-masked .hero-character { filter: brightness(1.28) saturate(0.9) blur(0.45px); }

.hero-tablist.is-loading { opacity: 0.72; }
.hero-tablist.is-busy { cursor: wait; }
.hero-tab:disabled { cursor: wait; }

.light-handle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 22;
  width: 88px;
  height: 88px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: transparent;
  cursor: default;
  pointer-events: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  will-change: transform;
}

.light-handle:active { cursor: grabbing; }
.light-handle:focus-visible { outline: 2px solid rgba(255,255,255,0.96); outline-offset: 5px; }
.light-handle:disabled { cursor: wait; }

.drag-primary-mode .light-handle { pointer-events: auto; cursor: grab; }
.drag-primary-mode .light-handle:active { cursor: grabbing; }
.drag-primary-mode .handle-caption { visibility: visible; }

.tap-primary-mode .light-handle { touch-action: pan-y; }

.tap-primary-mode .handle-caption { display: block; visibility: visible; }

@media (max-width: 768px), (max-width: 900px) and (max-height: 500px), (pointer: coarse) {
  .light-handle {
    pointer-events: auto;
    cursor: grab;
    touch-action: pan-y;
  }

  .handle-caption { display: block; visibility: visible; }
}

.light-handle img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(184px, 18vw, 260px);
  height: auto;
  max-width: none;
  transform: translate(-50%, -50%) scale(0.46);
  transform-origin: center;
  opacity: 0.96;
  mix-blend-mode: screen;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 0 12px rgba(255,235,172,0.46));
}

.charge-ring {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 50%;
  box-shadow: inset 0 0 16px rgba(255,247,215,0.13), 0 0 20px rgba(255,231,154,0.16);
  opacity: 0.78;
  pointer-events: none;
}

.charge-ring::before,
.charge-ring::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: inherit;
}

.charge-ring::after {
  inset: 50% -28px auto;
  height: 1px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

.phase-idle .charge-ring { animation: heroRingBreath 2.2s ease-in-out infinite; }
.phase-pressing .charge-ring { border-width: 2px; animation: heroHoldCharge 260ms linear both; }
.sequence-loading .charge-ring { animation: heroRingBreath 0.78s ease-in-out infinite; }
.phase-dragging .charge-ring,
.phase-magnetizing .charge-ring {
  opacity: 1;
  border-color: rgba(255,255,255,0.9);
  box-shadow: 0 0 26px rgba(255,234,166,0.52), inset 0 0 16px rgba(255,251,233,0.26);
}

.phase-magnetizing .light-handle,
.phase-catching .light-handle,
.phase-caught .light-handle,
.phase-returning .light-handle { pointer-events: none; }

.handle-caption {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  min-width: max-content;
  padding: 4px 7px;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  color: rgba(255,255,255,0.8);
  background: rgba(7,8,10,0.54);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.35;
  pointer-events: none;
  visibility: hidden;
}

.sequence-loading .handle-caption::after { content: " · 动作加载中"; opacity: 0.62; }
.phase-magnetizing .handle-caption,
.phase-catching .handle-caption,
.phase-caught .handle-caption,
.phase-returning .handle-caption { opacity: 0; }

.catch-bloom {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 21;
  width: clamp(300px, 35vw, 530px);
  max-width: none;
  mix-blend-mode: screen;
  pointer-events: none;
  will-change: transform;
}

.catch-bloom img {
  display: block;
  width: 100%;
  max-width: none;
  opacity: 0;
  will-change: transform, opacity;
}

.catch-bloom.is-blooming img { animation: heroCatchBloom 300ms cubic-bezier(0.16,0.86,0.3,1) both; }

.catch-exposure {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #ffe8ae;
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

.catch-exposure.is-flashing { animation: heroStageExposure 300ms ease-out both; }

@keyframes heroRingBreath {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 0.95; transform: scale(1.08); }
}

@keyframes heroHoldCharge {
  0% { opacity: 0.7; transform: scale(0.86) rotate(-40deg); box-shadow: 0 0 8px rgba(255,234,166,0.18); }
  100% { opacity: 1; transform: scale(1.08); border-color: rgba(255,255,255,0.95); box-shadow: 0 0 30px rgba(255,234,166,0.58), inset 0 0 18px rgba(255,251,233,0.28); }
}

@keyframes heroCatchBloom {
  0% { opacity: 0; transform: scale(0.25); }
  34% { opacity: 1; transform: scale(0.92); }
  62% { opacity: 0.92; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1.28); }
}

@keyframes heroStageExposure {
  0%, 100% { opacity: 0; }
  27% { opacity: 0.14; }
  48% { opacity: 0.07; }
}

@media (max-width: 768px) {
  .hero-character { top: 25%; width: 155%; height: min(70%, calc(100% - 190px)); }
  .hero-side-blue .hero-character { left: -55%; }
  .hero-side-orange .hero-character { left: -7%; width: 130%; }
  .light-handle { width: 78px; height: 78px; }
  .light-handle img { width: 178px; }
  .charge-ring { inset: 7px; }
  .handle-caption { top: calc(100% + 2px); }
  .catch-bloom { width: 300px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .nav { height: 48px; }
  .nav-inner { padding-inline: 16px; }
  .brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
  .nav-cta { padding: 7px 13px; font-size: 12px; }
  .branch-switch a { padding: 5px 12px; font-size: 11px; }
  .duel-hero { height: calc(100vh - 48px); height: calc(100svh - 48px); min-height: 0; max-height: none; }
  .hero-heading { top: 9px; }
  .hero-kicker { margin-bottom: 4px; font-size: 7px; }
  .hero-title { font-size: clamp(24px, 4.3vw, 31px); line-height: 1; }
  .hero-sub { display: none; }
  .hero-instruction { top: 61px; font-size: 10px; }
  .hero-character { top: 10%; left: 0 !important; width: 100% !important; height: 92%; }
  .light-handle { width: 70px; height: 70px; }
  .light-handle img { width: 166px; }
  .hero-tablist { bottom: 6px; width: min(560px, calc(100% - 24px)); min-height: 40px; padding: 4px; }
  .hero-tab { min-height: 32px; padding: 4px 10px; }
  .hero-tab-route { font-size: 10px; }
  .hero-tab-child { display: none; }
  .hero-cta { bottom: 54px; min-height: 34px; padding: 7px 16px; font-size: 11px; }
  .hero-compare { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sequence-canvas { display: none; }
  .phase-pressing .charge-ring { animation: none !important; opacity: 0.58; transform: scale(0.88); }
}
