/* ============================================================
   车库价值评估器 v2.0.0 · 在线版扩展样式
   仅作用于 public/index.html，不影响离线单文件版
   ============================================================ */

/* ---------- 页签显隐：统一规则，替代旧版逐条枚举 ---------- */
body:not([data-tab="calc"]) .view-calc { display: none !important; }
body:not([data-tab="theory"]) .view-theory { display: none !important; }
body:not([data-tab="club"]) .view-club { display: none !important; }
body:not([data-tab="kitlib"]) .view-kitlib { display: none !important; }
body:not([data-tab="collector"]) .view-collector { display: none !important; }
body:not([data-tab="library"]) .view-library { display: none !important; }
body:not([data-tab="analysis"]) .view-analysis { display: none !important; }
body:not([data-tab="compare"]) .view-compare { display: none !important; }

body.online-mode .snap-name-row,
body.online-mode #snap-list,
body.online-mode #snap-cmp { display: none !important; }

/* 未启用在线模式时隐藏新增页签（直接双击打开 public/index.html 的场景） */
body:not(.online-mode) .tab[data-tab="library"],
body:not(.online-mode) .tab[data-tab="analysis"],
body:not(.online-mode) .tab[data-tab="compare"] { display: none !important; }

/* ---------- 顶部在线状态 ---------- */
.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.online-chip .dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(49, 196, 141, .14);
}
.online-chip.offline .dot-live { background: var(--dim); box-shadow: none; }
.online-chip a { color: var(--accent-2); text-decoration: none; font-weight: 700; }
.online-chip a:hover { text-decoration: underline; }
.online-top-note {
  margin: 14px 0 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 106, 43, .28);
  border-radius: 10px;
  background: rgba(255, 106, 43, .07);
  color: #ffd9c2;
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- 当前车库工作台 ---------- */
.ow-card {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 16px;
}
.ow-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ow-title { font-weight: 700; font-size: 14px; }
.ow-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.ow-badge.edit { color: #ffd9c2; border-color: rgba(255, 106, 43, .4); background: rgba(255, 106, 43, .1); }
.ow-badge.ok { color: #b8f5d9; border-color: rgba(49, 196, 141, .35); background: rgba(49, 196, 141, .1); }
.ow-meta { color: var(--dim); font-size: 12px; }
.ow-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ow-actions .btn { flex: 0 0 auto; }
.ow-hint { color: var(--dim); font-size: 11.5px; line-height: 1.7; margin-top: 10px; }
.ow-diff {
  margin-top: 12px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}
.ow-diff b { color: var(--text); }
.ow-diff .up { color: var(--good); font-weight: 700; }
.ow-diff .down { color: #ff7b7b; font-weight: 700; }
.ow-diff .same { color: var(--dim); }
.ow-name-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ow-name-row .field { flex: 1 1 260px; }
.ow-identity {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin: 10px 0 0; color: var(--dim); font-size: 12px;
}
.ow-identity b { color: var(--text); font-weight: 600; }
.ow-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .06em;
  color: var(--accent-2);
  font-weight: 700;
}
.ow-kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--line-2);
  border-radius: 5px; font-size: 11px; color: var(--muted);
}

