/* =========================================================
   秘境法师 · ARCANE RIFT
   深色克制风格，与迅易达官网视觉保持一致
   所有图形由 Canvas / CSS 绘制，无外部图片、字体与第三方库
   ========================================================= */

:root {
  --ink: #070b09;
  --panel: #0c130f;
  --panel-2: #101a14;
  --paper: #f4f5ef;
  --white: #fbfcf8;
  --acid: #d8f36b;
  --acid-strong: #c9ee4a;
  --teal: #77e7c5;
  --blue: #7fb3ff;
  --violet: #c9a2ff;
  --gold: #f0cf74;
  --coral: #ff8377;
  --muted: #93a39a;
  --muted-dim: #617069;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
    "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #070b09;
  color: var(--paper);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 48px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0c130f 0%, #090e0b 100%);
  position: relative;
  z-index: 20;
}

.back-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.back-links a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  color: rgba(251, 252, 248, 0.6);
  font-size: 11px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.back-links a svg {
  width: 11px;
  height: 11px;
}

.back-links a:hover {
  color: var(--acid);
  background: rgba(216, 243, 107, 0.08);
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.title-mark {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.title-mark i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--acid);
  transform: rotate(45deg);
  opacity: 0.42;
}

.title-mark i:nth-child(2) {
  opacity: 0.75;
}

.title-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.title-copy strong {
  font-size: 13.5px;
  letter-spacing: 1.5px;
  font-weight: 600;
  white-space: nowrap;
}

.title-copy em {
  font-style: normal;
  font-size: 7.5px;
  letter-spacing: 2.4px;
  color: var(--muted-dim);
  font-family: var(--mono);
  white-space: nowrap;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sound-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(251, 252, 248, 0.68);
  transition: color 0.2s ease, background 0.2s ease;
}

.sound-toggle:hover {
  color: var(--acid);
  background: rgba(216, 243, 107, 0.08);
}

.sound-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle .sound-body {
  fill: currentColor;
  stroke: none;
}

.sound-toggle .sound-slash {
  opacity: 0;
}

.sound-toggle.off .sound-wave {
  opacity: 0;
}

.sound-toggle.off .sound-slash {
  opacity: 1;
}

.tag {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1.4px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}

/* ---------------- 舞台 ---------------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #060a08;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------- HUD ---------------- */

.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.vitals {
  display: flex;
  align-items: stretch;
  gap: 7px;
  padding: 5px 8px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(14, 22, 17, 0.92), rgba(8, 13, 10, 0.82));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lv-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 34px;
  border-right: 1px solid var(--line);
  padding-right: 7px;
  flex: 0 0 auto;
}

.lv-badge em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 1px;
  color: var(--muted-dim);
}

.lv-badge b {
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.15;
  color: var(--acid);
}

.vitals-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 126px;
  justify-content: center;
}

.bar {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar.exp {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  transition: width 0.16s linear;
}

.bar-hp i {
  background: linear-gradient(90deg, #d8584d, #ff8377 60%, #ffb289);
}

.bar-mp i {
  background: linear-gradient(90deg, #4f7ed6, #7fb3ff 55%, #77e7c5);
}

.bar-exp i {
  background: linear-gradient(90deg, #9fba3c, var(--acid));
}

.bar span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.locale {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding-top: 4px;
  text-align: right;
  min-width: 0;
}

.locale-name {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--paper);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.locale em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 1.8px;
  color: var(--muted-dim);
  white-space: nowrap;
}

.enemy-chip {
  margin-top: 3px;
  font-size: 8.5px;
  letter-spacing: 0.5px;
  color: var(--gold);
  border: 1px solid rgba(240, 207, 116, 0.3);
  background: rgba(240, 207, 116, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

.bossbar {
  position: absolute;
  top: 74px;
  left: 12px;
  right: 12px;
  z-index: 6;
  padding: 6px 9px 7px;
  border: 1px solid rgba(255, 131, 119, 0.25);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(22, 12, 16, 0.9), rgba(9, 10, 9, 0.82));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.bossbar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.bossbar-top span {
  font-size: 10.5px;
  letter-spacing: 1px;
  color: #ffd9d4;
}

.bossbar-top em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 2px;
  color: var(--coral);
}

.bossbar-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bossbar-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d8584d, #ff8377, #ffb289);
  transition: width 0.12s linear;
}

/* ---------------- 行囊 / 撤离 ---------------- */

.util {
  position: absolute;
  left: 10px;
  bottom: 128px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 7;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 15, 11, 0.82);
  color: rgba(251, 252, 248, 0.82);
  font-size: 10px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.util-btn:hover {
  border-color: rgba(216, 243, 107, 0.45);
  color: var(--acid);
}

.util-ico {
  font-size: 11px;
  color: var(--acid);
}

.util-warn {
  border-color: rgba(255, 131, 119, 0.3);
  color: rgba(255, 190, 184, 0.9);
}

.util-warn .util-ico {
  color: var(--coral);
}

/* ---------------- 浮动摇杆 ---------------- */

.joy {
  --joy-size: 148px;
  --joy-travel: 44px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--joy-size);
  height: var(--joy-size);
  border-radius: 50%;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.82);
  transform-origin: 50% 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(31, 48, 40, 0.72), rgba(6, 11, 8, 0.8) 68%);
  border: 1px solid rgba(119, 231, 197, 0.22);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.42),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  transition:
    opacity 0.09s ease,
    transform 0.13s ease,
    visibility 0s linear 0.13s;
  will-change: transform, opacity;
}

