/* ==========================================================================
   万年觉醒 · 竖屏 H5 冒险
   ========================================================================== */
:root {
  --ink: #f4f1ff;
  --muted: #b3acd4;
  --dim: #7d759e;
  --violet: #8b7bff;
  --cyan: #7fe7ff;
  --gold: #ffd479;
  --orange: #FF8A3D;
  --panel: rgba(20, 16, 42, .84);
  --line: rgba(160, 146, 255, .22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #04030a;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
body {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 0%, #171233 0%, #070510 55%, #030208 100%);
}
button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus { outline: none; }
img { -webkit-user-drag: none; user-select: none; }
p, h1, h2, h3 { margin: 0; }

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #05040c;
  user-select: none;
  isolation: isolate;
}
@media (min-width: 560px) {
  .app {
    height: min(100dvh, 940px);
    border-radius: 34px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .75), 0 0 0 1px rgba(150, 140, 255, .12);
  }
}

/* ============================ 通用场景 ============================ */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.is-active {
  display: flex;
  animation: screenIn .5s ease both;
}
.scene-bg {
  position: absolute;
  inset: -2%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  will-change: transform;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 75% at 50% 42%, transparent 40%, rgba(3, 2, 9, .52) 100%),
    linear-gradient(180deg, rgba(3, 2, 9, .45) 0%, transparent 22%, transparent 62%, rgba(3, 2, 9, .72) 100%);
}
.dust {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}
.dust i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #cfe0ff;
  box-shadow: 0 0 6px 1px rgba(150, 190, 255, .55);
  opacity: 0;
  animation: dustRise linear infinite;
}

/* ============================ 标题页 ============================ */
.title-bg {
  background-image: url("images/gen/wanian-sky.png");
  background-position: 58% 20%;
  filter: saturate(1.08) brightness(.78);
  animation: bgDrift 28s ease-in-out infinite alternate;
}
.title-halo {
  position: absolute;
  top: -90px;
  left: -100px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(116, 126, 255, .44) 0%, rgba(90, 80, 220, .15) 42%, transparent 68%);
  filter: blur(12px);
  z-index: 1;
  animation: haloBreathe 6s ease-in-out infinite;
}
.title-hero-wrap {
  position: absolute;
  left: -9%;
  bottom: 14%;
  width: 76%;
  max-width: 370px;
  z-index: 2;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 58% 56% at 51% 54%, #000 42%, rgba(0,0,0,.82) 58%, transparent 78%);
  mask-image: radial-gradient(ellipse 58% 56% at 51% 54%, #000 42%, rgba(0,0,0,.82) 58%, transparent 78%);
}
.title-hero-wrap img {
  display: block;
  width: 100%;
  filter: drop-shadow(0 24px 34px rgba(0, 0, 0, .62)) saturate(1.04);
}
.title-top {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  left: 16px;
  right: 16px;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.gold-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 9px;
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(34, 27, 58, .88), rgba(12, 9, 26, .8));
  border: 1px solid rgba(255, 212, 121, .28);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gold-chip .coin { width: 19px; height: 19px; flex-shrink: 0; }
.gold-chip span {
  font-size: 13px;
  font-weight: 800;
  color: #ffe8b3;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.round-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(38, 31, 66, .86), rgba(13, 10, 28, .82));
  border: 1px solid rgba(170, 160, 255, .26);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .12s ease, filter .12s;
}
.round-btn:active { transform: scale(.9); filter: brightness(1.2); }
.round-btn .mp-icon { width: 18px; height: 18px; color: #cfd7ff; }

.title-brand {
  position: absolute;
  top: calc(var(--safe-top) + 82px);
  left: 22px;
  z-index: 8;
}
.brand-ring {
  position: absolute;
  top: -74px;
  left: -52px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(160, 180, 255, .17);
  opacity: .72;
  pointer-events: none;
  animation: ringSpin 70s linear infinite;
}
.brand-ring::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  border: 1px dashed rgba(160, 180, 255, .16);
}
.brand-ring::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 160, 255, .09), transparent 68%);
}
.brand-ring span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 10px;
  margin-left: -.5px;
  background: rgba(190, 205, 255, .5);
  transform-origin: 50% 0;
}
.brand-ring span:nth-child(1) { transform: rotate(0deg) translateY(-109px); }
.brand-ring span:nth-child(2) { transform: rotate(90deg) translateY(-109px); }
.brand-ring span:nth-child(3) { transform: rotate(180deg) translateY(-109px); }
.brand-ring span:nth-child(4) { transform: rotate(270deg) translateY(-109px); }
.brand-kicker {
  font-size: 7.5px;
  letter-spacing: .28em;
  color: #9faddc;
  opacity: .62;
  margin-bottom: 9px;
  white-space: nowrap;
}
.title-brand h1 {
  position: relative;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  font-size: clamp(38px, 11.4vw, 52px);
  line-height: 1;
  letter-spacing: .07em;
  font-weight: 700;
  color: #eef6ff;
  text-shadow:
    0 0 10px rgba(154, 194, 255, .75),
    0 0 32px rgba(94, 118, 255, .55),
    0 3px 18px rgba(0, 0, 0, .6);
  background: linear-gradient(180deg, #ffffff 6%, #dceaff 42%, #a9b9ff 72%, #786dff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  font-size: 10px;
  letter-spacing: .3em;
  color: #b5c2ee;
  opacity: .82;
}
.brand-sub i {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(181, 194, 238, .8));
}
.brand-sub i:last-child {
  background: linear-gradient(90deg, rgba(181, 194, 238, .8), transparent);
}
.title-spacer { flex: 1; }

