/* ============================================================================
   北极星 V3 · 通用组件层（卡片/按钮/徽章/分段/列表/输入/弹层/反馈/图表基线）
   ----------------------------------------------------------------------------
   依赖：tokens.css + base.css
   命名约定（给 builder 的契约，详见 F 文档 §5）：
     - 结构：.card > .card-head > (.card-title/.card-sub) + .card-body
     - 修饰符一律 BEM 风格 `--`：.card--glow / .btn--primary / .badge--ok / .chip.is-on
     - 兼容别名：地基/旧视图用的 .btn.primary / .badge.ok / .chip.on 仍然生效（避免过渡期闪坏）
   纪律：
     - 触控区 ≥ --tap-min(44px)；颜色/阴影/时长全部走 token；
     - backdrop-filter 只用于「固定不滚动」的小面积（顶栏/底栏/弹层/Toast）；
     - 所有卡片的 1px 渐变描边用 mask 复合实现，不支持时降级为普通边框。
   ========================================================================== */

/* ===========================================================================
   1. 卡片（所有卡片的统一质感：渐变面 + 1px 渐变描边 + 顶部受光 + 内雾光）
   ========================================================================== */
.card {
  position: relative;
  isolation: isolate;
  border-radius: var(--r-lg);
  background:
    var(--card-face),
    var(--card-face-flat);                    /* 兜底：不支持 gradient 的老 WebView */
  box-shadow: var(--sh-2), var(--glow-inner);
  padding: var(--s-4);
  overflow: hidden;
}
/* 1px 渐变描边：两个 background 分别画 content-box / border-box，用 mask 挖掉中间 */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: var(--card-border-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
@supports not ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  .card { border: 1px solid var(--line-1); }
  .card::before { display: none; }
}
/* 顶部受光高光：让卡片「像被光打亮」，最便宜的质感 */
.card--lit::after {
  content: "";
  position: absolute;
  left: 14%; right: 14%; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  opacity: .45;
  pointer-events: none;
}
:root[data-theme="light"] .card--lit::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent); }
.card--glow { box-shadow: var(--sh-2), var(--glow-inner), 0 0 32px rgba(140, 124, 255, .10); }
.card--glow::before { background: var(--card-border-aurora); }
.card--brand { box-shadow: var(--sh-2), var(--glow-inner), 0 10px 32px rgba(255, 201, 77, .10); }
.card--brand::before { background: linear-gradient(160deg, var(--brand-line), rgba(255, 255, 255, .05) 42%, var(--aurora-violet-line)); }
.card--tight { padding: var(--s-3); }
.card--flush { padding: 0; }
.card--glass {                                   /* 只给固定/浮层或首屏 hero 用，滚动列表不用 */
  background: var(--surface-glass);
  -webkit-backdrop-filter: var(--surface-blur);
          backdrop-filter: var(--surface-blur);
}
@supports not (backdrop-filter: blur(1px)) {
  .card--glass { background: var(--bg-2); }
}
html[data-perf="lite"] .card--glass {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background: var(--bg-2);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.card-head--tight { margin-bottom: var(--s-2); }
.card-title { font-size: var(--fs-15); font-weight: var(--fw-semibold); letter-spacing: .02em; line-height: var(--lh-2); }
.card-sub { margin-top: 2px; font-size: var(--fs-11); color: var(--txt-2); letter-spacing: .02em; }
.card-link {
  display: inline-flex; align-items: center; gap: 2px;
  flex: none; font-size: var(--fs-12); color: var(--txt-2);
  min-height: 36px; padding: 0 4px; margin-right: -4px;
}
.card-link svg { width: 14px; height: 14px; }
.card-body { font-size: var(--fs-13); line-height: var(--lh-4); color: var(--txt-1); }

/* 卡片内的分隔（不用 border，用渐变发丝线） */
.divider { height: 1px; border: 0; background: var(--divider); margin: var(--s-3) 0; }
.divider--solid { background: var(--line-1); }
.divider--dashed { background: none; border-top: 1px dashed var(--line-2); }
.divider--inset { margin: 0 calc(-1 * var(--s-4)); }

/* ===========================================================================
   2. 按钮（主 CTA = 星芒金胶囊；次按钮 = 玻璃描边；图标按钮 = 圆形）
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap-min);
  padding: 0 20px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--txt-0);
  font-size: var(--fs-15);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-cjk);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-1) var(--ease-out),
              background-color var(--dur-1) var(--ease-out),
              border-color var(--dur-1) var(--ease-out),
              opacity var(--dur-1) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out);
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn--primary,
.btn.primary {
  color: var(--txt-on-brand);
  border-color: transparent;
  background: var(--brand-grad);
  box-shadow: var(--sh-brand), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .12);
  font-weight: var(--fw-bold);
}
.btn--primary:active,
.btn.primary:active { box-shadow: var(--sh-brand), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn--ghost,
.btn.ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--txt-1);
}
.btn--soft { background: var(--surface-2); border-color: var(--line-1); color: var(--txt-0); }
.btn--danger,
.btn.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn--ok,
.btn.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn--icon {
  width: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0;
  border-radius: 50%;
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--txt-1);
}
.btn--block,
.btn.block { width: 100%; }
.btn--sm,
.btn.sm { min-height: 34px; padding: 0 13px; font-size: var(--fs-13); border-radius: var(--r-full); gap: 5px; }
.btn--sm svg, .btn.sm svg { width: 15px; height: 15px; }
.btn--xs { min-height: 28px; padding: 0 10px; font-size: var(--fs-11); }
.btn-row { display: flex; gap: var(--s-2); }
.btn-row > .btn { flex: 1; }

/* 光扫：只用于主 CTA / 结果卡，一次性，不循环 */
.sweep { position: relative; overflow: hidden; }
.sweep::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, .22) 50%, transparent 100%);
  transform: skewX(-18deg);
  animation: sweep-in .9s var(--ease-out) .15s 1 both;
  pointer-events: none;
}

