/* live-results.css — Phase LV: how results are drawn (bars, scale, word cloud, typed answers,
   scores). Used by /join/ and /live/ after live.css, and by any published page through
   window.mChatAI.live.render (live-bridge.js loads this file and live-shared.js on demand).

   It reads eight variables: --text --muted --border --bg --accent --bar --good --track.
   /join/ and /live/ get them from live.css. A page with its own look wraps the results in
   .lv-dark or .lv-light instead: each is the validated pair for its surface (dataviz validator:
   dark #338ced + #0aac23 on #1e293b, light #257de0 + #008a17 on #ffffff, all checks pass), so put
   the results on that surface (var(--card)) and nowhere else. */
.lv-dark  { --bg: #0f172a; --card: #1e293b; --border: #334155; --text: #f8fafc; --muted: #94a3b8; --accent: #3b82f6; --bar: #338ced; --good: #0aac23; --track: rgba(148, 163, 184, 0.16); }
.lv-light { --bg: #f1f5f9; --card: #ffffff; --border: #cbd5e1; --text: #0f172a; --muted: #475569; --accent: #2563eb; --bar: #257de0; --good: #008a17; --track: rgba(15, 23, 42, 0.08); }

/* ── Results: bars (one series, so one color and no legend; every bar carries its number) ── */
.lv-bars { display: grid; gap: 12px; }
.lv-bar-row { display: grid; gap: 4px; }
.lv-bar-label { display: flex; justify-content: space-between; gap: 12px; color: var(--text); font-weight: 600; }
.lv-bar-label .lv-num { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lv-track { background: var(--track); border-radius: 0 4px 4px 0; height: 1.3em; overflow: hidden; }
.lv-fill { background: var(--bar); height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; transition: width 0.4s ease; }
.lv-bar-row.correct .lv-fill { background: var(--good); }
.lv-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: 0.8em; font-weight: 600; white-space: nowrap; }
.lv-tag.good::before { content: "\2713"; color: var(--good); font-weight: 800; }

/* ── Results: scale (columns on one baseline, the mean as the headline) ── */
.lv-scale { display: grid; gap: 10px; }
.lv-mean { color: var(--text); font-size: 1.6em; font-weight: 700; font-variant-numeric: tabular-nums; }
.lv-mean small { color: var(--muted); font-size: 0.55em; font-weight: 500; margin-left: 8px; }
.lv-cols { display: flex; align-items: flex-end; gap: 2px; height: min(9em, 24vh); border-bottom: 1px solid var(--border); }
.lv-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.lv-col .lv-num { color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.lv-col .lv-colfill { width: 100%; max-width: 6em; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.4s ease; }
.lv-axis { display: flex; gap: 2px; }
.lv-axis span { flex: 1; text-align: center; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85em; }

/* ── Results: word cloud (size carries the count; words stay in the text ink) ── */
.lv-cloud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.2em 0.7em; padding: 0.4em 0; line-height: 1.15; }
.lv-cloud span { color: var(--text); font-weight: 700; overflow-wrap: anywhere; text-align: center; }
.lv-texts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16em), 1fr)); gap: 10px; }
.lv-texts div { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); overflow-wrap: anywhere; }
.lv-empty { color: var(--muted); text-align: center; padding: 1em 0; }

/* ── Scoreboard ── */
.lv-scores { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lv-scores li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; color: var(--text); }
.lv-scores li:first-child { font-size: 1.2em; font-weight: 700; border-color: var(--accent); }
.lv-scores .lv-rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.lv-scores .lv-pts { font-variant-numeric: tabular-nums; font-weight: 600; }
.lv-scores li.me { border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) { .lv-fill, .lv-col .lv-colfill { transition: none; } }