.title-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 54px 16px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(180deg, transparent 0%, rgba(5, 4, 13, .7) 28%, rgba(5, 4, 13, .96) 62%, #05040d 100%);
}
.chapter-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(29, 24, 56, .82), rgba(12, 9, 26, .86));
  border: 1px solid rgba(160, 146, 255, .26);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chapter-thumb {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 212, 121, .26);
  box-shadow: 0 0 18px rgba(110, 100, 255, .25);
}
.chapter-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 30%;
  transform: scale(1.25);
}
.chapter-copy { flex: 1; min-width: 0; }
.chapter-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  letter-spacing: .13em;
  color: #ffd479;
}
.chapter-kicker em {
  font-style: normal;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 212, 121, .1);
  border: 1px solid rgba(255, 212, 121, .2);
  font-size: 8px;
  color: #e9c47d;
  letter-spacing: .06em;
}
.chapter-copy strong {
  display: block;
  margin-top: 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: #f4f1ff;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-copy small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: #a9a2c9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-arrow { color: #8d84b8; padding-right: 3px; }
.chapter-arrow .mp-icon { width: 18px; height: 18px; }

.btn-main {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  border-radius: 17px;
  background: linear-gradient(102deg, #ff7f30 0%, #ffa552 48%, #ffc978 100%);
  color: #2a1204;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .1em;
  box-shadow:
    0 10px 28px rgba(255, 126, 48, .38),
    0 2px 0 rgba(255, 226, 176, .65) inset,
    0 -2px 0 rgba(151, 62, 6, .28) inset;
  transition: transform .12s ease, filter .15s ease;
}
.btn-main::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  border: 1px solid rgba(255, 246, 220, .42);
  pointer-events: none;
}
.btn-main:active { transform: scale(.975); filter: brightness(1.06); }
.btn-main .mp-icon { width: 23px; height: 23px; color: #35190a; }
.btn-main.compact { height: 50px; font-size: 16px; border-radius: 15px; margin-top: 14px; }
.btn-shine {
  position: absolute;
  top: -40%;
  bottom: -40%;
  width: 46px;
  left: -60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg);
  animation: shineSweep 3.8s ease-in-out infinite;
}
.btn-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 47px;
  padding: 0 14px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(37, 31, 68, .85), rgba(13, 10, 28, .88));
  border: 1px solid rgba(160, 146, 255, .25);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: #dcd7f5;
  text-align: left;
  transition: transform .12s ease, filter .15s;
}
.btn-sub:active { transform: scale(.98); filter: brightness(1.18); }
.btn-sub .mp-icon { width: 19px; height: 19px; color: #b9aaff; flex-shrink: 0; }
.btn-sub b { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.btn-sub small { font-size: 10px; color: #8f86b3; margin-left: 2px; }
.btn-sub .trail { margin-left: auto; width: 17px; height: 17px; color: #7f76a6; }
.title-meta {
  display: flex;
  justify-content: center;
  gap: 13px;
  padding-top: 1px;
  font-size: 9.5px;
  color: #7f789e;
  letter-spacing: .05em;
}
.title-meta b {
  color: #b8b1d6;
  font-weight: 700;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

/* ============================ 序章 ============================ */
.prologue-screen {
  background: #05040d;
  justify-content: center;
  align-items: center;
}
.prologue-bg {
  background-image: url("images/gen/wanian-sky.png");
  background-position: 55% 26%;
  filter: blur(3px) brightness(.42) saturate(1.15);
  transform: scale(1.16);
  animation: bgDrift 34s ease-in-out infinite alternate;
}
.rift {
  position: absolute;
  top: 11%;
  left: 50%;
  width: 280px;
  height: 280px;
  margin-left: -140px;
  border-radius: 50%;
  border: 1px solid rgba(150, 170, 255, .18);
  box-shadow: 0 0 90px rgba(100, 90, 255, .22), inset 0 0 80px rgba(90, 100, 255, .12);
  animation: ringSpin 60s linear infinite;
  z-index: 2;
}
.rift::before, .rift::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(150, 170, 255, .16);
}
.rift::before { inset: 24px; }
.rift::after { inset: 62px; border-style: solid; }
.rift i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #cfe3ff;
  box-shadow: 0 0 14px 4px rgba(140, 170, 255, .55);
}
.rift i:nth-child(1) { transform: translate(-130px, -20px); }
.rift i:nth-child(2) { transform: translate(118px, 32px); }
.rift i:nth-child(3) { transform: translate(20px, -138px); }
.light-beam {
  position: absolute;
  top: 0;
  left: 50%;
  width: 150px;
  height: 78%;
  margin-left: -75px;
  z-index: 1;
  background: linear-gradient(180deg, rgba(170, 195, 255, .22), rgba(120, 120, 255, .06) 55%, transparent);
  clip-path: polygon(42% 0, 58% 0, 82% 100%, 18% 100%);
  filter: blur(9px);
  animation: beamBreathe 5s ease-in-out infinite;
}
.prologue-center {
  position: relative;
  z-index: 6;
  width: 100%;
  padding: 0 26px;
  text-align: center;
}
.year-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  height: 112px;
  margin-bottom: 4px;
  transition: opacity .4s ease;
}
.year-wrap.off { opacity: 0; }
#pro-year {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(58px, 17vw, 78px);
  line-height: 1;
  letter-spacing: .04em;
  font-weight: 600;
  color: #f0f6ff;
  text-shadow: 0 0 18px rgba(150, 190, 255, .55), 0 0 48px rgba(100, 100, 255, .45);
  font-variant-numeric: tabular-nums;
}
.year-wrap em {
  font-style: normal;
  font-size: 15px;
  letter-spacing: .35em;
  color: #9ba8d8;
  transform: translateY(-6px);
}
.story-line { min-height: 132px; }
#pro-title {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 23px;
  line-height: 1.62;
  font-weight: 600;
  letter-spacing: .06em;
  color: #f2eeff;
  text-shadow: 0 2px 22px rgba(0, 0, 0, .7);
  transition: opacity .35s ease, transform .35s ease;
}
#pro-sub {
  margin-top: 13px;
  font-size: 12.5px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: #aaa4ca;
  transition: opacity .35s ease, transform .35s ease;
}
.story-line.out #pro-title, .story-line.out #pro-sub {
  opacity: 0;
  transform: translateY(7px);
}
.story-line.in #pro-title, .story-line.in #pro-sub {
  opacity: 1;
  transform: translateY(0);
}
.skip-btn {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  right: 16px;
  z-index: 8;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: rgba(14, 11, 28, .62);
  border: 1px solid rgba(170, 160, 255, .2);
  color: #a9a2c9;
  font-size: 10.5px;
  letter-spacing: .08em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .12s;
}
.skip-btn:active { transform: scale(.94); }
.prologue-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 24px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.pro-dots { display: flex; gap: 6px; }
.pro-dots i {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .16);
  transition: background .25s, box-shadow .25s;
}
.pro-dots i.on { background: #ffd479; box-shadow: 0 0 9px rgba(255, 212, 121, .8); }
.pro-next {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  color: #d3cee9;
  font-size: 11px;
  letter-spacing: .16em;
  background: rgba(14, 11, 28, .45);
  border: 1px solid rgba(170, 160, 255, .16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: hintBreathe 2.4s ease-in-out infinite;
}
.pro-next .mp-icon { width: 15px; height: 15px; }

/* ============================ 游戏页 ============================ */
.game-screen { background: #070510; }
.game-bg {
  background-image: url("images/gen/wanian-sky.png");
  background-position: center 6%;
  filter: saturate(1.06) brightness(.72);
  animation: bgDrift 36s ease-in-out infinite alternate;
}
.game-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 45% at 58% 22%, rgba(120, 105, 255, .3), transparent 65%),
    linear-gradient(180deg, rgba(5, 4, 13, .68) 0%, transparent 24%, transparent 56%, rgba(5, 4, 13, .55) 82%, rgba(4, 3, 10, .92) 100%);
}
.game-screen[data-theme="2"] .game-bg { filter: hue-rotate(-30deg) saturate(1.18) brightness(.68); }
.game-screen[data-theme="3"] .game-bg { filter: hue-rotate(34deg) saturate(1.22) brightness(.7); }
.portal-pulse {
  position: absolute;
  top: 10%;
  left: 54%;
  width: 190px;
  height: 190px;
  margin-left: -95px;
  border-radius: 50%;
  z-index: 1;
  background: radial-gradient(circle, rgba(150, 175, 255, .32), rgba(90, 80, 255, .1) 45%, transparent 68%);
  filter: blur(8px);
  animation: portalBreathe 4.2s ease-in-out infinite;
}
.game-vignette {
  z-index: 4;
  box-shadow: inset 0 0 90px 18px rgba(2, 1, 7, .65);
}
.game-screen[data-theme="2"] .portal-pulse { background: radial-gradient(circle, rgba(255, 170, 120, .3), rgba(190, 70, 40, .1) 45%, transparent 68%); }
.game-screen[data-theme="3"] .portal-pulse { background: radial-gradient(circle, rgba(160, 235, 255, .34), rgba(70, 160, 255, .12) 45%, transparent 68%); }

.hud {
  position: relative;
  z-index: 22;
  padding: calc(var(--safe-top) + 10px) 12px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.hud::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% + 26px);
  background: linear-gradient(180deg, rgba(4, 3, 11, .86) 0%, rgba(4, 3, 11, .5) 55%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}
.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.avatar-ring {
  width: 47px;
  height: 47px;
  padding: 2px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(from 210deg, #ffd479, #8c7bff, #7fe7ff, #ffd479);
  box-shadow: 0 0 16px rgba(130, 115, 255, .42);
}
.avatar-ring img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  border: 1px solid rgba(5, 4, 13, .8);
}
.vitals { flex: 1; min-width: 0; max-width: 196px; }
.name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  font-size: 10px;
  color: #e8e4fb;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
}
.name-row > span {
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.lv-badge {
  font-size: 8px;
  font-weight: 700;
  color: #ffd479;
  border: 1px solid rgba(255, 212, 121, .35);
  background: rgba(255, 212, 121, .08);
  border-radius: 5px;
  padding: 1px 4px;
  letter-spacing: .02em;
}
.bar {
  position: relative;
  height: 12px;
  border-radius: 7px;
  margin-top: 3px;
  overflow: hidden;
  background: rgba(2, 2, 8, .72);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7);
}
.bar span {
  position: absolute;
  left: 1px;
  top: 1px;
  bottom: 1px;
  width: 100%;
  border-radius: 6px;
  transition: width .22s ease;
}
.bar.hp span {
  background: linear-gradient(90deg, #b21f34, #ff5d5d 55%, #ff9477);
  box-shadow: 0 0 10px rgba(255, 80, 80, .35);
}
.bar.mp span {
  background: linear-gradient(90deg, #2a4bc6, #4c9bff 60%, #82e3ff);
  box-shadow: 0 0 10px rgba(90, 180, 255, .35);
}
.bar::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 1px;
  height: 38%;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent);
  pointer-events: none;
}
.bar em {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .03em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
  font-variant-numeric: tabular-nums;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.gold-chip.small {
  height: 30px;
  padding: 0 9px 0 7px;
  border-radius: 15px;
}
.gold-chip.small .coin { width: 16px; height: 16px; }
.gold-chip.small span { font-size: 11.5px; }
.hud-right .round-btn { width: 30px; height: 30px; }
.hud-right .round-btn .mp-icon { width: 16px; height: 16px; }

.chapter-ribbon {
  position: relative;
  z-index: 21;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 30px);
  margin-top: 7px;
  padding: 4px 11px;
  border-radius: 13px;
  background: rgba(9, 7, 21, .58);
  border: 1px solid rgba(160, 146, 255, .18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: 9px;
  color: #b9b2d8;
  white-space: nowrap;
}
.chapter-ribbon > b { color: #6f678f; font-weight: 400; }
.chapter-ribbon strong {
  font-size: 10px;
  font-weight: 600;
  color: #f0edff;
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wave-dots { display: flex; gap: 3px; margin-left: 2px; }
.wave-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  transition: background .25s, box-shadow .25s;
}
.wave-dots i.on { background: #ffd479; box-shadow: 0 0 6px rgba(255, 212, 121, .8); }

/* ============================ 战斗舞台 ============================ */
.stage {
  position: relative;
  z-index: 6;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}
.ground {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -2%;
  height: 39%;
  background: url("images/gen/wanian-ground.png") center top / cover no-repeat;
  filter: brightness(.8) saturate(1.04);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 100%);
  z-index: 5;
}
.ground::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(140, 125, 255, .2), transparent 62%),
    linear-gradient(180deg, transparent 0%, rgba(3, 2, 8, .32) 52%, rgba(3, 2, 8, .78) 100%);
}
.stage-fog {
  position: absolute;
  left: -18%;
  width: 136%;
  height: 74px;
  bottom: 29%;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(154, 162, 255, .2), transparent 68%);
  filter: blur(13px);
  animation: fogDrift 13s ease-in-out infinite alternate;
}
.fog-b {
  bottom: 13%;
  height: 92px;
  opacity: .68;
  animation-duration: 19s;
  animation-direction: alternate-reverse;
}
.ember-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 7;
}
.ember-layer i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #ffdd9a;
  box-shadow: 0 0 7px 1px rgba(255, 200, 110, .55);
  opacity: 0;
  animation: emberRise linear infinite;
}

