:root {
  --orange: #ff8a3d;
  --orange-deep: #d95f1c;
  --orange-light: #ffb36b;
  --gold: #ffd166;
  --gold-deep: #c98a25;
  --cream: #fff3dd;
  --cream-dim: #e8d5b5;
  --ink: #2b1a10;
  --ink-soft: #46301f;
  --teal: #2bb6a3;
  --teal-light: #7de6d2;
  --red: #e0564a;
  --red-deep: #8e211c;
  --panel: rgba(39, 23, 14, 0.86);
  --panel-edge: rgba(255, 199, 116, 0.42);
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120c08;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--cream);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 138, 61, 0.16), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(43, 182, 163, 0.1), transparent 45%),
    linear-gradient(180deg, #1c110b, #0b0705);
}

.game {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #2e4a2b;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.7);
  isolation: isolate;
}

canvas#battlefield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ============ 顶部战况 ============ */
.hud {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(8px + var(--safe-top)) 10px 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.game.playing .hud {
  opacity: 1;
  transform: translateY(0);
}

.hud-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.hero-panel,
.match-panel {
  background: linear-gradient(180deg, rgba(48, 28, 17, 0.9), rgba(29, 17, 11, 0.78));
  border: 1px solid var(--panel-edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.hero-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 146px;
  flex: 0 0 146px;
  padding: 5px 7px 5px 5px;
  border-radius: 14px;
}

.avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  overflow: visible;
}

.avatar-wrap > img {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 209, 102, 0.78);
  background: radial-gradient(circle at 50% 30%, #7b3a2b, #2b1510);
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.level-badge {
  position: absolute;
  right: -4px;
  bottom: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffc65c, #d67f1e);
  border: 1px solid #ffe0a3;
  color: #3d1c06;
  font-size: 9px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.hero-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px;
  height: 13px;
  line-height: 13px;
}

.hero-name-row b {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--cream);
}

.hero-hp-text {
  font-size: 9px;
  color: rgba(255, 243, 221, 0.68);
  font-variant-numeric: tabular-nums;
}

.bar {
  position: relative;
  height: 7px;
  margin-top: 2px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(8, 5, 3, 0.72);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7);
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: width 0.15s linear;
}

.hp-bar i {
  background: linear-gradient(90deg, #28a678, #8fe36a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.hp-bar.low i {
  background: linear-gradient(90deg, #cb2b22, #ff7b55);
}

.mp-bar {
  height: 5px;
  margin-top: 2px;
}

.mp-bar i {
  background: linear-gradient(90deg, #2f7fd2, #7cd4ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.match-panel {
  flex: 1;
  min-width: 0;
  max-width: 184px;
  margin: 0 auto;
  padding: 3px 8px 4px;
  border-radius: 13px;
  text-align: center;
}

.clock {
  font-size: 10px;
  line-height: 13px;
  letter-spacing: 2px;
  color: rgba(255, 235, 200, 0.72);
  font-variant-numeric: tabular-nums;
}

.score-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 16px;
  line-height: 16px;
  font-size: 9px;
  color: rgba(255, 243, 221, 0.64);
  letter-spacing: 1px;
}

.score-line b {
  font-size: 15px;
  color: var(--cream);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.score-line em {
  font-style: normal;
  color: rgba(255, 209, 102, 0.5);
  font-size: 11px;
}

.score-ally b {
  color: var(--teal-light);
}

.score-enemy b {
  color: #ff9d8a;
}

.tower-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 15px;
  margin-top: 1px;
}

.tower-track .pip {
  width: 13px;
  height: 13px;
  opacity: 1;
  transition: opacity 0.3s, transform 0.3s;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.tower-track .pip.ally {
  color: var(--teal-light);
}

.tower-track .pip.enemy {
  color: #ff9d8a;
}

.tower-track .pip.down {
  opacity: 0.2;
  transform: scale(0.82);
}

.tower-track .track-split {
  width: 1px;
  height: 10px;
  margin: 0 4px;
  background: rgba(255, 209, 102, 0.3);
}

.icon-btn {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(180deg, rgba(55, 32, 19, 0.92), rgba(29, 17, 11, 0.8));
  color: var(--cream);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  pointer-events: auto;
  transition: transform 0.12s ease;
}

.icon-btn .mp-icon {
  width: 18px;
  height: 18px;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ============ 提示 / 低血 ============ */
.toast {
  position: absolute;
  z-index: 42;
  top: calc(82px + var(--safe-top));
  left: 50%;
  transform: translate(-50%, -6px);
  max-width: 82%;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  background: rgba(38, 21, 12, 0.92);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--cream);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

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

.toast.gold {
  color: #ffe3a1;
  border-color: rgba(255, 209, 102, 0.72);
}

.toast.danger {
  color: #ffc0b6;
  border-color: rgba(224, 86, 74, 0.7);
}

.low-hp {
  position: absolute;
  z-index: 16;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 90px 22px rgba(190, 27, 21, 0.58);
  transition: opacity 0.28s ease;
}

.low-hp.show {
  opacity: 1;
  animation: lowPulse 1.1s ease-in-out infinite;
}

@keyframes lowPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}

/* ============ 摇杆 ============ */
.controls {
  position: absolute;
  z-index: 24;
  left: 0;
  right: 0;
  bottom: 0;
  height: 196px;
  padding: 0 14px calc(14px + var(--safe-bottom));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.game.playing .controls {
  opacity: 1;
}

.joystick {
  position: absolute;
  left: 14px;
  bottom: calc(14px + var(--safe-bottom));
  width: 116px;
  height: 116px;
  touch-action: none;
  pointer-events: auto;
}

.joy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 209, 102, 0.1), rgba(17, 10, 6, 0.48) 66%),
    radial-gradient(circle at 50% 50%, transparent 56%, rgba(255, 209, 102, 0.24) 57%, rgba(255, 209, 102, 0.24) 60%, transparent 61%);
  border: 1.5px solid rgba(255, 209, 102, 0.35);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.24);
}