/* ===========================================================================
   3. 徽章 / 状态点 / chip / 分段控制器
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-11);
  font-weight: var(--fw-medium);
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
  color: var(--txt-1);
  background: var(--surface-2);
  border: 1px solid var(--line-1);
}
.badge svg { width: 12px; height: 12px; }
.badge--ok, .badge.ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.badge--warn, .badge.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge--danger, .badge.danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.badge--info, .badge.info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.badge--brand, .badge.gold { color: var(--brand-text); background: var(--brand-soft); border-color: var(--brand-line); }
.badge--aurora { color: var(--aurora-teal); background: var(--aurora-teal-soft); border-color: var(--aurora-teal-line); }
.badge--violet { color: var(--aurora-violet); background: var(--aurora-violet-soft); border-color: var(--aurora-violet-line); }
.badge--ghost, .badge.ghost { background: transparent; color: var(--txt-2); }
.badge--lg { height: 26px; padding: 0 10px; font-size: var(--fs-12); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.dot--pulse { animation: pulse-dot 1.8s var(--ease-out) infinite; }

/* chip：筛选/快捷标签；可点（36px 高，整卡筛选条内热区足够） */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  background: var(--surface-1);
  color: var(--txt-1);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out),
              border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.chip svg { width: 14px; height: 14px; }
.chip:active { transform: scale(.96); }
.chip.is-on, .chip.on {
  color: var(--brand-text);
  background: var(--brand-soft);
  border-color: var(--brand-line);
  box-shadow: inset 0 0 14px rgba(255, 201, 77, .06);
}
.chip--aurora.is-on { color: var(--aurora-teal); background: var(--aurora-teal-soft); border-color: var(--aurora-teal-line); box-shadow: none; }
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px var(--page-x);
  margin: 0 calc(-1 * var(--page-x));
  scroll-padding: 0 var(--page-x);
}
.chips::-webkit-scrollbar { display: none; }
.chips::after { content: ""; flex: none; width: 2px; }   /* 末尾留呼吸 */

/* 分段控制器（今日/近7天/30天；四档字号……） */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-full);
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12);
}
.seg > button {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--txt-2);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.seg > button:active { transform: scale(.97); }
.seg > button[aria-selected="true"], .seg > button.is-on {
  color: var(--txt-0);
  background: var(--surface-3);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--hairline-top);
}

