:root {
  --accent: #FF8A3D;
  --accent-2: #FFC46B;
  --accent-deep: #E8651B;
  --ink: #F8EFE6;
  --muted: #B9A79C;
  --dim: #8A7A72;
  --bg: #0B0710;
  --panel: rgba(28, 17, 30, 0.86);
  --panel-strong: rgba(22, 13, 25, 0.96);
  --line: rgba(255, 176, 112, 0.18);
  --line-strong: rgba(255, 176, 112, 0.34);
  --good: #5BE7B4;
  --danger: #FF6B57;
  --blue: #57C8FF;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
.is-hidden { display: none !important; }

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 72% 38%, #2A1327 0%, #120914 52%, #08050C 100%);
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.fx { position: absolute; inset: 0; pointer-events: none; }
.fx-vignette {
  background: radial-gradient(ellipse at 50% 48%, rgba(0,0,0,0) 42%, rgba(0,0,0,0.52) 100%);
  z-index: 3;
}
.fx-grain {
  z-index: 4;
  opacity: 0.065;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.55) 0 1px, rgba(0,0,0,0) 1px 3px);
  mix-blend-mode: overlay;
}

/* ---------- 通用组件 ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-2);
  font-size: 12px;
  letter-spacing: 0.22em;
  font-weight: 600;
}
.eyebrow-line {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #5B3048, #25142A 68%);
  border: 1px solid var(--line-strong);
  color: var(--accent-2);
  font-weight: 800;
  overflow: visible;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 150, 80, 0.4);
  border-top-color: transparent;
  border-left-color: transparent;
  animation: spin 5s linear infinite;
}
.avatar-hud { width: 42px; height: 42px; font-size: 16px; }
.avatar-start { width: 44px; height: 44px; font-size: 16px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.12s ease, filter 0.16s ease, background 0.16s ease;
}
.btn:active { transform: scale(0.965); filter: brightness(1.1); }
.btn-primary {
  color: #241006;
  background: linear-gradient(135deg, #FFD08A 0%, #FF9B48 42%, #FF7A24 100%);
  box-shadow: 0 10px 26px rgba(255, 122, 36, 0.32), inset 0 1px 0 rgba(255,255,255,0.55);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent 48%);
  pointer-events: none;
}
.btn-secondary {
  color: var(--ink);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-strong);
}
.btn-ghost {
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
}
.btn-text {
  color: var(--muted);
  background: transparent;
  min-height: 40px;
}
.btn-text:active { color: var(--ink); }
.btn .mp-icon { width: 20px; height: 20px; }

/* ---------- 首页 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.start-screen {
  z-index: 12;
  padding: clamp(12px, 2.6vh, 28px) clamp(16px, 3.4vw, 52px);
  background:
    linear-gradient(90deg, rgba(8,5,12,0.94) 0%, rgba(8,5,12,0.78) 36%, rgba(8,5,12,0.25) 66%, rgba(8,5,12,0.62) 100%),
    radial-gradient(ellipse at 76% 28%, rgba(255, 138, 61, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(11,7,16,0.18), rgba(11,7,16,0.7));
}
.start-wrap {
  width: 100%;
  max-width: 1400px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(18px, 4vw, 64px);
  height: 100%;
  max-height: 760px;
}
.start-hero {
  flex: 1 1 56%;
  min-width: 0;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: clamp(0px, 1vw, 16px);
}
.game-logo {
  margin: 12px 0 0;
  font-size: clamp(48px, 8.4vw, 98px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #FFF3E4;
  text-shadow: 0 6px 26px rgba(255, 120, 40, 0.2), 0 2px 0 rgba(0,0,0,0.3);
}
.game-logo em {
  font-style: normal;
  background: linear-gradient(135deg, #FFEBC6 0%, #FFB35E 44%, #FF7A24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 20px rgba(255, 122, 36, 0.3));
}
.game-sub {
  margin: 12px 0 0;
  padding-left: 4px;
  font-size: clamp(9px, 1.05vw, 12px);
  letter-spacing: 0.4em;
  color: #A98D7F;
}
.lore {
  margin: clamp(12px, 2.4vh, 24px) 0 0;
  max-width: 520px;
  color: #D9C7BB;
  font-size: clamp(12px, 1.2vw, 14px);
  line-height: 1.85;
}
.lore strong { color: var(--accent-2); font-weight: 600; }
.start-stats {
  display: flex;
  gap: clamp(8px, 1.1vw, 14px);
  margin: clamp(14px, 2.6vh, 26px) 0 0;
  flex-wrap: wrap;
}
.mini-stat {
  min-width: 82px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 2px solid rgba(255, 138, 61, 0.55);
}
.mini-stat span { display: block; font-size: 10px; color: var(--dim); letter-spacing: 0.08em; }
.mini-stat b { display: block; margin-top: 2px; font-size: clamp(14px, 1.4vw, 17px); color: var(--ink); }
.mini-stat b.accent { color: var(--accent-2); }

.start-buttons {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: clamp(14px, 2.6vh, 26px);
  max-width: 540px;
}
.btn-start {
  flex: 1 1 auto;
  justify-content: flex-start;
  gap: 13px;
  padding: 10px 16px 10px 12px;
  min-height: 62px;
  border-radius: 16px;
}
.btn-ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(36, 16, 6, 0.16);
  border: 1px solid rgba(36, 16, 6, 0.18);
  flex: 0 0 auto;
}
.btn-ico .mp-icon { width: 24px; height: 24px; }
.btn-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; flex: 1 1 auto; }
.btn-copy b { font-size: clamp(14px, 1.3vw, 17px); letter-spacing: 0.04em; }
.btn-copy small { margin-top: 4px; font-size: 10px; font-weight: 600; opacity: 0.66; letter-spacing: 0.03em; }
.btn-chev { width: 20px; height: 20px; opacity: 0.72; }
.btn-reset { flex: 0 0 auto; min-height: 62px; border-radius: 16px; padding-inline: 14px; font-size: 12px; flex-direction: column; gap: 5px; }
.btn-reset .mp-icon { width: 19px; height: 19px; }
.start-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: clamp(11px, 1.8vh, 18px) 0 0;
  color: #8D7B72;
  font-size: 10px;
  line-height: 1.5;
  max-width: 520px;
}
.start-note .mp-icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; color: #C58C62; }

.start-side {
  flex: 0 1 470px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100%;
}
.panel {
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(38, 23, 40, 0.9), rgba(17, 10, 20, 0.93));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
}
.class-panel {
  padding: clamp(12px, 1.6vw, 18px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-title span { font-size: 15px; font-weight: 800; letter-spacing: 0.16em; color: #FFE7D2; }
.panel-title small { font-size: 10px; color: var(--dim); letter-spacing: 0.08em; }

.class-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}
.class-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 9px;
  border-radius: 13px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  overflow: hidden;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}
.class-card:active { transform: scale(0.975); }
.class-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14%; bottom: 14%;
  width: 2px;
  border-radius: 2px;
  background: var(--c, var(--accent));
  opacity: 0.5;
}
.class-card.active {
  background: linear-gradient(120deg, rgba(255, 138, 61, 0.17), rgba(255,255,255,0.035));
  border-color: rgba(255, 160, 90, 0.5);
  box-shadow: 0 6px 18px rgba(255, 122, 36, 0.13), inset 0 0 0 1px rgba(255, 190, 130, 0.1);
}
.class-ico {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 34%, transparent);
}
.class-ico .mp-icon { width: 19px; height: 19px; }
.class-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.class-txt b { font-size: 13px; color: var(--ink); letter-spacing: 0.04em; }
.class-txt small { margin-top: 3px; font-size: 9px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--c, var(--accent)); margin-left: auto; opacity: 0; box-shadow: 0 0 8px var(--c, var(--accent)); }
.class-card.active .class-dot { opacity: 1; }

.class-detail {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  min-height: 0;
}
.detail-head { display: flex; align-items: center; gap: 8px; }
.detail-head b { font-size: 14px; color: #FFE7D2; letter-spacing: 0.05em; }
.detail-head span { font-size: 10px; color: var(--muted); }
.detail-desc { margin: 6px 0 0; font-size: 10.5px; line-height: 1.55; color: #A9958C; }
.detail-attrs { display: flex; gap: 12px; margin-top: 8px; }
.attr { flex: 1 1 0; display: flex; align-items: center; gap: 6px; }
.attr span { font-size: 9px; color: var(--dim); flex: 0 0 auto; }
.attr i { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); flex: 1 1 auto; overflow: hidden; }
.attr i::after { content: ""; display: block; width: var(--v, 50%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); }
.detail-kit { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.kit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  color: #D8C1B2;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
}
.kit-pill b { color: var(--accent-2); font-weight: 700; }
.kit-pill .mp-icon { width: 12px; height: 12px; color: var(--accent); }

.player-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(34,21,38,0.9), rgba(16,9,19,0.9));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}
.player-copy { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1 1 auto; }
.player-copy b { font-size: 13px; color: #FFEAD8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-copy span { font-size: 9px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 10px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;
}
.mini-btn:active { background: rgba(255,255,255,0.1); }
.mini-btn .mp-icon { width: 13px; height: 13px; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  padding: max(9px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.hud-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hud-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-profile { display: flex; align-items: center; gap: 8px; }
.hud-id { display: flex; flex-direction: column; line-height: 1.18; max-width: 112px; }
.hud-id b { font-size: 11px; color: #FFEAD8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-id span { font-size: 8.5px; color: #B39382; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: flex; align-items: center; gap: 5px; }
.bar-key { width: 10px; font-size: 8.5px; color: #A88E80; text-align: center; }
.bar {
  position: relative;
  width: clamp(92px, 12vw, 148px);
  height: 11px;
  border-radius: 4px;
  background: rgba(8,5,10,0.62);
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; border-radius: 3px; transition: width 0.14s linear; }
.bar-hp i { background: linear-gradient(90deg, #E8442E, #FF8260 70%, #FFB08E); }
.bar-mp i { background: linear-gradient(90deg, #2C7BE5, #57C8FF 70%, #A5E9FF); }
.bar-rage i { background: linear-gradient(90deg, #8A4DFF, #D26BFF 55%, #FFB35E); }
.bar em {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-style: normal;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; padding-top: 2px; }
.stage-pill {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(12,7,15,0.62);
  border: 1px solid rgba(255, 170, 100, 0.2);
  backdrop-filter: blur(5px);
  white-space: nowrap;
}
.stage-pill span { font-size: 8.5px; color: #B99A88; letter-spacing: 0.1em; }
.stage-pill b { font-size: 11px; color: #FFE4CC; letter-spacing: 0.06em; }
.wave-dots { display: flex; align-items: center; gap: 4px; height: 7px; }
.wave-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.22); transition: all 0.2s; }
.wave-dot.done { background: var(--accent); opacity: 0.6; }
.wave-dot.active { background: #FFD08A; width: 13px; border-radius: 4px; box-shadow: 0 0 8px rgba(255, 160, 80, 0.7); }
.wave-dot.boss { width: 7px; height: 7px; border: 1px solid rgba(255, 150, 80, 0.5); background: transparent; }
.wave-dot.boss.done { background: var(--accent); }
.boss-bar { width: clamp(220px, 32vw, 430px); margin-top: 2px; }
.boss-name { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 3px; }
.boss-name span { font-size: 10px; font-weight: 700; color: #FFD7EA; letter-spacing: 0.12em; text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.boss-name em { font-size: 8px; font-style: normal; color: #F3B7CE; }
.boss-track { height: 6px; border-radius: 6px; background: rgba(8,4,10,0.7); border: 1px solid rgba(255, 150, 200, 0.25); overflow: hidden; }
.boss-track i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #B21D57, #FF5C9E 55%, #FFB35E); transition: width 0.18s linear; }

.hud-right { display: flex; align-items: center; gap: 6px; }
.points-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(12,7,15,0.66);
  border: 1px solid rgba(255, 170, 100, 0.25);
  backdrop-filter: blur(5px);
}
.points-chip .mp-icon { width: 14px; height: 14px; color: var(--accent-2); }
.points-chip b { font-size: 12px; color: #FFE4CC; letter-spacing: 0.04em; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(12,7,15,0.66);
  border: 1px solid rgba(255,255,255,0.1);
  color: #D8C4B7;
  pointer-events: auto;
  transition: transform 0.12s ease, background 0.16s ease;
}
.icon-btn:active { transform: scale(0.92); background: rgba(255,255,255,0.14); }
.icon-btn .mp-icon { width: 17px; height: 17px; }

.hint-bar {
  position: absolute;
  left: 50%;
  bottom: max(9px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(10,6,13,0.7);
  border: 1px solid rgba(255,255,255,0.08);
  color: #C9B6AA;
  font-size: 9px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  backdrop-filter: blur(5px);
}
.hint-bar.show { opacity: 1; transform: translate(-50%, 0); }
.hint-bar .mp-icon { width: 13px; height: 13px; color: var(--accent); }

/* ---------- 触控 ---------- */
.controls { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.joy-base {
  position: absolute;
  left: max(18px, 3.2vw, env(safe-area-inset-left));
  bottom: max(18px, 4vh, env(safe-area-inset-bottom));
  width: clamp(96px, 15.5vh, 136px);
  height: clamp(96px, 15.5vh, 136px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.08), rgba(10,6,13,0.32) 68%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 26px rgba(0,0,0,0.35), 0 8px 26px rgba(0,0,0,0.25);
  pointer-events: auto;
  touch-action: none;
}
.joy-ring {
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 180, 110, 0.25);
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42%;
  height: 42%;
  margin-left: -21%;
  margin-top: -21%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 32%, rgba(255, 211, 154, 0.85), rgba(255, 122, 36, 0.68));
  border: 1px solid rgba(255, 236, 210, 0.65);
  box-shadow: 0 5px 16px rgba(255, 110, 30, 0.35), inset 0 1px 0 rgba(255,255,255,0.55);
  color: #4A1D05;
  will-change: transform;
}
.joy-knob .mp-icon { width: 46%; height: 46%; }