.joy-ring::before,
.joy-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 209, 102, 0.22);
  transform: translate(-50%, -50%);
}

.joy-ring::before {
  width: 76%;
  height: 1px;
}

.joy-ring::after {
  width: 1px;
  height: 76%;
}

.joy-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.46), transparent 34%),
    linear-gradient(180deg, #ffb15e, #d8611e);
  border: 1.5px solid rgba(255, 229, 175, 0.86);
  box-shadow: 0 5px 0 #8c3c10, 0 8px 18px rgba(0, 0, 0, 0.42), inset 0 2px 3px rgba(255, 255, 255, 0.32);
  color: rgba(63, 26, 7, 0.72);
  will-change: transform;
  transition: transform 0.08s linear;
}

.joy-stick .mp-icon {
  width: 22px;
  height: 22px;
  opacity: 0.8;
}

.joystick.active .joy-ring {
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow: inset 0 0 32px rgba(255, 138, 61, 0.2), 0 0 24px rgba(255, 138, 61, 0.18);
}

/* ============ 技能键 ============ */
.skill-cluster {
  position: absolute;
  right: 12px;
  bottom: calc(8px + var(--safe-bottom));
  width: 184px;
  height: 172px;
  pointer-events: none;
}

.skill-btn {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 224, 172, 0.6);
  color: #2a1508;
  font-family: inherit;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.08s ease, filter 0.2s ease;
  will-change: transform;
}

.skill-btn:active {
  transform: scale(0.9);
}

.skill-btn .glyph {
  position: relative;
  z-index: 2;
  font-family: "STKaiti", "KaiTi", "STSong", serif;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.skill-btn .btn-label {
  position: relative;
  z-index: 2;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.78;
  margin-top: 1px;
  white-space: nowrap;
}

.skill-btn .cost {
  position: absolute;
  z-index: 4;
  top: 2px;
  right: 3px;
  min-width: 15px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: rgba(9, 18, 43, 0.7);
  border: 1px solid rgba(124, 212, 255, 0.45);
  color: #a9e7ff;
  font-size: 7px;
  font-weight: 700;
  line-height: 11px;
  text-align: center;
}

.skill-btn .cd-mask {
  position: absolute;
  z-index: 3;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(8, 5, 3, 0.7) calc(var(--cd, 0) * 1turn), transparent 0);
  pointer-events: none;
}