.boss-bar {
  position: absolute;
  top: 8px;
  left: 22px;
  right: 22px;
  z-index: 19;
  padding: 6px 10px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 13, 30, .92), rgba(10, 6, 17, .88));
  border: 1px solid rgba(255, 130, 130, .32);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4), 0 0 22px rgba(255, 80, 100, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: bannerIn .35s ease both;
}
.boss-bar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #ffd8d0;
}
.boss-bar-title em {
  font-style: normal;
  font-size: 7px;
  color: #ff8c7d;
  border: 1px solid rgba(255, 140, 125, .4);
  border-radius: 4px;
  padding: 0 3px;
  letter-spacing: .06em;
}
.boss-bar-track {
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(255, 255, 255, .1);
}
.boss-bar-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #7d1d3c, #e0445e 55%, #ff947d);
  box-shadow: 0 0 12px rgba(255, 90, 100, .4);
  transition: width .2s ease;
}

/* ---- 玩家 ---- */
.player {
  position: absolute;
  left: 0;
  bottom: 35.5%;
  width: 88px;
  height: 131px;
  margin-left: -44px;
  z-index: 12;
  will-change: transform;
  pointer-events: none;
}
.player-aura {
  position: absolute;
  inset: -16% -26%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 200, 255, .14), transparent 66%);
  filter: blur(4px);
  z-index: -1;
}
.player-shadow {
  position: absolute;
  left: 13%;
  right: 13%;
  bottom: -5px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .66), transparent 72%);
  filter: blur(2px);
}
.player-body {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  transform: scaleX(var(--face, 1));
  transition: transform .11s ease;
}
.player-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 9px 9px rgba(0, 0, 0, .55)) drop-shadow(0 0 7px rgba(120, 150, 255, .18));
  animation: idleBob 2.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.player.moving .player-img { animation: walkBob .34s ease-in-out infinite; }
