/* 网络测速组件样式。只用门户共享 token，不自定义配色——深色模式要保持近黑、
   中性灰，不要给深色面染绿色调。 */
.sp-wrap {
  box-sizing: border-box; width: 100%; max-width: 960px;
  margin: 0 auto; padding: 40px 24px 72px;
}

.page-head { margin-bottom: 28px; }
.page-head .eyebrow {
  margin: 0 0 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ui-muted);
}
.page-head h1 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 32px); line-height: 1.2; }
.page-head .lede { margin: 0; max-width: 62ch; color: var(--ui-muted); font-size: 14px; }
.page-head .lede b { color: var(--ui-text); font-weight: 600; }

.sp-card {
  background: var(--ui-surface); border: 1px solid var(--ui-line);
  border-radius: var(--radius, 14px); padding: 28px 24px;
}
.sp-main {
  display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 32px; align-items: center;
}
.sp-dial { width: 100%; max-width: 400px; margin-inline: auto; }
.sp-gauge { display: block; width: 100%; height: auto; }
.sp-track {
  fill: none; stroke: var(--ui-line); stroke-width: 9; stroke-linecap: round;
}
.sp-arc {
  fill: none; stroke: var(--ui-accent); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 0 1;
  transition: stroke-dasharray .18s linear;
}
.sp-needle {
  transition: transform .18s cubic-bezier(.22,.61,.36,1);
}
.sp-needle line { stroke: var(--ui-text); stroke-width: 3.5; stroke-linecap: round; }
.sp-hub { fill: var(--ui-text); }
.sp-tick { stroke: var(--ui-line); stroke-width: 1.5; }
.sp-tick-label {
  fill: var(--ui-muted); font-size: 9px; text-anchor: middle; font-family: inherit;
}
.sp-value {
  fill: var(--ui-text); font-size: 30px; font-weight: 650;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.sp-value.is-three-digit { font-size: 28px; }
.sp-value.is-four-digit { font-size: 21px; }
.sp-value.is-overflow { font-size: 17px; }
.sp-unit { fill: var(--ui-muted); font-size: 11px; font-family: inherit; }

/* ---------------------------------------------------------------- 阶段与操作 */
.sp-side { min-width: 0; }
.sp-node-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 12px; color: var(--ui-muted); }
.sp-node-label select { max-width: 100%; padding: 6px 8px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-surface); color: var(--ui-text); font: inherit; }
.sp-side .sp-network { margin: -8px 0 16px; }
.sp-phases {
  display: flex; gap: 18px; list-style: none; margin: 0 0 14px; padding: 0;
  font-size: 12px; color: var(--ui-muted);
}
.sp-phases li { display: flex; align-items: center; gap: 6px; }
.sp-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ui-line); transition: background .2s;
}
.sp-phases li.is-active { color: var(--ui-text); }
.sp-phases li.is-active .sp-dot { background: var(--ui-accent); }
.sp-phases li.is-done .sp-dot { background: var(--ui-muted); }

.sp-phase { margin: 0 0 18px; font-size: 14px; color: var(--ui-muted); min-height: 1.6em; }
.sp-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sp-btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 20px; font-size: 14px; font-weight: 550; cursor: pointer;
  background: var(--ui-accent); color: var(--ui-on-accent);
  transition: opacity .15s;
}
.sp-btn:hover:not(:disabled) { opacity: .88; }
.sp-btn:disabled { opacity: .5; cursor: default; }
.sp-btn-ghost {
  background: transparent; color: var(--ui-text); border-color: var(--ui-line);
}

.sp-summary { margin: 18px 0 0; font-size: 13px; color: var(--ui-muted); }
.sp-summary b {
  display: block; font-size: 22px; color: var(--ui-text); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 指标卡 */
.sp-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin: 28px 0 0; padding: 20px 0 0;
  border-top: 1px solid var(--ui-line);
}
.sp-metric { min-width: 0; }
.sp-metric dt { font-size: 12px; color: var(--ui-muted); margin-bottom: 4px; }
.sp-metric dd {
  margin: 0; font-size: 22px; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 4px;
}
.sp-metric dd small { font-size: 11px; font-weight: 400; color: var(--ui-muted); }
.sp-note {
  margin: 5px 0 0; font-size: 11px; color: var(--ui-muted);
  line-height: 1.5; overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 说明 */
.sp-notes {
  margin-top: 20px; background: var(--ui-surface);
  border: 1px solid var(--ui-line); border-radius: var(--radius, 14px);
  padding: 4px 20px;
}
.sp-notes > summary {
  cursor: pointer; padding: 14px 0; font-size: 14px; font-weight: 550;
  color: var(--ui-text); list-style: none;
}
.sp-notes > summary::-webkit-details-marker { display: none; }
.sp-notes > summary::before { content: '▸ '; color: var(--ui-muted); }
.sp-notes[open] > summary::before { content: '▾ '; }
.sp-notes-body { padding: 4px 0 18px; border-top: 1px solid var(--ui-line); }
.sp-notes-body h2 {
  font-size: 13px; margin: 18px 0 6px; color: var(--ui-text); font-weight: 600;
}
.sp-notes-body p, .sp-notes-body li {
  font-size: 13px; color: var(--ui-muted); margin: 0 0 8px; line-height: 1.7;
}
.sp-notes-body ul { margin: 0 0 8px; padding-left: 20px; }
.sp-notes-body b { color: var(--ui-text); font-weight: 600; }
.sp-notes-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--ui-raised); padding: 1px 5px; border-radius: 5px;
}

/* ---------------------------------------------------------------- 窄屏 */
@media (max-width: 720px) {
  .sp-wrap { padding: 28px 16px 56px; }
  .sp-card { padding: 20px 16px; }
  .sp-main { grid-template-columns: 1fr; gap: 24px; }
  .sp-dial { max-width: 300px; margin: 0 auto; }
  .sp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .sp-phase { text-align: center; }
  .sp-node-label { justify-content: center; }
  .sp-actions { justify-content: center; }
}