.skill-btn .cd-text {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff8ea;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.skill-btn.ready {
  animation: readyGlow 2.6s ease-in-out infinite;
}

@keyframes readyGlow {
  0%, 100% { box-shadow: 0 6px 0 rgba(87, 40, 12, 0.85), 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.38), 0 0 0 rgba(255, 180, 80, 0); }
  50% { box-shadow: 0 6px 0 rgba(87, 40, 12, 0.85), 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.38), 0 0 18px rgba(255, 180, 80, 0.38); }
}

.skill-btn.no-mana {
  filter: saturate(0.55) brightness(0.82);
}

.attack-btn {
  right: 0;
  bottom: 2px;
  width: 80px;
  height: 80px;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.58), transparent 30%),
    radial-gradient(circle at 50% 70%, #ffb24d, #e96a1f 72%);
  box-shadow: 0 6px 0 #8e3a0d, 0 9px 18px rgba(0, 0, 0, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.attack-btn .glyph {
  font-size: 30px;
}

.skill-1 {
  right: 92px;
  bottom: 2px;
  width: 58px;
  height: 58px;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.5), transparent 30%),
    radial-gradient(circle at 50% 66%, #63e2ca, #169c88 74%);
  box-shadow: 0 5px 0 #0b5c51, 0 8px 15px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.34);
}

.skill-2 {
  right: 92px;
  bottom: 70px;
  width: 58px;
  height: 58px;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.5), transparent 30%),
    radial-gradient(circle at 50% 66%, #8dd2ff, #337fce 74%);
  box-shadow: 0 5px 0 #1b4f8e, 0 8px 15px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.34);
}

.skill-3 {
  right: 26px;
  bottom: 100px;
  width: 58px;
  height: 58px;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.55), transparent 30%),
    radial-gradient(circle at 50% 66%, #ffe592, #eaa62c 74%);
  box-shadow: 0 5px 0 #8f5c0c, 0 8px 15px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.36);
}

.skill-1 .glyph,
.skill-2 .glyph,
.skill-3 .glyph {
  font-size: 21px;
}

/* ============ 阵亡 ============ */
.respawn {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(90, 15, 10, 0.18), rgba(15, 7, 4, 0.48));
  pointer-events: none;
}

.respawn-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 26px;
  border-radius: 20px;
  background: rgba(37, 20, 12, 0.88);
  border: 1px solid rgba(224, 86, 74, 0.5);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.respawn-ring {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 138, 61, 0.8);
  background: radial-gradient(circle, rgba(255, 138, 61, 0.16), rgba(20, 10, 5, 0.7));
  box-shadow: 0 0 26px rgba(255, 120, 50, 0.25), inset 0 0 18px rgba(0, 0, 0, 0.5);
  animation: ringPulse 1.4s ease-in-out infinite;
}

.respawn-ring span {
  font-size: 36px;
  font-weight: 800;
  color: #ffe1b3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
}

.respawn-card p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 236, 208, 0.8);
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 22px rgba(255, 120, 50, 0.2), inset 0 0 18px rgba(0, 0, 0, 0.5); }
  50% { transform: scale(1.04); box-shadow: 0 0 36px rgba(255, 120, 50, 0.4), inset 0 0 18px rgba(0, 0, 0, 0.5); }
}

/* ============ 开场 ============ */
.overlay {
  position: absolute;
  z-index: 60;
  inset: 0;
}

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding: calc(10px + var(--safe-top)) 18px calc(10px + var(--safe-bottom));
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 138, 61, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(18, 10, 6, 0.58) 0%, rgba(18, 10, 6, 0.35) 26%, rgba(18, 10, 6, 0.78) 68%, #120c08 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.start-screen.leaving {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.start-deco {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 52px;
  opacity: 0.32;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 209, 102, 0.22) 0 2px, transparent 3px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

.deco-left { left: 0; transform: rotate(4deg); }
.deco-right { right: 0; transform: rotate(-4deg); }

.start-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.start-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: rgba(255, 196, 120, 0.86);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 3px;
  white-space: nowrap;
}

.start-kicker span {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 120, 0.65));
}

