:root {
  --gold: #f5c35b;
  --gold-bright: #ffe6a3;
  --teal: #5ee0c8;
  --blue: #7eb8ff;
  --ink: #071018;
  --panel: rgba(7, 17, 26, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f3eee4;
  --muted: rgba(243, 238, 228, 0.62);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #061019;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#game:active {
  cursor: grabbing;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, transparent 42%, rgba(2, 6, 10, 0.42) 100%),
    linear-gradient(to bottom, rgba(2, 6, 10, 0.12), transparent 24%, transparent 72%, rgba(2, 6, 10, 0.28));
  z-index: 2;
}

.damage-vignette {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 46%, transparent 38%, rgba(105, 20, 150, 0.32) 100%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(160, 20, 40, 0.18) 100%);
  box-shadow: inset 0 0 110px rgba(90, 20, 135, 0.45);
  transition: opacity 0.18s ease;
}

.damage-vignette.flash {
  opacity: 1;
}

.damage-vignette.hazard {
  opacity: 0.55;
  animation: hazardPulse 1.05s ease-in-out infinite;
}

@keyframes hazardPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

.hidden {
  display: none !important;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* --------------------------------------------------------------------------
   Loading
   -------------------------------------------------------------------------- */
.loading-screen {
  z-index: 50;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 45%, rgba(30, 58, 74, 0.35), transparent 48%),
    #061019;
}

.loader-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 26px;
  border: 1px solid rgba(245, 195, 91, 0.45);
  transform: rotate(45deg);
  box-shadow: 0 0 32px rgba(245, 195, 91, 0.2), inset 0 0 18px rgba(245, 195, 91, 0.08);
  animation: loaderPulse 1.8s ease-in-out infinite;
}

.loader-mark::first-letter {
  transform: rotate(-45deg);
}

.loader-title {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.18em;
  color: rgba(243, 238, 228, 0.86);
}

.loader-bar {
  width: min(300px, 64vw);
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.loader-bar span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd8b35, var(--gold-bright));
  box-shadow: 0 0 14px rgba(245, 195, 91, 0.7);
  transition: width 0.3s ease;
}

