/* Tailwind CSS CDN（仅提供基础重置与工具类，页面风格由下方自定义变量与组件样式实现） */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* ============ Design Tokens ============ */
:root {
  --bg-0: #0b0f14;
  --bg-1: #121a23;
  --bg-2: #1a2431;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --text-0: #e6edf3;
  --text-1: #8b9aab;
  --text-2: #5d6b7a;

  --accent: #00e5a0;
  --accent-2: #38bdf8;
  --violet: #7c5cff;
  --danger: #ef4444;

  --glass: rgba(18, 26, 35, 0.74);
  --glass-strong: rgba(11, 15, 20, 0.86);

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-panel: 0 22px 48px rgba(0, 0, 0, 0.52);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);

  --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", var(--font);
}

/* ============ Base ============ */
html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(0, 229, 160, 0.09), transparent 62%),
    radial-gradient(900px 520px at 96% 0%, rgba(124, 92, 255, 0.1), transparent 60%),
    var(--bg-0);
  color: var(--text-0);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

/* 组件里用了 display:flex/grid，会盖住 [hidden] 的默认行为，这里强制兜底 */
[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: rgba(0, 229, 160, 0.28);
}

/* 滚动条 */
.file-list::-webkit-scrollbar {
  width: 6px;
}
.file-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
.file-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 160, 0.4);
}
.file-list::-webkit-scrollbar-track {
  background: transparent;
}

/* ============ Glass ============ */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

/* ============ Topbar ============ */
.topbar {
  position: relative;
  z-index: 1200;
  flex: 0 0 56px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(11, 15, 20, 0.94), rgba(11, 15, 20, 0.76));
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 4px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: linear-gradient(150deg, rgba(0, 229, 160, 0.22), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(0, 229, 160, 0.32);
  box-shadow: 0 0 22px rgba(0, 229, 160, 0.18) inset;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-text p {
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.4;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex: 0 0 auto;
}

.topbar-spacer {
  flex: 1;
}

.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.segmented-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.9), rgba(56, 189, 248, 0.85));
  box-shadow: 0 6px 18px rgba(0, 229, 160, 0.28);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented[data-active="satellite"] .segmented-thumb {
  transform: translateX(100%);
}

.seg-btn {
  position: relative;
  z-index: 1;
  min-width: 56px;
  height: 26px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  transition: color 220ms ease;
}

.seg-btn.is-active {
  color: #06110d;
  font-weight: 600;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  transition: all 200ms ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: rgba(0, 229, 160, 0.4);
  background: rgba(0, 229, 160, 0.1);
  transform: translateY(-1px);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 160, 0.32);
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.16), rgba(56, 189, 248, 0.1));
  color: #d9fff2;
  font-size: 12px;
  font-weight: 500;
  transition: all 200ms ease;
}

.ghost-btn svg {
  width: 15px;
  height: 15px;
}

.ghost-btn:hover {
  border-color: rgba(0, 229, 160, 0.6);
  box-shadow: 0 8px 22px rgba(0, 229, 160, 0.22);
  transform: translateY(-1px);
}

/* ============ Layout ============ */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

/* ============ Sidebar ============ */
.sidebar {
  position: relative;
  z-index: 30;
  flex: 0 0 320px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 26, 35, 0.9), rgba(11, 15, 20, 0.94));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.022);
  padding: 12px;
  animation: panelIn 320ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.file-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 10px;
}

.stats-panel {
  flex: 0 0 auto;
  animation-delay: 80ms;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-head h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-1);
}

.counter {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-family: var(--font-num);
  color: var(--accent);
  background: rgba(0, 229, 160, 0.12);
  border: 1px solid rgba(0, 229, 160, 0.24);
}

.subtle {
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.04em;
}

/* File list */
.file-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.file-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px 9px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: var(--text-0);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
}

.file-item.is-active {
  background: linear-gradient(90deg, rgba(0, 229, 160, 0.14), rgba(0, 229, 160, 0.02));
  border-color: rgba(0, 229, 160, 0.32);
}

.file-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.file-item-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-2);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.file-item.is-active .file-item-icon {
  color: var(--accent);
  background: rgba(0, 229, 160, 0.14);
  border-color: rgba(0, 229, 160, 0.28);
}

.file-item-icon svg {
  width: 14px;
  height: 14px;
}

.file-item-body {
  min-width: 0;
  flex: 1;
}

