/* ============================================
   Tesla Dashcam Player — FUI Dashboard Theme
   Inspired by Territory Studio sci-fi screen design
   ============================================ */

/* ── Reset & Variables ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 色彩系统 — 琥珀/青色双调（已做护眼软化：抬亮背景、降低霓虹饱和、提升次级文字可读性） */
  --bg-primary: #14171f;
  --bg-secondary: #1a1e28;
  --bg-tertiary: #212633;
  --bg-elevated: #2a3040;
  --bg-glass: rgba(33, 38, 51, 0.86);

  --border-faint: rgba(240, 168, 58, 0.07);
  --border-subtle: rgba(240, 168, 58, 0.13);
  --border-active: rgba(240, 168, 58, 0.32);
  --border-cyan: rgba(69, 200, 230, 0.22);

  --text-primary: #dde3ec;
  --text-secondary: #9aa4b6;
  --text-muted: #697285;
  --text-accent: #f0a83a;
  --text-cyan: #5fcfe6;
  --text-danger: #ff7a7a;
  --text-success: #6cc46f;

  --accent-amber: #f0a83a;
  --accent-amber-dim: rgba(240, 168, 58, 0.5);
  --accent-cyan: #5fcfe6;
  --accent-cyan-dim: rgba(95, 207, 230, 0.45);

  /* 品牌色（来自 ModelCA logo，锁定不变，勿随主题调和） */
  --brand-ink: #0f1620;
  --brand-cyan: #22d3ee;
  --brand-cream: #e8eef4;
  --accent-right: #7fdcae;
  --accent-right-dim: rgba(127, 220, 174, 0.45);

  /* 尺寸 */
  --sidebar-w: 300px;
  --control-h: 64px;
  --topbar-h: 52px;

  /* 动效 */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* 字体 */
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ── 背景纹理 ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 176, 64, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 212, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 176, 64, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 176, 64, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── App Container ── */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  padding-bottom: 48px; /* 为底部 ICP + 公安双备案 footer 预留空间，避免遮挡控制栏 */
  position: relative;
  z-index: 1;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-faint);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-faint);
}

/* 完整品牌字标（图形标 + ModelCA + TESLA DASHCAM PLAYER 副标）
   使用设计稿导出的整图，宽度撑满侧栏内容区，高度按 740:200 比例自适应 */
.logo {
  display: block;
}

.logo-lockup {
  display: block;
  width: 100%;
  max-width: 264px;
  height: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-success);
  box-shadow: 0 0 6px var(--text-success);
  transition: var(--transition-fast);
}

.status-dot.loading {
  background: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
  animation: pulse 1s ease-in-out infinite;
}

.status-dot.error {
  background: var(--text-danger);
  box-shadow: 0 0 6px var(--text-danger);
}

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

/* ── Search ── */
.search-bar {
  position: relative;
  padding: 12px 14px 8px;
}

.search-input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--border-active);
  background: var(--bg-elevated);
}

.search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ── Filter Tabs ── */
.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border-faint);
}