.joy.on {
  opacity: 1;
  visibility: visible;
  border-color: rgba(119, 231, 197, 0.42);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.42),
    inset 0 0 30px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(119, 231, 197, 0.12);
  transform: translate(-50%, -50%) scale(1);
  transition:
    opacity 0.08s ease,
    transform 0.12s ease,
    visibility 0s;
}

.joy-base {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  display: grid;
  place-items: center;
}

.joy-knob {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(216, 243, 107, 0.95), rgba(119, 231, 197, 0.62) 48%, rgba(21, 53, 45, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 20px rgba(119, 231, 197, 0.22);
  will-change: transform;
}

/* ---------------- 技能 ---------------- */

.skills {
  position: absolute;
  right: 8px;
  bottom: 10px;
  width: 172px;
  height: 192px;
  z-index: 8;
  pointer-events: none;
}

.skill {
  position: absolute;
  border-radius: 50%;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--paper);
  background:
    radial-gradient(circle at 36% 30%, rgba(119, 231, 197, 0.16), rgba(9, 17, 13, 0.94) 62%),
    #0a120e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  touch-action: none;
}

.skill:active {
  transform: scale(0.94);
}

.sk-glyph {
  font-size: 20px;
  line-height: 1;
  color: var(--acid);
  text-shadow: 0 0 12px rgba(216, 243, 107, 0.4);
}

.sk-name {
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(251, 252, 248, 0.9);
}

.sk-cost {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--blue);
}

.sk-key {
  position: absolute;
  top: 3px;
  right: 5px;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--mono);
  font-size: 7px;
  color: rgba(255, 255, 255, 0.5);
}

.sk-cd {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: conic-gradient(rgba(4, 8, 6, 0.74) var(--cd, 0deg), transparent 0deg);
  pointer-events: none;
}

.skill.cooling {
  border-color: rgba(119, 231, 197, 0.28);
}

.skill.no-mana {
  opacity: 0.62;
}

.skill.no-mana .sk-glyph {
  color: var(--blue);
  text-shadow: none;
}

.skill.no-mana .sk-cost {
  color: var(--coral);
}

.skill-star {
  right: 28px;
  bottom: 124px;
  width: 62px;
  height: 62px;
}

.skill-lance {
  right: 84px;
  bottom: 42px;
  width: 58px;
  height: 58px;
}

.skill-nova {
  right: 4px;
  bottom: 4px;
  width: 68px;
  height: 68px;
}

.skill-nova .sk-glyph {
  font-size: 22px;
}

/* ---------------- 交互按钮 ---------------- */

.interact {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(216, 243, 107, 0.45);
  background: linear-gradient(160deg, rgba(28, 45, 34, 0.94), rgba(10, 18, 13, 0.94));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(216, 243, 107, 0.08);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.8px;
  z-index: 9;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: interactPulse 2.2s ease-in-out infinite;
}

.interact-key {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--acid);
  color: #10160b;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

@keyframes interactPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 18px rgba(216, 243, 107, 0.06); }
  50% { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 26px rgba(216, 243, 107, 0.2); }
}

/* ---------------- 横幅 / 提示 ---------------- */

.banner {
  position: absolute;
  top: 27%;
  left: 50%;
  transform: translate(-50%, -44%) scale(0.96);
  opacity: 0;
  text-align: center;
  pointer-events: none;
  z-index: 12;
  transition: opacity 0.28s ease, transform 0.28s ease;
  width: min(86vw, 360px);
}

.banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.banner b {
  display: block;
  font-size: 22px;
  letter-spacing: 2.5px;
  font-weight: 600;
  color: var(--acid);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8), 0 0 24px rgba(216, 243, 107, 0.2);
}

.banner em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 3px;
  color: rgba(244, 245, 239, 0.5);
}

.banner.level b { color: var(--gold); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8), 0 0 26px rgba(240, 207, 116, 0.3); }
.banner.rift b { color: var(--violet); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8), 0 0 26px rgba(201, 162, 255, 0.3); }
.banner.warn b { color: var(--gold); }
.banner.town b { color: var(--acid); }

.toasts {
  position: absolute;
  top: 112px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 40;
  pointer-events: none;
  max-width: 230px;
}

.toast {
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--acid);
  background: rgba(9, 15, 11, 0.92);
  color: rgba(251, 252, 248, 0.9);
  font-size: 10px;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.22s ease both;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.toast.good { border-left-color: var(--teal); }
.toast.warn { border-left-color: var(--gold); }
.toast.bad { border-left-color: var(--coral); }
.toast.dim { border-left-color: var(--muted-dim); color: var(--muted); }
.toast.out { opacity: 0; transform: translateX(-6px); transition: opacity 0.25s ease, transform 0.25s ease; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.tap-hint {
  position: absolute;
  left: 50%;
  bottom: 280px;
  transform: translateX(-50%);
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 12, 9, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 9.5px;
  letter-spacing: 1px;
  color: rgba(244, 245, 239, 0.55);
  text-align: center;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.6s ease;
  white-space: nowrap;
}

.tap-hint.gone {
  opacity: 0;
}

/* ---------------- 弹层 ---------------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(3, 7, 5, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: relative;
  width: min(394px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(158deg, #0e1812 0%, #0a110d 62%, #080d0a 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 243, 107, 0.55), transparent);
  opacity: 0.55;
}

.sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 0%, rgba(119, 231, 197, 0.055), transparent 44%),
    radial-gradient(circle at 100% 100%, rgba(201, 162, 255, 0.05), transparent 46%);
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  z-index: 2;
  transition: color 0.2s ease, background 0.2s ease;
}

.sheet-close:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.06);
}

.sheet-kicker {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 3px;
  color: rgba(216, 243, 107, 0.7);
  position: relative;
  z-index: 1;
}

.sheet-title {
  margin-top: 5px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.25;
  color: var(--paper);
  position: relative;
  z-index: 1;
}

.sheet-desc {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.sheet-body {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.sheet-body::-webkit-scrollbar {
  width: 3px;
}

.sheet-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
}

.sheet-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
  flex: 0 0 auto;
}

.btn {
  width: 100%;
  min-height: 42px;
  border-radius: 9px;
  font-size: 12.5px;
  letter-spacing: 1px;
  border: 1px solid transparent;
  transition: transform 0.08s ease, filter 0.18s ease, background 0.18s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn.primary {
  background: linear-gradient(180deg, var(--acid), var(--acid-strong));
  color: #10160b;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(216, 243, 107, 0.16);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(251, 252, 248, 0.82);
}

.btn.ghost:hover {
  border-color: rgba(216, 243, 107, 0.3);
  color: var(--acid);
}

.btn.danger {
  border-color: rgba(255, 131, 119, 0.4);
  background: rgba(255, 131, 119, 0.12);
  color: #ffc9c4;
}

.btn.danger:hover {
  background: rgba(255, 131, 119, 0.2);
}

/* ---------------- 开场 ---------------- */

.intro-mark {
  position: relative;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 2px 0 8px;
}

.intro-mark span {
  font-size: 42px;
  line-height: 1;
  color: var(--acid);
  text-shadow: 0 0 28px rgba(216, 243, 107, 0.45);
  animation: markBreath 3.4s ease-in-out infinite;
}

.intro-mark i {
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(119, 231, 197, 0.5);
  transform: rotate(45deg);
}

.intro-mark i:nth-child(1) { left: 32%; top: 22%; animation: markOrbit 9s linear infinite; }
.intro-mark i:nth-child(2) { right: 30%; top: 34%; border-color: rgba(201, 162, 255, 0.55); animation: markOrbit 12s linear infinite reverse; }
.intro-mark i:nth-child(3) { left: 47%; bottom: 12%; border-color: rgba(240, 207, 116, 0.5); animation: markOrbit 7s linear infinite; }

@keyframes markBreath {
  0%, 100% { transform: scale(1); opacity: 0.86; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes markOrbit {
  0% { transform: rotate(45deg) translateY(-7px) rotate(0deg); }
  100% { transform: rotate(45deg) translateY(-7px) rotate(360deg); }
}

.intro-text {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.intro-cell {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.intro-cell b {
  font-size: 10px;
  font-weight: 600;
  color: rgba(251, 252, 248, 0.9);
  letter-spacing: 0.5px;
}

.intro-cell span {
  font-size: 9px;
  color: var(--muted-dim);
}

.intro-save {
  margin-top: 9px;
  padding: 8px 10px;
  border-left: 2px solid var(--acid);
  border-radius: 0 8px 8px 0;
  background: rgba(216, 243, 107, 0.06);
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 8px;
  align-items: baseline;
}

.intro-save span {
  font-size: 8.5px;
  color: var(--muted);
}

.intro-save b {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--acid);
}

.intro-save em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 8.5px;
  color: var(--muted-dim);
}

.intro-note {
  margin-top: 10px;
  font-size: 9px;
  line-height: 1.55;
  color: var(--muted-dim);
  text-align: center;
}

/* ---------------- 行囊与成长 ---------------- */

.bag-level {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}

.bag-level span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

.bag-level span b {
  font-size: 16px;
  color: var(--acid);
}

.bag-level em {
  font-style: normal;
  font-size: 9px;
  color: var(--gold);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.stat-grid > div {
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-grid span {
  font-size: 8px;
  color: var(--muted-dim);
  letter-spacing: 0.4px;
}

.stat-grid b {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--paper);
  white-space: nowrap;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 7px;
}

.panel-head span {
  font-size: 10.5px;
  letter-spacing: 1px;
  color: rgba(251, 252, 248, 0.9);
}

.panel-head em {
  font-style: normal;
  font-size: 8px;
  color: var(--muted-dim);
  letter-spacing: 0.3px;
  text-align: right;
}

.attr-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.attr-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.022);
}

.attr-name {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.attr-name b {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(251, 252, 248, 0.9);
}

.attr-name em {
  font-style: normal;
  font-size: 8px;
  color: var(--muted-dim);
}

.attr-value {
  margin-left: auto;
  width: 26px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--teal);
}

.attr-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(216, 243, 107, 0.45);
  background: rgba(216, 243, 107, 0.1);
  color: var(--acid);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.attr-btn:disabled {
  opacity: 0.28;
  border-color: var(--line);
  background: transparent;
  color: var(--muted-dim);
}

.equip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.equip-slot {
  min-height: 92px;
  padding: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.equip-slot.filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.12);
  border-top: 2px solid var(--rar, var(--muted));
  background: rgba(255, 255, 255, 0.03);
}

.slot-tag {
  font-size: 7.5px;
  letter-spacing: 1.5px;
  color: var(--muted-dim);
}

.equip-slot b {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--paper);
  word-break: break-all;
}