/* 主行：轨迹开始时间（从 GPX 内读取） */
.file-item-time {
  display: block;
  font-family: var(--font-num);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item.is-active .file-item-time {
  color: var(--accent);
}

.file-item-time.is-muted {
  color: var(--text-2);
  font-weight: 500;
}

.file-item-sub {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-empty {
  padding: 22px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.7;
}

.drop-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  transition: all 200ms ease;
}

.drop-hint svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--accent-2);
}

body.is-dragging .drop-hint {
  color: var(--accent);
  border-color: rgba(0, 229, 160, 0.5);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.stat {
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.3, 1), border-color 220ms ease,
    background 220ms ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 160, 0.3);
  background: rgba(0, 229, 160, 0.055);
}

.stat-wide {
  grid-column: span 2;
}

.stat-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 4px;
}

.stat-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #b9c7d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-wide .stat-value {
  font-size: 27px;
  background: linear-gradient(180deg, #ffffff 10%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-value-sm {
  font-size: 16px;
}

.stat-unit {
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.06em;
}

.panel-foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============ Map ============ */
.map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: #0d1319;
  z-index: 0;
}

.map-wrap .leaflet-container {
  background: #0d1319;
  font-family: var(--font);
  outline: none;
}

/* 路网底图反相为暗色，卫星图保持原样 */
.tiles-invert .leaflet-tile-pane {
  filter: invert(0.93) hue-rotate(180deg) saturate(0.66) brightness(0.94) contrast(1.04);
}

/* Leaflet 覆盖样式 */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}

.leaflet-control-zoom {
  margin: 0 14px 14px 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: var(--shadow-soft) !important;
}

.leaflet-control-zoom a {
  width: 32px !important;
  height: 32px !important;
  line-height: 31px !important;
  font-size: 16px !important;
  color: var(--text-0) !important;
  background: rgba(18, 26, 35, 0.86) !important;
  border-bottom: 1px solid var(--line) !important;
  transition: background 180ms ease, color 180ms ease;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(0, 229, 160, 0.16) !important;
  color: var(--accent) !important;
}

.leaflet-control-attribution {
  padding: 2px 8px !important;
  font-size: 10px !important;
  color: var(--text-2) !important;
  background: rgba(11, 15, 20, 0.7) !important;
  border-radius: 8px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--text-1) !important;
}

/* 起点 / 终点 / 回放标记 */
.leaflet-marker-icon.mk {
  position: absolute;
  width: 0 !important;
  height: 0 !important;
  background: transparent;
  border: 0;
  pointer-events: none;
}

.mk-start-core {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b8ffe9, var(--accent) 65%);
  border: 2px solid rgba(6, 20, 15, 0.85);
  box-shadow: 0 0 14px rgba(0, 229, 160, 0.9), 0 0 0 3px rgba(0, 229, 160, 0.18);
}

.mk-start-ring {
  position: absolute;
  left: -13px;
  top: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 229, 160, 0.65);
  animation: mkPulse 2.4s ease-out infinite;
}

@keyframes mkPulse {
  0% {
    transform: scale(0.55);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.7);
    opacity: 0;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.mk-end-core {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(140deg, #ff8a8a, var(--danger));
  border: 2px solid rgba(30, 6, 6, 0.8);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.75);
}

.mk-label {
  position: absolute;
  left: 14px;
  top: -18px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #06110d;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mk-end .mk-label {
  color: #fff;
  background: var(--danger);
  top: 8px;
}

.mk-player-core {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.95), 0 0 18px rgba(0, 229, 160, 0.9),
    0 0 34px rgba(56, 189, 248, 0.55);
}

.mk-player-halo {
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 160, 0.5), transparent 68%);
  animation: mkGlow 1.8s ease-in-out infinite;
}

@keyframes mkGlow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.55);
    opacity: 0.35;
  }
}

/* ============ Map overlays ============ */
.map-topright {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 640;
  display: flex;
  gap: 8px;
}

.glass-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-0);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  transition: all 200ms ease;
}

.glass-btn svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.glass-btn:hover {
  border-color: rgba(0, 229, 160, 0.42);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* 图例 */
.legend {
  position: absolute;
  right: 14px;
  bottom: 112px;
  z-index: 640;
  width: 132px;
  padding: 10px 11px;
  border-radius: var(--radius-md);
}

.legend-title {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 7px;
}

.legend-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--text-1);
  font-family: var(--font-num);
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 999px;
  flex: 0 0 auto;
}