.filter-tab {
  flex: 1;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.filter-tab.active {
  color: var(--accent-amber);
  border-color: var(--border-subtle);
  background: rgba(255, 176, 64, 0.05);
}

/* ── Event List ── */
.event-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.event-list::-webkit-scrollbar {
  width: 4px;
}

.event-list::-webkit-scrollbar-track {
  background: transparent;
}

.event-list::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

.event-group {
  margin-bottom: 4px;
}

.event-group-header {
  padding: 6px 16px 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.event-item {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.event-item:hover {
  background: var(--bg-tertiary);
  border-left-color: var(--border-subtle);
}

.event-item.active {
  background: rgba(255, 176, 64, 0.06);
  border-left-color: var(--accent-amber);
}

.event-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-item-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.event-item-type {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.event-item-type.recent {
  color: var(--text-cyan);
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.event-item-type.saved {
  color: var(--accent-amber);
  background: rgba(255, 176, 64, 0.1);
  border: 1px solid rgba(255, 176, 64, 0.2);
}

.event-item-type.sentry {
  color: var(--text-danger);
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

.event-item-cameras {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.event-progress-bar {
  height: 2px;
  background: var(--bg-tertiary);
  border-radius: 1px;
  margin-top: 4px;
  overflow: hidden;
}

.event-progress-fill {
  height: 100%;
  background: var(--accent-amber-dim);
  border-radius: 1px;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 8px;
}

.empty-icon {
  font-size: 32px;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-import {
  margin-top: 12px;
  padding: 8px 20px;
  background: rgba(255, 176, 64, 0.1);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--accent-amber);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-import:hover {
  background: rgba(255, 176, 64, 0.15);
  border-color: var(--border-active);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ============================================
   MAIN AREA
   ============================================ */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ── Top Bar ── */
.top-bar {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-faint);
  background: var(--bg-secondary);
}

.event-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-title {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.event-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--accent-amber);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.icon-btn.active {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
  color: #0a0c10;
}

/* ── Video Area ── */
.video-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

/* 四路网格布局 */
.video-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
}

.video-cell {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.video-cell:hover {
  border-color: var(--border-subtle);
}

.video-cell.focus {
  border-color: var(--accent-amber);
  box-shadow: 0 0 12px rgba(255, 176, 64, 0.15);
}

.video-cell.wide {
  grid-column: 1 / -1;
}

.video-cell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.video-cell-label {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  background: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-faint);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
}

.video-cell-label.cyan {
  color: var(--accent-cyan);
}

.video-cell-label.left {
  color: var(--accent-cyan);
}

.video-cell-label.right {
  color: var(--accent-right);
}

/* ── 六路视角布局 ──
   前 FRONT 居中且最大（主视角）；后 REAR 居中下方且较小；
   左侧 B 柱 / 翼子板 分布在左列；右侧 B 柱 / 翼子板 分布在右列。 */
.video-grid.layout-6 {
  grid-template-columns: 1fr 1.7fr 1fr;
  grid-template-rows: 1.8fr 1fr;
  grid-template-areas:
    "left_b_pillar  front        right_b_pillar"
    "left_fender   back         right_fender";
  gap: 6px;
}

.video-grid.layout-6 .video-cell[data-camera="front"]          { grid-area: front; }
.video-grid.layout-6 .video-cell[data-camera="back"]           { grid-area: back; }
.video-grid.layout-6 .video-cell[data-camera="left_b_pillar"]  { grid-area: left_b_pillar; }
.video-grid.layout-6 .video-cell[data-camera="left_fender"]   { grid-area: left_fender; }
.video-grid.layout-6 .video-cell[data-camera="right_b_pillar"] { grid-area: right_b_pillar; }
.video-grid.layout-6 .video-cell[data-camera="right_fender"]  { grid-area: right_fender; }

/* 放大模式布局 */
.video-area.zoom-mode {
  flex-direction: row;
  gap: 6px;
  padding: 16px;
}

.zoom-main {
  flex: 1;
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-active);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}

.zoom-main video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.zoom-thumbs {
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zoom-thumb {
  flex: 1;
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-faint);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.zoom-thumb:hover {
  border-color: var(--border-subtle);
}

.zoom-thumb.active {
  border-color: var(--accent-amber);
  box-shadow: 0 0 8px rgba(255, 176, 64, 0.2);
}

.zoom-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zoom-thumb-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  padding: 2px 5px;
  background: rgba(10, 12, 16, 0.8);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent-amber);
  text-transform: uppercase;
  pointer-events: none;
}

/* 空视频状态 */
.empty-video-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
}

.empty-video-icon {
  font-size: 48px;
  opacity: 0.3;
}

.empty-video-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.empty-video-hint {
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ── Control Bar ── */
.control-bar {
  height: var(--control-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-faint);
  gap: 12px;
}

.control-bar.hidden {
  display: none;
}

.control-left, .control-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctrl-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.ctrl-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-faint);
  color: var(--text-primary);
}

.ctrl-btn.play-btn {
  width: 38px;
  height: 38px;
  background: rgba(255, 176, 64, 0.1);
  border-color: var(--border-subtle);
  color: var(--accent-amber);
  font-size: 13px;
}

.ctrl-btn.play-btn:hover {
  background: rgba(255, 176, 64, 0.2);
  border-color: var(--border-active);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 48px;
  text-align: center;
}

/* Timeline */
.timeline {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.timeline-track {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  position: relative;
  overflow: visible;
}

.timeline-buffered {
  position: absolute;
  height: 100%;
  background: rgba(255, 176, 64, 0.15);
  border-radius: 2px;
  transition: width 150ms linear;
}

.timeline-progress {
  position: absolute;
  height: 100%;
  background: var(--accent-amber);
  border-radius: 2px;
  transition: width 100ms linear;
  box-shadow: 0 0 4px var(--accent-amber-dim);
}

.timeline-thumb {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent-amber);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--accent-amber);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.timeline:hover .timeline-thumb {
  opacity: 1;
}

/* Speed */
.speed-btn {
  padding: 4px 10px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 3px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.speed-btn:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--border-cyan);
}

.speed-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============================================
   DROP OVERLAY
   ============================================ */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

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

.drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.drop-icon {
  font-size: 64px;
  color: var(--accent-amber);
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.drop-text {
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 600;
}

.drop-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ============================================
   IMPORT PROGRESS
   ============================================ */
.import-progress {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  min-width: 320px;
}

.import-progress.hidden {
  display: none;
}

.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-amber);
  border-radius: 2px;
  width: 0%;
  transition: width 200ms ease;
  box-shadow: 0 0 4px var(--accent-amber-dim);
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  animation: slideIn 200ms ease;
  font-size: 13px;
  color: var(--text-primary);
  /* 提示条位于右上角、与顶栏按钮同区域：必须放行点击，
     否则提示显示期间会挡住 🚗/📷/⛶ 三个按钮 */
  pointer-events: none;
  max-width: 420px;
}

.toast.success { border-color: rgba(76, 175, 80, 0.3); }
.toast.error { border-color: rgba(255, 82, 82, 0.3); }
.toast.info { border-color: var(--border-cyan); }
.toast.warning { border-color: rgba(240, 168, 58, 0.45); color: #f3d9a8; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
  animation: fadeOut 200ms ease forwards;
}

@keyframes fadeOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* ============================================
   PRIVACY NOTICE
   ============================================ */
.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 12px;
  padding: 9px 10px;
  background: rgba(255, 82, 82, 0.10);
  border: 1px solid rgba(255, 122, 122, 0.55);
  border-radius: 5px;
  font-size: 10.5px;
  line-height: 1.55;
  color: #ff9a9a;
  letter-spacing: 0.2px;
  font-weight: 500;
}

