* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #87ceeb;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  touch-action: none;
}

canvas.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Top-left status */
.hud-top-left {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 26, 38, 0.72);
  backdrop-filter: blur(8px);
  color: #fff8e7;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.16);
  width: fit-content;
}

.coin-val {
  color: #ffd166;
  font-size: 16px;
  font-weight: 700;
}

.coin-rate {
  font-size: 11px;
  color: #a3e635;
}

.zone-tag {
  background: rgba(155, 34, 38, 0.82);
  border-color: rgba(244, 211, 94, 0.5);
}

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

.buff-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 95, 70, 0.85);
  color: #ecfdf5;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(110, 231, 183, 0.45);
  width: fit-content;
}

/* Top-right minimap & tools */
.hud-top-right {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.minimap-wrap {
  background: rgba(20, 26, 38, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 4px;
  backdrop-filter: blur(6px);
}

.minimap-canvas {
  display: block;
  width: 118px;
  height: 82px;
  border-radius: 8px;
}

.quick-btns {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.small-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 26, 38, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.small-btn:active {
  transform: scale(0.95);
}

/* Toast & Tour Guide */
.toast-box {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(86vw, 420px);
  background: rgba(20, 26, 38, 0.88);
  color: #fff8e7;
  border: 1px solid rgba(244, 211, 94, 0.55);
  padding: 9px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.toast-box.show {
  opacity: 1;
}

.climb-hint {
  position: absolute;
  bottom: 136px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(233, 185, 73, 0.92);
  color: #1f2421;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.climb-hint.show {
  opacity: 1;
}

/* Mobile Controls */
.joy-zone {
  position: absolute;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.35);
  pointer-events: auto;
  touch-action: none;
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.action-pad {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}

.interact-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-width: 126px;
  border-radius: 16px;
  border: 2px solid #f4d35e;
  background: rgba(155, 34, 38, 0.92);
  color: #fff8e7;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.interact-btn.visible {
  display: flex;
}

.interact-sub {
  font-size: 11px;
  font-weight: 500;
  color: #fde68a;
  margin-top: 2px;
}

.jump-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: rgba(38, 70, 83, 0.8);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.jump-btn:active,
.interact-btn:active {
  transform: scale(0.94);
}

/* Modal & Welcome */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.62);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: auto;
  padding: 18px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 390px;
  background: #fffaf0;
  color: #24292f;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  border: 2px solid #e9b949;
}

.modal-card h2 {
  font-size: 19px;
  color: #8c1d18;
  margin-bottom: 10px;
}

.modal-card p {
  font-size: 13px;
  line-height: 1.6;
  color: #444;
  margin-bottom: 10px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}

.check-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f5efe2;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.check-row.done {
  background: #e6f4ea;
  color: #137333;
}

.check-hint {
  display: block;
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

.primary-btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 12px;
  background: #9b2226;
  color: #fff8e7;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:active {
  transform: scale(0.98);
}