/* ===========================================================================
   4. 列表行（设置项 / 历史场次 / 任务行 / 系统健康）
   ========================================================================== */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-1);
  -webkit-tap-highlight-color: transparent;
}
.list-item:last-child { border-bottom: 0; }
.list-item--link { transition: transform var(--dur-1) var(--ease-out); }
.list-item--link:active { transform: scale(.99); }
.li-lead {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--txt-1);
  background: var(--surface-2);
  border: 1px solid var(--line-1);
}
.li-lead svg { width: 17px; height: 17px; }
.li-lead--gold { color: var(--brand-text); background: var(--brand-soft); border-color: var(--brand-line); }
.li-lead--teal { color: var(--aurora-teal); background: var(--aurora-teal-soft); border-color: var(--aurora-teal-line); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: var(--fs-15); font-weight: var(--fw-medium); line-height: var(--lh-2); color: var(--txt-0); }
.li-sub { margin-top: 2px; font-size: var(--fs-12); color: var(--txt-2); line-height: var(--lh-2); }
.li-trail { flex: none; display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--txt-1); }
.li-chev { color: var(--txt-3); }
.li-chev svg { width: 18px; height: 18px; }

/* 键值行（比赛信息 / 详情） */
.kv { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 9px 0;
  border-bottom: 1px solid var(--line-1);
  font-size: var(--fs-13);
}
.kv-row:last-child { border-bottom: 0; }
.kv-k { color: var(--txt-2); flex: none; }
.kv-v { color: var(--txt-0); text-align: right; word-break: break-word; min-width: 0; }

/* ===========================================================================
   5. 表单（输入 / 开关 / 复选）
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-12); color: var(--txt-1); letter-spacing: .02em; }
.help { font-size: var(--fs-11); color: var(--txt-3); line-height: var(--lh-3); }
.input, textarea.input, select.input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-inset);
  color: var(--txt-0);
  font-size: var(--fs-15);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.input::placeholder { color: var(--txt-3); }
.input:focus { border-color: var(--aurora-teal-line); box-shadow: 0 0 0 3px var(--aurora-teal-soft); }
textarea.input { min-height: 120px; resize: vertical; line-height: var(--lh-4); }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d89a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

/* 开关 */
.switch { position: relative; display: inline-flex; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.switch .track {
  width: 46px; height: 28px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 4px; left: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform var(--dur-2) var(--ease-out);
}
.switch input:checked + .track {
  background: var(--brand);
  border-color: var(--brand-2);
  box-shadow: 0 0 14px var(--brand-glow);
}
.switch input:checked + .track::after { transform: translateX(18px); background: #fffdf5; }
.switch input:focus-visible + .track { outline: 2px solid var(--aurora-teal); outline-offset: 2px; }

/* ===========================================================================
   6. 进度 / 骨架 / 空态 / 分隔 / 加载
   ========================================================================== */
.progress {
  height: 4px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aurora-teal), var(--aurora-violet));
  box-shadow: 0 0 10px var(--aurora-teal-soft);
  transition: width var(--dur-4) var(--ease-out);
}
.progress--brand > i { background: linear-gradient(90deg, var(--brand-2), var(--brand-hi)); }

/* 骨架：位移一条渐变（transform），不用 background-position */
.sk {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--r-xs);
  background: var(--surface-1);
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 20%, var(--surface-3) 48%, transparent 76%);
  animation: sk-shimmer 1.4s var(--ease-in-out) infinite;
}
.sk-line { height: 12px; }
.sk-line.w30 { width: 30%; } .sk-line.w40 { width: 40%; } .sk-line.w55 { width: 55%; }
.sk-line.w60 { width: 60%; } .sk-line.w70 { width: 70%; }
.sk-av { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.sk-block { height: 88px; border-radius: var(--r-md); }
.sk-card {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.sk-row { display: flex; align-items: center; gap: var(--s-3); }

/* 空态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-4);
  text-align: center;
}
.empty-ico {
  width: 56px; height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: var(--aurora-teal);
  background: linear-gradient(180deg, var(--aurora-teal-soft), transparent);
  border: 1px solid var(--aurora-teal-line);
  margin-bottom: var(--s-1);
}
.empty-ico svg { width: 26px; height: 26px; }
.empty .e-ico { font-size: 0; }                    /* 兼容 core.js emptyBox 的 emoji 入参 */
.empty .e-ico::before {
  content: "";
  display: block;
  width: 40px; height: 40px;
  border-radius: 14px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232bd9c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center / 22px no-repeat,
    var(--aurora-teal-soft);
  border: 1px solid var(--aurora-teal-line);
}
.empty .e-t { font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--txt-0); }
.empty .e-d { font-size: var(--fs-13); color: var(--txt-2); line-height: var(--lh-4); max-width: 26em; }
.empty .btn { margin-top: var(--s-2); }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
  display: inline-block;
  vertical-align: -3px;
}