.player.attacking .player-img { animation: attackLunge .26s ease-out; }
.player.hurt .player-img { animation: hurtFlash .22s linear; }
.player.dashing .player-aura { background: radial-gradient(circle, rgba(127, 231, 255, .42), transparent 66%); }

/* ---- 敌人 ---- */
.enemy-layer {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
}
.enemy {
  --foe-body: #251b4a;
  --foe-dark: #0f0a22;
  --foe-glow: #a98cff;
  --foe-eye: #d9f4ff;
  position: absolute;
  left: 0;
  bottom: 35.5%;
  width: 66px;
  height: 98px;
  margin-left: -33px;
  will-change: transform;
  transform-origin: 50% 100%;
}
.game-screen[data-theme="2"] .enemy {
  --foe-body: #4a2328;
  --foe-dark: #1d0c12;
  --foe-glow: #ff9166;
  --foe-eye: #ffe1c7;
}
.game-screen[data-theme="3"] .enemy {
  --foe-body: #183e4e;
  --foe-dark: #081a22;
  --foe-glow: #6fe8ff;
  --foe-eye: #e8ffff;
}
.enemy-art {
  width: 100%;
  height: 100%;
  animation: foeFloat 2.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45));
}
.enemy-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.enemy-hp {
  position: absolute;
  left: 14%;
  right: 14%;
  top: -8px;
  height: 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .62);
  border: 1px solid rgba(255, 255, 255, .15);
  overflow: hidden;
  z-index: 2;
}
.enemy-hp i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff6580, #ffb27a);
  transition: width .14s linear;
}
.enemy.boss {
  width: 126px;
  height: 174px;
  margin-left: -63px;
  --foe-body: #3b1d4e;
  --foe-dark: #170a24;
  --foe-glow: #ff7d9c;
  --foe-eye: #fff0f6;
  z-index: 13;
}
.enemy.boss .enemy-hp { top: -10px; height: 5px; }
.enemy-name {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #ffd4da;
  text-shadow: 0 0 10px rgba(255, 90, 120, .75), 0 2px 3px #000;
}
.enemy.hit .enemy-art { animation: foeHit .16s linear; }
.enemy.dead { animation: foeDissolve .4s ease forwards; }
.enemy.spawning .enemy-art { animation: foeSpawn .55s ease-out; }