.start-kicker span:last-child {
  background: linear-gradient(90deg, rgba(255, 196, 120, 0.65), transparent);
}

.game-logo {
  margin: 4px 0 0;
  font-family: "STKaiti", "KaiTi", "STSong", "Songti SC", serif;
  font-size: clamp(36px, 11vw, 48px);
  font-weight: 900;
  letter-spacing: 7px;
  line-height: 1.08;
  padding-left: 7px;
  background: linear-gradient(180deg, #fff6da 8%, #ffd166 42%, #ff9a45 78%, #d8621f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(84, 36, 8, 0.45);
  filter: drop-shadow(0 3px 0 rgba(76, 30, 6, 0.5)) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

.game-sub {
  margin: 3px 0 0;
  color: rgba(255, 231, 194, 0.7);
  font-size: 10px;
  letter-spacing: 4px;
  padding-left: 4px;
}

.hero-stage {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 330px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-top: 2px;
}

.stage-glow {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 250px;
  height: 250px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 61, 0.28) 0%, rgba(255, 138, 61, 0.08) 38%, transparent 66%);
  filter: blur(2px);
}

.stage-ring {
  position: absolute;
  left: 50%;
  bottom: 104px;
  border-radius: 50%;
  border: 1px solid rgba(255, 209, 102, 0.2);
  transform: translateX(-50%);
  pointer-events: none;
}

.ring-a {
  width: 232px;
  height: 232px;
  border-style: dashed;
  animation: slowSpin 26s linear infinite;
}

.ring-b {
  width: 178px;
  height: 178px;
  border-color: rgba(43, 182, 163, 0.18);
  animation: slowSpin 18s linear infinite reverse;
}

@keyframes slowSpin {
  to { transform: translateX(-50%) rotate(360deg); }
}

.hero-art {
  position: relative;
  z-index: 2;
  display: block;
  height: 100%;
  max-height: 318px;
  width: auto;
  max-width: 94%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.48));
  animation: heroFloat 4.2s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero-tag {
  position: absolute;
  z-index: 3;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 12px;
  border-radius: 999px;
  background: rgba(36, 20, 12, 0.76);
  border: 1px solid rgba(255, 209, 102, 0.38);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.hero-tag-name {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 16px;
  font-weight: 900;
  color: #ffe4a9;
  letter-spacing: 2px;
}

.hero-tag-role {
  font-size: 9px;
  color: rgba(255, 235, 200, 0.62);
  letter-spacing: 1px;
}

.start-panel {
  width: 100%;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 12px 14px 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(49, 28, 17, 0.78), rgba(25, 14, 9, 0.9));
  border: 1px solid rgba(255, 199, 116, 0.28);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rule-line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 20px;
  color: rgba(255, 237, 208, 0.84);
  font-size: 11px;
  letter-spacing: 0.5px;
}

.rule-line .mp-icon {
  width: 14px;
  height: 14px;
  color: var(--orange);
  flex: 0 0 14px;
}

.best-line {
  margin: 5px 0 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(255, 209, 102, 0.18);
  color: rgba(255, 220, 168, 0.66);
  font-size: 10px;
  letter-spacing: 1px;
  text-align: center;
}

.btn-primary {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid rgba(255, 233, 184, 0.85);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.55), transparent 55%),
    linear-gradient(180deg, #ffae55, #f0751f 62%, #d65b13);
  color: #3c1a05;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.32);
  box-shadow: 0 6px 0 #963c0c, 0 12px 24px rgba(0, 0, 0, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.2s ease;
  pointer-events: auto;
}