/* 提示条（说明/错误） */
.notice {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: var(--surface-1);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-13);
  line-height: var(--lh-4);
  color: var(--txt-1);
}
.notice b { color: var(--txt-0); }
.notice--warn, .notice.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.notice--danger, .notice.danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.notice--ok, .notice.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.notice--info, .notice.info { border-color: var(--info-line); background: var(--info-soft); color: var(--info); }
.notice svg { width: 16px; height: 16px; margin-top: 2px; flex: none; }

/* ===========================================================================
   7. 底部弹层（与 core.js popup() 生成的 DOM 完全对齐）
   ========================================================================== */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
  animation: fade-in var(--dur-2) var(--ease-out);
}
.sheet-wrap {
  position: relative;
  width: 100%;
  max-width: var(--app-max);
  max-height: calc(100vh - var(--safe-t) - 16px);
  max-height: calc(100dvh - var(--safe-t) - 16px);
  margin: 0 0 var(--safe-b);
  padding: 0 var(--s-2);
  display: flex;
  outline: none;
  animation: sheet-up var(--dur-4) var(--ease-out);
}
.sheet-wrap.full { padding: 0; max-width: none; max-height: 100dvh; margin: 0; }
.sheet {
  flex: 1;
  min-width: 0;
  max-height: calc(100vh - var(--safe-t) - 16px);
  max-height: calc(100dvh - var(--safe-t) - 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg-0);                        /* 兜底 */
  background: color-mix(in srgb, var(--bg-0) 92%, transparent);
  -webkit-backdrop-filter: var(--surface-blur);
          backdrop-filter: var(--surface-blur);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: var(--s-5) var(--s-4) calc(var(--s-5) + var(--safe-b));
  box-shadow: var(--sh-4);
}
.sheet::before {                                  /* 抓手 */
  content: "";
  display: block;
  width: 36px; height: 4px;
  margin: 0 auto var(--s-3);
  border-radius: 2px;
  background: var(--line-3);
}
.sheet-wrap.full .sheet { border-radius: 0; min-height: 100dvh; padding-top: calc(var(--s-5) + var(--safe-t)); }
.sheet-wrap.full .sheet::before { display: none; }
.sheet-title { font-size: var(--fs-20); font-weight: var(--fw-bold); letter-spacing: .02em; padding-right: 44px; line-height: var(--lh-2); }
.sheet-desc { margin-top: 6px; color: var(--txt-1); font-size: var(--fs-13); line-height: var(--lh-4); }
.sheet-body { margin-top: var(--s-4); font-size: var(--fs-13); line-height: var(--lh-4); color: var(--txt-1); }
.sheet-x {
  position: absolute;
  top: calc(var(--s-3) + var(--safe-t));
  right: calc(var(--s-4) - var(--s-2));
  width: var(--tap-min); height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--txt-1);
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  font-size: 0;                                   /* 隐藏字符 ✕，用 CSS 图标 */
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}
.sheet-x::before {
  content: "";
  width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeb9ce' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sheet-wrap.full .sheet-x { top: calc(var(--s-4) + var(--safe-t)); }
.sheet-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-1);
}
.sheet-actions > .btn { flex: 1; }

/* ===========================================================================
   8. Toast / 全局错误条
   ========================================================================== */
#toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 20px + var(--safe-b));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  background: var(--bg-0);                        /* 兜底 */
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  color: var(--txt-0);
  font-size: var(--fs-13);
  box-shadow: var(--sh-3);
  animation: toast-in var(--dur-3) var(--ease-spring);
}
.toast.ok { border-color: var(--ok-line); }
.toast.err { border-color: var(--danger-line); }
.toast.warn { border-color: var(--warn-line); }
.toast.out { animation: toast-out var(--dur-2) var(--ease-out) forwards; }
.toast-ico {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--fw-bold);
  flex: none;
  color: var(--bg-0);
  background: var(--txt-2);
}
.toast.ok .toast-ico { background: var(--ok); }
.toast.err .toast-ico, .toast.warn .toast-ico { background: var(--danger); }
.toast.warn .toast-ico { background: var(--warn); }
.toast-txt { word-break: break-word; }

#diag {
  position: sticky;
  top: 0;
  z-index: var(--z-diag);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px calc(var(--s-3) + var(--safe-r)) 8px calc(var(--s-3) + var(--safe-l));
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-12);
  border-bottom: 1px solid var(--danger-line);
}
#diag-msg { flex: 1; min-width: 0; word-break: break-word; }
.diag-ico { font-size: 0; flex: none; }
.diag-ico::before {
  content: "";
  display: block;
  width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5f6d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19z'/%3E%3Cpath d='M12 9v5M12 17.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.diag-x {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: inherit;
  font-size: 0;
  position: relative;
}
.diag-x::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5f6d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ===========================================================================
   9. 数据可视化基线（赔率曲线 / sparkline / 环 / 堆叠条 / 图例）
   ========================================================================== */
.chart { display: block; width: 100%; overflow: visible; }
.chart .grid { stroke: var(--data-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-txt { fill: var(--data-axis); font-size: 9px; font-family: var(--font-num); letter-spacing: 0; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line-a { stroke: var(--data-a); }
.chart .line-b { stroke: var(--data-b); stroke-dasharray: 2.5 3; stroke-width: 1.5; }
.chart .line-c { stroke: var(--data-c); }
.chart .line-d { stroke: var(--data-d); stroke-dasharray: 4 3; stroke-width: 1.5; }
.chart .area-a { fill: url(#fillA); }
.chart .pt { stroke: rgba(0, 0, 0, .18); stroke-width: 1; }
.chart .last-pt { filter: drop-shadow(0 0 4px currentColor); }
.chart-draw { animation: chart-draw 1s var(--ease-out) both; }

.spark { width: 74px; height: 24px; overflow: visible; flex: none; }
.spark path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* 命中率环：conic-gradient 实现（零 SVG），中心挖空 */
.ring {
  --p: 72;
  --ring-w: 7px;
  position: relative;
  width: 86px; height: 86px;
  border-radius: 50%;
  flex: none;
  background:
    radial-gradient(closest-side, var(--bg-2) calc(100% - var(--ring-w) - .5px), transparent calc(100% - var(--ring-w)) 100%),
    conic-gradient(from -90deg,
      var(--aurora-teal) 0 calc(var(--p) * 1%),
      var(--aurora-violet) calc(var(--p) * 1%) calc(var(--p) * 1% + 12%),
      var(--surface-2) calc(var(--p) * 1% + 12%) 100%);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 10px rgba(43, 217, 196, .18));
}
.ring::before {                                    /* 顶部一点高光，避免纯色环呆板 */
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: radial-gradient(60% 60% at 50% 0%, rgba(255, 255, 255, .16), transparent 60%);
  pointer-events: none;
}
.ring > b { font: var(--fw-bold) var(--fs-20)/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring > small { display: block; margin-top: 2px; font-size: 10px; color: var(--txt-2); letter-spacing: .04em; }
.ring--brand {
  background:
    radial-gradient(closest-side, var(--bg-2) calc(100% - var(--ring-w) - .5px), transparent calc(100% - var(--ring-w)) 100%),
    conic-gradient(from -90deg, var(--brand) 0 calc(var(--p) * 1%), var(--surface-2) calc(var(--p) * 1%) 100%);
  filter: drop-shadow(0 0 10px var(--brand-glow));
}

/* 堆叠条（进球时段 6 段） */
.stacked { display: flex; gap: 2px; height: 10px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-1); }
.stacked > i { display: block; height: 100%; background: var(--aurora-teal); opacity: var(--o, .55); border-radius: 1px; }
.stacked > i:nth-child(2n) { background: var(--aurora-violet); }

/* 30 场点阵 */
.dots { display: flex; flex-wrap: wrap; gap: 5px; }
.dots > i {
  width: 16px; height: 16px;
  border-radius: 5px;
  background: var(--surface-2);
  display: block;
}
.dots > i.hit { background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok-line); }
.dots > i.hit::after { content: ""; display: block; width: 100%; height: 100%; background: var(--ok); border-radius: inherit; transform: scale(.5); }
.dots > i.miss { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger-line); }
.dots > i.miss::after { content: ""; display: block; width: 100%; height: 100%; background: var(--danger); border-radius: inherit; transform: scale(.5); }
.dots > i.void { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.dots > i.now { box-shadow: 0 0 0 2px var(--brand-glow), inset 0 0 0 1px var(--brand-line); }

.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--fs-11); color: var(--txt-2); }
.legend i { display: inline-block; width: 9px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ===========================================================================
   10. Markdown 报告正文基线（md.js 输出结构；页面级再做表格三改法）
   ========================================================================== */
.md-body {
  font-size: var(--read-fs, 15px);
  line-height: var(--read-lh, 1.72);
  color: var(--txt-1);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.md-body > *:first-child { margin-top: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  color: var(--txt-0);
  line-height: var(--lh-2);
  letter-spacing: var(--ls-cjk-title);
  margin: 1.5em 0 .6em;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-t) + 64px);
}
.md-body h1 { font-size: 1.5em; }
.md-body h2 { font-size: 1.28em; padding-bottom: .35em; border-bottom: 1px solid var(--line-1); }
.md-body h3 { font-size: 1.12em; }
.md-body h4 { font-size: 1em; color: var(--txt-1); }
.md-body p { margin: .72em 0; }
.md-body strong { color: var(--txt-0); font-weight: var(--fw-semibold); }
.md-body em { color: var(--txt-2); font-style: normal; }
.md-body del { color: var(--txt-3); }
.md-body a { color: var(--link); word-break: break-all; }
.md-body code {
  font-family: var(--font-mono);
  font-size: .88em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-1);
}
.md-body pre.md-pre {
  margin: .9em 0;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-1);
  background: var(--bg-inset);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.md-body pre.md-pre code { border: 0; background: none; padding: 0; white-space: pre; }
.md-body ul, .md-body ol { margin: .6em 0; padding-left: 1.35em; }
.md-body li { margin: .34em 0; }
.md-body li::marker { color: var(--aurora-teal); }
.md-body blockquote.md-quote {
  margin: .9em 0;
  padding: var(--s-2) var(--s-4);
  border-left: 3px solid var(--aurora-teal-line);
  background: var(--surface-1);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--txt-1);
}
.md-body hr { border: 0; border-top: 1px solid var(--line-1); margin: 1.2em 0; }