/* ---------- 记录库 ---------- */
.lib-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.lib-toolbar .field { flex: 1 1 220px; }
.lib-toolbar .btn { flex: 0 0 auto; }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.lib-card {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  transition: border-color .15s, transform .15s;
}
.lib-card:hover { border-color: #46536d; transform: translateY(-1px); }
.lib-card.current { border-color: rgba(255, 106, 43, .55); box-shadow: inset 0 0 0 1px rgba(255, 106, 43, .18); }
.lib-name {
  font-weight: 700; font-size: 14px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-meta { color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.lib-val { display: flex; align-items: baseline; gap: 8px; }
.lib-val b { font-size: 20px; font-variant-numeric: tabular-nums; }
.lib-val span { color: var(--muted); font-size: 12px; }
.lib-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #0d131d; border: 1px solid var(--line);
  color: var(--muted); font-size: 11px;
}
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.lib-actions .btn { flex: 0 0 auto; }
.lib-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  padding: 34px 18px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.9;
}
.lib-empty b { color: var(--text); }

/* ---------- 记录分析 ---------- */
.an-picker { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.an-picker .field { flex: 1 1 280px; }
.an-hero {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: linear-gradient(160deg, #171f2e, #111722 60%);
  padding: 18px;
  margin-bottom: 14px;
}
.an-ring {
  --pct: 0;
  width: 110px; height: 110px; flex: 0 0 110px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), #222c3d 0);
  display: grid; place-items: center;
  position: relative;
}
.an-ring::after {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: #111722;
}
.an-ring-in {
  position: relative; z-index: 1; text-align: center; line-height: 1.2;
}
.an-ring-in b { display: block; font-size: 20px; }
.an-ring-in span { color: var(--dim); font-size: 10.5px; }
.an-main { flex: 1 1 300px; min-width: 0; }
.an-main .an-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.an-main .an-sub { color: var(--dim); font-size: 12px; margin-bottom: 10px; }
.an-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.an-total b { font-size: 30px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.an-total span { color: var(--accent-2); font-weight: 700; font-size: 13px; }
.an-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.an-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 11px 12px;
}
.an-stat span { display: block; color: var(--dim); font-size: 11px; margin-bottom: 4px; }
.an-stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.an-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.an-box {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 14px;
  min-width: 0;
}
.an-box h3 { font-size: 13px; margin-bottom: 11px; color: var(--muted); font-weight: 700; }
.bar-row { margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; font-size: 12px; }
.bar-top b { margin-left: auto; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 99px; background: #0d131d; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; }
.an-list { display: flex; flex-direction: column; gap: 8px; }
.an-car {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px;
  background: #0d131d; border: 1px solid var(--line);
  font-size: 12.5px;
}
.an-car .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-car .v { margin-left: auto; font-weight: 700; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.an-car .g { color: var(--dim); font-size: 11px; flex: 0 0 auto; }
.an-empty {
  border: 1px dashed var(--line-2); border-radius: 12px; padding: 34px 18px;
  text-align: center; color: var(--dim); font-size: 13px; line-height: 1.9;
}

/* ---------- 记录对比 ---------- */
.cmp-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cmp-pick {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 7px 12px; font-size: 12px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.cmp-pick.on { border-color: rgba(255, 106, 43, .5); color: #ffd9c2; background: rgba(255, 106, 43, .1); }
.cmp-pick input { accent-color: var(--accent); }
.cmp-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line-2); border-radius: 12px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 520px; }
.cmp-table th, .cmp-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.cmp-table th { color: var(--muted); font-weight: 700; background: var(--panel-2); white-space: nowrap; }
.cmp-table th small { display: block; color: var(--dim); font-weight: 400; margin-top: 2px; }
.cmp-table td { font-variant-numeric: tabular-nums; }
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-table td.best { color: var(--good); font-weight: 700; }
.cmp-table td .delta { display: block; font-size: 10.5px; color: var(--dim); font-weight: 400; }
.cmp-table td .delta.up { color: var(--good); }
.cmp-table td .delta.down { color: #ff7b7b; }
.cmp-note { color: var(--dim); font-size: 12px; line-height: 1.8; margin-top: 10px; }
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.diff-box {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 14px;
  background: var(--panel-2); min-width: 0;
}
.diff-box h3 { font-size: 13px; margin-bottom: 10px; color: var(--muted); }
.diff-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 8px; font-size: 12px;
  background: #0d131d; border: 1px solid var(--line); margin-bottom: 7px;
}
.diff-item:last-child { margin-bottom: 0; }
.diff-item .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: #1a2231; color: var(--muted); }
.diff-item .v { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- 成长日志 ---------- */
.growth-list { display: flex; flex-direction: column; gap: 9px; }
.growth-item {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); padding: 10px 12px;
}
.growth-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  margin-top: 5px; flex: 0 0 9px;
}
.growth-dot.minus { background: #ff7b7b; }
.growth-main { flex: 1 1 auto; min-width: 0; }
.growth-title { font-size: 12.5px; font-weight: 600; line-height: 1.6; }
.growth-meta { color: var(--dim); font-size: 11px; line-height: 1.7; }
.growth-delta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.growth-delta.up { color: var(--good); }
.growth-delta.down { color: #ff7b7b; }

/* ---------- 参数锁定提示 ---------- */
body.online-mode #config input,
body.online-mode #config select,
body.online-mode #opt-grip { cursor: not-allowed; opacity: .72; }
body.online-mode #mastery-groups { pointer-events: none; opacity: .6; }
.online-lock-note {
  margin: 10px 0 0; padding: 10px 12px;
  border: 1px dashed rgba(255, 106, 43, .35);
  border-radius: 9px; color: #ffd9c2; font-size: 12px; line-height: 1.7;
}

/* ---------- 弹窗 ---------- */
.ov-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 18px; background: rgba(3, 6, 11, .72);
  backdrop-filter: blur(3px);
}
.ov-modal.open { display: flex; }
.ov-dialog {
  width: min(460px, 100%);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: #121722;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  padding: 20px;
}
.ov-dialog h3 { font-size: 16px; margin-bottom: 6px; }
.ov-dialog .ov-sub { color: var(--dim); font-size: 12px; line-height: 1.7; margin-bottom: 14px; }
.ov-dialog label.field { margin-bottom: 10px; }
.ov-err { color: #ff8d8d; font-size: 12px; min-height: 17px; line-height: 1.5; margin: 2px 0 4px; }
.ov-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.ov-code {
  display: block; padding: 12px; margin: 8px 0;
  border: 1px dashed var(--accent); border-radius: 9px;
  background: #0d131d; color: var(--accent-2);
  font: 700 20px/1.2 ui-monospace, Consolas, monospace;
  letter-spacing: .1em; text-align: center;
}
.ov-copy-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .an-cols, .diff-cols { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .online-chip { padding: 6px 9px; font-size: 11px; }
  .ow-card, .lib-card, .an-box, .diff-box { padding: 12px; }
  .an-ring { width: 92px; height: 92px; flex-basis: 92px; }
  .an-hero { gap: 14px; padding: 14px; }
  .an-total b { font-size: 25px; }
  .lib-grid { grid-template-columns: minmax(0,1fr); }
  .ow-name-row .field { flex: 1 1 100%; }
  .ow-actions .btn { flex: 1 1 auto; }
  .cmp-table th, .cmp-table td { padding: 9px 10px; }
}
