:root {
  --gold: #ffd36a;
  --gold2: #f0a830;
  --text: #f6eedb;
  --muted: #b7ad98;
  --panel: rgba(20, 18, 32, 0.86);
  --panel2: rgba(34, 30, 52, 0.92);
  --line: rgba(255, 214, 130, 0.28);
  --red: #ff5a5a;
  --green: #6be35a;
  --blue: #6fd3ff;
  --safe-top: 0px;
  --safe-bottom: 0px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0d0f1c; color: var(--text);
  font-family: var(--font); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui > * { pointer-events: auto; }
button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
img { -webkit-user-drag: none; user-select: none; }
.hidden { display: none !important; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(circle at 50% 40%, #2a1e3a, #0d0f1c 70%); z-index: 50; color: var(--gold); letter-spacing: 2px; }
#loading .spark { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle, #fff6c8, #ff9a3d 45%, transparent 70%); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.35); opacity: 0.6; } }

#rotate-hint { display: none; }
body.landscape-phone #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 99; background: #0d0f1c; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 20px; color: var(--gold); }
body.landscape-phone #rotate-hint div:first-child { font-size: 48px; animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 50% { transform: rotate(-90deg); } }

.errbox { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: #5a1a1a; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; font-size: 13px; max-width: 90vw; }

/* ===================== 通用按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px; border-radius: 14px; font-size: 16px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(70, 62, 96, 0.95), rgba(40, 34, 60, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.08s, filter 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.98); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn.primary { background: linear-gradient(180deg, #ffd978, #e8962a); color: #3a1e05; border-color: rgba(255, 240, 200, 0.6); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.big { min-height: 58px; font-size: 19px; border-radius: 18px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: linear-gradient(180deg, #d85050, #8a2222); color: #fff; }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); }
.btnrow { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.btncol { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sub { color: var(--muted); font-size: 13px; margin: 8px 0; }
.center { text-align: center; }

/* ===================== 局外界面 ===================== */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(180deg, rgba(10, 8, 20, 0.55), rgba(10, 8, 20, 0.82));
  opacity: 0; transition: opacity 0.35s; touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
.screen.show { opacity: 1; }
.screen > * { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }

.screen.title { justify-content: center; align-items: center; background: radial-gradient(ellipse at 50% 35%, rgba(40, 20, 10, 0.1), rgba(8, 6, 16, 0.78) 75%); }
.logo { text-align: center; margin-bottom: 36px; }
.logo h1 {
  margin: 0; font-size: clamp(54px, 17vw, 88px); font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(180deg, #fff6d0 10%, #ffcf5a 45%, #e8762a 80%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(90, 30, 0, 0.8)) drop-shadow(0 0 24px rgba(255, 150, 50, 0.45));
  animation: logoGlow 3s ease-in-out infinite;
}
@keyframes logoGlow { 50% { filter: drop-shadow(0 4px 0 rgba(90, 30, 0, 0.8)) drop-shadow(0 0 40px rgba(255, 170, 60, 0.75)); } }
.logo-sub { letter-spacing: 10px; color: #ffcf8a; font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.logo-tag { margin-top: 10px; color: #f0e0c0; letter-spacing: 4px; font-size: 15px; text-shadow: 0 2px 6px #000; }
.menu { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
.titlefoot { margin-top: 30px; text-align: center; color: var(--muted); font-size: 13px; text-shadow: 0 1px 4px #000; }

.nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: sticky; top: 0; z-index: 3; }
.nav .back { width: 42px; height: 42px; border-radius: 12px; font-size: 30px; line-height: 1; background: var(--panel); border: 1px solid var(--line); }
.navtitle { flex: 1; font-size: 19px; font-weight: 800; text-shadow: 0 2px 6px #000; }
.navglory { color: var(--gold); font-weight: 700; background: var(--panel); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; }

.segment { display: flex; gap: 6px; background: var(--panel); padding: 5px; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 12px; }
.segment button { flex: 1; padding: 7px 4px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); }
.segment button b { font-size: 15px; }
.segment button small { font-size: 10px; opacity: 0.8; }
.segment button.on { background: linear-gradient(180deg, #ffd978, #e8962a); color: #3a1e05; }

.maplist { display: flex; flex-direction: column; gap: 12px; }
.mapcard { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 10px; position: relative; overflow: hidden; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.mapcard::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 30%, var(--mc)); opacity: 0.14; pointer-events: none; }
.mapcard.locked { filter: grayscale(0.85) brightness(0.65); }
.mthumb { position: relative; width: 84px; flex: none; border-radius: 12px; overflow: hidden; aspect-ratio: 720 / 1280; border: 2px solid rgba(255, 255, 255, 0.15); }
.mthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mnum { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, 0.65); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--gold); }
.minfo { flex: 1; display: flex; flex-direction: column; gap: 3px; position: relative; min-width: 0; }
.mname { font-size: 19px; font-weight: 800; color: var(--mc); text-shadow: 0 1px 4px #000; }
.msub { font-size: 13px; color: var(--muted); }
.mmeta { font-size: 11px; color: #9e9584; }
.mstars span { font-size: 20px; color: rgba(255, 255, 255, 0.18); }
.mstars span.on { color: var(--gold); text-shadow: 0 0 8px rgba(255, 200, 80, 0.7); }
.mstars .crown { margin-left: 6px; font-size: 16px; }
.mbtns { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.lockmsg { margin-top: auto; font-size: 13px; color: var(--muted); }

.herogrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.herocard { background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 16px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; transition: transform 0.15s; }
.herocard img { width: 100%; max-width: 76px; aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.12), transparent 70%); }
.herocard.sel { border-color: var(--hc); box-shadow: 0 0 16px -2px var(--hc); transform: translateY(-3px); }
.herocard.locked img { filter: brightness(0.25) grayscale(1); }
.hcname { font-weight: 800; font-size: 15px; }
.hcrole { font-size: 10px; color: var(--muted); }
.herodetail { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.hdhead { display: flex; justify-content: space-between; align-items: baseline; }
.hdname { font-size: 20px; font-weight: 900; }
.hdrole { font-size: 12px; color: var(--muted); }
.hdintro { font-size: 13px; color: #e0d6c0; line-height: 1.5; }
.hdstats { display: flex; flex-wrap: wrap; gap: 6px; }
.hdstats span { background: rgba(255, 255, 255, 0.06); padding: 3px 8px; border-radius: 8px; font-size: 12px; }
.hdskill { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: #ddd3bd; }
.hdskill b { color: var(--text); font-size: 14px; }
.hdskill small { color: var(--gold); }
.hdsi { font-size: 22px; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); display: grid; place-items: center; flex: none; }
.footbtn { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.footbtn .btn { width: 100%; }

.talentlist { display: flex; flex-direction: column; gap: 10px; }
.talent { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.tic { font-size: 26px; width: 46px; height: 46px; border-radius: 12px; background: rgba(255, 210, 120, 0.1); display: grid; place-items: center; flex: none; }
.tbody { flex: 1; min-width: 0; }
.tname { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.tdesc, .tnext { font-size: 12.5px; color: var(--muted); }
.tnext { color: #9fd48a; }
.pipsrow { display: inline-flex; gap: 3px; }
.pipsrow i { width: 9px; height: 9px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); transform: rotate(45deg); }
.pipsrow i.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.maxtag { color: var(--gold); font-weight: 900; font-size: 13px; padding: 0 8px; }

.codexbody { display: flex; flex-direction: column; gap: 8px; }
.codexrow { display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; align-items: flex-start; }
.codexrow.boss { border-color: rgba(255, 90, 90, 0.5); }
.codexrow > img { width: 52px; height: 52px; flex: none; background: rgba(255, 255, 255, 0.05); border-radius: 12px; }
.codexrow.tower > img { width: 64px; height: 64px; }
.codexrow b { font-size: 15px; }
.tag { font-size: 10px; background: rgba(255, 255, 255, 0.1); padding: 2px 6px; border-radius: 6px; margin-left: 6px; font-weight: 600; color: #e0d4b8; }
.cdesc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.cstats { font-size: 11px; color: #9e9584; margin-top: 3px; }
.cbranch { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.cbranch img { width: 40px; height: 40px; flex: none; }
.cbranch b { font-size: 13px; color: var(--gold); }
.runegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.runemini { display: flex; gap: 8px; background: var(--panel); border: 1px solid var(--rc); border-radius: 12px; padding: 8px; }
.runemini > span { font-size: 22px; }
.runemini b { font-size: 13px; color: var(--rc); }

.settings { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px; margin-top: 12px; }
.setrow { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.setrow:last-child { border-bottom: none; }
.toggle { width: 50px; height: 30px; border-radius: 15px; background: rgba(255, 255, 255, 0.15); position: relative; transition: background 0.2s; }
.toggle i { position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
.toggle.on { background: linear-gradient(90deg, #e8962a, #ffd36a); }
.toggle.on i { transform: translateX(20px); }
.about { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; background: var(--panel); border-radius: 16px; padding: 14px; border: 1px solid var(--line); }
.confirm { background: rgba(120, 20, 20, 0.35); border-radius: 12px; padding: 12px; font-size: 14px; text-align: center; }

/* ===================== 局内 HUD ===================== */
#ui > .hud, .hud { position: fixed; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.topbar {
  position: absolute; left: 0; right: 0; top: 0; height: calc(52px + var(--safe-top)); padding: var(--safe-top) 10px 0;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(12, 10, 22, 0.95), rgba(12, 10, 22, 0.75)); border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.stat { display: flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 5px 10px 5px 7px; font-size: 16px; border: 1px solid rgba(255, 255, 255, 0.06); }
.stat b { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 22px; }
.stat .ico { font-size: 15px; }
.stat.gold b { color: var(--gold); }
.stat.gold.bump { animation: goldBump 0.25s ease-out; }
@keyframes goldBump { 40% { transform: scale(1.12); background: rgba(255, 210, 80, 0.28); } }
.stat.lives.danger { animation: danger 0.8s ease-in-out infinite; }
.stat.lives.danger b { color: var(--red); }
@keyframes danger { 50% { background: rgba(255, 60, 60, 0.3); } }
.spacer { flex: 1; }
.tbtn { width: 40px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); font-size: 16px; font-weight: 900; }
.tbtn.speed.fast { background: linear-gradient(180deg, #ffd978, #e8962a); color: #3a1e05; }

.bossbar { position: absolute; top: calc(58px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: min(420px, 80vw); text-align: center; pointer-events: none; }
.bossname { font-weight: 900; font-size: 13px; color: #ffb0b0; text-shadow: 0 1px 3px #000; letter-spacing: 2px; }
.bosstrack { height: 9px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); border: 1px solid rgba(255, 120, 120, 0.5); overflow: hidden; margin-top: 2px; }
.bossfill { height: 100%; background: linear-gradient(90deg, #ff3a3a, #ff9a5a); box-shadow: 0 0 10px #ff4a4a; transition: width 0.15s; }

.bottombar {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(92px + var(--safe-bottom)); padding: 8px 10px calc(8px + var(--safe-bottom));
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(0deg, rgba(12, 10, 22, 0.96), rgba(12, 10, 22, 0.78)); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}
.herobox { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; flex: none; }
.portrait { position: relative; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 50% 65%, #3a2e4e, #120e1e 75%); border: 2px solid var(--hc); box-shadow: 0 0 12px -2px var(--hc); overflow: visible; }
.portrait img { width: 100%; height: 100%; border-radius: 50%; }
.portrait .lvl { position: absolute; right: -5px; bottom: -3px; min-width: 22px; height: 22px; border-radius: 11px; background: linear-gradient(180deg, #ffd978, #e8962a); color: #3a1e05; font-weight: 900; font-size: 13px; display: grid; place-items: center; border: 2px solid #2a1a08; }
.portrait .deadmask { position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; font-size: 20px; font-weight: 900; color: #ff8080; }
.portrait.lvlup { animation: lvlup 0.8s ease-out; }
@keyframes lvlup { 0% { box-shadow: 0 0 0 0 rgba(255, 230, 120, 0.9); transform: scale(1.15); } 100% { box-shadow: 0 0 0 18px rgba(255, 230, 120, 0); transform: scale(1); } }
.bars { width: 62px; display: flex; flex-direction: column; gap: 2px; }
.bar { height: 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
.bar.thin { height: 4px; }
.fill { height: 100%; }
.fill.hp { background: linear-gradient(90deg, #3fbf3a, #8aff7a); }
.fill.xp { background: linear-gradient(90deg, #8a5aff, #c8a0ff); }

.skills { display: flex; gap: 7px; }
.skill {
  position: relative; width: 56px; height: 56px; border-radius: 16px; font-size: 26px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.18), rgba(30, 24, 48, 0.95) 70%);
  border: 2px solid var(--hc); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  display: grid; place-items: center; overflow: visible; transition: transform 0.1s;
}
.skill:active { transform: scale(0.93); }
.skill.ult { border-color: var(--gold); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 10px rgba(255, 200, 80, 0.35); }
.skill.ready:not(.passive) { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 12px -2px var(--hc); }
.skill.locked .sico { filter: grayscale(1) brightness(0.45); }
.skill.herodead { filter: grayscale(0.9) brightness(0.6); }
.skill.active { transform: translateY(-6px); border-color: #fff; box-shadow: 0 0 18px var(--hc); }
.skill.passive { border-style: dashed; }
.sico { line-height: 1; pointer-events: none; }
img.sico { width: 84%; height: 84%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); }
.skic img, .hdsi img { width: 100%; height: 100%; }
.infocard .ic img.skimg { width: 46px; height: 46px; }
.skill .cd { position: absolute; inset: 0; border-radius: 14px; pointer-events: none; }
.skill .cdt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.skill .key { position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 900; color: rgba(255, 255, 255, 0.65); pointer-events: none; }
.pips { position: absolute; bottom: 3px; left: 0; right: 0; display: flex; gap: 3px; justify-content: center; pointer-events: none; }
.pips i { width: 6px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); transform: rotate(45deg); }
.pips i.on { background: var(--gold); box-shadow: 0 0 4px var(--gold); }
.plus { position: absolute; right: -7px; top: -9px; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, #8aff7a, #2fa82a); color: #0a2a08; font-weight: 900; font-size: 20px; line-height: 1; border: 2px solid #0a2a08; animation: plusPulse 1s ease-in-out infinite; display: grid; place-items: center; }
@keyframes plusPulse { 50% { transform: scale(1.18); box-shadow: 0 0 12px #8aff7a; } }
.shopbtn { width: 52px; height: 56px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.shopbtn span { font-size: 22px; }
.shopbtn small { font-size: 10px; color: var(--muted); }

.worldlayer { position: absolute; inset: 0; pointer-events: none; }
.worldlayer > * { pointer-events: auto; }
.wavebtn { position: absolute; left: 0; top: 0; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; display: grid; place-items: center; animation: waveBob 1.4s ease-in-out infinite; }
@keyframes waveBob { 50% { margin-top: -31px; } }
.wavebtn .wring { position: absolute; inset: 0; border-radius: 50%; }
.wavebtn::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #5a3a8a, #1e1030); border: 2px solid #ffd36a; box-shadow: 0 0 14px rgba(255, 200, 80, 0.6); }
.wavebtn.first::before { animation: glowPulse 1s ease-in-out infinite; }
.wavebtn.bossnext::before { border-color: #ff5a5a; box-shadow: 0 0 16px rgba(255, 60, 60, 0.8); background: radial-gradient(circle at 50% 35%, #8a2a2a, #300a0a); }
@keyframes glowPulse { 50% { box-shadow: 0 0 28px rgba(255, 220, 100, 1); } }
.wico { position: relative; font-size: 22px; }
.wlbl { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 900; color: var(--gold); text-shadow: 0 1px 3px #000, 0 0 2px #000; white-space: nowrap; }
.wprev { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 2px; background: rgba(10, 8, 20, 0.8); border: 1px solid rgba(255, 214, 130, 0.35); border-radius: 12px; padding: 2px 4px 2px 5px; }
.wprev .wq { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 214, 130, 0.25); color: var(--gold); font-size: 11px; font-weight: 900; display: grid; place-items: center; margin-left: 2px; }
.wrows { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.wrow { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wrow img { width: 28px; height: 28px; }
.infocard .stats b.up { color: #8aff7a; }
.wprev:empty { display: none; }
.wprev img { width: 24px; height: 24px; }
.wprev img.boss { filter: drop-shadow(0 0 4px #ff4040); }

.ring { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.ring.pop .ritem { animation: ringPop 0.22s ease-out backwards; }
.ringbg { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed rgba(255, 230, 160, 0.35); background: radial-gradient(circle, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0) 70%); pointer-events: none; }
@keyframes ringPop { from { opacity: 0; scale: 0.3; } }
.ritem {
  position: absolute; left: -28px; top: -28px; width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #4a3e66, #1a1428); border: 2px solid #c8a868; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
}
.ritem img { width: 52px; height: 52px; margin-top: -6px; pointer-events: none; }
.remoji { font-size: 24px; }
.rlabel { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); background: #1a1220; border: 1px solid #c8a868; color: var(--gold); font-size: 11px; font-weight: 900; padding: 0 6px; border-radius: 8px; white-space: nowrap; line-height: 17px; }
.ritem.poor { filter: grayscale(0.9) brightness(0.6); }
.ritem.poor .rlabel { color: var(--red); }
.ritem.sell { border-color: #e8c050; }
.ritem.sell .rlabel { color: #9fe88a; }
.ritem.target .rlabel { color: #fff; }
.ritem.up { border-color: #8aff7a; }
.ritem.maxed { border-color: var(--gold); }
.ritem .check { position: absolute; right: -4px; top: -4px; width: 22px; height: 22px; border-radius: 50%; background: #3fbf3a; color: #fff; font-weight: 900; font-size: 14px; display: none; place-items: center; border: 2px solid #0a2a08; }
.ritem.sel { border-color: #fff; box-shadow: 0 0 16px rgba(255, 240, 180, 0.9); transform-origin: center; scale: 1.12; }
.ritem.sel .check { display: grid; }

.infocard {
  position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-bottom)); width: min(520px, calc(100vw - 20px));
  background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); pointer-events: none; animation: slideUp 0.18s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 10px); } }
.infocard .ic { width: 52px; height: 52px; flex: none; border-radius: 12px; background: rgba(255, 255, 255, 0.05); display: grid; place-items: center; }
.infocard .ic img { width: 56px; height: 56px; }
.infocard .ic.emoji { font-size: 30px; }
.infocard .body { flex: 1; min-width: 0; }
.infocard .title { font-weight: 900; font-size: 15px; }
.infocard .title small { color: var(--gold); font-weight: 700; font-size: 11.5px; }
.infocard .desc { font-size: 12.5px; color: #d8ceb8; line-height: 1.4; margin-top: 2px; }
.infocard .stats { font-size: 12px; color: #a8e0ff; margin-top: 3px; line-height: 1.5; }
.infocard .tip { font-size: 11.5px; color: #9fe88a; margin-top: 3px; }

.banner { position: absolute; left: 0; right: 0; top: 28%; text-align: center; pointer-events: none; opacity: 0; }
.banner.show { animation: bannerIn 2.4s ease-out forwards; }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
.btitle { font-size: 40px; font-weight: 900; letter-spacing: 6px; color: #fff3d0; text-shadow: 0 3px 0 #5a2a00, 0 0 24px rgba(255, 170, 60, 0.8); }
.banner.boss .btitle { color: #ffd0d0; text-shadow: 0 3px 0 #5a0000, 0 0 30px rgba(255, 50, 50, 0.9); font-size: 44px; }
.bsub { margin: 6px auto 0; max-width: 86vw; font-size: 14px; color: #f0e4c8; text-shadow: 0 1px 4px #000, 0 0 2px #000; }
.bicons { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.bicons img { width: 40px; height: 40px; filter: drop-shadow(0 2px 4px #000); }

.toast { position: absolute; left: 50%; top: calc(64px + var(--safe-top)); transform: translateX(-50%); background: rgba(16, 12, 28, 0.92); border: 1px solid var(--line); color: var(--text); padding: 8px 16px; border-radius: 20px; font-size: 13.5px; pointer-events: none; max-width: 90vw; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.toast.show { animation: toastIn 0.25s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

.hint { position: absolute; background: linear-gradient(180deg, #fff4cc, #ffd36a); color: #3a1e05; font-weight: 800; font-size: 14px; padding: 10px 12px; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); pointer-events: none; text-align: center; animation: hintBob 1.2s ease-in-out infinite; z-index: 5; }
.hint::after { content: ''; position: absolute; left: var(--ax, 50%); margin-left: -9px; border: 9px solid transparent; }
.hint.arrow-down::after { top: 100%; border-top-color: #ffd36a; }
.hint.arrow-up::after { bottom: 100%; border-bottom-color: #fff4cc; }
.hint.arrow-none::after { display: none; }
@keyframes hintBob { 50% { translate: 0 -5px; } }

/* ===================== 弹窗 ===================== */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(6, 4, 14, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 12px); opacity: 0; transition: opacity 0.2s; touch-action: pan-y; }
.overlay.show { opacity: 1; }
.modal { width: min(420px, 100%); max-height: 100%; overflow-y: auto; background: linear-gradient(180deg, rgba(40, 32, 62, 0.97), rgba(20, 16, 34, 0.97)); border: 1px solid var(--line); border-radius: 22px; padding: 18px 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08); text-align: center; -webkit-overflow-scrolling: touch; }
.overlay.show .modal { animation: modalIn 0.25s ease-out; }
@keyframes modalIn { from { transform: scale(0.9) translateY(20px); opacity: 0; } }
.modal.wide { width: min(560px, 100%); text-align: left; }
.modal h2 { margin: 0 0 6px; font-size: 26px; font-weight: 900; letter-spacing: 3px; }
.modal h2.glow { color: #fff0c0; text-shadow: 0 0 18px rgba(255, 200, 100, 0.7); }
.modal h2.win { font-size: 38px; background: linear-gradient(180deg, #fff6d0, #ffcf5a 50%, #e8762a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #5a2a00); }
.modal h2.lose { color: #ff9a9a; }
.mapline { color: var(--muted); font-size: 13px; }
.runelist { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.runelist .sub { width: 100%; margin: 0; }
.runechip { font-size: 12px; padding: 4px 8px; border-radius: 10px; border: 1px solid var(--rc); color: var(--rc); background: rgba(0, 0, 0, 0.25); }

.runecards { display: flex; gap: 8px; margin-top: 12px; }
.runecard {
  flex: 1; min-width: 0; border-radius: 16px; padding: 12px 6px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #2c2442, #141020); border: 2px solid var(--rc);
  box-shadow: inset 0 0 34px -12px var(--rc), 0 0 14px -6px var(--rc); transition: transform 0.15s; animation: cardIn 0.4s ease-out backwards;
}
.runecard:nth-child(2) { animation-delay: 0.08s; }
.runecard:nth-child(3) { animation-delay: 0.16s; }
@keyframes cardIn { from { transform: translateY(30px) rotateY(90deg); opacity: 0; } }
.runecard.sel { transform: translateY(-8px) scale(1.04); border-color: #fff; box-shadow: 0 0 26px var(--rc); }
.rr { font-size: 10px; font-weight: 900; color: var(--rc); letter-spacing: 2px; }
.ricon { font-size: 34px; filter: drop-shadow(0 0 8px var(--rc)); }
.rname { font-weight: 900; font-size: 14px; }
.rdesc { font-size: 11.5px; color: #d8ceb8; line-height: 1.4; }

.heropanel { display: flex; flex-direction: column; gap: 12px; }
.hphead { display: flex; gap: 12px; align-items: center; }
.hpic { width: 72px; height: 72px; border-radius: 18px; background: radial-gradient(circle at 50% 65%, #3a2e4e, #120e1e 75%); border: 2px solid var(--hc); flex: none; }
.hpic img { width: 100%; height: 100%; }
.hname { font-size: 18px; font-weight: 900; }
.hrole { font-size: 12px; color: var(--muted); }
.hstats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.hstats span { font-size: 11.5px; background: rgba(255, 255, 255, 0.07); padding: 2px 6px; border-radius: 6px; }
.skilllist { display: flex; flex-direction: column; gap: 6px; }
.skrow { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.04); border-radius: 12px; padding: 8px; }
.skrow.off { opacity: 0.75; }
.skic { position: relative; font-size: 24px; width: 42px; height: 42px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; flex: none; }
.skic b { position: absolute; left: 2px; top: 0; font-size: 9px; color: var(--muted); }
.skbody { flex: 1; min-width: 0; }
.skname { font-weight: 800; font-size: 14px; }
.skname small { color: var(--gold); font-weight: 600; }
.skdesc { font-size: 12px; color: #cfc5ae; line-height: 1.4; }
.slots .sub, .shop .sub { margin: 0 0 6px; }
.slotrow { display: flex; gap: 8px; }
.slot { width: 50px; height: 50px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); font-size: 26px; }
.slot.empty { color: rgba(255, 255, 255, 0.2); font-size: 20px; border-style: dashed; }
.shopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.item { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; text-align: left; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 8px; }
.item .iic { grid-row: span 3; font-size: 26px; align-self: center; }
.item .iname { font-weight: 800; font-size: 13px; }
.item .idesc { font-size: 11px; color: var(--muted); line-height: 1.3; }
.item .icost { font-size: 12px; color: var(--gold); font-weight: 800; }
.item.poor { opacity: 0.5; }
.item:active:not(.poor) { transform: scale(0.97); }

.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.star { font-size: 48px; color: rgba(255, 255, 255, 0.15); animation: starIn 0.5s ease-out backwards; }
.star.on { color: var(--gold); text-shadow: 0 0 16px rgba(255, 200, 80, 0.9), 0 3px 0 #8a4a00; }
@keyframes starIn { from { transform: scale(2.5) rotate(-30deg); opacity: 0; } }
.resgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.resgrid div { background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; }
.resgrid b { font-size: 17px; }
.resgrid small { font-size: 11px; color: var(--muted); }
.glory { font-size: 20px; font-weight: 900; color: var(--gold); margin: 8px 0; }
.glory small { font-size: 12px; color: #9fe88a; }
.unlock { background: rgba(120, 255, 120, 0.08); border: 1px solid rgba(140, 255, 140, 0.3); border-radius: 12px; padding: 8px; font-size: 13.5px; color: #c8ffc0; display: flex; flex-direction: column; gap: 4px; }
.tipbox { background: rgba(255, 210, 120, 0.08); border-radius: 12px; padding: 10px; font-size: 13px; color: #f0dca8; line-height: 1.5; text-align: left; margin-top: 8px; }

@media (min-width: 700px) {
  .skill { width: 62px; height: 62px; }
  .runecard { padding: 16px 10px; }
  .rdesc { font-size: 12.5px; }
}
@media (max-width: 430px) {
  .bottombar { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .skill { width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
  .skills { gap: 6px; }
  .shopbtn { width: 46px; }
  .herobox { width: 60px; }
  .portrait { width: 52px; height: 52px; }
  .bars { width: 56px; }
  .stat { padding: 4px 8px 4px 6px; font-size: 15px; }
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 365px) {
  .skill { width: 47px; height: 47px; font-size: 21px; }
  .skills { gap: 5px; }
  .shopbtn { width: 40px; }
  .shopbtn small { display: none; }
  .herobox { width: 54px; }
  .portrait { width: 48px; height: 48px; }
  .bars { width: 50px; }
  .stat { padding: 3px 6px 3px 4px; font-size: 14px; }
  .stat .ico { font-size: 13px; }
  .tbtn { width: 36px; }
}

/* ===================== 首领登场 ===================== */
.bossintro { position: absolute; inset: 0; z-index: 6; pointer-events: auto; display: flex; align-items: center; justify-content: center; animation: biFade 3.2s ease forwards; }
@keyframes biFade { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.bossintro .lb { position: absolute; left: 0; right: 0; height: 12%; background: #000; }
.bossintro .lb.top { top: 0; animation: lbTop 0.4s ease-out; }
.bossintro .lb.bot { bottom: 0; animation: lbBot 0.4s ease-out; }
@keyframes lbTop { from { transform: translateY(-100%); } }
@keyframes lbBot { from { transform: translateY(100%); } }
.bicard { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px; background: linear-gradient(90deg, rgba(60, 0, 0, 0), rgba(70, 8, 8, 0.88) 15%, rgba(70, 8, 8, 0.88) 85%, rgba(60, 0, 0, 0)); border-top: 2px solid rgba(255, 90, 90, 0.6); border-bottom: 2px solid rgba(255, 90, 90, 0.6); animation: biSlide 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes biSlide { from { transform: translateX(-60%); opacity: 0; } }
.biimg { width: 96px; height: 96px; flex: none; border-radius: 50%; background: radial-gradient(circle, rgba(255, 80, 80, 0.45), rgba(40, 0, 0, 0.2) 70%); display: grid; place-items: center; animation: biPulse 1s ease-in-out infinite; }
.biimg img { width: 110px; height: 110px; filter: drop-shadow(0 4px 8px #000); }
@keyframes biPulse { 50% { box-shadow: 0 0 30px rgba(255, 60, 60, 0.8); } }
.bitext { min-width: 0; }
.bitag { color: #ff9a9a; font-weight: 900; letter-spacing: 3px; font-size: 13px; }
.biname { font-size: 32px; font-weight: 900; letter-spacing: 4px; color: #fff0e0; text-shadow: 0 3px 0 #5a0000, 0 0 20px rgba(255, 60, 60, 0.8); }
.bidesc { font-size: 13px; color: #f4d8c8; margin-top: 2px; }
.bitip { font-size: 12.5px; color: #ffd36a; margin-top: 4px; }

/* ===================== 新敌人卡 ===================== */
.enemycard { position: absolute; right: 8px; top: calc(62px + var(--safe-top)); width: min(330px, calc(100vw - 16px)); display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px; border-radius: 16px; background: linear-gradient(90deg, rgba(50, 36, 80, 0.96), rgba(28, 22, 44, 0.96)); border: 1px solid rgba(200, 160, 255, 0.5); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); z-index: 4; animation: ecIn 0.35s cubic-bezier(0.2, 1.3, 0.4, 1); }
.enemycard.out { animation: ecOut 0.25s ease-in forwards; }
@keyframes ecIn { from { transform: translateX(110%); } }
@keyframes ecOut { to { transform: translateX(110%); opacity: 0; } }
.enemycard img { width: 54px; height: 54px; flex: none; background: rgba(255, 255, 255, 0.06); border-radius: 12px; }
.ecnew { font-size: 10px; font-weight: 900; color: #c8a0ff; letter-spacing: 2px; }
.ecname { font-weight: 900; font-size: 16px; }
.ecdesc { font-size: 12.5px; color: #e0d6c0; line-height: 1.4; margin-top: 2px; }

.bossbar:not(.hidden) ~ .toast, .bossbar:not(.hidden) ~ .enemycard { top: calc(100px + var(--safe-top)); }