.actions {
  position: absolute;
  right: max(18px, 3.2vw, env(safe-area-inset-right));
  bottom: max(16px, 3.4vh, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: end;
  gap: clamp(8px, 1.5vh, 14px);
  pointer-events: none;
}
.act-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: clamp(62px, 12.6vh, 92px);
  height: clamp(62px, 12.6vh, 92px);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  background: radial-gradient(circle at 36% 28%, rgba(83, 49, 95, 0.92), rgba(24, 13, 30, 0.94) 70%);
  border: 1px solid rgba(255, 170, 110, 0.26);
  box-shadow: 0 10px 26px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.13);
  color: #FFE8D5;
  transition: transform 0.09s ease, filter 0.12s ease;
  overflow: hidden;
}
.act-btn:active, .act-btn.pressed { transform: scale(0.9); filter: brightness(1.15); }
.act-btn .mp-icon { width: 32%; height: 32%; margin-bottom: 2px; }
.act-btn b { font-size: clamp(9px, 1.15vh, 12px); letter-spacing: 0.05em; }
.act-btn em { font-style: normal; font-size: clamp(6.5px, 0.86vh, 8px); color: #B99A88; letter-spacing: 0.02em; }
.act-attack {
  grid-column: 2;
  grid-row: 2;
  width: clamp(78px, 16.4vh, 118px);
  height: clamp(78px, 16.4vh, 118px);
  background: radial-gradient(circle at 36% 28%, #FFC57C, #F27422 58%, #B3420C 100%);
  border-color: rgba(255, 232, 200, 0.65);
  color: #2C1004;
  box-shadow: 0 12px 30px rgba(255, 110, 30, 0.34), inset 0 1px 0 rgba(255,255,255,0.5);
}
.act-attack em { color: rgba(44,16,4,0.6); }
.act-skill {
  grid-column: 1;
  grid-row: 2;
  background: radial-gradient(circle at 36% 28%, #7E6BFF, #4130A8 62%, #22155E 100%);
  border-color: rgba(180, 160, 255, 0.42);
}
.act-skill em { color: #C8BCFF; }
.act-weapon {
  grid-column: 2;
  grid-row: 1;
  background: radial-gradient(circle at 36% 28%, #FF8DDA, #A332A8 60%, #4D1459 100%);
  border-color: rgba(255, 170, 230, 0.4);
}
.act-weapon.is-ready {
  border-color: rgba(255, 236, 180, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 180, 80, 0.25), 0 0 26px rgba(255, 150, 60, 0.6), inset 0 1px 0 rgba(255,255,255,0.3);
  animation: readyPulse 1.4s ease-in-out infinite;
}
.act-btn.is-cooling .mp-icon, .act-btn.is-cooling b { opacity: 0.55; }
.act-cd {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: transparent;
}
.act-btn.is-noMp { opacity: 0.66; }

/* ---------- 横幅 ---------- */
.stage-banner {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(9,5,12,0.5), rgba(9,5,12,0) 62%);
  text-align: center;
  padding: 20px;
}
.stage-banner.show { animation: bannerShow 2.5s ease both; }
.stage-banner span {
  font-size: clamp(10px, 1.15vw, 13px);
  letter-spacing: 0.42em;
  color: var(--accent-2);
  padding-left: 0.42em;
}
.stage-banner h2 {
  margin: 8px 0 0;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.15;
  letter-spacing: 0.12em;
  color: #FFF0DE;
  text-shadow: 0 8px 34px rgba(255, 120, 40, 0.4), 0 2px 0 rgba(0,0,0,0.25);
}
.stage-banner p {
  margin: 10px 0 0;
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: 0.12em;
  color: #C3AA9A;
}

/* ---------- 弹层 ---------- */
.modal-screen { z-index: 20; padding: 16px; background: rgba(6,3,9,0.4); }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 120, 45, 0.09), transparent 55%),
    rgba(6, 3, 9, 0.62);
  backdrop-filter: blur(9px);
}
.dead-backdrop { background: radial-gradient(ellipse at 50% 44%, rgba(180, 30, 50, 0.16), transparent 58%), rgba(6,3,9,0.72); }
.end-backdrop { background: radial-gradient(ellipse at 50% 42%, rgba(255, 150, 60, 0.14), transparent 58%), rgba(6,3,9,0.7); }
.ad-backdrop { background: rgba(6,3,9,0.8); }

.branch-card, .dead-card, .pause-card, .end-card, .ad-card, .rename-card {
  position: relative;
  width: 100%;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(40, 24, 42, 0.96), rgba(17, 10, 20, 0.98));
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 70px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.07);
  padding: clamp(18px, 3vh, 30px);
  animation: cardIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.branch-card { max-width: 820px; }