.btn-primary .mp-icon {
  width: 22px;
  height: 22px;
  color: #4a2107;
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #963c0c, 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

.btn-primary:disabled {
  filter: grayscale(0.5);
}

.start-tip {
  margin: 8px 0 0;
  color: rgba(255, 235, 200, 0.38);
  font-size: 8px;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ============ 结算 ============ */
.over-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 138, 61, 0.15), transparent 48%),
    rgba(10, 6, 4, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.over-card {
  width: 100%;
  max-width: 330px;
  padding: 24px 22px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 199, 116, 0.4);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 138, 61, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(53, 30, 18, 0.96), rgba(24, 13, 8, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-align: center;
  animation: cardIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.over-emblem {
  width: 66px;
  height: 66px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffe3a0;
  border: 1.5px solid rgba(255, 209, 102, 0.55);
  background: radial-gradient(circle at 50% 32%, rgba(255, 209, 102, 0.28), rgba(60, 32, 14, 0.8));
  box-shadow: 0 0 26px rgba(255, 170, 60, 0.26), inset 0 2px 4px rgba(255, 255, 255, 0.16);
}

.over-emblem .mp-icon {
  width: 34px;
  height: 34px;
}

.over-screen.defeat .over-emblem {
  color: #ffb3a7;
  border-color: rgba(224, 86, 74, 0.55);
  background: radial-gradient(circle at 50% 32%, rgba(224, 86, 74, 0.22), rgba(52, 14, 10, 0.8));
  box-shadow: 0 0 26px rgba(224, 86, 74, 0.24), inset 0 2px 4px rgba(255, 255, 255, 0.12);
}

.over-card h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "STSong", serif;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffe2a2;
  text-shadow: 0 2px 0 rgba(82, 35, 6, 0.6), 0 8px 20px rgba(0, 0, 0, 0.4);
}

.over-screen.defeat .over-card h2 {
  color: #ffb3a7;
}

.over-sub {
  margin: 5px 0 16px;
  color: rgba(255, 235, 204, 0.56);
  font-size: 10px;
  letter-spacing: 2px;
}

.over-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(13, 7, 4, 0.34);
  border: 1px solid rgba(255, 209, 102, 0.12);
}

.over-stats div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.over-stats b {
  font-size: 21px;
  line-height: 24px;
  color: #ffe6b4;
  font-variant-numeric: tabular-nums;
}

.over-stats span {
  font-size: 9px;
  color: rgba(255, 235, 204, 0.48);
  letter-spacing: 1px;
}

.new-best {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd166, #e59a22);
  color: #4a2305;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.over-card .btn-primary {
  margin-top: 16px;
  height: 48px;
  font-size: 16px;
  letter-spacing: 3px;
}

/* ============ 矮屏适配 ============ */
@media (max-height: 730px) {
  .game-logo { font-size: 34px; }
  .game-sub { font-size: 9px; margin-top: 1px; }
  .start-kicker { font-size: 8px; }
  .hero-stage { max-height: 230px; }
  .hero-art { max-height: 228px; }
  .stage-ring { bottom: 78px; }
  .ring-a { width: 176px; height: 176px; }
  .ring-b { width: 132px; height: 132px; }
  .start-panel { padding: 9px 12px 8px; border-radius: 18px; }
  .rule-line { height: 18px; font-size: 10px; }
  .best-line { margin: 4px 0 6px; padding-top: 5px; font-size: 9px; }
  .btn-primary { height: 46px; font-size: 16px; }
  .start-tip { margin-top: 6px; font-size: 8px; }
  .hero-tag { bottom: 0; padding: 4px 12px; }
  .hero-tag-name { font-size: 14px; }
  .hero-tag-role { font-size: 8px; }
}

@media (max-height: 640px) {
  .start-kicker,
  .start-tip { display: none; }
  .game-logo { font-size: 30px; }
  .hero-stage { max-height: 172px; }
  .hero-art { max-height: 170px; }
  .stage-ring { display: none; }
  .start-panel { padding: 7px 12px 7px; }
  .rule-line { height: 16px; font-size: 9px; }
  .best-line { margin-top: 3px; margin-bottom: 5px; }
  .btn-primary { height: 44px; }
}

/* 触屏设备不展示键鼠提示，避免误导手机玩家 */
@media (hover: none) and (pointer: coarse) {
  .start-tip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art,
  .ring-a,
  .ring-b,
  .skill-btn.ready,
  .respawn-ring,
  .low-hp.show {
    animation: none !important;
  }
  .start-screen,
  .controls,
  .hud,
  .over-screen {
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 370px) {
  .hero-panel { width: 136px; flex-basis: 136px; }
  .match-panel { padding-left: 4px; padding-right: 4px; }
  .skill-cluster { right: 8px; transform: scale(0.94); transform-origin: right bottom; }
  .joystick { left: 10px; }
}
