/* ==================== 重置与基础 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --border-color: #2a2a3a;
  --border-hover: #4fc3f7;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #666;
  --accent: #4fc3f7;
  --accent-glow: rgba(79, 195, 247, 0.3);
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #2ecc71;
  --transition-default: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* ==================== 深色模式（默认就是深色，保留类以备切换） ==================== */
body.dark-mode {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ==================== 容器 ==================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.header-content {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.app-title h1 {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, #e0f2fe, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== 按钮与指示器 ==================== */
.sound-btn,
.api-indicator,
.settings-trigger {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-default);
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.2);
  color: var(--accent);
}

.sound-btn:hover,
.api-indicator:hover,
.settings-trigger:hover {
  background: rgba(79, 195, 247, 0.15);
  border-color: rgba(79, 195, 247, 0.4);
  transform: translateY(-1px);
}

.sound-btn.muted {
  color: var(--text-muted);
  border-color: #3a3a4a;
  background: rgba(100, 100, 100, 0.1);
}

.settings-trigger {
  width: 40px;
  justify-content: center;
  font-size: 1.2rem;
  padding: 0;
}

.api-indicator {
  gap: 8px;
}

.api-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1s ease-in-out infinite;
}

.api-dot.error {
  background: var(--danger);
  animation: blink-fast 0.5s ease-in-out infinite;
}

.api-dot.success {
  background: var(--success);
  animation: none;
}

.api-dot.ws-connected {
  background: #9b59b6;
  animation: none;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

@keyframes blink-fast {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

/* ==================== 设置浮层优化 ==================== */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.settings-panel {
  background: linear-gradient(145deg, #12121f 0%, #0c0c16 100%);
  border-radius: 32px;
  width: 90%;
  max-width: 560px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  box-shadow:
    0 30px 50px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(79, 195, 247, 0.1) inset;
  overflow: hidden;
  animation: panelGlideIn 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

@keyframes panelGlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 26px;
  background: rgba(10, 10, 20, 0.7);
  border-bottom: 1px solid rgba(79, 195, 247, 0.2);
}

.settings-header h3 {
  font-size: 1.4rem;
  font-weight: 600;
  background: linear-gradient(135deg, #e0f2fe, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-settings {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #aaa;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-settings:hover {
  background: rgba(231, 76, 60, 0.25);
  color: #ff7b5c;
  transform: rotate(90deg);
}

.settings-content {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.settings-content::-webkit-scrollbar {
  width: 5px;
}

.settings-content::-webkit-scrollbar-track {
  background: #1e1e2a;
  border-radius: 10px;
}

.settings-content::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}

.setting-card {
  background: rgba(18, 18, 30, 0.7);
  border-radius: 24px;
  padding: 18px 22px;
  border: 1px solid rgba(79, 195, 247, 0.15);
  transition: all 0.2s;
}

.setting-card:hover {
  border-color: rgba(79, 195, 247, 0.35);
  background: rgba(26, 26, 42, 0.6);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 16px;
}

/* 设置项通用样式 */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(79, 195, 247, 0.1);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

/* 复选框样式 */
.setting-item input[type="checkbox"] {
  width: 44px;
  height: 24px;
  appearance: none;
  background: #2a2a3a;
  border-radius: 40px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}

.setting-item input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--accent), #00bcd4);
}

.setting-item input[type="checkbox"]::before {
  content: "";
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.setting-item input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

/* 数字输入框 */
.threshold-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.threshold-control input {
  width: 80px;
  background: #0a0a12;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: monospace;
  text-align: center;
  transition: 0.2s;
}

.threshold-control input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.threshold-control span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* 滑块样式 */
.threshold-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #2a2a3a;
  border-radius: 4px;
  outline: none;
  margin: 12px 0;
}

.threshold-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--accent);
  transition: 0.1s;
}

.threshold-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.threshold-value {
  font-weight: 600;
  color: var(--accent);
  font-size: 1rem;
  margin-left: 8px;
}