/* 悬浮提示 */
.hover-tip {
  position: absolute;
  z-index: 700;
  min-width: 104px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(8, 12, 17, 0.92);
  border: 1px solid rgba(0, 229, 160, 0.28);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transform: translate(-50%, -125%);
  transition: opacity 120ms ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.tip-time {
  font-size: 11px;
  font-family: var(--font-num);
  color: var(--accent);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

.tip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  color: var(--text-1);
  line-height: 1.6;
}

.tip-row b {
  color: var(--text-0);
  font-family: var(--font-num);
  font-weight: 600;
}

/* 加载 */
.map-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 720;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-0);
  background: rgba(11, 15, 20, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============ Playbar ============ */
.playbar {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 800;
  width: min(680px, calc(100% - 160px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 20px;
  /* 只用透明度做入场动画：transform 已被 translateX(-50%) 占用 */
  animation: fadeIn 420ms ease 120ms both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.play-btn {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #04140f;
  background: linear-gradient(150deg, #5cf5c6, var(--accent) 45%, #12c7c1);
  box-shadow: 0 10px 24px rgba(0, 229, 160, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
  transition: transform 200ms cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 200ms ease;
}

.play-btn svg {
  width: 20px;
  height: 20px;
  grid-area: 1 / 1;
}

.play-btn .ico-pause {
  display: none;
}

.play-btn.is-playing .ico-play {
  display: none;
}

.play-btn.is-playing .ico-pause {
  display: block;
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(0, 229, 160, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.play-btn:active {
  transform: scale(0.97);
}

.play-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.6);
}

.play-btn[disabled]:hover {
  transform: none;
  box-shadow: none;
}

.play-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.play-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 10.5px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.04em;
}

.play-clock {
  color: var(--text-0);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.play-speed {
  color: var(--text-1);
}

.play-speed b {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.play-elapsed {
  margin-left: auto;
  color: var(--text-2);
}

.seek-wrap {
  position: relative;
  height: 42px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008));
  border: 1px solid rgba(255, 255, 255, 0.055);
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.seek-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.play-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-select {
  position: relative;
}

.rate-select select {
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  padding: 0 22px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  transition: border-color 180ms ease;
}

.rate-select select:hover {
  border-color: rgba(0, 229, 160, 0.4);
}

.rate-select select option {
  background: #121a23;
  color: var(--text-0);
}

.rate-select::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.4px solid var(--text-1);
  border-bottom: 1.4px solid var(--text-1);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  display: none;
}

.switch-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  transition: background 220ms ease, border-color 220ms ease;
}

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-1);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1), background 220ms ease;
}

.switch input:checked + .switch-track {
  background: rgba(0, 229, 160, 0.24);
  border-color: rgba(0, 229, 160, 0.5);
}

.switch input:checked + .switch-track .switch-knob {
  transform: translateX(13px);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 229, 160, 0.8);
}

.switch-text {
  font-size: 10.5px;
  color: var(--text-1);
  letter-spacing: 0.04em;
}

/* ============ 区间分布卡片 ============ */
.range-card {
  position: absolute;
  left: 14px;
  /* 抬起到底部回放栏之上，避免窄屏时与回放栏重叠 */
  bottom: 118px;
  z-index: 800;
  width: 268px;
  padding: 11px 12px 10px;
  border-radius: var(--radius-md);
  animation: fadeIn 320ms ease 100ms both;
}

/* 宽屏时回放栏两侧空间足够，卡片贴回左下角 */
@media (min-width: 1620px) {
  .range-card {
    bottom: 20px;
  }
}

.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.range-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-1);
}

.range-hint {
  font-size: 9.5px;
  color: var(--text-2);
}

.range-block + .range-block {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.range-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

.range-block-head b {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-0);
}

.range-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 64px;
}

.range-bar {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  transition: background 160ms ease, transform 160ms ease;
}

.range-bar:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.range-bar:active {
  transform: translateY(0) scale(0.97);
}

.range-bar.is-empty {
  opacity: 0.45;
}

.range-bar-pct {
  font-family: var(--font-num);
  font-size: 8.5px;
  line-height: 10px;
  color: var(--text-2);
}

.range-bar-fill {
  width: 78%;
  height: var(--h, 4px);
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 72%),
    var(--c, #38bdf8);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  transition: filter 160ms ease;
}