/* ---- 高瘦男子 ---- */
.npc {
  position: absolute;
  right: 9%;
  bottom: 35%;
  width: 92px;
  height: 158px;
  z-index: 10;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s ease, transform .8s ease;
  pointer-events: none;
}
.npc.show { opacity: 1; transform: translateY(0); }
.npc-aura {
  position: absolute;
  inset: -18% -30%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 190, 255, .2), transparent 66%);
  filter: blur(5px);
}
.npc svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5));
  animation: npcBreathe 4s ease-in-out infinite;
}
.npc-name {
  position: absolute;
  top: -19px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 8.5px;
  letter-spacing: .12em;
  color: #d8d2f5;
  text-shadow: 0 2px 4px #000;
}

/* ---- 特效 ---- */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}
.slash {
  position: absolute;
  width: 92px;
  height: 104px;
  margin-left: -46px;
  margin-bottom: -22px;
  border-radius: 50%;
  background: conic-gradient(from 196deg at 50% 58%, transparent 0deg, transparent 34deg, rgba(205, 236, 255, .9) 48deg, rgba(128, 176, 255, .28) 62deg, transparent 80deg);
  filter: blur(.4px) drop-shadow(0 0 8px rgba(130, 190, 255, .8));
  -webkit-mask-image: radial-gradient(circle at 50% 58%, transparent 0 36%, #000 52%, transparent 76%);
  mask-image: radial-gradient(circle at 50% 58%, transparent 0 36%, #000 52%, transparent 76%);
  animation: slashSweep .3s ease-out forwards;
  transform-origin: 50% 60%;
}
.slash.flip { transform: scaleX(-1); }
.nova {
  position: absolute;
  width: 240px;
  height: 240px;
  margin-left: -120px;
  margin-bottom: -120px;
  border-radius: 50%;
  border: 2px solid rgba(150, 235, 255, .8);
  background: radial-gradient(circle, rgba(150, 235, 255, .22), rgba(80, 90, 255, .1) 45%, transparent 65%);
  box-shadow: 0 0 40px rgba(100, 200, 255, .5), inset 0 0 40px rgba(120, 220, 255, .3);
  animation: novaBurst .55s ease-out forwards;
}
.hit-spark {
  position: absolute;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, rgba(190, 230, 255, .9) 25%, transparent 65%);
  animation: sparkPop .3s ease-out forwards;
}
.shock {
  position: absolute;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-bottom: -30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 120, 120, .7);
  animation: shockWave .5s ease-out forwards;
}
.dmg {
  position: absolute;
  z-index: 18;
  font-weight: 900;
  font-size: 15px;
  color: #fff3f3;
  text-shadow: 0 0 8px rgba(255, 100, 100, .85), 0 2px 3px #000;
  animation: dmgFloat .78s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}
.dmg.crit { font-size: 21px; color: #ffd479; text-shadow: 0 0 12px rgba(255, 190, 80, .9), 0 2px 3px #000; }
.dmg.heal { color: #9affc8; text-shadow: 0 0 10px rgba(80, 255, 160, .8), 0 2px 3px #000; }
.dmg.gold { color: #ffd479; text-shadow: 0 0 10px rgba(255, 190, 80, .8), 0 2px 3px #000; }
.player-debuff {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(120% 90% at 50% 50%, transparent 40%, rgba(255, 30, 50, .38) 100%);
}
.player-debuff.on { animation: hurtVignette .32s ease-out; }

/* ---- 对话 ---- */
.dialogue {
  position: absolute;
  left: 13px;
  right: 13px;
  top: 9px;
  z-index: 21;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 28px 11px 10px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(22, 17, 44, .93), rgba(8, 6, 19, .95));
  border: 1px solid rgba(165, 150, 255, .3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  animation: dialogueIn .24s ease both;
}
.dialogue[hidden] { display: none; }
.dialogue-avatar {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 212, 121, .45);
  background: #191431;
  box-shadow: 0 0 12px rgba(140, 120, 255, .3);
}
.dialogue-avatar img, .dialogue-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dialogue-body { flex: 1; min-width: 0; }
.dlg-name {
  display: block;
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  color: #ffd479;
}
.dlg-name:empty { display: none; }
#dlg-text {
  font-size: 12.5px;
  line-height: 1.58;
  color: #efecff;
  min-height: 20px;
  letter-spacing: .01em;
}
.dlg-next {
  position: absolute;
  right: 8px;
  bottom: 5px;
  color: #9a91c4;
  animation: nextBob 1.15s ease-in-out infinite;
}
.dlg-next .mp-icon { width: 15px; height: 15px; }

/* ---- 波次 / 时间 / 关卡开场 ---- */
.wave-banner {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 20;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  width: 100%;
}
.wave-banner.show { animation: waveShow 1.7s ease both; }
.wave-banner span {
  display: block;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .2em;
  color: #f5f2ff;
  text-shadow: 0 0 22px rgba(140, 160, 255, .8), 0 3px 8px #000;
}
.wave-banner em {
  display: block;
  margin-top: 7px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: .24em;
  color: #aaa3cd;
}
.time-skip {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.time-skip[hidden] { display: none; }
.time-skip span {
  max-width: 80%;
  text-align: center;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 22px;
  letter-spacing: .14em;
  color: #e6e3ff;
  text-shadow: 0 0 30px rgba(120, 110, 255, .9), 0 2px 10px #000;
  animation: timeFade 1.55s ease both;
}
.level-intro {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  text-align: center;
  background: radial-gradient(70% 60% at 50% 48%, rgba(16, 12, 34, .9), rgba(4, 3, 10, .96));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn .35s ease both;
}
.level-intro[hidden] { display: none; }
.level-intro .intro-line {
  width: 86px;
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 212, 121, .75), transparent);
}
.intro-kicker {
  font-size: 10px;
  letter-spacing: .34em;
  color: #ffd479;
}
.level-intro h2 {
  margin-top: 9px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 23px;
  line-height: 1.45;
  letter-spacing: .08em;
  color: #f5f2ff;
  text-shadow: 0 0 22px rgba(140, 150, 255, .65);
}
.level-intro p {
  margin-top: 9px;
  font-size: 11px;
  letter-spacing: .1em;
  color: #a9a2c9;
}
.level-intro.tap-out { animation: introOut .45s ease forwards; }