.privacy-note .privacy-icon {
  font-size: 12px;
  line-height: 1.4;
  flex-shrink: 0;
  color: #ff7a7a;
}

/* ============================================
   SITE FOOTER（工信部 / 公安部备案号悬挂）
   ============================================ */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: auto;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  background: rgba(20, 23, 31, 0.92);
  border-top: 1px solid var(--border-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  z-index: 500;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.beian-row {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4;
}

.beian-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.beian-link:hover {
  color: var(--accent-amber);
  text-decoration: underline;
}

.beian-icon {
  height: 14px;
  width: auto;
  margin-right: 5px;
  vertical-align: middle;
  display: inline-block;
}

.beian-gongan {
  display: inline-flex;
  align-items: center;
}

/* ============================================
   TELEMETRY HUD
   仪表卡片：拖动手柄 / 状态徽章行 / 车速 / 方向盘角度条
   ⚠️ 改这里的视觉必须同步改 app.js 的 _captureFullView()，canvas 不认 DOM 样式
   ============================================ */
.telemetry-hud {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 162px;
  padding: 6px 16px 11px;
  background: linear-gradient(180deg, rgba(15, 22, 32, 0.90) 0%, rgba(15, 22, 32, 0.74) 100%);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  pointer-events: none;
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.42),
    0 2px 6px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  user-select: none;
}

/* 顶部品牌色高光丝（ModelCA cyan） */
.telemetry-hud::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.55), transparent);
}

.telemetry-hud.hidden {
  display: none;
}

/* 拖动条 */
.hud-drag {
  pointer-events: auto;
  cursor: grab;
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  opacity: 0.7;
  transition: opacity .15s ease, background .15s ease, width .15s ease;
  touch-action: none;
}

.telemetry-hud:hover .hud-drag {
  opacity: 1;
  width: 36px;
  background: rgba(255, 255, 255, 0.26);
}

.hud-drag:active {
  cursor: grabbing;
  opacity: 1;
  background: var(--accent-amber);
}

/* ── 顶部行：拖动手柄居中 · AP 作右上角状态位 ──
   AP 只作"状态提示"，宽度不参与布局，避免它变宽把中央挡位挤偏。 */
.hud-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 18px;
  margin-bottom: 2px;
}

.hud-ap {
  position: absolute;
  right: 0;
  top: 0;
}