.range-bar:hover .range-bar-fill {
  filter: brightness(1.18) saturate(1.1);
}

.range-bar-label {
  font-family: var(--font-num);
  font-size: 7.5px;
  line-height: 9px;
  color: var(--text-2);
  white-space: nowrap;
}

/* ============ 公里 / 极值标记 ============ */
.leaflet-marker-icon.mk-km,
.leaflet-marker-icon.mk-flag {
  pointer-events: auto;
  cursor: pointer;
}

.mk-km-dot {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 8.5px;
  font-weight: 600;
  color: #d7fff2;
  background: rgba(9, 14, 19, 0.9);
  border: 1px solid rgba(0, 229, 160, 0.6);
  box-shadow: 0 0 10px rgba(0, 229, 160, 0.3), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.leaflet-marker-icon.mk-km:hover .mk-km-dot {
  transform: scale(1.18);
  background: rgba(0, 229, 160, 0.85);
  color: #06110d;
}

.mk-flag-icon {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #0b0f14;
}

.mk-flag-speed .mk-flag-icon {
  background: linear-gradient(150deg, #ffe0a3, #fbbf24);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.65);
}

.mk-flag-power .mk-flag-icon {
  background: linear-gradient(150deg, #c9b8ff, #7c5cff);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.65);
}

.mk-flag-label {
  position: absolute;
  left: 15px;
  top: -9px;
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--font-num);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  color: #0b0f14;
  background: #fbbf24;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.mk-flag-power .mk-flag-label {
  color: #ffffff;
  background: #7c5cff;
}

/* ============ 功率参数弹层 ============ */
.ghost-btn-quiet {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
}

.ghost-btn-quiet svg {
  color: var(--accent);
}

.ghost-btn-quiet:hover {
  border-color: rgba(0, 229, 160, 0.42);
  background: rgba(0, 229, 160, 0.1);
  color: var(--text-0);
}

.icon-btn[disabled] {
  opacity: 0.45;
  cursor: progress;
  transform: none;
}

.mini-btn {
  height: 20px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  color: #c9b8ff;
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: all 180ms ease;
}

.mini-btn:hover {
  border-color: rgba(124, 92, 255, 0.65);
  background: rgba(124, 92, 255, 0.22);
  color: #ffffff;
}

.stat-accent {
  background: linear-gradient(150deg, rgba(124, 92, 255, 0.1), rgba(56, 189, 248, 0.05));
  border-color: rgba(124, 92, 255, 0.22);
}

.stat-accent:hover {
  border-color: rgba(124, 92, 255, 0.5);
  background: linear-gradient(150deg, rgba(124, 92, 255, 0.18), rgba(56, 189, 248, 0.08));
}

.stat-accent .stat-value {
  background: linear-gradient(180deg, #ffffff, #c3b2ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.play-power {
  color: var(--text-1);
}

.play-power b {
  color: #c9b8ff;
  font-size: 12px;
  font-weight: 600;
}

.power-pop {
  position: fixed;
  top: 62px;
  right: 16px;
  z-index: 1300;
  width: 272px;
  padding: 14px;
  border-radius: var(--radius-md);
  /* 参数面板需要更实的底，保证数字可读 */
  background: rgba(13, 19, 26, 0.93);
  border-color: rgba(255, 255, 255, 0.12);
  animation: popIn 200ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.power-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.power-pop-head h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.pop-close {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-1);
  font-size: 14px;
  line-height: 1;
  transition: all 180ms ease;
}

.pop-close:hover {
  color: var(--accent);
  border-color: rgba(0, 229, 160, 0.42);
}

.power-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.field-input {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  transition: border-color 180ms ease, background 180ms ease;
}

.field-input:focus-within {
  border-color: rgba(0, 229, 160, 0.5);
  background: rgba(0, 229, 160, 0.07);
}

.field-input input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-0);
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  -moz-appearance: textfield;
}

.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input i {
  font-style: normal;
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-num);
}

.field-select select {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-0);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
}

.field-select select option {
  background: #121a23;
  color: var(--text-0);
}

.power-note {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-2);
  font-family: var(--font-num);
  letter-spacing: 0.02em;
}

.power-note b {
  color: var(--accent);
  font-weight: 600;
}

.power-note-sub {
  margin-top: 3px;
  color: #55636f;
  font-family: var(--font);
}