/* ============================ 操作区 ============================ */
.controls {
  position: relative;
  z-index: 23;
  flex-shrink: 0;
  height: calc(164px + var(--safe-bottom));
  padding: 0 16px var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, transparent 0%, rgba(4, 3, 10, .55) 38%, rgba(4, 3, 10, .9) 100%);
}
.joystick {
  position: relative;
  width: 102px;
  height: 102px;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .09), rgba(16, 12, 34, .46) 68%),
    rgba(8, 6, 20, .35);
  border: 1px solid rgba(180, 170, 255, .27);
  box-shadow: inset 0 0 22px rgba(120, 110, 255, .16), 0 8px 22px rgba(0, 0, 0, .36);
  touch-action: none;
}
.joy-ring {
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  border: 1px dashed rgba(200, 190, 255, .19);
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 47px;
  height: 47px;
  margin: -23.5px 0 0 -23.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #e3e0f2, #a7a0cc 45%, #5e5884 78%, #3e3a5e);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .52), inset 0 1px 3px rgba(255, 255, 255, .62), 0 0 16px rgba(150, 140, 255, .18);
  will-change: transform;
}
.joy-knob span {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
}
.joy-arrow {
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -4px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: .35;
}
.joy-arrow.left { left: 8px; border-right: 6px solid #d5d0ee; }
.joy-arrow.right { right: 8px; border-left: 6px solid #d5d0ee; }

.action-cluster {
  position: relative;
  width: 146px;
  height: 146px;
  flex-shrink: 0;
}
.action {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  touch-action: none;
  transition: transform .08s ease, filter .15s ease;
  will-change: transform;
}
.action:active { transform: scale(.9); filter: brightness(1.18); }
.action svg { width: 52%; height: 52%; overflow: visible; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.action .act-cd {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: conic-gradient(rgba(3, 3, 9, .74) var(--cd, 0%), transparent 0);
  transition: opacity .15s;
}
.action.cooling .act-cd { opacity: 1; }
.action.attack {
  right: 0;
  bottom: 0;
  width: 86px;
  height: 86px;
  background: radial-gradient(circle at 35% 28%, #4a5b9c 0%, #232a50 48%, #0c1024 100%);
  border: 2px solid rgba(180, 198, 255, .46);
  box-shadow:
    0 0 0 5px rgba(15, 12, 32, .58),
    0 0 26px rgba(100, 130, 255, .28),
    inset 0 0 20px rgba(150, 185, 255, .2);
}
.action.attack::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
}
.action.attack svg { width: 56%; height: 56%; }
.action.skill {
  right: 0;
  bottom: 94px;
  width: 58px;
  height: 58px;
  background: radial-gradient(circle at 35% 28%, #3b87d2 0%, #1d3a7a 52%, #0a1229 100%);
  border: 1px solid rgba(128, 222, 255, .55);
  box-shadow: 0 0 20px rgba(60, 185, 255, .25), inset 0 0 14px rgba(130, 225, 255, .2);
}
.action.potion {
  right: 94px;
  bottom: 0;
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at 35% 28%, #6a2a3a 0%, #3a1422 56%, #170810 100%);
  border: 1px solid rgba(255, 160, 150, .4);
  box-shadow: 0 0 16px rgba(255, 80, 100, .18), inset 0 0 12px rgba(255, 150, 130, .13);
}
.action.dash {
  right: 82px;
  bottom: 68px;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 35% 28%, #2a5b72 0%, #173348 56%, #08131e 100%);
  border: 1px solid rgba(130, 225, 255, .38);
  box-shadow: 0 0 14px rgba(70, 190, 230, .18);
}
.action.dash svg { width: 56%; height: 56%; }
.act-cost, .act-count {
  position: absolute;
  right: -1px;
  bottom: -1px;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(6, 5, 14, .9);
  border: 1px solid rgba(130, 220, 255, .4);
  color: #a9ecff;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.act-count {
  border-color: rgba(255, 180, 160, .45);
  color: #ffd1c4;
}
.action.disabled { filter: grayscale(.55) brightness(.62); }
.damage-flash {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(120% 90% at 50% 50%, transparent 35%, rgba(255, 30, 50, .42) 100%);
}
.damage-flash.on { animation: hurtVignette .34s ease-out; }

/* ============================ 弹层 ============================ */
.modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal.centered { align-items: center; padding: 18px; }
.modal.is-open { display: flex; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 2, 9, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .22s ease both;
}
.sheet {
  position: relative;
  width: 100%;
  max-height: 88%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(var(--safe-bottom) + 18px);
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #1b1538 0%, #100c22 60%, #080614 100%);
  border: 1px solid rgba(160, 146, 255, .28);
  border-bottom: 0;
  box-shadow: 0 -24px 70px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: sheetUp .32s cubic-bezier(.2, .9, .3, 1) both;
}
.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  margin: 0 auto 13px;
  background: rgba(255, 255, 255, .18);
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.sheet-head > div:first-child { flex: 1; min-width: 0; }
.kicker {
  display: block;
  font-size: 9px;
  letter-spacing: .26em;
  color: #ffd479;
  margin-bottom: 4px;
}
.sheet-head h2, .dialog-card h2 {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: .08em;
  color: #f7f4ff;
}
.sheet-gold {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 14px;
  background: rgba(255, 212, 121, .08);
  border: 1px solid rgba(255, 212, 121, .24);
  color: #ffe4a8;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sheet-gold .coin { width: 15px; height: 15px; }
.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #b8b1d8;
  flex-shrink: 0;
  transition: transform .12s;
}
.close-btn:active { transform: scale(.9); }
.close-btn .mp-icon { width: 17px; height: 17px; }
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 13px;
  padding: 10px 6px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
}
.stat-strip div { text-align: center; min-width: 0; }
.stat-strip span {
  display: block;
  font-size: 8.5px;
  color: #8d85ad;
  letter-spacing: .08em;
  margin-bottom: 3px;
}
.stat-strip b {
  font-size: 14px;
  color: #f4f1ff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.equip-list { display: flex; flex-direction: column; gap: 9px; }
.equip-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border: 1px solid rgba(160, 146, 255, .15);
}
.equip-art {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(140, 125, 255, .22), rgba(12, 9, 25, .6) 70%);
  border: 1px solid rgba(170, 155, 255, .16);
}
.equip-art svg { width: 86%; height: 86%; }
.equip-main { flex: 1; min-width: 0; }
.equip-title { display: flex; align-items: center; gap: 6px; }
.equip-title strong { font-size: 13px; color: #f3f0ff; font-weight: 700; }
.equip-lv {
  font-size: 8px;
  color: #ffd479;
  border: 1px solid rgba(255, 212, 121, .3);
  border-radius: 5px;
  padding: 0 4px;
  line-height: 1.5;
}
.equip-main p {
  margin-top: 3px;
  font-size: 10px;
  color: #9e96bd;
}
.equip-main p b { color: #e6e0ff; font-size: 11.5px; font-weight: 700; }
.equip-main .gain {
  margin-left: 5px;
  font-size: 8.5px;
  color: #8fe8b4;
}
.equip-main small {
  display: block;
  margin-top: 2px;
  font-size: 8.5px;
  color: #6f688c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upgrade-btn {
  flex-shrink: 0;
  width: 72px;
  padding: 7px 4px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 138, 61, .2), rgba(255, 138, 61, .08));
  border: 1px solid rgba(255, 160, 95, .36);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform .12s, filter .15s;
}
.upgrade-btn:active { transform: scale(.95); filter: brightness(1.15); }
.upgrade-btn span { font-size: 11px; font-weight: 700; color: #ffcb9b; }
.upgrade-btn em {
  display: flex;
  align-items: center;
  gap: 3px;
  font-style: normal;
  font-size: 8.5px;
  color: #ffd9b0;
}
.upgrade-btn .coin { width: 10px; height: 10px; }
.upgrade-btn:disabled {
  opacity: .48;
  filter: grayscale(.4);
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
}
.upgrade-btn:disabled span, .upgrade-btn:disabled em { color: #9b94b4; }
.sheet-note {
  margin: 13px 2px 0;
  font-size: 9.5px;
  line-height: 1.7;
  color: #77708f;
  text-align: center;
}

/* ---- 对话框 ---- */
.dialog-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 390px;
  padding: 22px 18px 17px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(30, 24, 62, .98), rgba(10, 8, 22, .99));
  border: 1px solid rgba(170, 155, 255, .3);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .72), inset 0 1px 0 rgba(255, 255, 255, .08);
  text-align: center;
  animation: cardIn .3s cubic-bezier(.2, .9, .3, 1) both;
}
.dialog-card h2 { margin-bottom: 7px; font-size: 24px; }
.dialog-sub {
  font-size: 11.5px;
  line-height: 1.75;
  color: #a9a2c9;
  margin-bottom: 14px;
}
.dialog-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn-ghost {
  flex: 1;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(160, 146, 255, .2);
  color: #d3cdec;
  font-size: 12px;
  font-weight: 600;
  transition: transform .12s, filter .15s;
}
.btn-ghost:active { transform: scale(.97); filter: brightness(1.2); }
.btn-ghost .mp-icon { width: 16px; height: 16px; color: #b9aaff; }
.btn-text {
  margin: 13px auto 0;
  padding: 6px 12px;
  color: #8b83a8;
  font-size: 10.5px;
  letter-spacing: .08em;
}
.btn-text:active { color: #c9c2e4; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 13px;
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
}
.mini-grid div { text-align: center; min-width: 0; }
.mini-grid span {
  display: block;
  font-size: 8.5px;
  color: #8d85ad;
  margin-bottom: 3px;
  letter-spacing: .04em;
}
.mini-grid b {
  font-size: 13px;
  color: #f4f1ff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.dialog-card .btn-main.compact { margin-top: 3px; }

/* ---- 过关 / 死亡 / 终章 ---- */
.clear-card { border-color: rgba(255, 212, 121, .36); box-shadow: 0 26px 80px rgba(0, 0, 0, .72), 0 0 50px rgba(255, 190, 90, .09), inset 0 1px 0 rgba(255, 255, 255, .1); }
.clear-emblem {
  width: 74px;
  height: 74px;
  margin: 0 auto 9px;
  animation: emblemPulse 3s ease-in-out infinite;
}
.clear-emblem svg { width: 100%; height: 100%; filter: drop-shadow(0 0 14px rgba(255, 200, 100, .45)); }
.reward-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 5px; }
.reward {
  padding: 10px 6px 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 212, 121, .13);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.reward .coin.big { width: 24px; height: 24px; }
.reward .mp-icon { width: 23px; height: 23px; color: #8fe8b4; }
.reward b { font-size: 13px; color: #ffe7b5; font-weight: 800; }
.reward span { font-size: 8.5px; color: #8f87ab; }
.dead-card { border-color: rgba(255, 110, 110, .3); }
.dead-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 160px;
  height: 160px;
  margin-left: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 60, 80, .25), transparent 66%);
  filter: blur(10px);
  pointer-events: none;
}
.ending-card {
  border-color: rgba(190, 210, 255, .4);
  background: linear-gradient(180deg, rgba(30, 36, 74, .99), rgba(9, 9, 22, .99));
  overflow: hidden;
}
.ending-rays {
  position: absolute;
  top: -80px;
  left: 50%;
  width: 280px;
  height: 280px;
  margin-left: -140px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 7%, rgba(160, 210, 255, .2) 9%, transparent 12% 20%, rgba(255, 212, 121, .16) 22%, transparent 25% 38%, rgba(160, 210, 255, .16) 40%, transparent 44% 100%);
  filter: blur(2px);
  animation: ringSpin 40s linear infinite;
  pointer-events: none;
}
.ending-card > * { position: relative; }

/* ---- toast ---- */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(178px + var(--safe-bottom));
  z-index: 130;
  transform: translate(-50%, 8px);
  padding: 8px 16px;
  border-radius: 18px;
  background: rgba(10, 8, 22, .94);
  border: 1px solid rgba(255, 212, 121, .32);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  color: #ffe2a1;
  font-size: 11px;
  letter-spacing: .03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---- 额外战斗表现 ---- */
#modal-equip { z-index: 110; }
.stage.shaking { animation: stageShake .24s linear; }
@keyframes stageShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(-5px, 2px, 0); }
  36% { transform: translate3d(4px, -2px, 0); }
  54% { transform: translate3d(-3px, 1px, 0); }
  72% { transform: translate3d(2px, -1px, 0); }
}
.nova.heal {
  border-color: rgba(150, 255, 195, .85);
  background: radial-gradient(circle, rgba(150, 255, 195, .24), rgba(60, 220, 140, .1) 45%, transparent 65%);
  box-shadow: 0 0 40px rgba(90, 255, 170, .45), inset 0 0 40px rgba(120, 255, 190, .3);
}
.shock.warn {
  border-color: rgba(255, 105, 105, .55);
  background: radial-gradient(circle, transparent 47%, rgba(255, 70, 80, .18) 50%, transparent 62%);
  animation: shockWarn .72s ease-out forwards;
}
@keyframes shockWarn {
  0% { opacity: 0; transform: scale(.4); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.06); }
}