/* 下拉选择 */
.theme-select {
  background: #0a0a12;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}

.theme-select:hover,
.theme-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* 数据源切换按钮组 */
.datasource-switch {
  display: flex;
  gap: 12px;
  background: #0a0a12;
  padding: 6px;
  border-radius: 60px;
  border: 1px solid var(--border-color);
}

.ds-btn {
  flex: 1;
  text-align: center;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 0;
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.ds-btn.active {
  background: linear-gradient(135deg, var(--accent), #00bcd4);
  color: #0a0a0f;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.ds-btn:not(.active):hover {
  background: rgba(79, 195, 247, 0.2);
  color: var(--accent);
}

/* 位置预览卡片 */
.location-preview {
  background: #0a0a12;
  border-radius: 20px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-family: monospace;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.coord-text {
  color: #b9e6ff;
  word-break: break-all;
}

.reset-location-btn,
.save-location-btn,
.clear-location-btn {
  background: linear-gradient(135deg, #2c3e66, #1f2a48);
  border: none;
  padding: 8px 18px;
  border-radius: 40px;
  color: #e0f2fe;
  font-weight: 500;
  font-size: 0.75rem;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reset-location-btn:hover,
.save-location-btn:hover {
  background: linear-gradient(135deg, #3e5a8c, #2a3a60);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.clear-location-btn {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid var(--danger);
  color: #ff8a6c;
}

.clear-location-btn:hover {
  background: rgba(231, 76, 60, 0.3);
  transform: translateY(-2px);
}

.manual-location-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.input-group label {
  min-width: 60px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.input-group input {
  flex: 1;
  background: #0a0a12;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: monospace;
  transition: 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.info-note {
  font-size: 0.7rem;
  color: #6b7b9c;
  margin-top: 10px;
  text-align: center;
}

.settings-footer {
  padding: 14px 24px;
  background: #08080e;
  border-top: 1px solid #1f1f2a;
  text-align: center;
  font-size: 0.7rem;
  color: #5f6c84;
}

/* ==================== 主内容区布局 ==================== */
.main-content {
  flex: 1;
  display: flex;
  padding: 16px;
  gap: 16px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.left-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.map-container {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  flex: 1;
  min-height: 400px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  z-index: 1;
}

#waveCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}

/* 地图覆盖层优化 */
.status-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(18, 18, 26, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 10px 16px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  z-index: 1000;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.status-value.stopped {
  color: var(--success);
}
.status-value.running {
  color: var(--danger);
}

.location-info {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(18, 18, 26, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  z-index: 1000;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.location-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
}

.location-label {
  color: var(--text-muted);
}
.location-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ==================== 右侧面板 ==================== */
.right-section {
  width: 320px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
  padding-right: 4px;
}

.right-section::-webkit-scrollbar {
  width: 4px;
}
.right-section::-webkit-scrollbar-track {
  background: #1a1a24;
  border-radius: 4px;
}
.right-section::-webkit-scrollbar-thumb {
  background: #4a4a5a;
  border-radius: 4px;
}
.right-section::-webkit-scrollbar-thumb:hover {
  background: #5a5a6a;
}

.panel {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border-color);
  transition: box-shadow 0.2s;
}

.panel:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.panel-icon {
  font-size: 16px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-panel {
  background: linear-gradient(
    135deg,
    rgba(231, 76, 60, 0.08) 0%,
    rgba(243, 156, 18, 0.08) 100%
  );
  border: 2px solid rgba(231, 76, 60, 0.3);
}

.countdown-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.countdown-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.countdown-item.arrived {
  border-color: rgba(231, 76, 60, 0.6);
  background: rgba(231, 76, 60, 0.1);
}

.countdown-wave-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.countdown-wave-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.countdown-time {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.countdown-time.p-wave {
  color: #ff6b6b;
  text-shadow: 0 0 12px rgba(255, 107, 107, 0.4);
}

.countdown-time.s-wave {
  color: #ffd93d;
  text-shadow: 0 0 12px rgba(255, 217, 61, 0.4);
}

.countdown-time.surface-wave {
  color: #3dfff5;
  text-shadow: 0 0 12px rgba(61, 255, 245, 0.4);
}

.countdown-status {
  display: inline-block;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.countdown-status.waiting {
  background: rgba(79, 195, 247, 0.15);
  color: var(--accent);
  border: 1px solid rgba(79, 195, 247, 0.3);
}

.countdown-status.arrived {
  background: rgba(231, 76, 60, 0.2);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.4);
  animation: pulse-status 1.5s ease-in-out infinite;
}

@keyframes pulse-status {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* 地震详情面板 */
.earthquake-panel {
  display: none;
}
.earthquake-panel.active {
  display: block;
}

.earthquake-header {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  text-align: center;
}

.earthquake-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 4px;
}

.earthquake-location {
  font-size: 12px;
  color: #ff8c6b;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.detail-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
}

.detail-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-value.large {
  font-size: 22px;
  color: var(--danger);
}

.elapsed-box {
  margin-top: 14px;
  padding: 12px;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 12px;
  text-align: center;
}

.elapsed-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.elapsed-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.data-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
}

.data-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.data-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.data-value.warning {
  color: var(--warning);
}
.data-value.danger {
  color: var(--danger);
}
.data-value.success {
  color: var(--success);
}

/* ==================== 通知 ==================== */
.notification-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 340px;
}

.notification {
  background: rgba(26, 26, 36, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  transform: translateX(420px);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1),
    opacity 0.3s;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  border-left: 4px solid var(--success);
}
.notification.error {
  border-left: 4px solid var(--danger);
}
.notification.warning {
  border-left: 4px solid var(--warning);
}
.notification.info {
  border-left: 4px solid var(--accent);
}

.notification-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.loading-progress {
  width: 240px;
  height: 4px;
  background: var(--border-color);
  border-radius: 4px;
  margin-top: 16px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00bcd4);
  width: 0%;
  transition: width 0.3s ease;
}

/* ==================== 地图标记 ==================== */
.epicenter-marker {
  width: 30px;
  height: 30px;
  position: relative;
}
.epicenter-marker::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow:
    0 0 15px var(--danger),
    0 0 30px rgba(231, 76, 60, 0.5);
}
.epicenter-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 2px solid var(--danger);
  border-radius: 50%;
  animation: epicenter-pulse 1.5s ease-out infinite;
}

@keyframes epicenter-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

.user-marker {
  width: 24px;
  height: 24px;
  position: relative;
}
.user-marker::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}
.user-marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2px solid rgba(79, 195, 247, 0.6);
  border-radius: 50%;
}

/* ==================== 其他辅助 ==================== */
.cert-tip {
  background: rgba(243, 156, 18, 0.12);
  border-left: 4px solid var(--warning);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  margin-top: 12px;
  backdrop-filter: blur(4px);
}

.cert-tip a {
  color: var(--warning);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.cert-tip .reconnect-link {
  margin-left: 12px;
  color: var(--accent);
}

/* 隐藏第三方控件中不需要的部分 */
.leaflet-control-attribution {
  display: none !important;
}
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: #fff !important;
  border: 1px solid var(--border-color) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
}
.leaflet-control-zoom a:hover {
  background: #2a2a3a !important;
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 900px) {
  .header-content {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
  .app-title h1 {
    font-size: 1.3rem;
  }
  .right-section {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    padding: 12px;
  }
  .left-section {
    min-height: 400px;
  }
  .right-section {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    max-height: none;
  }
  .right-section .panel {
    flex: 1 1 calc(50% - 12px);
  }
  .countdown-grid {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .countdown-item {
    flex: 1 1 calc(33% - 8px);
  }
  .detail-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }
  .location-info {
    bottom: 60px;
    right: 12px;
    max-width: 200px;
    font-size: 10px;
  }
  .status-indicator {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  .right-section .panel {
    flex: 1 1 100%;
  }
  .countdown-time {
    font-size: 18px;
  }
  .countdown-item {
    padding: 8px;
  }
  .location-info {
    max-width: 180px;
    padding: 8px 10px;
  }
  .settings-panel {
    width: 95%;
    margin: 16px;
  }
  .settings-content {
    padding: 16px;
  }
}

@media (max-height: 600px) {
  .right-section {
    gap: 8px;
  }
  .countdown-time {
    font-size: 16px;
  }
  .panel {
    padding: 12px;
  }
  .elapsed-value {
    font-size: 20px;
  }
}

/* 移动端触摸优化 */
@media (hover: none) {
  .sound-btn,
  .api-indicator,
  .settings-trigger,
  .ds-btn,
  .reset-location-btn {
    cursor: default;
  }
}
/* ==================== 输入控件通用优化 ==================== */

/* 隐藏数字输入框的默认上下箭头（保留干净外观） */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 所有输入框聚焦时的统一光晕效果 */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

/* 滑块数值显示区域优化 */
.threshold-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.threshold-control input {
  width: 80px;
  text-align: center;
  font-weight: 600;
  background: #0f0f18;
  border: 1px solid #2a2a3a;
  border-radius: 28px;
  padding: 6px 0;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.threshold-control input:focus {
  background: #14141e;
  border-color: var(--accent);
}
.threshold-control span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* 滑块轨道和拇指增强 */
.threshold-slider {
  width: 100%;
  height: 5px;
  background: #2a2a3a;
  border-radius: 5px;
  transition: background 0.2s;
}
.threshold-slider:hover {
  background: #3a3a4a;
}
.threshold-slider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.1s ease,
    background 0.2s;
}
.threshold-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #6ed4ff;
}
.threshold-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease;
}
.threshold-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* 复选框（开关）优化：增加聚焦可见环 */
.setting-item input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.4);
  border-radius: 40px;
}
.setting-item input[type="checkbox"]:active::before {
  transform: scale(0.9);
  transition: transform 0.05s;
}

/* 单选/复选框的标签点击区域优化 */
.setting-item label {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 普通按钮（设置面板内的按钮）增加更明显的按下反馈 */
.reset-location-btn,
.save-location-btn,
.clear-location-btn,
.ds-btn,
.sound-btn,
.settings-trigger,
.close-settings,
.confirm-btn,
.cancel-btn {
  transition:
    transform 0.1s ease,
    background 0.2s,
    box-shadow 0.2s;
}
.reset-location-btn:active,
.save-location-btn:active,
.clear-location-btn:active,
.ds-btn:active,
.sound-btn:active,
.settings-trigger:active {
  transform: translateY(1px);
}
.confirm-btn,
.cancel-btn {
  padding: 8px 20px;
  border-radius: 40px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.confirm-btn {
  background: linear-gradient(135deg, var(--accent), #00bcd4);
  color: #0a0a0f;
}
.confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(79, 195, 247, 0.3);
}
.cancel-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #3a3a4a;
  color: #ccc;
}
.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* 手动定位弹窗中的输入框优化 */
.manual-location-dialog input {
  background: #0f0f18;
  border: 1px solid #2a2a3a;
  border-radius: 28px;
  padding: 10px 16px;
  width: 100%;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.manual-location-dialog input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

/* 数据源切换按钮组中的活动状态增强 */
.ds-btn.active {
  position: relative;
  overflow: hidden;
}
.ds-btn.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0) 80%
  );
  pointer-events: none;
}

/* 阈值显示数值动态变化时的轻微高亮（可选，增加科技感） */
.threshold-value {
  transition: color 0.1s ease;
}
.threshold-slider:active + .threshold-value {
  color: #6ed4ff;
} /* ==================== 自定义开关（声音/通知等按钮式开关） ==================== */
.toggle-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.toggle-btn {
  width: 52px;
  height: 28px;
  background: #2a2a3a;
  border-radius: 40px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
  outline: none;
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--accent), #00bcd4);
}

.toggle-btn::after {
  content: "";
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 3px;
  transition: transform 0.2s ease;
}

.toggle-btn.active::after {
  transform: translateX(24px);
}

/* 悬停与聚焦 */
.toggle-btn:hover {
  opacity: 0.9;
}
.toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.4);
}

/* 移动端适配 */
@media (hover: none) {
  .toggle-btn {
    cursor: default;
  }
}

@media (max-width: 768px) {
  .map-container {
    min-height: 60vh;
  }
}

.data-timestamp-widget {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(18, 18, 26, 0.92);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  z-index: 1000;
  font-size: 11px;
  font-family: monospace;
  pointer-events: none;
}
.timestamp-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.4;
}
.timestamp-label {
  color: #8a8a9a;
}
.timestamp-value {
  color: #4fc3f7;
  font-weight: 500;
}
@media (max-width: 768px) {
  .data-timestamp-widget {
    bottom: 80px;
    left: 12px;
    padding: 4px 10px;
    font-size: 9px;
  }
}