.equip-slot em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted-dim);
}

.equip-slot p {
  margin-top: 3px;
  font-size: 8px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-all;
}

.r0 { --rar: #9aa8a0; }
.r1 { --rar: #77e7c5; }
.r2 { --rar: #7fb3ff; }
.r3 { --rar: #c9a2ff; }

.empty-note {
  padding: 12px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--muted-dim);
  text-align: center;
}

.bag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-card {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--rar, var(--muted));
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.024);
}

.item-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
}

.item-slot {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rar, var(--muted));
  color: var(--rar, var(--muted));
  font-size: 9px;
  align-self: center;
}

.item-head b {
  font-size: 11px;
  font-weight: 600;
  color: var(--paper);
}

.item-head em {
  margin-left: auto;
  font-style: normal;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted-dim);
  white-space: nowrap;
}

.item-stats {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.item-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.item-compare span {
  font-size: 8px;
  line-height: 1.4;
  padding: 1px 5px;
  border-radius: 3px;
}

.item-compare .up {
  color: var(--teal);
  background: rgba(119, 231, 197, 0.1);
}

.item-compare .down {
  color: var(--coral);
  background: rgba(255, 131, 119, 0.09);
}

.item-compare .flat {
  color: var(--muted-dim);
  background: rgba(255, 255, 255, 0.04);
}

.item-action {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 6px;
}

.mini-btn {
  height: 29px;
  padding: 0 15px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--acid), var(--acid-strong));
  color: #10160b;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  transition: filter 0.15s ease, transform 0.08s ease;
}

