/* ============================================================
   detail.css — 遥测详情页（赛道视图 + 数据视图 + AI 建议）
   ============================================================ */

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
@media (max-width: 1100px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* 详情头 */
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-4); gap: var(--sp-4);
}
.back-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); flex-shrink: 0;
  transition: all var(--dur) var(--ease); margin-top: 4px;
}
.back-btn:hover { background: var(--accent-soft); border-color: var(--border-accent); color: var(--accent); transform: translateX(-2px); }

/* 对比源按钮 */
.cmp-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 var(--sp-3);
  background: var(--bg-surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-primary);
  transition: all var(--dur-fast) var(--ease);
}
.cmp-btn:hover { background: var(--bg-surface-3); border-color: var(--border-strong); }
.cmp-btn .cb-cur { color: var(--accent); font-weight: 600; }
.cmp-btn .icon:last-child { color: var(--text-tertiary); }
.cmp-time-display { display: inline-flex; align-items: center; gap: 7px; padding: 0 var(--sp-3); }
.cmp-time-display .cmp-time-val { font-size: 15px; font-weight: 700; }

/* 对比源弹窗 */
.cmp-dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--border); }
.cmp-tabs { display: flex; padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); gap: var(--sp-4); }
.cmp-tab { padding: 10px 0; font-size: 13px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--dur-fast) var(--ease); }
.cmp-tab:hover { color: var(--text-primary); }
.cmp-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.cmp-dlg-body { padding: var(--sp-3); max-height: 56vh; overflow-y: auto; }
.cmp-dlg-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); background: var(--bg-surface); }
.cmp-pane-tip { font-size: 12px; color: var(--text-secondary); padding: 4px var(--sp-2) var(--sp-3); line-height: 1.6; }

/* 圈选择列表（源数据） */
.lap-pick-list { display: flex; flex-direction: column; gap: 4px; }
.lap-pick {
  display: flex; align-items: center; gap: 10px;
  padding: 9px var(--sp-3); border-radius: var(--r-sm);
  background: var(--bg-surface-2); cursor: pointer;
  transition: all var(--dur-fast) var(--ease); border: 1px solid transparent;
}
.lap-pick:hover { background: var(--bg-surface-3); }
.lap-pick.active { background: var(--accent-soft); border-color: var(--border-accent); }
.lap-pick.disabled { opacity: 0.5; cursor: not-allowed; }
.lap-pick .lp-name { font-size: 13px; font-weight: 500; }
.lap-pick .lp-time { font-size: 13px; font-weight: 600; }

/* 通用 radio 小圆点 */
.lp-radio, .cmp-opt-radio {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--text-tertiary); flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease); position: relative;
}
.lap-pick.active .lp-radio, .cmp-opt.active .cmp-opt-radio { border-color: var(--accent); }
.lap-pick.active .lp-radio::after, .cmp-opt.active .cmp-opt-radio::after {
  content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--accent);
}

/* 对比选项 */
.cmp-opt { border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: var(--sp-2); overflow: hidden; cursor: pointer; transition: all var(--dur-fast) var(--ease); }
.cmp-opt:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
.cmp-opt.active { border-color: var(--border-accent); background: var(--accent-soft); }
.cmp-opt.disabled { opacity: 0.55; }
.cmp-opt-main { display: flex; align-items: center; gap: 10px; padding: 11px var(--sp-3); }
.cmp-opt-name { font-size: 13px; font-weight: 600; }
/* 子列表（本圈其他 / 他人） */
.cmp-sub-list { padding: 0 var(--sp-3) var(--sp-2); display: flex; flex-direction: column; gap: 4px; }
.cmp-sub {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: var(--r-xs); background: var(--bg-surface); cursor: pointer;
  transition: background var(--dur-fast) var(--ease); font-size: 12.5px;
}
.cmp-sub:hover { background: var(--bg-surface-3); }
.cmp-sub.active { background: var(--accent-soft); }
.cmp-other.mine { border: 1px solid var(--border-accent); }
/* 个性化推荐目标圈（置顶高亮） */
.cmp-recommend {
  background: linear-gradient(135deg, rgba(255,87,34,0.16), rgba(255,87,34,0.05)) !important;
  border: 1px solid var(--border-accent) !important;
  padding: 9px 10px !important;
}
.cmp-recommend:hover { background: linear-gradient(135deg, rgba(255,87,34,0.22), rgba(255,87,34,0.08)) !important; }
.cmp-rec-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* 单视图布局（赛道/数据切换时）—— 占满宽度 */
.detail-layout-single { grid-template-columns: 1fr; }
.detail-layout-single .track-view,
.detail-layout-single .data-view { width: 100%; max-width: none; }
.detail-layout-single .track-canvas { height: 520px; }