/* ============ 数据大屏 ============ */
.dash {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 18px;
  overflow: auto;
  color: var(--text-0);
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(0, 229, 160, 0.12), transparent 62%),
    radial-gradient(1000px 560px at 92% -6%, rgba(124, 92, 255, 0.16), transparent 62%),
    #070b10;
  animation: dashIn 300ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes dashIn {
  from {
    opacity: 0;
    transform: scale(0.994);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dash-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 10%, #000 10%, transparent 74%);
  mask-image: radial-gradient(circle at 50% 10%, #000 10%, transparent 74%);
}

.dash > *:not(.dash-bg) {
  position: relative;
  z-index: 1;
}

/* 顶部标题 */
.dash-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.dash-title h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  background: linear-gradient(90deg, #ffffff, #8ff0d0 68%, #7cc9ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dash-title p {
  margin-top: 4px;
  font-family: var(--font-num);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-2);
}

.dash-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-year {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dash-year select {
  appearance: none;
  -webkit-appearance: none;
  height: 26px;
  padding: 0 26px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease;
}

.dash-year select:hover {
  border-color: rgba(0, 229, 160, 0.45);
  background: rgba(0, 229, 160, 0.08);
}

.dash-year select option {
  background: #121a23;
  color: var(--text-0);
}

.dash-year::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px;
  height: 5px;
  border-right: 1.4px solid var(--text-1);
  border-bottom: 1.4px solid var(--text-1);
  transform: translateY(-30%) rotate(45deg);
  pointer-events: none;
}

.dash-pill {
  height: 24px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(0, 229, 160, 0.1);
  border: 1px solid rgba(0, 229, 160, 0.28);
}

.dash-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  font-size: 16px;
  line-height: 1;
  transition: all 180ms ease;
}

.dash-close:hover {
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.16);
}

/* KPI */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  position: relative;
  padding: 11px 14px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
}

.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 72%);
}

.kpi:nth-child(2)::before {
  background: linear-gradient(90deg, var(--accent-2), transparent 72%);
}

.kpi:nth-child(3)::before {
  background: linear-gradient(90deg, var(--violet), transparent 72%);
}

.kpi:nth-child(4)::before {
  background: linear-gradient(90deg, #a3e635, transparent 72%);
}

.kpi:nth-child(5)::before {
  background: linear-gradient(90deg, #fbbf24, transparent 72%);
}

.kpi:nth-child(6)::before {
  background: linear-gradient(90deg, #f472b6, transparent 72%);
}

.kpi-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.kpi-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 5px;
}

.kpi-value {
  font-family: var(--font-num);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.kpi-unit {
  font-style: normal;
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

/* 三栏 */
.dash-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 12px;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.dash-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(18, 26, 35, 0.72);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

.dash-card-grow {
  flex: 1;
}

.dash-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dash-card-head h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-1);
}

.dash-card-head span {
  font-family: var(--font-num);
  font-size: 10px;
  color: var(--text-2);
}

.dash-card .range-bars {
  height: 78px;
}

/* 地图 */
.dash-map-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0d1319;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
}

#dashMap {
  position: absolute;
  inset: 0;
}

.dash-map-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 500;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-1);
  background: rgba(11, 15, 20, 0.82);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* 排行 */
.dash-rank {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.dash-rank::-webkit-scrollbar {
  width: 6px;
}

.dash-rank::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.rank-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* overflow:hidden 会让 flex 子项的可压缩到 0，必须固定住高度 */
  flex: 0 0 auto;
  width: 100%;
  padding: 8px 10px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease;
}

.rank-item:hover {
  border-color: rgba(0, 229, 160, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.rank-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  opacity: 0.85;
}

.rank-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.rank-order {
  font-style: normal;
  font-family: var(--font-num);
  font-size: 10px;
  color: var(--text-2);
}

.rank-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-num);
  font-size: 10.5px;
  color: var(--text-2);
}

.rank-meta em {
  font-style: normal;
  color: var(--accent);
}