.branch-head { text-align: center; }
.branch-head h2 { margin: 9px 0 0; font-size: clamp(21px, 2.6vw, 30px); letter-spacing: 0.12em; color: #FFECDA; }
.branch-head p { margin: 7px 0 0; font-size: 11px; color: #B49C8E; }
.branch-options { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.6vw, 18px); margin-top: clamp(14px, 2.4vh, 24px); }
.branch-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(12px, 2vh, 22px) clamp(12px, 1.6vw, 20px);
  border-radius: 18px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.09);
  transition: transform 0.14s ease, border-color 0.16s ease, background 0.16s ease;
}
.branch-opt:active { transform: scale(0.975); }
.branch-opt > .mp-icon { width: clamp(28px, 3.6vh, 40px); height: clamp(28px, 3.6vh, 40px); }
.branch-opt h3 { margin: 8px 0 0; font-size: clamp(17px, 2vw, 23px); letter-spacing: 0.12em; }
.branch-opt p { margin: 7px 0 0; font-size: 10.5px; line-height: 1.55; color: #B9A399; max-width: 240px; }
.branch-opt .opt-reward { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.branch-opt .opt-reward span { padding: 4px 9px; border-radius: 999px; font-size: 9px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.07); }
.branch-opt em { margin-top: 10px; font-style: normal; font-size: 9px; letter-spacing: 0.24em; opacity: 0.7; }
.opt-purify { border-color: rgba(91, 231, 180, 0.32); background: linear-gradient(160deg, rgba(91, 231, 180, 0.1), rgba(255,255,255,0.025)); }
.opt-purify > .mp-icon, .opt-purify h3 { color: #7CF3C8; }
.opt-purify .opt-reward span { color: #A7FFDD; }
.opt-sever { border-color: rgba(255, 138, 61, 0.34); background: linear-gradient(160deg, rgba(255, 107, 87, 0.1), rgba(255,255,255,0.025)); }
.opt-sever > .mp-icon, .opt-sever h3 { color: #FF9C7F; }
.opt-sever .opt-reward span { color: #FFC9A8; }
.branch-note { margin: 14px 0 0; text-align: center; font-size: 9px; color: #8A766C; letter-spacing: 0.1em; }

.dead-card { max-width: 440px; text-align: center; }
.dead-sigil {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: -4px auto 10px;
  border-radius: 50%;
  color: #FF9C7F;
  background: radial-gradient(circle, rgba(255, 80, 80, 0.22), rgba(255, 80, 80, 0.04));
  border: 1px solid rgba(255, 120, 100, 0.36);
  box-shadow: 0 0 24px rgba(255, 80, 60, 0.18);
}
.dead-sigil .mp-icon { width: 26px; height: 26px; }
.dead-card h2 { margin: 7px 0 0; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: 0.16em; color: #FFE2D6; }
.dead-sub { margin: 8px 0 0; font-size: 11px; color: #B49C8E; line-height: 1.55; }
.dead-stats { display: flex; gap: 10px; margin: 16px 0 14px; }
.dead-stats div { flex: 1 1 0; padding: 8px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.dead-stats span { display: block; font-size: 9px; color: #8A766C; }
.dead-stats b { display: block; margin-top: 3px; font-size: 15px; color: #FFD3B8; }
.btn-ad-revive { width: 100%; justify-content: flex-start; min-height: 58px; padding-inline: 14px; }
.btn-ad-revive .btn-copy b { color: #241006; }
.btn-ad-revive .btn-copy small { color: rgba(36,16,6,0.62); opacity: 1; }
.dead-card .btn-secondary { width: 100%; margin-top: 9px; justify-content: flex-start; min-height: 52px; }
.dead-card .btn-text { width: 100%; margin-top: 4px; }
.ad-note { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 12px 0 0; font-size: 8.5px; color: #77665F; line-height: 1.4; }
.ad-note .mp-icon { width: 12px; height: 12px; }

.pause-card { max-width: 360px; text-align: center; }
.pause-card h2 { margin: 8px 0 16px; font-size: clamp(21px, 2.5vw, 28px); letter-spacing: 0.14em; color: #FFEBDA; }
.pause-actions { display: flex; flex-direction: column; gap: 8px; }
.pause-actions .btn { width: 100%; justify-content: center; }

.end-card { max-width: 560px; text-align: center; }
.end-card h2 { margin: 9px 0 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: 0.14em; color: #FFEDDA; }
.end-card > p { margin: 9px auto 0; max-width: 420px; font-size: 11px; line-height: 1.7; color: #BAA296; }
.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 16px; }
.end-stats div { padding: 10px 4px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.end-stats span { display: block; font-size: 9px; color: #8A766C; }
.end-stats b { display: block; margin-top: 3px; font-size: clamp(14px, 1.6vw, 18px); color: #FFD3B8; }
.end-card .btn { width: 100%; min-height: 52px; }
.end-note { margin: 11px 0 0 !important; font-size: 9px !important; letter-spacing: 0.16em; color: #806C62 !important; }

.rename-card { max-width: 380px; text-align: center; }
.rename-card h2 { margin: 8px 0 14px; font-size: 22px; letter-spacing: 0.12em; }
.rename-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255, 170, 110, 0.32);
  color: #FFE7D2;
  font-size: 16px;
  letter-spacing: 0.06em;
  outline: none;
  text-align: center;
}
.rename-input:focus { border-color: rgba(255, 190, 130, 0.7); box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.12); }
.rename-actions { display: flex; gap: 9px; margin-top: 12px; }
.rename-actions .btn { flex: 1 1 0; }

/* ---------- 模拟广告 ---------- */
.ad-card { max-width: 500px; }
.ad-top { display: flex; justify-content: space-between; align-items: center; }
.ad-top span { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: #C6B1A4; letter-spacing: 0.1em; }
.ad-top .mp-icon { width: 14px; height: 14px; color: var(--good); }
.ad-top b { font-size: 12px; color: var(--accent-2); }
.ad-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: clamp(140px, 30vh, 230px);
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 180, 110, 0.33), transparent 54%),
    linear-gradient(140deg, #47263A, #23152C 60%, #1A1020);
  border: 1px solid rgba(255, 180, 120, 0.2);
}
.ad-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 120, 0.22), transparent 66%);
  animation: readyPulse 3s ease-in-out infinite;
}
.ad-visual .mp-icon { position: relative; width: 42px; height: 42px; color: #FFD4A2; }
.ad-visual strong { position: relative; font-size: 17px; letter-spacing: 0.14em; color: #FFF1DF; }
.ad-visual span { position: relative; font-size: 9px; color: #C4A996; letter-spacing: 0.16em; }
.ad-progress { height: 5px; margin-top: 13px; border-radius: 5px; background: rgba(255,255,255,0.1); overflow: hidden; }
.ad-progress i { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); transition: width 0.1s linear; }
.ad-copy { margin: 10px 0 0; font-size: 10px; color: #A89387; text-align: center; }
.ad-card .btn-text { width: 100%; margin-top: 6px; font-size: 10px; }

/* ---------- toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: max(64px, 12vh);
  z-index: 40;
  transform: translate(-50%, -8px);
  max-width: min(76vw, 500px);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(18, 10, 22, 0.93);
  border: 1px solid rgba(255, 170, 110, 0.34);
  color: #FFE6CE;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes readyPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.035); filter: brightness(1.15); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bannerShow {
  0% { opacity: 0; transform: scale(1.04); }
  12% { opacity: 1; transform: scale(1); }
  78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.99); }
}

/* ---------- 紧凑横屏 ---------- */
@media (max-height: 560px) {
  .game-logo { font-size: clamp(42px, 7vw, 64px); }
  .lore { line-height: 1.65; margin-top: 10px; font-size: 11px; }
  .start-stats { margin-top: 12px; }
  .mini-stat { padding: 6px 9px; min-width: 70px; }
  .mini-stat b { font-size: 13px; }
  .start-buttons { margin-top: 12px; }
  .btn-start, .btn-reset { min-height: 54px; }
  .start-note { margin-top: 9px; font-size: 9px; }
  .class-card { min-height: 42px; padding: 5px 8px; }
  .class-ico { width: 27px; height: 27px; }
  .class-detail { margin-top: 8px; padding-top: 8px; }
  .detail-desc { font-size: 9.5px; }
  .detail-kit { margin-top: 6px; }
  .player-bar { padding: 6px 10px; }
  .avatar-start { width: 38px; height: 38px; }
  .branch-card, .dead-card, .pause-card, .end-card, .ad-card { padding: 16px 20px; }
  .branch-head h2 { font-size: 21px; }
  .branch-opt { padding: 10px; }
  .branch-opt p { font-size: 9.5px; }
  .dead-sigil { width: 42px; height: 42px; }
  .dead-card h2 { font-size: 22px; }
  .dead-stats { margin: 10px 0; }
  .end-stats { margin: 12px 0; }
}

@media (max-width: 760px) {
  .start-wrap { gap: 12px; }
  .start-hero { flex-basis: 52%; }
  .start-side { flex-basis: 44%; min-width: 0; }
  .class-list { grid-template-columns: 1fr; }
  .class-card { min-height: 40px; }
  .class-txt small { display: none; }
  .detail-attrs { gap: 7px; }
  .kit-pill { padding: 3px 6px; font-size: 8px; }
  .hud-id { display: none; }
  .bar { width: 92px; }
  .hint-bar { display: none; }
  .stage-pill b { font-size: 10px; }
  .boss-bar { width: 180px; }
}

@media (max-width: 620px) {
  .start-screen { padding: 10px 12px; }
  .game-logo { font-size: 36px; }
  .game-sub { letter-spacing: 0.24em; }
  .lore { font-size: 9.5px; line-height: 1.55; }
  .start-buttons { flex-direction: column; gap: 7px; }
  .btn-reset { flex-direction: row; min-height: 38px; }
  .start-note { display: none; }
  .mini-stat { flex: 1 1 0; min-width: 0; padding: 5px 7px; }
  .panel-title small { display: none; }
  .class-panel { padding: 9px; border-radius: 16px; }
  .player-bar { padding: 5px 8px; }
  .player-copy span { display: none; }
  .mini-btn { padding: 6px 7px; font-size: 9px; }
  .branch-options { gap: 8px; }
  .branch-opt .opt-reward span { font-size: 8px; padding: 3px 6px; }
  .branch-head p { font-size: 9.5px; }
  .end-stats { grid-template-columns: repeat(2, 1fr); }
}