.loader-text {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

@keyframes loaderPulse {
  0%, 100% { transform: rotate(45deg) scale(1); opacity: 0.85; }
  50% { transform: rotate(45deg) scale(1.08); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Start screen
   -------------------------------------------------------------------------- */
.start-screen {
  z-index: 30;
  align-items: stretch;
  background:
    linear-gradient(90deg, rgba(3, 9, 14, 0.94) 0%, rgba(3, 9, 14, 0.78) 34%, rgba(3, 9, 14, 0.2) 68%, rgba(3, 9, 14, 0.02) 100%),
    linear-gradient(to bottom, rgba(3, 9, 14, 0.32), transparent 32%, transparent 70%, rgba(3, 9, 14, 0.48));
}

.site-back {
  position: absolute;
  top: calc(22px + var(--safe-top));
  right: clamp(20px, 4vw, 48px);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(243, 238, 228, 0.62);
  background: rgba(7, 17, 26, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-back:hover {
  color: var(--gold-bright);
  border-color: rgba(245, 195, 91, 0.4);
}

.start-copy {
  width: min(620px, 52vw);
  margin-left: clamp(24px, 8vw, 120px);
  padding-top: max(9vh, 56px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.eyebrow-line {
  display: block;
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.start-copy h1 {
  margin: 20px 0 22px;
  font-family: "Georgia", "Songti SC", "Microsoft YaHei", serif;
  font-size: clamp(74px, 10.5vw, 146px);
  line-height: 0.84;
  letter-spacing: -0.045em;
  font-weight: 700;
  text-shadow: 0 10px 48px rgba(0, 0, 0, 0.45);
}

.start-copy h1 em {
  color: var(--gold);
  font-style: normal;
  background: linear-gradient(135deg, var(--gold-bright), #d7952f 58%, #8e5a16);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(245, 195, 91, 0.18));
}

.lead {
  margin: 0 0 24px;
  color: rgba(243, 238, 228, 0.72);
  font-size: clamp(14px, 1.35vw, 17px);
  line-height: 1.8;
  letter-spacing: 0.03em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 30px;
}

.chips span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(243, 238, 228, 0.7);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.chip-dot.gold { background: var(--gold); color: var(--gold); }
.chip-dot.teal { background: var(--teal); color: var(--teal); }
.chip-dot.blue { background: var(--blue); color: var(--blue); }

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 220px;
  padding: 17px 28px;
  border: 1px solid rgba(255, 230, 163, 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe6a3 0%, #f5c35b 42%, #c78b2d 100%);
  color: #1d1304;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(245, 195, 91, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.42),
    0 0 38px rgba(245, 195, 91, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.primary-btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-arrow {
  font-size: 18px;
  line-height: 1;
}

.controls {
  margin-top: 20px;
  color: rgba(243, 238, 228, 0.42);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.workshop-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 13px;
  border: 1px solid rgba(94, 224, 200, 0.24);
  border-radius: 999px;
  background: rgba(94, 224, 200, 0.055);
  color: rgba(157, 255, 216, 0.72);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.workshop-link:hover {
  color: #d7fff9;
  border-color: rgba(94, 224, 200, 0.55);
  background: rgba(94, 224, 200, 0.11);
}

.credits {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.mobile-only {
  display: none;
}

body.is-touch .mobile-only {
  display: block;
}

body.is-touch .desktop-only {
  display: none;
}

.start-footer {
  position: absolute;
  left: clamp(24px, 8vw, 120px);
  bottom: calc(24px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(243, 238, 228, 0.28);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.footer-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(245, 195, 91, 0.45);
}

/* --------------------------------------------------------------------------
   HUD
   -------------------------------------------------------------------------- */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: calc(18px + var(--safe-top));
  left: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

.health-hud {
  position: absolute;
  z-index: 10;
  top: calc(74px + var(--safe-top));
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 190px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.health-heart {
  color: #ff7f8f;
  font-size: 15px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 80, 110, 0.55));
}

.health-track {
  position: relative;
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.health-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d94a5e, #f5c35b 52%, #6ee7a8);
  box-shadow: 0 0 10px rgba(110, 231, 168, 0.25);
  transition: width 0.22s ease, background 0.3s ease;
}

.health-text {
  min-width: 24px;
  color: rgba(243, 238, 228, 0.7);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.health-hud.low .health-track span {
  background: linear-gradient(90deg, #d94a5e, #ff9a5a);
}

.health-hud.critical .health-track span {
  background: #ff5b6e;
  animation: healthPulse 0.75s ease-in-out infinite;
}

.health-hud.critical .health-heart {
  animation: heartPulse 0.75s ease-in-out infinite;
}

@keyframes healthPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

.kill-feed {
  position: absolute;
  z-index: 10;
  top: calc(118px + var(--safe-top));
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: min(280px, 48vw);
  pointer-events: none;
}

.kill-feed-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-left: 3px solid rgba(255, 138, 92, 0.8);
  border-radius: 0 8px 8px 0;
  background: rgba(6, 15, 22, 0.76);
  color: rgba(243, 238, 228, 0.62);
  font-size: 10px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  animation: killFeedIn 0.22s ease both;
}

.kill-feed-item .killer {
  color: #ffe6a3;
  font-weight: 800;
}

.kill-feed-item .victim {
  color: #ff9eaa;
  font-weight: 700;
}

.kill-feed-item .streak {
  margin-left: auto;
  color: #ff9a5a;
  font-weight: 800;
  white-space: nowrap;
}

.kill-feed-item.fade {
  animation: killFeedOut 0.35s ease both;
}

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

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

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-right {
  justify-content: flex-end;
  pointer-events: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 15px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.kill-pill {
  height: 32px;
  padding: 0 12px;
  color: #ffbd8a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.kill-icon {
  color: #ff8a5c;
  font-size: 13px;
  text-shadow: 0 0 9px rgba(255, 120, 80, 0.6);
}

.timer-pill {
  height: 32px;
  padding: 0 12px;
  color: rgba(243, 238, 228, 0.55);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.net-pill {
  height: 32px;
  padding: 0 12px;
  color: rgba(243, 238, 228, 0.64);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #67e0a8;
  box-shadow: 0 0 9px rgba(103, 224, 168, 0.9);
  animation: netPulse 2s ease-in-out infinite;
}

.net-pill.is-offline .net-dot {
  background: #8a929b;
  box-shadow: none;
  animation: none;
}

.net-pill.is-connecting .net-dot {
  background: var(--gold);
  box-shadow: 0 0 9px rgba(245, 195, 91, 0.8);
}

/* 链路抖动：连接还在，但已经收不到快照 */
.net-pill.is-degraded {
  color: #ffb35c;
}

.net-pill.is-degraded .net-dot {
  background: #ff8f3c;
  box-shadow: 0 0 9px rgba(255, 143, 60, 0.85);
  animation: netPulse 0.9s ease-in-out infinite;
}

@keyframes netPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.lobby-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: rgba(243, 238, 228, 0.42);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.lobby-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(245, 195, 91, 0.75);
}

.lobby-status.is-online {
  color: rgba(157, 255, 216, 0.72);
}

.lobby-status.is-online .lobby-dot {
  background: #67e0a8;
  box-shadow: 0 0 9px rgba(103, 224, 168, 0.85);
}

.lobby-status.is-offline {
  color: rgba(243, 238, 228, 0.32);
}

.lobby-status.is-offline .lobby-dot {
  background: #8a929b;
  box-shadow: none;
}

.objective {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: center;
  max-width: min(440px, 40vw);
  padding: 11px 18px;
  border: 1px solid rgba(245, 195, 91, 0.18);
  border-radius: 999px;
  background: rgba(7, 17, 26, 0.64);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(243, 238, 228, 0.72);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.objective.is-ready {
  border-color: rgba(94, 224, 200, 0.34);
  color: #d7fff9;
}

.objective-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(245, 195, 91, 0.8);
}

.objective.is-ready .objective-dot {
  background: var(--teal);
  box-shadow: 0 0 12px rgba(94, 224, 200, 0.9);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(243, 238, 228, 0.72);
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
  color: var(--gold);
  border-color: rgba(245, 195, 91, 0.4);
  transform: translateY(-1px);
}

.icon-btn.is-muted {
  color: rgba(243, 238, 228, 0.3);
  text-decoration: line-through;
}

/* 全屏按钮：只在触摸设备出现（桌面用 F11 就够了，省一个按钮位） */
#fullscreenBtn {
  display: none;
}

body.is-touch #fullscreenBtn {
  display: grid;
}

#fullscreenBtn.on {
  color: var(--gold);
  border-color: rgba(245, 195, 91, 0.5);
  background: rgba(245, 195, 91, 0.14);
}

/* 退出对局：二次确认状态 */
.icon-btn.is-confirm {
  color: #ff8a7a;
  border-color: rgba(255, 138, 122, 0.65);
  background: rgba(120, 32, 32, 0.45);
  animation: exit-pulse 0.9s ease-in-out infinite;
}

@keyframes exit-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 138, 122, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 138, 122, 0);
  }
}

/* toast */
.toast {
  position: absolute;
  top: calc(82px + var(--safe-top));
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 9px 16px;
  border: 1px solid rgba(245, 195, 91, 0.3);
  border-radius: 999px;
  background: rgba(7, 17, 26, 0.78);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

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

/* interaction prompt */
.prompt {
  position: absolute;
  left: 50%;
  bottom: calc(132px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(7, 17, 26, 0.76);
  color: rgba(243, 238, 228, 0.82);
  font-size: 12px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  white-space: nowrap;
  animation: promptIn 0.25s ease both;
}

.prompt .key {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  border: 1px solid rgba(245, 195, 91, 0.45);
  border-radius: 7px;
  background: rgba(245, 195, 91, 0.12);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

@keyframes promptIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* joystick */
.joystick {
  position: absolute;
  left: calc(26px + env(safe-area-inset-left, 0px));
  bottom: calc(28px + var(--safe-bottom));
  width: 126px;
  height: 126px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015) 64%, transparent 66%),
    rgba(5, 13, 20, 0.35);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  touch-action: none;
}

.joystick-ring {
  position: absolute;
  inset: 17px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 230, 163, 0.55);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, rgba(255, 246, 214, 0.9), rgba(245, 195, 91, 0.7) 38%, rgba(125, 77, 15, 0.75));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 18px rgba(245, 195, 91, 0.16);
  transition: transform 0.12s ease-out;
}

.joystick.is-active .joystick-knob {
  transition: none;
}

/* action button */
.action-btn {
  position: absolute;
  right: calc(28px + env(safe-area-inset-right, 0px));
  bottom: calc(30px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(255, 230, 163, 0.65);
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe6a3, #f5c35b 55%, #bd7c22);
  color: #1d1304;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(245, 195, 91, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: actionIn 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  touch-action: manipulation;
}

.action-icon {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.action-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.attack-btn {
  position: absolute;
  right: calc(33px + env(safe-area-inset-right, 0px));
  bottom: calc(122px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 190, 120, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 220, 170, 0.85), transparent 30%),
    linear-gradient(145deg, #ff8a5c, #d94a3e 58%, #8f221f);
  color: #2a0b08;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 26px rgba(255, 100, 70, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.attack-btn:active,
.attack-btn.cooldown {
  transform: scale(0.94);
  filter: brightness(0.8);
}

.attack-icon {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.attack-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.bow-btn {
  position: absolute;
  right: calc(112px + env(safe-area-inset-right, 0px));
  bottom: calc(122px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(210, 230, 255, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, rgba(225, 205, 172, 0.9), transparent 30%),
    linear-gradient(145deg, #a8734a, #6b4226 58%, #3d2413);
  color: #fdf3e3;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(201, 138, 75, 0.22),
    inset 0 1px 0 rgba(255, 236, 209, 0.4);
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.bow-btn:active,
.bow-btn.empty {
  transform: scale(0.94);
  filter: brightness(0.72);
}

.bow-icon {
  font-size: 19px;
  line-height: 1;
}

.bow-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.inventory {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
  pointer-events: auto;
}

.inv-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(243, 238, 228, 0.3);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.inv-slot.has-item {
  border-color: rgba(245, 195, 91, 0.4);
  background: rgba(245, 195, 91, 0.09);
  color: var(--gold-bright);
}

.inv-slot:hover {
  transform: translateY(-2px);
}

.inv-slot:active {
  transform: scale(0.94);
}

.inv-slot.flash {
  border-color: var(--teal);
  background: rgba(94, 224, 200, 0.18);
  color: #d7fff9;
}

.inv-slot.cooldown {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.65;
}

.inv-slot.cooldown::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 28, 0.75);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1;
}

.inv-cooldown-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffd166;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.6);
  z-index: 2;
  pointer-events: none;
}

.inv-icon {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 0 8px currentColor);
}

.inv-count {
  position: absolute;
  right: 5px;
  bottom: 3px;
  min-width: 14px;
  padding: 0 3px;
  border-radius: 5px;
  background: rgba(6, 15, 23, 0.85);
  color: rgba(243, 238, 228, 0.55);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.inv-slot.has-item .inv-count {
  color: var(--gold-bright);
}

.inv-key {
  position: absolute;
  top: 3px;
  left: 5px;
  color: rgba(243, 238, 228, 0.28);
  font-size: 8px;
  font-weight: 800;
}

@keyframes actionIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Scoreboard
   -------------------------------------------------------------------------- */
.scoreboard {
  position: absolute;
  inset: 0;
  z-index: 38;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 7, 11, 0.68);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.score-card {
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid rgba(245, 195, 91, 0.26);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 195, 91, 0.08), transparent 45%),
    rgba(7, 17, 26, 0.95);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.score-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.score-head h2 {
  margin: 7px 0 0;
  font-family: "Georgia", "Songti SC", "Microsoft YaHei", serif;
  font-size: 38px;
  color: var(--gold-bright);
}

.score-table-head,
.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px 76px;
  align-items: center;
  gap: 8px;
}

.score-table-head {
  padding: 0 12px 8px;
  color: rgba(243, 238, 228, 0.34);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-table-head span:not(:first-child) {
  text-align: right;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 50vh;
  overflow-y: auto;
}

.score-row {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.score-row.you {
  border-color: rgba(245, 195, 91, 0.35);
  background: rgba(245, 195, 91, 0.09);
}

.score-row.dead {
  opacity: 0.5;
}

.score-row .name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-weight: 650;
}

.score-row .name .color-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
}

.score-row .kills {
  color: #ffbd8a;
  font-weight: 800;
  text-align: right;
}

.score-row .deaths,
.score-row .hp {
  color: rgba(243, 238, 228, 0.56);
  text-align: right;
}

.score-row .hp.low {
  color: #ff6f80;
}

.score-note {
  margin: 14px 0 0;
  color: rgba(243, 238, 228, 0.3);
  font-size: 9px;
  text-align: center;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Result card (shared by the error screen)
   -------------------------------------------------------------------------- */
.win-card {
  width: min(470px, 100%);
  padding: 38px 34px 32px;
  border: 1px solid rgba(245, 195, 91, 0.3);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 195, 91, 0.12), transparent 46%),
    rgba(7, 17, 26, 0.9);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  animation: winIn 0.55s cubic-bezier(0.2, 1.2, 0.35, 1) both;
}

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

.win-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border: 1px solid rgba(245, 195, 91, 0.45);
  border-radius: 50%;
  color: var(--gold);
  font-size: 25px;
  box-shadow: 0 0 30px rgba(245, 195, 91, 0.18);
}

.win-card .eyebrow {
  justify-content: center;
  font-size: 9px;
}

.win-card h2 {
  margin: 14px 0 8px;
  font-family: "Georgia", "Songti SC", "Microsoft YaHei", serif;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gold-bright);
}

.win-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.stats span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.stats strong {
  color: var(--text);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.win-card .primary-btn {
  width: 100%;
}

.death-screen {
  z-index: 45;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(90, 20, 130, 0.28), transparent 46%),
    rgba(2, 7, 11, 0.7);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  pointer-events: none;
}

.death-card {
  text-align: center;
  animation: deathIn 0.45s ease both;
}

.death-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border: 1px solid rgba(190, 110, 255, 0.5);
  border-radius: 50%;
  color: #d8a7ff;
  font-size: 26px;
  box-shadow: 0 0 38px rgba(145, 60, 220, 0.3);
}

.death-card h2 {
  margin: 0 0 8px;
  font-family: "Georgia", "Songti SC", "Microsoft YaHei", serif;
  font-size: clamp(44px, 6vw, 68px);
  letter-spacing: -0.02em;
  color: #f0d8ff;
  text-shadow: 0 0 30px rgba(160, 80, 240, 0.4);
}

.death-card p {
  margin: 0;
  color: rgba(243, 238, 228, 0.55);
  font-size: 13px;
  letter-spacing: 0.08em;
}

@keyframes deathIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.error-screen {
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #061019;
}

.error-screen .win-mark {
  color: #ff8c7a;
  border-color: rgba(255, 140, 122, 0.4);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .inventory {
    bottom: calc(14px + var(--safe-bottom));
    gap: 5px;
    padding: 6px;
    border-radius: 13px;
  }

  .inv-slot {
    width: 42px;
    height: 42px;
    border-radius: 9px;
  }

  .inv-icon {
    font-size: 17px;
  }

  .hud-top {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    left: 14px;
    right: 14px;
    top: calc(12px + var(--safe-top));
  }

  .hud-left {
    gap: 6px;
  }

  .kill-feed {
    top: calc(144px + var(--safe-top));
    left: 14px;
    width: min(220px, 56vw);
  }

  .kill-feed-item {
    padding: 6px 8px;
    font-size: 9px;
  }

  .score-card {
    padding: 18px;
    border-radius: 18px;
  }

  .score-head h2 {
    font-size: 30px;
  }

  .score-table-head,
  .score-row {
    grid-template-columns: minmax(0, 1fr) 44px 44px 58px;
    gap: 4px;
  }

  .score-row {
    padding: 8px;
    font-size: 11px;
  }

  .score-note {
    font-size: 8px;
  }

  .health-hud {
    top: calc(104px + var(--safe-top));
    left: 14px;
    width: 150px;
    height: 32px;
    padding: 0 10px;
  }

  .pill {
    height: 38px;
    padding: 0 12px;
  }

  .timer-pill {
    display: none;
  }

  .objective {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    max-width: calc(100vw - 28px);
    padding: 8px 14px;
    font-size: 11px;
  }

  .hud-top {
    grid-template-rows: auto auto;
  }

  .hud-right {
    grid-column: 3;
    grid-row: 1;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }

  .start-copy {
    width: 100%;
    margin: 0;
    padding: max(8vh, 48px) 24px calc(80px + var(--safe-bottom));
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(3, 9, 14, 0.96) 0%, rgba(3, 9, 14, 0.8) 42%, rgba(3, 9, 14, 0.15) 78%, transparent 100%);
  }

  .start-copy h1 {
    font-size: clamp(62px, 17vw, 96px);
    margin: 14px 0 16px;
  }

  .lead {
    margin-bottom: 18px;
    font-size: 13px;
    line-height: 1.7;
  }

  .chips {
    margin-bottom: 22px;
  }

  .chips span {
    padding: 7px 10px;
    font-size: 11px;
  }

  .primary-btn {
    width: 100%;
    min-width: 0;
    padding: 16px 24px;
  }

  .start-footer {
    display: none;
  }

  .controls {
    margin-top: 14px;
    font-size: 10px;
  }

  .prompt {
    bottom: calc(126px + var(--safe-bottom));
    max-width: calc(100vw - 36px);
    white-space: normal;
    text-align: center;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .inventory {
    left: 50%;
    bottom: calc(150px + var(--safe-bottom));
    gap: 4px;
    padding: 5px;
  }

  .inv-slot {
    width: 38px;
    height: 38px;
  }

  .inv-icon {
    font-size: 15px;
  }

  .kill-feed {
    top: calc(190px + var(--safe-top));
    width: min(210px, 62vw);
  }

  .joystick {
    width: 112px;
    height: 112px;
    left: 18px;
    bottom: calc(22px + var(--safe-bottom));
  }

  .joystick-knob {
    width: 48px;
    height: 48px;
  }

  .action-btn {
    width: 74px;
    height: 74px;
    right: 18px;
    bottom: calc(24px + var(--safe-bottom));
  }

  .attack-btn {
    width: 62px;
    height: 62px;
    right: 24px;
    bottom: calc(108px + var(--safe-bottom));
  }

  .attack-icon {
    font-size: 18px;
  }

  .action-icon {
    font-size: 19px;
  }

  .win-card {
    padding: 30px 22px 24px;
    border-radius: 24px;
  }

  .toast {
    top: calc(148px + var(--safe-top));
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .inventory {
    bottom: calc(10px + var(--safe-bottom));
    gap: 4px;
    padding: 5px;
  }

  .inv-slot {
    width: 34px;
    height: 34px;
  }

  .inv-icon {
    font-size: 14px;
  }
  .start-copy {
    justify-content: center;
    padding-top: 28px;
    padding-bottom: 24px;
  }

  .start-copy h1 {
    font-size: 52px;
    margin: 10px 0 10px;
    /* 基础样式的 line-height 是 0.84，中文字形比行盒高，
       横屏高度紧张时第二行会被下一块内容压住，这里放宽一点 */
    line-height: 0.98;
    padding-bottom: 2px;
  }

  .lead,
  .chips,
  .controls {
    display: none;
  }

  .primary-btn {
    width: auto;
    padding: 13px 24px;
  }

  .start-copy {
    background: linear-gradient(90deg, rgba(3, 9, 14, 0.94), rgba(3, 9, 14, 0.55) 60%, transparent);
  }

  .joystick {
    width: 96px;
    height: 96px;
    bottom: 16px;
  }

  .joystick-knob {
    width: 42px;
    height: 42px;
  }

  .action-btn {
    width: 68px;
    height: 68px;
    bottom: 16px;
  }

  .attack-btn {
    width: 58px;
    height: 58px;
    right: 24px;
    bottom: 92px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .joystick {
    display: none !important;
  }

  body.is-touch .desktop-only {
    display: block;
  }

  body.is-touch .mobile-only {
    display: none;
  }
}

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

/* --------------------------------------------------------------------------
   Crosshair (准星)
   -------------------------------------------------------------------------- */
.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  width: 24px;
  height: 24px;
}

.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #ffd166;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(255, 209, 102, 0.8);
}

.crosshair-line-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 209, 102, 0.6) 20%, 
    rgba(255, 209, 102, 0.9) 50%, 
    rgba(255, 209, 102, 0.6) 80%, 
    transparent 100%
  );
  transform: translateY(-50%);
}

.crosshair-line-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, 
    transparent 0%, 
    rgba(255, 209, 102, 0.6) 20%, 
    rgba(255, 209, 102, 0.9) 50%, 
    rgba(255, 209, 102, 0.6) 80%, 
    transparent 100%
  );
  transform: translateX(-50%);
}

.crosshair.hidden {
  display: none;
}

/* Slight spread while moving - the aim reacts to movement */
.crosshair.spread .crosshair-line-h {
  transform: translateY(-50%) scaleX(1.3);
}

.crosshair.spread .crosshair-line-v {
  transform: translateX(-50%) scaleY(1.3);
}

/* 准星常驻：没拿弓时淡一些，拿了弓（body.aiming）更亮更清晰 */
body.aiming .crosshair {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.65));
}

body:not(.aiming) .crosshair {
  opacity: 0.42;
  filter: none;
}
