/* 设置 →「网络测速」(spec §27.1; js/net/speed-section.js). Three equal tiles, one verdict line with a
   fixed height (two lines of text) and one row of buttons that keeps its height while a test runs, so
   nothing below moves between idle, running, a result and an error. Tokens only, so dark mode follows. */

.net-card { display: grid; gap: var(--gap); padding: var(--card-pad); }

.net-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--gap);
}
.net-tile {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  height: 100%;
  padding: 12px;
  border-radius: var(--r-s);
  background: var(--surface-3);
  transition: box-shadow var(--dur-2) var(--ease-out);
}
.net-tile-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.net-tile-head svg { width: 16px; height: 16px; flex-shrink: 0; }
.net-tile-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.net-tile-unit { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The step being measured. */
.net-tile.is-active { box-shadow: inset 0 0 0 2px var(--accent); }
.net-tile.is-active .net-tile-value { color: var(--accent); }

/* Always two lines tall. Chinese breaks only after punctuation or at a space (keep-all), so a line never
   ends inside a phrase (「半分 / 钟」); where a number and its unit must stay together the text joins
   them with a no-break space. A phrase longer than the line (an error from the server) still wraps. */
.net-verdict {
  --net-line: 1.45em;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(2 * var(--net-line) + 20px);
  padding: 10px 12px;
  border-radius: var(--r-s);
  background: var(--surface-3);
  font-size: 14px;
  line-height: var(--net-line);
  color: var(--text-2);
}
.net-verdict-lead { display: grid; place-items: center; flex-shrink: 0; min-width: 20px; }
.net-verdict-lead svg { width: 20px; height: 20px; }
.net-verdict-lead .spinner { width: 18px; height: 18px; color: var(--accent); }
.net-verdict-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.net-verdict--fast, .net-verdict--ok, .net-verdict--slow { color: var(--text); }
.net-verdict--fast { background: var(--positive-soft); }
.net-verdict--ok { background: var(--warning-soft); }
.net-verdict--slow, .net-verdict--error { background: var(--danger-soft); }
.net-verdict--error { color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.net-verdict--idle .net-verdict-lead, .net-verdict--cancelled .net-verdict-lead { color: var(--text-3); }

/* 很快 / 一般 / 慢: one width, so the tags line up in the list. */
.net-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
/* Text mixed toward --text: ≥ 4.4:1 on the soft fills in both themes (plain --warning is ~3:1). */
.net-tag--fast { background: var(--positive-soft); color: color-mix(in srgb, var(--positive) 70%, var(--text)); }
.net-tag--ok { background: var(--warning-soft); color: color-mix(in srgb, var(--warning) 70%, var(--text)); }
.net-tag--slow { background: var(--danger-soft); color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
/* On the tinted verdict line the tag sits on the card colour. */
.net-verdict .net-tag { background: var(--surface); }

/* Idle: 「测一下」 across the card. Running: the step with its progress | 「取消」, two equal halves. */
.net-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.net-actions .btn { min-width: 0; padding: 0 12px; }
.net-start { grid-column: 1 / -1; overflow: hidden; isolation: isolate; }
.net-start-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.net-start-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-glass-strong);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--dur-2) var(--ease-out);
}
/* Back to 0 for the next step or the end: at once (js sets this for one style flush). */
.net-start-fill.is-jump { transition: none; }
.net-card.is-running .net-start { grid-column: auto; pointer-events: none; }
.net-card.is-running .net-start > svg { display: none; }

.net-history-label { margin-top: 18px; }
.net-hist-row { min-height: 64px; }
.net-hist-sub { display: flex; align-items: center; gap: 12px; }
.net-hist-part { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.net-hist-part svg { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  .net-start-fill, .net-tile { transition: none; }
}