/* 通用表格兜底（报告页会用专用组件替换已知表格；未知表保留横滚 + 首列吸附 + 边缘渐隐） */
.md-table-wrap {
  position: relative;
  width: 100%;
  margin: .8em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  background: var(--bg-inset);
  scrollbar-width: thin;
}
.md-table-wrap table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: var(--fs-12); }
.md-table-wrap th, .md-table-wrap td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-1);
  vertical-align: top;
  line-height: var(--lh-3);
  word-break: break-word;
  color: var(--txt-1);
}
.md-table-wrap tr:last-child td { border-bottom: 0; }
.md-table-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-2);
  color: var(--txt-2);
  font-weight: var(--fw-medium);
  font-size: var(--fs-11);
  white-space: nowrap;
}
.md-table-wrap tbody tr:nth-child(even) { background: var(--surface-1); }
.md-table-wrap[data-cols="4"] table { min-width: 520px; }
.md-table-wrap[data-cols="5"] table,
.md-table-wrap[data-cols="6"] table { min-width: 640px; }
/* 横滚提示：由页面的 .table-scroll 容器负责（见 pages/report.css 的 .tbl-hint） */

/* ===========================================================================
   11. 兼容层：地基占位页 / 旧视图标记（builder 完成后可整体删除）
   ========================================================================== */
