/* iq-overview-live · 速览「模型智商」实时跑分带 / Overview · Model IQ live-run band.
   Reads the overview card's own tokens (home-overview.css: --accent, --line, --sunken, --font-mono …)
   so dark/light follow html[data-theme]; every token has a dark fallback for use outside the card.
   Motion = one-shot transitions from data-fx="armed" → "fired" (set by iq-overview-live-view.mjs);
   the caret breath and card-edge scan loop while a fresh run is active. */

.iqlv {
  --iqlv-accent: var(--accent, #39ff88);
  --iqlv-accent-2: var(--accent-2, #22c76a);
  --iqlv-strong: var(--accent-strong, #8dffbf);
  --iqlv-ink: var(--accent-ink, #032412);
  --iqlv-soft: var(--accent-soft, rgba(57, 255, 136, .07));
  --iqlv-glow: var(--accent-line, rgba(57, 255, 136, .32));
  --iqlv-text: var(--text, #ddeae1);
  --iqlv-text-2: var(--text-2, #a2b8aa);
  --iqlv-text-3: var(--text-3, #6f8a79);
  --iqlv-line: var(--line, #193a29);
  --iqlv-line-2: var(--line-2, #2a5a40);
  --iqlv-line-soft: var(--line-soft, #10251a);
  --iqlv-bg: var(--sunken, #040705);
  --iqlv-tile: var(--surface-2, #0c1610);
  --iqlv-warn: var(--warn, #f2c14e);
  --iqlv-warn-soft: var(--warn-soft, rgba(242, 193, 78, .12));
  --iqlv-mono: var(--font-mono, "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace);
  --iqlv-sans: var(--font-sans, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif);
  --iqlv-focus: var(--focus, #39ff88);
  position: relative;
  display: block;
  min-width: 0;
  margin: 10px 0 2px;
  padding: 8px 10px 7px;
  border: 1px solid var(--iqlv-line);
  border-left: 2px solid var(--iqlv-line-2);
  border-radius: var(--r, 4px);
  background: var(--iqlv-bg);
  color: var(--iqlv-text);
  font: 400 12px/1.45 var(--iqlv-mono);
  font-variant-numeric: tabular-nums;
}
.iqlv, .iqlv *, .iqlv *::before, .iqlv *::after { box-sizing: border-box; }
.iqlv[hidden], .iqlv [hidden] { display: none !important; }
.iqlv[data-phase="running"]:not([data-stale]) { border-left-color: var(--iqlv-accent); }
.iqlv[data-stale], .iqlv[data-phase="paused"], .iqlv[data-phase="failed"] { border-left-color: var(--iqlv-warn); }

/* Sweep the card edge independently of the measured progress rail. */
@media (prefers-reduced-motion: no-preference) {
  .iqlv[data-phase="running"]:not([data-stale])::before {
    content: "";
    position: absolute;
    inset: -1px 4px auto;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--iqlv-accent-2) 38%, var(--iqlv-strong) 62%, transparent)
      left center / min(35%, 180px) 100% no-repeat;
    animation: iqlv-running-scan 2.8s ease-in-out infinite;
  }
}
@keyframes iqlv-running-scan {
  0% { background-position: 0% center; opacity: 0; }
  18%, 75% { opacity: 1; }
  90%, 100% { background-position: 100% center; opacity: 0; }
}

/* ── status line ── */
.iqlv .iqlv-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.iqlv .iqlv-title { display: inline-flex; align-items: center; gap: 7px; margin: 0; font: 700 12px/1.4 var(--iqlv-mono); letter-spacing: .04em; color: var(--iqlv-text); }
.iqlv .iqlv-caret { flex: none; width: 7px; height: 12px; border-radius: 1px; background: var(--iqlv-accent); box-shadow: 0 0 6px var(--iqlv-glow); }
.iqlv[data-phase="running"]:not([data-stale]) .iqlv-caret { animation: iqlv-breathe 2.4s ease-in-out infinite; }
.iqlv[data-phase="paused"] .iqlv-caret { background: var(--iqlv-warn); box-shadow: none; }
.iqlv[data-stale] .iqlv-caret,
.iqlv[data-phase="failed"] .iqlv-caret { background: transparent; box-shadow: inset 0 0 0 1.5px var(--iqlv-warn); }
.iqlv[data-phase="not_started"] .iqlv-caret { background: transparent; box-shadow: inset 0 0 0 1.5px var(--iqlv-text-3); }
@keyframes iqlv-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.iqlv .iqlv-stat { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 11.5px; color: var(--iqlv-text-2); }
.iqlv .iqlv-phase { padding: 0 6px; border: 1px solid var(--iqlv-glow); border-radius: 3px; color: var(--iqlv-accent); font-size: 10.5px; line-height: 17px; }
.iqlv[data-phase="not_started"] .iqlv-phase { border-color: var(--iqlv-line-2); color: var(--iqlv-text-2); }
.iqlv[data-phase="paused"] .iqlv-phase,
.iqlv[data-phase="failed"] .iqlv-phase,
.iqlv[data-stale] .iqlv-phase { border-color: var(--iqlv-warn); color: var(--iqlv-warn); }
.iqlv .iqlv-count { white-space: nowrap; }
.iqlv .iqlv-g { font-size: 13px; font-weight: 700; color: var(--iqlv-text); }
.iqlv .iqlv-t { color: var(--iqlv-text-2); }
.iqlv .iqlv-pct { color: var(--iqlv-text-3); }
.iqlv .iqlv-stale { padding: 0 6px; border-radius: 3px; background: var(--iqlv-warn-soft); color: var(--iqlv-warn); font-size: 10.5px; line-height: 17px; }

/* ── segmented progress rail: answered (dim) under graded (green), 20 cells ── */
.iqlv .iqlv-rail { position: relative; height: 5px; margin: 7px 0 8px; border-radius: 1px; background: var(--iqlv-line-soft); }
.iqlv .iqlv-rail-a,
.iqlv .iqlv-rail-g { position: absolute; top: 0; bottom: 0; left: 0; display: block; width: 0; }
.iqlv .iqlv-rail-a { background: var(--iqlv-line-2); }
.iqlv .iqlv-rail-g { background: var(--iqlv-accent-2); }
.iqlv .iqlv-rail::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 1px), var(--iqlv-bg) calc(5% - 1px) 5%); }
.iqlv .iqlv-tip { position: absolute; z-index: 1; top: -2px; bottom: -2px; right: -1px; display: block; width: 2px;
  background: var(--iqlv-accent); opacity: .7; transform: none; box-shadow: none; }
.iqlv[data-stale] .iqlv-tip,
.iqlv[data-phase="paused"] .iqlv-tip { opacity: .35; }

/* ── latest-grade tickets ── */
.iqlv .iqlv-feed { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.iqlv .iqlv-item {
  --iqlv-marker: var(--iqlv-line-2);
  position: relative; display: grid; min-width: 0; overflow: hidden;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "task who score" "meter meter meter";
  align-items: center; gap: 4px 8px;
  margin: 0; padding: 5px 8px 6px 9px;
  border: 1px solid var(--iqlv-line-soft); border-radius: 3px;
  background-color: var(--iqlv-tile);
  box-shadow: inset 2px 0 0 var(--iqlv-marker);
}
.iqlv .iqlv-item[data-tier="full"],
.iqlv .iqlv-item[data-tier="hi"] { --iqlv-marker: var(--iqlv-accent-2); }
.iqlv .iqlv-item > :not(.iqlv-sweep) { position: relative; z-index: 1; }
.iqlv .iqlv-task { grid-area: task; justify-self: start; padding: 0 5px; border: 1px solid var(--iqlv-line-2); border-radius: 2px;
  background-color: transparent; color: var(--iqlv-text-2); font-size: 10.5px; line-height: 16px; white-space: nowrap; }
.iqlv .iqlv-who { grid-area: who; display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 12px; }
.iqlv .iqlv-model { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--iqlv-text); }
.iqlv .iqlv-eff { flex: none; font-size: 11px; color: var(--iqlv-text-2); }
.iqlv .iqlv-score { grid-area: score; justify-self: end; white-space: nowrap; }
.iqlv .iqlv-pts { display: inline-block; font: 700 15px/1 var(--iqlv-mono); letter-spacing: -.01em; color: var(--iqlv-text);
  transform: none; transform-origin: 100% 75%; text-shadow: none; }
.iqlv .iqlv-max { margin-left: 2px; font-size: 10.5px; color: var(--iqlv-text-3); }
.iqlv .iqlv-meter { grid-area: meter; position: relative; display: block; height: 3px; border-radius: 1px; background: var(--iqlv-line-soft); }
.iqlv .iqlv-fill { position: absolute; top: 0; bottom: 0; left: 0; display: block; width: calc(var(--f, 0) * 100%); border-radius: 1px; background: var(--iqlv-line-2); }
.iqlv .iqlv-spark { position: absolute; top: 50%; right: -3.5px; display: block; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--iqlv-accent); box-shadow: 0 0 0 2px var(--iqlv-glow), 0 0 10px var(--iqlv-accent);
  opacity: 0; transform: scale(2.6); pointer-events: none; }
.iqlv .iqlv-sweep { position: absolute; z-index: 0; inset: 0; display: block; pointer-events: none; opacity: 0; transform: translateX(101%);
  background: linear-gradient(100deg, transparent 0 48.6%, var(--iqlv-glow) 49.6% 50.4%, transparent 51.4% 100%),
              linear-gradient(100deg, transparent 0 34%, var(--iqlv-soft) 42%, var(--iqlv-glow) 50%, var(--iqlv-soft) 58%, transparent 66% 100%); }
.iqlv .iqlv-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* score strength from the item's own maximum */
.iqlv [data-tier="full"] .iqlv-pts { color: var(--iqlv-accent); }
.iqlv [data-tier="hi"] .iqlv-pts { color: var(--iqlv-accent-2); }
.iqlv [data-tier="lo"] .iqlv-pts { color: var(--iqlv-text-2); }
.iqlv [data-tier="zero"] .iqlv-pts { color: var(--iqlv-text-3); }
.iqlv [data-tier="full"] .iqlv-fill { background: var(--iqlv-accent); }
.iqlv [data-tier="hi"] .iqlv-fill { background: var(--iqlv-accent-2); }
.iqlv [data-tier="mid"] .iqlv-fill { background: var(--iqlv-text-3); }

/* a complete 150 total is the headline ticket */
.iqlv .iqlv-item[data-task="total"] { grid-column: 1 / -1; padding-block: 6px 7px; }
.iqlv [data-task="total"] .iqlv-task { border-color: var(--iqlv-accent); background-color: var(--iqlv-accent); color: var(--iqlv-ink); font-weight: 700; }
.iqlv [data-task="total"] .iqlv-pts { font-size: 20px; }
.iqlv [data-task="total"] .iqlv-meter { height: 4px; }

.iqlv .iqlv-empty { margin: 0; padding: 2px 0; font-size: 11.5px; color: var(--iqlv-text-3); }

/* ── footer ── */
.iqlv .iqlv-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; margin-top: 6px; font-size: 11px; color: var(--iqlv-text-3); }
.iqlv .iqlv-reload { color: var(--iqlv-accent); }
.iqlv .iqlv-link { display: inline-flex; align-items: center; min-height: 24px; color: var(--iqlv-accent); font: 600 12px/1.3 var(--iqlv-sans); text-decoration: none; white-space: nowrap; }
.iqlv .iqlv-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.iqlv .iqlv-link:focus-visible { outline: 2px solid var(--iqlv-focus); outline-offset: 2px; border-radius: 2px; }
@media (pointer: coarse) { .iqlv .iqlv-link { min-height: 32px; } }

/* ── arrival: armed = first frame (no transition), fired = decay back to the settled look ──
   0ms tint + sweep · 160ms score lands · 340ms point pulse · .45–2s edge cools · .6–.9s tag stamp flips ·
   .7–2.9s score colour settles · 0–9s background tail. Cascade 70ms per ticket (max 3). */
.iqlv .iqlv-item[data-fx="armed"] {
  transition: none;
  border-color: var(--iqlv-accent);
  background-color: var(--iqlv-soft);
  box-shadow: inset 2px 0 0 var(--iqlv-accent), 0 0 0 1px var(--iqlv-glow);
}
@supports (background-color: color-mix(in srgb, red 50%, blue)) {
  .iqlv .iqlv-item[data-fx="armed"] { background-color: color-mix(in srgb, var(--iqlv-accent) 15%, var(--iqlv-tile)); }
  .iqlv .iqlv-item[data-fx="armed"][data-task="total"] { background-color: color-mix(in srgb, var(--iqlv-accent) 22%, var(--iqlv-tile)); }
}
.iqlv .iqlv-item[data-fx="armed"][data-task="total"] {
  box-shadow: inset 2px 0 0 var(--iqlv-accent), 0 0 0 1px var(--iqlv-accent), 0 0 22px var(--iqlv-glow);
}
.iqlv [data-fx="armed"] .iqlv-sweep { transition: none; opacity: 1; transform: translateX(-101%); }
.iqlv [data-fx="armed"] .iqlv-pts { transition: none; color: var(--iqlv-strong); transform: translateY(-.22em) scale(1.12);
  text-shadow: 0 0 .65em var(--iqlv-glow), 0 0 .18em var(--iqlv-accent); }
.iqlv [data-fx="armed"] .iqlv-task { transition: none; border-color: var(--iqlv-accent); background-color: var(--iqlv-accent); color: var(--iqlv-ink); }
.iqlv [data-fx="armed"] .iqlv-spark { transition: none; opacity: 1; transform: scale(.5); }
/* low and zero scores arrive quietly: same moment, less light */
.iqlv [data-fx="armed"][data-tier="lo"] .iqlv-sweep,
.iqlv [data-fx="armed"][data-tier="zero"] .iqlv-sweep { opacity: .5; }
.iqlv [data-fx="armed"][data-tier="lo"] .iqlv-pts,
.iqlv [data-fx="armed"][data-tier="zero"] .iqlv-pts { color: var(--iqlv-text); text-shadow: none; }
.iqlv [data-fx="armed"][data-tier="zero"] .iqlv-spark { opacity: .4; }

.iqlv .iqlv-item[data-fx="fired"] {
  --iqlv-d: calc(var(--i, 0) * 70ms);
  transition: background-color 9s cubic-bezier(.04, .7, .2, 1) var(--iqlv-d),
              border-color 1.6s ease-out calc(var(--iqlv-d) + .45s),
              box-shadow 2.2s ease-out calc(var(--iqlv-d) + .25s);
}
.iqlv .iqlv-item[data-fx="fired"][data-task="total"] {
  transition: background-color 9s cubic-bezier(.04, .7, .2, 1) var(--iqlv-d),
              border-color 2s ease-out calc(var(--iqlv-d) + .6s),
              box-shadow 3.2s ease-out calc(var(--iqlv-d) + .3s);
}
.iqlv [data-fx="fired"] .iqlv-sweep { transition: transform .78s cubic-bezier(.3, .6, .25, 1) var(--iqlv-d), opacity .32s linear calc(var(--iqlv-d) + .5s); }
.iqlv [data-fx="fired"] .iqlv-pts { transition: transform .46s cubic-bezier(.2, 1.32, .42, 1) calc(var(--iqlv-d) + .16s),
  color 2.2s ease-out calc(var(--iqlv-d) + .7s), text-shadow 2.6s ease-out calc(var(--iqlv-d) + .3s); }
/* the inverse stamp flips back in a short .3s crossfade so the label never sits at low contrast */
.iqlv [data-fx="fired"] .iqlv-task { transition: background-color .3s ease-in calc(var(--iqlv-d) + .6s),
  color .3s ease-in calc(var(--iqlv-d) + .6s), border-color 1.4s ease-out calc(var(--iqlv-d) + .6s); }
.iqlv [data-fx="fired"] .iqlv-spark { transition: transform 1.1s cubic-bezier(.12, .75, .3, 1) calc(var(--iqlv-d) + .34s),
  opacity 1.1s ease-out calc(var(--iqlv-d) + .34s); }

/* band pulse: graded counter and rail tip acknowledge the same real batch */
.iqlv[data-pulse="armed"] .iqlv-g { transition: none; color: var(--iqlv-accent); text-shadow: 0 0 10px var(--iqlv-glow); }
.iqlv[data-pulse="fired"] .iqlv-g { transition: color 1.6s ease-out .25s, text-shadow 1.6s ease-out .25s; }
.iqlv[data-pulse="armed"] .iqlv-tip { transition: none; opacity: 1; transform: scaleY(2.6); box-shadow: 0 0 8px var(--iqlv-accent); }
.iqlv[data-pulse="fired"] .iqlv-tip { transition: opacity 1.2s ease-out .2s, transform .7s cubic-bezier(.2, 1.2, .4, 1) .1s, box-shadow 1.4s ease-out .2s; }

/* ── narrow phones (≤380px): task + score on top, model + meter below ── */
@media (max-width: 380px) {
  .iqlv { padding: 7px 8px 6px; }
  .iqlv .iqlv-item { grid-template-columns: minmax(0, 1fr) minmax(44px, 30%); grid-template-areas: "task score" "who meter"; gap: 3px 8px; }
  .iqlv [data-task="total"] .iqlv-pts { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .iqlv, .iqlv *, .iqlv *::before, .iqlv *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .iqlv::before, .iqlv .iqlv-sweep, .iqlv .iqlv-spark, .iqlv .iqlv-rail::after { display: none; }
  .iqlv .iqlv-fill, .iqlv .iqlv-rail-g, .iqlv .iqlv-tip, .iqlv .iqlv-caret { forced-color-adjust: none; background: CanvasText; }
  .iqlv .iqlv-rail-a { forced-color-adjust: none; background: GrayText; }
  .iqlv .iqlv-item { border-color: CanvasText; }
}

#overview-card-iq[data-view-hidden] .iqlv::before,
#overview-card-iq[data-view-hidden] .iqlv-caret { animation-play-state: paused; }