/* 数据视图右下角迷你地图 */
.data-mini-map {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  width: 220px; padding: var(--sp-2);
  background: rgba(22,26,33,0.92); backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.data-mini-map .dmm-canvas { height: 150px; }
.view-seg .vs { display: inline-flex; align-items: center; gap: 5px; }
.view-seg .vs .icon { width: 13px; height: 13px; }

/* 遥测字段 */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.detail-title { display: flex; align-items: center; gap: var(--sp-3); }
.detail-title .lap-time { font-size: 32px; font-weight: 800; font-family: var(--font-dig); color: var(--accent); line-height: 1; }
.detail-title .info { display: flex; flex-direction: column; gap: 2px; }
.detail-title .info .game { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }
.detail-title .info .name { font-size: 16px; font-weight: 600; }

/* 对比源选择 */
.compare-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
}
.compare-bar .cb-label { font-size: 11.5px; color: var(--text-secondary); }
.src-chips { display: flex; gap: 4px; }
.src-chip {
  padding: 5px 10px; border-radius: var(--r-xs);
  background: var(--bg-surface-2); font-size: 11px; cursor: pointer;
  border: 1px solid transparent; transition: all var(--dur-fast) var(--ease);
}
.src-chip:hover { background: var(--bg-surface-3); }
.src-chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--border-accent); }

/* 视图切换 */
.view-seg { display: flex; gap: 2px; background: var(--bg-surface-2); border-radius: var(--r-sm); padding: 3px; }
.view-seg .vs { padding: 5px 14px; border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--text-secondary); }
.view-seg .vs.active { background: var(--bg-elevated); color: var(--text-primary); }

/* 赛道视图卡 */
.track-view {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  position: relative;
}
.track-view .tv-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.track-canvas {
  height: 340px;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02), transparent 70%);
  border-radius: var(--r-sm);
  position: relative;
  cursor: crosshair;
}
.track-legend { display: flex; gap: var(--sp-3); font-size: 11px; margin-top: var(--sp-3); }
.track-legend .lg { display: flex; align-items: center; gap: 5px; }
.track-legend .swatch { width: 14px; height: 3px; border-radius: 2px; }

/* 分段差距列表 */
.seg-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--sp-3); }
.seg-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-xs);
  font-size: 10.5px; cursor: pointer;
  background: var(--bg-surface-2); transition: all var(--dur-fast) var(--ease);
}
.seg-chip:hover { background: var(--bg-surface-3); }
.seg-chip.faster { color: var(--success); }
.seg-chip.mid { color: var(--warning); }
.seg-chip.slower { color: var(--danger); }
.seg-chip .delta { font-family: var(--font-dig); font-weight: 600; }

/* 数据视图 */
.data-view { display: flex; flex-direction: column; gap: var(--sp-3); }