/* 旧写法别名（地基占位页与历史代码仍在使用：.card.tight/.card.glass/.btn.primary 等） */
.card.tight { padding: var(--s-3); }
.card.flush { padding: 0; }
.card.glass {
  background: var(--surface-glass);
  -webkit-backdrop-filter: var(--surface-blur);
          backdrop-filter: var(--surface-blur);
}
.card.glow { box-shadow: var(--sh-2), var(--glow-inner), 0 0 32px rgba(140, 124, 255, .10); }

.ph-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-5);
  box-shadow: var(--sh-1);
}
.ph-ico {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
}
.ph-title { font-size: var(--fs-20); font-weight: var(--fw-bold); letter-spacing: .02em; }
.ph-desc { font-size: var(--fs-13); color: var(--txt-1); line-height: var(--lh-4); }
.ph-route {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--txt-2);
  background: var(--bg-inset);
  border: 1px solid var(--line-1);
  border-radius: var(--r-xs);
  padding: 4px 8px;
  word-break: break-all;
}
.probe { background: var(--surface-1); border: 1px solid var(--line-1); border-radius: var(--r-md); padding: var(--s-4); }
.probe-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.probe-title { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--txt-1); }
.probe-rows { display: flex; flex-direction: column; }
.probe-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-1);
  font-size: var(--fs-12);
}
.probe-row:last-child { border-bottom: 0; }
.probe-k { color: var(--txt-2); font-family: var(--font-mono); flex: none; }
.probe-v { text-align: right; word-break: break-word; color: var(--txt-1); }
.probe-v.ok { color: var(--ok); }
.probe-v.warn { color: var(--warn); }
.probe-v.err { color: var(--danger); }
.probe-empty { color: var(--txt-3); font-size: var(--fs-12); }

/* ===========================================================================
   12. 章节折叠卡（报告页/串关页/管理页共用；报告页的 .anchor-bar 另见 report.css）
   ========================================================================== */
.sec { padding: 0; overflow: hidden; }
.sec-head {
  display: flex; align-items: center; gap: var(--s-2);
  width: 100%; min-height: 50px; padding: 0 var(--s-4);
  text-align: left; color: var(--txt-0);
}
.sec-head .sec-ico {
  width: 28px; height: 28px; flex: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--aurora-teal); background: var(--aurora-teal-soft);
  border: 1px solid var(--aurora-teal-line);
}
.sec-head .sec-ico svg { width: 15px; height: 15px; }
.sec-title { font-size: var(--fs-15); font-weight: var(--fw-semibold); letter-spacing: .01em; flex: 1; min-width: 0; }
.sec-note { font-size: var(--fs-11); color: var(--txt-2); flex: none; }
.sec-chev { color: var(--txt-3); flex: none; transition: transform var(--dur-3) var(--ease-out); }
.sec-chev svg { width: 18px; height: 18px; }
.sec-body { padding: 0 var(--s-4) var(--s-4); }
.sec:not(.is-open) .sec-body { display: none; }
.sec:not(.is-open) .sec-chev { transform: rotate(-90deg); }
.sec.is-open .sec-head { padding-bottom: var(--s-2); }

/* ===========================================================================
   13. 跨页稳定性修正（builder 页面用自有结构时也必须不破版）
   - 中文短徽章/胶囊禁止被 flex 压成竖排（竖排=单个字换行，阅读性极差）
   - 行动条允许 note 换行到第二行，不挤主结论
   ========================================================================== */
.badge, .chip, .tag-inline, .pick, .score-chip, .badge--lg, .anchor-chip { flex: 0 0 auto; white-space: nowrap; }
.badge, .tag-inline, .pick, .score-chip { min-width: max-content; }
.v-action { flex-wrap: wrap; }
.v-action-line { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; min-width: 0; }
.v-action b, .v-action-k { flex: 0 0 auto; white-space: nowrap; }
.v-action-note { flex: 1 1 100%; }
.v-do, .v-extra { min-width: 0; }
.tabbtn, .sec-title, .card-title { min-width: 0; }

/* 环内容改为纵向 flex 居中（b + small 直接子元素；兼容 record 等页面） */
.ring { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring > b { display: block; }
.ring > small { display: block; }


/* ---- QA P2 触控：chip / card-link 提升到 ≥36 高（覆盖本文件前文定义） ---- */
.chip { height: 36px; }
.card-link { min-height: 36px; }