/* 纪录 */
.dash-records {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.record {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.record-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.record-value {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.record-note {
  font-family: var(--font-num);
  font-size: 9.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 活动分布 */
.dash-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.dash-tabs button {
  min-width: 24px;
  height: 19px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 1;
  transition: all 180ms ease;
}

.dash-tabs button:hover {
  color: var(--text-0);
  background: rgba(255, 255, 255, 0.06);
}

.dash-tabs button.is-active {
  color: #06110d;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.9), rgba(56, 189, 248, 0.85));
  box-shadow: 0 4px 12px rgba(0, 229, 160, 0.28);
}

.dash-days {
  flex: 1;
  min-height: 110px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  /* 给柱顶数值留出空间 */
  padding-top: 18px;
}

.day-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
}

.day-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.day-bar {
  position: relative;
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #38bdf8, #00e5a0);
  box-shadow: 0 0 12px rgba(0, 229, 160, 0.35);
  transition: height 520ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

.day-value {
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  font-family: var(--font-num);
  font-size: 9px;
  line-height: 12px;
  white-space: nowrap;
  color: #cfe3f0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.day-label {
  font-family: var(--font-num);
  font-size: 8.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.dash-empty {
  font-size: 11px;
  color: var(--text-2);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(560px, calc(100vw - 40px));
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12px;
  color: #ffe4e4;
  background: rgba(40, 14, 16, 0.94);
  border: 1px solid rgba(239, 68, 68, 0.42);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 240ms ease, transform 240ms cubic-bezier(0.2, 0.7, 0.3, 1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 2600;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #2a0b0b;
  background: var(--danger);
}

/* ============ Drop overlay ============ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 12, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 56px;
  border-radius: 22px;
  color: var(--accent);
  border: 1.5px dashed rgba(0, 229, 160, 0.55);
  background: rgba(18, 26, 35, 0.72);
  box-shadow: 0 0 60px rgba(0, 229, 160, 0.18);
  animation: panelIn 220ms ease both;
}

.drop-card svg {
  width: 34px;
  height: 34px;
}

.drop-card p {
  font-size: 13px;
  color: var(--text-0);
  letter-spacing: 0.04em;
}

/* ============ Responsive ============ */
@media (max-width: 1080px) {
  .playbar {
    width: calc(100% - 48px);
  }
  .legend {
    display: none;
  }
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    gap: 8px;
  }
  .file-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .file-item {
    width: auto;
    flex: 0 0 auto;
    max-width: 220px;
  }
  .drop-hint {
    display: none;
  }
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stat-wide {
    grid-column: span 1;
  }
  .stat {
    padding: 7px 8px;
  }
  .stat-value {
    font-size: 16px;
  }
  .stat-wide .stat-value {
    font-size: 18px;
  }
  .stat-value-sm {
    font-size: 13px;
  }
  .map-wrap {
    min-height: 300px;
  }
  .playbar {
    width: calc(100% - 20px);
    bottom: 10px;
    padding: 10px 12px;
    gap: 10px;
  }
  .file-pill {
    display: none;
  }
  .ghost-btn span {
    display: none;
  }
  .ghost-btn {
    padding: 0 9px;
  }
  .play-elapsed {
    display: none;
  }
  .seg-btn {
    min-width: 46px;
    padding: 0 10px;
  }
  .brand-text p {
    display: none;
  }
  /* 小屏地图太矮，分布卡片会让底部过挤，直接收起 */
  .range-card {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }
  .topbar {
    gap: 8px;
    padding: 0 10px;
  }
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stat-wide {
    grid-column: span 1;
  }
  .play-right .switch-text {
    display: none;
  }
  .legend {
    display: none;
  }
}

@media (max-width: 560px) {
  .power-pop {
    top: 58px;
    left: 10px;
    right: 10px;
    width: auto;
  }
}

/* ============ 单页面版：导入空态 ============ */
.file-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.file-empty-btn {
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 160, 0.5);
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.24), rgba(56, 189, 248, 0.16));
  color: #d9fff2;
  font-size: 12px;
  font-weight: 500;
  transition: all 200ms ease;
}

.file-empty-btn:hover {
  border-color: rgba(0, 229, 160, 0.8);
  box-shadow: 0 8px 22px rgba(0, 229, 160, 0.24);
  transform: translateY(-1px);
}

.file-empty-sub {
  display: block;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-2);
}

#btnFolder {
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .dash-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* 中等宽度：地图独占一行，两栏并排放在下面 */
  .dash-body {
    flex: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .dash-map-wrap {
    grid-column: 1 / -1;
    order: -1;
    min-height: 340px;
  }
  .dash-col {
    max-height: none;
  }
  .dash-card-grow {
    flex: none;
    height: 300px;
  }
  .dash-card .range-bars {
    height: 64px;
  }
}

@media (max-width: 620px) {
  .dash {
    padding: 10px;
  }
  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-value {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
