/* Top page section .kv (competition-score duel). Colours come from the site.css variables; no external loading, no inline style (CSP).
   Motion states exist only under .kv.is-js (kval.js adds it), so without the script every bar and number is already final. */
.kv { margin: 0 0 28px; padding: 18px 16px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(31, 26, 28, .06); font-variant-numeric: tabular-nums; }
.kv [hidden] { display: none !important; }
.kv p, .kv ul, .kv ol { margin: 0; padding: 0; list-style: none; }
.kv h2 { margin: 0 0 6px; padding: 0; border: 0; font-size: clamp(20px, 3.2vw, 28px); line-height: 1.35; }
.kv h3 { margin: 0; font-size: 1rem; line-height: 1.5; }
.kv-eyebrow { margin: 0 0 4px !important; color: var(--red-ink); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.kv-lede { font-size: 14px; line-height: 1.7; }
.kv-basis, .kv-note { margin-top: 4px !important; color: var(--muted); font-size: 12px; line-height: 1.6; }
.kv-body { display: grid; gap: 16px; margin-top: 14px; }
.kv a:focus-visible, .kv button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* tug: how often the two picks differed, and who arrived first */
.kv-tug { padding: 14px; background: var(--sunk); border-radius: 12px; }
.kv-tug h3 b { color: var(--red-ink); font-size: 1.25em; }
.kv-ends { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin: 10px 0 4px !important; font-size: 13px; font-weight: 800; }
.kv-ends b { font-size: 22px; }
.kv-ends .kv-a { color: var(--red-ink); }
.kv-ends .kv-b, .kv-ends .kv-c { color: var(--muted); }
.kv-tugbar { display: block; width: 100%; height: 12px; }
.kv-tug .kv-sr + .kv-basis { margin-top: 8px !important; }

/* rates: one pair of bars per metric, a gap tag, group tabs */
.kv-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.kv-tab { min-height: 44px; padding: 0 18px; border: 1px solid var(--ui); border-radius: 999px; background: var(--bg2); color: var(--text); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.kv-tab[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.kv-grp h3 { margin-bottom: 2px; font-size: 14px; }
.kv-row { padding: 10px 0; border-top: 1px solid var(--line); }
.kv-row-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px !important; }
.kv-m { font-weight: 800; }
.kv-gap { padding: 0 10px; border-radius: 99px; background: var(--red-ink); color: #fff; font-size: 13px; font-weight: 800; line-height: 1.9; white-space: nowrap; }
.kv-gap.is-flat { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--ui); }
.kv-bar { display: grid; grid-template-columns: 4.6em minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 3px 0 !important; }
.kv-who { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.kv-bar.a .kv-who { color: var(--red-ink); font-size: 16px; }
.kv-svg { display: block; width: 100%; height: 10px; }
.kv-trk { fill: var(--track); }
.kv-bar.a .kv-fill { fill: var(--red); }
.kv-bar.b .kv-fill { fill: var(--base); }
.kv-pct { min-width: 5.2ch; text-align: right; white-space: nowrap; font-weight: 800; }
.kv-bar.a .kv-pct { font-size: 20px; }
.kv-bar.b .kv-pct { color: var(--muted); font-size: 16px; }

/* recent races where the picks differed (both outcomes listed) */
.kv-roll h3 { margin-bottom: 2px; font-size: 14px; }
.kv-roll-list li { border-top: 1px solid var(--line); }
.kv-r { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; min-height: 44px; padding: 6px 0; color: var(--text); text-decoration: none; }
a.kv-r:hover .kv-r-name { color: var(--amber); text-decoration: underline; }
.kv-r-name { font-size: 14px; font-weight: 800; }
.kv-r-a, .kv-r-b { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.kv-r i { color: var(--muted); font-size: 11px; font-style: normal; }
.kv-pos { padding: 0 8px; border-radius: 99px; box-shadow: inset 0 0 0 1.5px var(--ui); font-size: 12px; font-weight: 800; line-height: 1.8; text-decoration: none; }
.kv-r-a .kv-pos.is-ahead { background: var(--red-ink); color: #fff; box-shadow: none; }
.kv-r-b .kv-pos.is-ahead { background: var(--text); color: #fff; box-shadow: none; }
.kv-roll-list li.is-new .kv-r-name::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--red); animation: kv-pulse 1.2s ease-in-out 3; }
@keyframes kv-pulse { 50% { transform: scale(1.7); opacity: .45; } }
@media (max-width: 767px) { .kv-roll-list li:nth-child(n+7) { display: none; } }
@media (max-width: 420px) { .kv { padding: 16px 14px 14px; } .kv-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .kv-r-name { grid-column: 1 / -1; } }

/* motion: armed only when kval.js is running; the bars grow from the left edge, the tug from both ends, the list drops in oldest first */
.kv .kv-fill { transform-box: fill-box; transform-origin: 0 50%; transition: transform .9s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms); }
.kv .kv-bar.b .kv-fill { transition-delay: calc(var(--d, 0ms) + 120ms); }
.kv .kv-gap { transition: opacity .3s ease calc(var(--d, 0ms) + 950ms), transform .35s cubic-bezier(.3, 1.6, .5, 1) calc(var(--d, 0ms) + 950ms); }
.kv .kv-tugbar rect { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .6s ease; }
.kv .kv-tugbar .kv-tug-a { transform-origin: 0 50%; }   /* .kv .kv-tugbar rect (0,2,1) に負けない強さ（0,3,0）. 負けると各帯が自分の真ん中から伸びて, 境で出会わない */
.kv .kv-tugbar .kv-tug-b { transform-origin: 100% 50%; }
.kv .kv-roll-list li { transition: opacity .32s ease calc(var(--i, 0) * 180ms), transform .32s ease calc(var(--i, 0) * 180ms); }
.kv .is-reset, .kv .is-reset * { transition: none !important; }
.kv.is-js .kv-grp:not(.is-in) .kv-fill { transform: scaleX(0); }
.kv.is-js .kv-grp:not(.is-in) .kv-gap { opacity: 0; transform: scale(.6); }
.kv.is-js .kv-tug:not(.is-in) .kv-tugbar rect { transform: scaleX(0); opacity: 0; }
.kv.is-js .kv-roll-list:not(.is-in) li { opacity: 0; transform: translateY(-8px); }

@media (prefers-reduced-motion: reduce) {
  .kv *, .kv *::before { animation: none !important; transition: none !important; }
  .kv.is-js .kv-grp:not(.is-in) .kv-fill, .kv.is-js .kv-tug:not(.is-in) .kv-tugbar rect, .kv.is-js .kv-roll-list:not(.is-in) li { transform: none; }
  .kv.is-js .kv-grp:not(.is-in) .kv-gap, .kv.is-js .kv-tug:not(.is-in) .kv-tugbar rect, .kv.is-js .kv-roll-list:not(.is-in) li { opacity: 1; transform: none; }
}
