* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  height: 100%;
  width: 100%;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* 紧急联系面板 */
#emergency-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
}

.emergency-toggle {
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-left: auto;
}

.emergency-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.emergency-icon {
  font-size: 24px;
}

.emergency-content {
  display: none;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-top: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  min-width: 280px;
  max-width: 320px;
  animation: slideDown 0.3s ease;
}

.emergency-content.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emergency-content h3 {
  font-size: 16px;
  color: #1a1a1a;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.emergency-section {
  margin-bottom: 16px;
}

.emergency-section:last-child {
  margin-bottom: 0;
}

.emergency-section h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.emergency-section p {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
  line-height: 1.4;
}

.clickable-address {
  cursor: pointer;
  color: #2563eb !important;
  text-decoration: underline;
  transition: color 0.2s;
}

.clickable-address:hover {
  color: #1d4ed8 !important;
}

.phone-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
  transition: background 0.2s;
}

.phone-link:hover {
  background: #bbf7d0;
}

.phone-link::before {
  content: '📞';
}

/* 加入世界按钮 */
#join-btn-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

.join-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.join-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.join-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 20px;
}

.join-btn.joined {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.alarm-toggle {
  margin-top: 20px;
}

.alarm-toggle.hidden {
  display: none;
}

.alarm-toggle.alarm-sending {
  background: #ef4444;
  animation: alarmPulse 0.5s ease infinite;
}

.alarm-toggle.alarm-sending .emergency-icon {
  animation: alarmShake 0.3s ease infinite;
}

@keyframes alarmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

@keyframes alarmShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

.stealth-toggle {
  margin-top: 20px;
}

.stealth-toggle.stealthed {
  background: #374151;
  box-shadow: 0 4px 12px rgba(55, 65, 81, 0.4);
}

.stealth-toggle.hidden {
  display: none;
}

.watermark-brand {
  margin-top: 16px;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.watermark-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  color: rgba(0, 0, 0, 0.18);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* 在线人数 */
#online-count {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  background: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  color: #333;
}

.online-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.toggle-view-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.toggle-view-btn:hover {
  background: #f3f4f6;
}

.toggle-view-btn.show-all {
  background: #dbeafe;
  border-color: #93c5fd;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 400px;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content h2 {
  font-size: 22px;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

.type-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: #666;
}

.type-btn:hover {
  border-color: #667eea;
}

.type-btn.active {
  border-color: #667eea;
  background: #f0f0ff;
  color: #667eea;
  font-weight: 600;
}

.type-icon {
  font-size: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.hidden {
  display: none;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #667eea;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-cancel {
  flex: 1;
  padding: 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  color: #666;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: #f9fafb;
}

.btn-submit {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 15px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-submit:hover {
  opacity: 0.9;
}

/* 地图标记样式 */
.member-marker {
  position: relative;
}

.marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  pointer-events: none;
}

.marker-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

.marker-label.team {
  background: rgba(102, 126, 234, 0.9);
}

.marker-label.team::after {
  border-top-color: rgba(102, 126, 234, 0.9);
}

.marker-dot {
  width: 16px;
  height: 16px;
  background: #ef4444;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-dot.individual {
  background: #10b981;
}

.marker-dot.team {
  background: #667eea;
}

.marker-dot.self {
  background: #ef4444;
  width: 20px;
  height: 20px;
  animation: selfPulse 2s infinite;
}

@keyframes selfPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* 报警闪烁标记 */
.alarm-marker-flash {
  z-index: 900 !important;
}

.alarm-marker-flash .alarm-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid rgba(239, 68, 68, 0.6);
  animation: alarmRingExpand 1s ease-out infinite;
}

@keyframes alarmRingExpand {
  0% { width: 20px; height: 20px; opacity: 1; }
  100% { width: 80px; height: 80px; opacity: 0; }
}

.alarm-flash-label {
  background: rgba(239, 68, 68, 0.95) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 5px 12px !important;
  animation: alarmLabelFlash 0.4s ease infinite alternate, alarmLabelShake 0.15s ease infinite;
}

.alarm-flash-label::after {
  border-top-color: rgba(239, 68, 68, 0.95) !important;
}

@keyframes alarmLabelFlash {
  0% { background: rgba(239, 68, 68, 0.95); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
  100% { background: rgba(185, 28, 28, 0.95); box-shadow: 0 0 20px rgba(239, 68, 68, 0.9); }
}

@keyframes alarmLabelShake {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-3deg) translateX(-2px); }
  75% { transform: translateX(-50%) rotate(3deg) translateX(2px); }
}

