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

input, select {
  user-select: text;
}

html, body {
  width: 100%;
  height: 100%;
  background: #030712;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans", sans-serif;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* 顶部全局语言与音频控制条 */
.global-topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.global-topbar > * {
  pointer-events: auto;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-pill {
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.top-pill.active {
  border-color: rgba(245, 158, 11, 0.65);
  color: #fde68a;
  background: rgba(30, 41, 59, 0.9);
}

.select-pill {
  outline: none;
  color: #f8fafc;
}

.select-pill option {
  background: #0f172a;
  color: #f8fafc;
}

/* 通用全屏视图层 */
.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 24px;
  overflow-y: auto;
  transition: opacity 0.65s ease;
}

.screen-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ========== 开场动画 ========== */
.view-intro {
  text-align: center;
  flex-direction: column;
}

.intro-content {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.intro-seal {
  position: relative;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  animation: sealReveal 1.2s ease forwards;
}

.seal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.72);
}

.seal-ring-outer {
  border-style: dashed;
  animation: spinSlow 18s linear infinite;
}

.seal-ring-inner {
  inset: 12px;
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.35), inset 0 0 22px rgba(245, 158, 11, 0.2);
  animation: spinReverse 12s linear infinite;
}

.seal-char {
  font-size: 44px;
  font-weight: 700;
  color: #fde68a;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.75);
}

.intro-tag {
  font-size: 12px;
  letter-spacing: 3px;
  color: #7dd3fc;
  opacity: 0;
  animation: fadeUp 0.9s ease 0.5s forwards;
}

.intro-title {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fef3c7 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 20px rgba(245, 158, 11, 0.35));
  opacity: 0;
  animation: fadeUp 1s ease 0.9s forwards;
}

.intro-line {
  font-size: 15px;
  line-height: 1.7;
  color: #cbd5e1;
  opacity: 0;
  animation: fadeUp 1s ease 1.8s forwards;
}

.intro-line-delay {
  animation-delay: 2.9s;
  color: #fde68a;
}

.intro-progress-track {
  width: 220px;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin-top: 8px;
}

.intro-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f59e0b);
  transition: width 0.1s linear;
}

.intro-tap-hint {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.85);
  margin-top: 4px;
}

.btn-skip {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  right: 20px;
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

@keyframes sealReveal {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
@keyframes fadeUp {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========== 注册 / 登录首页 ========== */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(9, 14, 26, 0.82);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-seal {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid #f59e0b;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22), rgba(15, 23, 42, 0.9));
  color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: #fef3c7;
}

.auth-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-ghost-xs {
  margin-inline-start: auto;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.region-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.28);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.region-label {
  font-size: 12px;
  color: #7dd3fc;
  font-weight: 500;
}

.btn-region-switch {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fffbeb;
  border: 1px solid rgba(253, 230, 138, 0.5);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-region-switch:hover {
  filter: brightness(1.08);
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.tab-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  padding: 8px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.method-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.method-btn {
  background: rgba(15, 23, 42, 0.7);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}

.method-btn.active {
  border-color: #38bdf8;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.14);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

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

.field label {
  font-size: 12px;
  color: #cbd5e1;
}

.field input {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
}

.field input:focus {
  border-color: #f59e0b;
}

.phone-row, .code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.prefix-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  font-size: 13px;
  color: #fde68a;
  font-weight: 600;
}

.btn-outline {
  white-space: nowrap;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.info-banner {
  font-size: 11.5px;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.6);
  border-inline-start: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 6px;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #0b0f17;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.28);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.google-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.22);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.28);
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-message {
  font-size: 12.5px;
  line-height: 1.45;
  padding: 9px 12px;
  border-radius: 10px;
}

.auth-message.error {
  background: rgba(153, 27, 27, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

.auth-message.success {
  background: rgba(6, 95, 70, 0.42);
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #a7f3d0;
}

.auth-footer {
  text-align: center;
}

.btn-link {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

/* ========== 游戏主地图界面 ========== */
.view-game {
  position: fixed;
  inset: 0;
  z-index: 20;
}

#map {
  width: 100%;
  height: 100%;
}

.hud-top {
  position: fixed;
  top: max(54px, calc(env(safe-area-inset-top) + 44px));
  left: 12px;
  right: 12px;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(11, 15, 23, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.hud-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hud-title h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fef3c7;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.45);
}

.provider-switch {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  overflow: hidden;
}

.switch-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
}

.switch-btn.active {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  font-weight: 600;
}

.switch-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn-mini {
  background: rgba(30, 41, 59, 0.92);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.btn-warn-mini {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.restricted-banner {
  position: fixed;
  top: 126px;
  left: 12px;
  right: 12px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(120, 53, 15, 0.94);
  border: 1px solid #f59e0b;
  color: #fef3c7;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.hud-bottom {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 25;
  padding: 10px 14px;
  background: rgba(11, 15, 23, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compass-status {
  font-size: 13px;
  color: #cbd5e1;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #94a3b8;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-inline-end: 4px;
}

.dot-ghost { background: #38bdf8; }
.dot-zone { background: #d97706; }

.ar-badge {
  margin-inline-start: auto;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.ar-ok { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.ar-locked { background: rgba(239, 68, 68, 0.22); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }

/* 收鬼弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #111827;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-head h2 { font-size: 18px; }
.muted { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.btn-close {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}

.ghost-stage {
  position: relative;
  height: 170px;
  border-radius: 12px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.9), #090d16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}

.ghost-orb {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 28px #38bdf8;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

.ghost-orb.stealth { opacity: 0.22; filter: blur(4px); }
.ghost-orb.shake { transform: scale(0.88) translateX(6px); }

.stage-hint { font-size: 13px; color: #e2e8f0; text-align: center; padding: 0 12px; }
.progress-wrap { width: 82%; height: 8px; border-radius: 999px; background: rgba(148, 163, 184, 0.2); overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, #f59e0b, #10b981); transition: width 0.08s linear; }

.vessel-wheel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vessel-btn {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 10px 6px;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.vessel-btn.active { border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); }
.v-icon { font-size: 20px; }
.v-name { font-size: 13px; font-weight: 600; }
.v-sub { font-size: 10px; color: #94a3b8; }

.action-pad {
  height: 54px;
  border-radius: 12px;
  background: #1f2937;
  border: 1px dashed rgba(245, 158, 11, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fde68a;
  cursor: pointer;
}
.action-pad:active { background: rgba(245, 158, 11, 0.22); }