.mini-btn:active {
  transform: scale(0.96);
}

.mini-btn:hover {
  filter: brightness(1.06);
}

.item-equipped {
  display: inline-block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.6px;
  color: var(--teal);
}

.badge-warn {
  font-size: 8.5px;
  color: var(--gold);
}

.link-danger {
  display: block;
  margin: 16px auto 2px;
  padding: 4px 6px;
  font-size: 9.5px;
  color: rgba(255, 131, 119, 0.78);
  border-bottom: 1px dotted rgba(255, 131, 119, 0.35);
}

.link-danger:hover {
  color: var(--coral);
}

/* ---------------- 结算 / 死亡 ---------------- */

.settle-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.settle-stats > div {
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.settle-stats span {
  font-size: 7.5px;
  color: var(--muted-dim);
  letter-spacing: 0.5px;
}

.settle-stats b {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--paper);
  white-space: nowrap;
}

.settle-heal {
  margin-top: 8px;
  font-size: 9px;
  color: var(--teal);
  text-align: center;
}

.settle-final {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--gold);
  text-align: center;
}

.settle-hint {
  margin-top: 12px;
  font-size: 9px;
  line-height: 1.55;
  color: var(--muted-dim);
  text-align: center;
}

.death-mark {
  font-size: 54px;
  line-height: 1;
  text-align: center;
  color: var(--coral);
  text-shadow: 0 0 30px rgba(255, 131, 119, 0.35);
  margin: 12px 0 10px;
  animation: markBreath 3s ease-in-out infinite;
}

.death-note {
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
  text-align: center;
}

.confirm-note {
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted-dim);
}

/* ---------------- 页脚 ---------------- */

.foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #070b09;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  z-index: 15;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.foot-nav a {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.4px;
  transition: color 0.2s ease;
}

.foot-nav a:hover {
  color: var(--acid);
}

.foot p {
  font-size: 8px;
  color: var(--muted-dim);
  letter-spacing: 0.3px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #070b09;
  color: var(--paper);
  font-size: 13px;
  text-align: center;
  z-index: 999;
}

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 374px) {
  .back-links a {
    padding: 0 5px;
    font-size: 10px;
  }

  .title-copy strong {
    font-size: 12.5px;
    letter-spacing: 1px;
  }

  .title-copy em {
    letter-spacing: 1.8px;
  }

  .tag {
    display: none;
  }

  .vitals-bars {
    width: 112px;
  }

  .skills {
    right: 5px;
    transform: scale(0.94);
    transform-origin: 100% 100%;
  }

  .util {
    left: 8px;
  }

  .joy {
    --joy-size: 136px;
    --joy-travel: 40px;
  }

  .joy-knob {
    width: 52px;
    height: 52px;
  }

  .toasts {
    max-width: 196px;
  }

  .sheet {
    padding: 16px 13px 12px;
  }

  .sheet-title {
    font-size: 19px;
  }

  .stat-grid {
    gap: 4px;
  }

  .stat-grid b {
    font-size: 11px;
  }

  .settle-stats b {
    font-size: 10px;
  }
}

@media (max-height: 700px) {
  .topbar {
    height: 44px;
  }

  .banner {
    top: 25%;
  }

  .banner b {
    font-size: 20px;
  }

  .tap-hint {
    bottom: 260px;
  }

  .sheet {
    max-height: 100%;
    padding-top: 15px;
  }

  .intro-mark {
    height: 56px;
    margin-bottom: 4px;
  }

  .intro-mark span {
    font-size: 34px;
  }

  .intro-text {
    font-size: 10.5px;
    line-height: 1.6;
    margin-bottom: 9px;
  }

  .intro-cell {
    padding: 6px 8px;
  }

  .intro-save {
    margin-top: 7px;
    padding: 6px 9px;
  }

  .intro-note {
    margin-top: 7px;
  }

  .btn {
    min-height: 40px;
    font-size: 12px;
  }

  .sheet-actions {
    gap: 6px;
    margin-top: 9px;
  }

  .equip-slot {
    min-height: 86px;
  }
}

@media (max-height: 640px) {
  .tap-hint {
    display: none;
  }

  .intro-mark {
    height: 44px;
    margin-bottom: 0;
  }

  .intro-mark span {
    font-size: 28px;
  }

  .intro-grid {
    gap: 4px;
  }

  .intro-cell {
    padding: 5px 7px;
  }

  .intro-text {
    margin-bottom: 7px;
  }
}

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