.alarm-flash-dot {
  background: #ef4444 !important;
  width: 20px !important;
  height: 20px !important;
  border: 3px solid #fff !important;
  animation: alarmDotPulse 0.5s ease infinite alternate;
}

@keyframes alarmDotPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  100% { transform: scale(1.4); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

/* 离线成员样式 */
.marker-label.offline {
  background: rgba(156, 163, 175, 0.8);
  opacity: 0.7;
}

.marker-label.offline::after {
  border-top-color: rgba(156, 163, 175, 0.8);
}

.marker-dot.offline {
  background: #9ca3af;
  opacity: 0.6;
}

/* 连接状态提示 */
.connection-status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 20px 32px;
  border-radius: 16px;
  text-align: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.connection-status.hidden {
  display: none;
}

.connection-status p {
  margin: 8px 0;
  font-size: 14px;
}

.connection-status .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* 导航面板 */
.nav-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  background: #fff;
  padding: 16px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideUp 0.3s ease;
}

.nav-panel.hidden {
  display: none;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.nav-info {
  flex: 1;
}

.nav-target {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.nav-target strong {
  color: #1a1a1a;
  margin-left: 4px;
}

.nav-details {
  display: flex;
  gap: 16px;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.nav-close-btn {
  padding: 10px 20px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.nav-close-btn:hover {
  opacity: 0.9;
}

/* 通知权限提示 */
.push-prompt {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  padding: 10px 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  animation: slideUp 0.3s ease;
}

.push-prompt.hidden {
  display: none;
}

.push-prompt-btn {
  padding: 5px 14px;
  background: #fff;
  color: #667eea;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.push-prompt-btn:hover {
  opacity: 0.9;
}

.push-prompt-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.push-prompt-close:hover {
  color: #fff;
}

/* 报警弹层 */
.alarm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5000;
  background: rgba(239, 68, 68, 0.15);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: alarmFlash 0.6s ease 3;
}

.alarm-overlay.hidden {
  display: none;
}

@keyframes alarmFlash {
  0%, 100% { background: rgba(239, 68, 68, 0.15); }
  50% { background: rgba(239, 68, 68, 0.35); }
}

.alarm-content {
  position: relative;
  text-align: center;
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px 32px;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 20px 60px rgba(239, 68, 68, 0.3);
  animation: alarmBounce 0.4s ease;
}

@keyframes alarmBounce {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.alarm-pulse-ring {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  animation: ringExpand 1.5s ease infinite;
}

@keyframes ringExpand {
  0% { transform: translateX(-50%) scale(0.8); opacity: 1; }
  100% { transform: translateX(-50%) scale(2); opacity: 0; }
}

.alarm-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  animation: alarmShake 0.3s ease infinite;
}

.alarm-title {
  font-size: 22px;
  font-weight: 700;
  color: #ef4444;
  margin-bottom: 8px;
}

.alarm-sender {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.alarm-hint {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

.alarm-locate-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: opacity 0.2s;
}

.alarm-locate-btn:hover {
  opacity: 0.9;
}

.alarm-dismiss-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.alarm-dismiss-btn:hover {
  background: #e5e7eb;
}

/* 响应式 */
@media (max-width: 480px) {
  .emergency-content {
    min-width: 240px;
    max-width: 280px;
    padding: 16px;
  }

  .modal-content {
    padding: 24px;
  }

  .join-btn {
    padding: 12px 24px;
    font-size: 15px;
  }
}