/* ── 状态行：左灯 | 挡位 | 右灯 ──
   1fr auto 1fr 网格：两侧等宽 ⇒ 中间的挡位**永远严格居中**，
   且左转向灯恒在最左、右转向灯恒在最右，不会混在同一处。 */
.hud-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 20px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.5px;
}

.hud-badge,
.hud-blink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 24px;
  padding: 0 7px;
  border-radius: 7px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

/* 挡位徽章固定在中央列 */
.hud-gear {
  justify-self: center;
}

/* AP 无信号时整枚收起 */
.hud-ap.hud-off {
  display: none;
}

/* 挡位：按挡位分色，D 前进 / R 倒车 / P·N 中性 */
.hud-gear[data-gear="D"] {
  color: var(--accent-amber);
  background: rgba(240, 168, 58, 0.14);
  border-color: rgba(240, 168, 58, 0.30);
  font-weight: 700;
}

.hud-gear[data-gear="R"] {
  color: var(--text-danger);
  background: rgba(255, 122, 122, 0.14);
  border-color: rgba(255, 122, 122, 0.30);
  font-weight: 700;
}

.hud-gear[data-gear="P"],
.hud-gear[data-gear="N"] {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.09);
  font-weight: 600;
}

/* 自动驾驶状态（右上角小标签：比挡位/转向灯轻一档，避免右侧过重） */
.hud-ap {
  height: 16px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 9.5px;
  letter-spacing: 0.6px;
  color: var(--accent-cyan);
  background: rgba(95, 207, 230, 0.10);
  border-color: rgba(95, 207, 230, 0.26);
  font-weight: 600;
}

/* ── 转向指示灯（左灯贴最左，右灯贴最右）── */
.hud-blink {
  padding: 0;
  width: 26px;
  min-width: 26px;
  font-size: 10px;
}

.hud-blink:first-child { justify-self: start; }
#hud-blink-r { justify-self: end; }

/* 无信号：保留槽位（隐藏而非移除），避免中央挡位被挤偏 */
.hud-blink.hud-off {
  visibility: hidden;
}

/* 左转：琥珀 */
.hud-blink.active {
  color: var(--accent-amber);
  background: rgba(240, 168, 58, 0.16);
  border-color: rgba(240, 168, 58, 0.34);
  box-shadow: 0 0 12px rgba(240, 168, 58, 0.28);
}

/* 右转：青 */
#hud-blink-r.active {
  color: var(--accent-cyan);
  background: rgba(95, 207, 230, 0.16);
  border-color: rgba(95, 207, 230, 0.34);
  box-shadow: 0 0 12px rgba(95, 207, 230, 0.28);
}

/* 双闪：两侧同时点白 */
.hud-blink.active.both {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.30);
}

/* ── 车速 ──
   数字固定占 3 个字符宽并居中：1/2/3 位数切换时卡片宽度、数字位置都不变。
   单位「km/h」放到数字正下方并居中 —— 放右侧就必须左右各配一块等宽留白，
   会把卡片从 162px 撑到 ~179px；放下方既保持窄卡，又天然对称。 */
.hud-speed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin: 3px 0 8px;
  font-family: var(--font-mono);
  line-height: 1;
  color: #fff;
}

.hud-speed #hud-speed-val {
  min-width: 3ch;
  text-align: center;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.hud-speed-unit {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(221, 227, 236, 0.55);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ── 方向盘角度条 ──
   量程 ±360°（方向盘一整圈）。中线刻度烧进轨道背景（渐变实现），
   填充条从中线向左右延伸，左琥珀 / 右青，与转向灯方向色一致。 */
.hud-steer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.hud-steer.hidden {
  display: none;
}

.hud-steer-track {
  position: relative;
  width: 128px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.07) 49.2%,
    rgba(255, 255, 255, 0.32) 49.2%,
    rgba(255, 255, 255, 0.32) 50.8%,
    rgba(255, 255, 255, 0.07) 50.8%,
    rgba(255, 255, 255, 0.07) 100%
  );
}

.hud-steer-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-radius: 3px;
  background: var(--accent-amber);
  box-shadow: 0 0 8px rgba(240, 168, 58, 0.45);
}

.hud-steer-fill.right {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(95, 207, 230, 0.45);
}

.hud-steer-val {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.3px;
  color: rgba(221, 227, 236, 0.72);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 240px;
  }
  .zoom-thumbs {
    width: 120px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .video-grid {
    gap: 3px;
  }
}