/* 顶部分段指示条 */
.dt-bar-wrap { margin-bottom: var(--sp-1); }
.data-topbar {
  height: 40px; background: var(--bg-surface-2);
  border-radius: var(--r-sm); position: relative;
  border: 1px solid var(--border);
  user-select: none;
}
.dt-seg {
  position: absolute; top: 0; bottom: 0; cursor: pointer;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease);
}
.dt-seg:last-child { border-right: none; }
.dt-seg:hover { background: rgba(255,255,255,0.05); }
.dt-seg-num { font-size: 11px; color: var(--text-tertiary); font-weight: 700; font-family: var(--font-dig); }
.dt-range {
  position: absolute; top: 3px; bottom: 3px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--r-xs); cursor: grab;
}
.dt-range:active { cursor: grabbing; }
.dt-handle {
  position: absolute; top: 0; bottom: 0; width: 10px;
  cursor: ew-resize; display: flex; align-items: center; justify-content: center;
}
.dt-handle::after {
  content: ""; width: 3px; height: 60%; border-radius: 2px;
  background: var(--accent);
}
#dt-handle-l { left: -5px; }
#dt-handle-r { right: -5px; }
.dt-handle:hover::after { background: var(--accent-hover); }

.curve-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
}
.curve-card .cc-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.curve-card .cc-title { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cc-vals { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.cc-val { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-tertiary); }
.cc-val .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.cc-val b { font-size: 12.5px; font-weight: 700; }
.cc-integral { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-tertiary); padding-left: 8px; border-left: 1px solid var(--border); }
.cmp-sign { font-style: normal; font-weight: 800; color: var(--text-secondary); margin: 0 3px; font-size: 12px; }
.cc-help { color: var(--text-tertiary); cursor: help; display: inline-flex; margin-left: 3px; }
.cc-help:hover { color: var(--accent); }
.curve-card .cc-canvas { height: 110px; cursor: crosshair; }
.curve-card .cc-canvas.steer { height: 100px; }
.curve-card.steer-chart { position: relative; }
/* 曲线刻度（HTML 叠加，避免拉伸） */
.cv-wrap { position: relative; width: 100%; height: 100%; }
.cv-ylabel {
  position: absolute; transform: translate(-6px, -50%);
  font-size: 10px; color: var(--text-tertiary);
  font-family: var(--font-dig); white-space: nowrap; pointer-events: none;
}
.cv-yunit {
  position: absolute; left: 4px; bottom: 0;
  font-size: 9.5px; color: var(--text-tertiary); pointer-events: none;
}

/* 驾驶事件 */
.event-card { padding: var(--sp-3) var(--sp-4); }
.event-legend { display: flex; gap: var(--sp-3); font-size: 10.5px; flex-wrap: wrap; }
.event-legend .lg { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.event-legend .lg.off { opacity: 0.35; }
.event-legend .sw { width: 10px; height: 10px; border-radius: 2px; }
.event-canvas { height: 50px; margin-top: var(--sp-2); position: relative; background: var(--bg-surface-2); border-radius: var(--r-xs); overflow: hidden; }
.event-mark { position: absolute; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; }

/* AI 分析建议区 */
.suggest-card { padding: var(--sp-4); }
.suggest-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.suggest-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.suggest-item {
  display: flex; gap: var(--sp-3); padding: var(--sp-3);
  background: var(--bg-surface-2); border-radius: var(--r-sm);
  border-left: 3px solid var(--warning); cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.suggest-item:hover { background: var(--bg-surface-3); transform: translateX(2px); }
.suggest-item.high { border-left-color: var(--danger); }
.suggest-item.low { border-left-color: var(--info); }
.suggest-item .si-corner { font-size: 11px; font-weight: 600; color: var(--accent); min-width: 80px; }
.suggest-item .si-body { flex: 1; }
.suggest-item .si-type { font-size: 11.5px; font-weight: 600; }
.suggest-item .si-text { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.suggest-item .si-loss { font-family: var(--font-dig); font-size: 16px; font-weight: 700; color: var(--danger); }

/* 遥测字段 cell */
.tele-cell {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: var(--sp-3);
}
.tele-cell .k { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.tele-cell .v { font-size: 16px; font-weight: 600; margin-top: 2px; font-family: var(--font-dig); }

/* AI 介入标记 */
.ai-intervene-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--ai-soft); color: var(--ai);
  font-size: 10.5px; font-weight: 600;
}