/* ============================ 动画 ============================ */
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bgDrift {
  from { transform: scale(1.03) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.2%, -1.5%, 0); }
}
@keyframes haloBreathe {
  0%, 100% { opacity: .72; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.07); }
}
@keyframes ringSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shineSweep {
  0%, 58% { left: -70px; }
  82%, 100% { left: 118%; }
}
@keyframes dustRise {
  0% { opacity: 0; transform: translate3d(0, 20px, 0) scale(.5); }
  15% { opacity: .7; }
  75% { opacity: .45; }
  100% { opacity: 0; transform: translate3d(18px, -180px, 0) scale(1.2); }
}
@keyframes beamBreathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes hintBreathe { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes idleBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2.4px) rotate(-.4deg); }
}
@keyframes walkBob {
  0%, 100% { transform: translateY(0) rotate(-1.4deg); }
  50% { transform: translateY(-3.6px) rotate(1.6deg); }
}
@keyframes attackLunge {
  0% { transform: translateX(0) rotate(0); }
  38% { transform: translateX(9px) rotate(-3deg); }
  100% { transform: translateX(0) rotate(0); }
}
@keyframes swordSwing {
  0% { transform: rotate(0deg); }
  35% { transform: rotate(-52deg); }
  100% { transform: rotate(0deg); }
}
@keyframes hurtFlash {
  0%, 100% { filter: none; }
  40% { filter: brightness(2.2) sepia(.5) hue-rotate(-28deg) drop-shadow(0 0 10px rgba(255, 60, 60, .9)); }
}
@keyframes foeFloat {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-4px) rotate(.6deg); }
}
@keyframes foeHit {
  0%, 100% { filter: none; }
  40% { filter: brightness(2.4) drop-shadow(0 0 12px rgba(255, 220, 255, .9)); transform: translateX(4px); }
}
@keyframes foeSpawn {
  from { opacity: 0; transform: scale(.55) translateY(14px); filter: brightness(2.2); }
  to { opacity: 1; transform: scale(1) translateY(0); filter: none; }
}
@keyframes foeDissolve {
  0% { opacity: 1; transform: scale(1); filter: brightness(1.8); }
  100% { opacity: 0; transform: scale(.82) translateY(-10px); filter: brightness(2.4) blur(3px); }
}
@keyframes slashSweep {
  0% { opacity: 0; transform: rotate(-35deg) scale(.75); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: rotate(28deg) scale(1.08); }
}
@keyframes novaBurst {
  0% { opacity: 0; transform: scale(.35); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18); }
}
@keyframes sparkPop {
  0% { opacity: 1; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes shockWave {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(2.2); }
}
@keyframes dmgFloat {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.8); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(.94); }
}
@keyframes hurtVignette {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes dialogueIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes nextBob { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes waveShow {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1.02); }
}
@keyframes timeFade {
  0% { opacity: 0; transform: translateY(10px); letter-spacing: .3em; }
  25% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); letter-spacing: .1em; }
}
@keyframes portalBreathe {
  0%, 100% { opacity: .62; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes fogDrift {
  from { transform: translate3d(-3%, 0, 0) scale(1); opacity: .55; }
  to { transform: translate3d(3%, -6px, 0) scale(1.08); opacity: .9; }
}
@keyframes emberRise {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(.5); }
  12% { opacity: .9; }
  80% { opacity: .5; }
  100% { opacity: 0; transform: translate3d(22px, -160px, 0) scale(1.1); }
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes npcBreathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(34px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes emblemPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.18); }
}
@keyframes introOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
