/* progress.css — Heads-Up progression (progress-ui.js; docs/HEADSUP-CONTRACT.md §3.1–3.3).
 * Its own file so it stays clear of style.css's motion sections. Nothing here sits on the felt:
 * the showdown slot is the action bar's idle space, the XP float rises inside the bar, and the lab
 * card lives on home. XP is cyan or white, never gold (gold is money). Every animation is in the
 * no-preference block; reduced motion shows the same end states without motion. */

/* ---------------------------------------------------------------- showdown slot: rating */
#table .actions .pg-rate, #table .actions .pg-beat { flex: 0 1 560px; box-sizing: border-box; min-width: 0; max-width: 560px; margin: 0; padding: 6px 12px;
  border-radius: var(--r-3); background: var(--bg-1); border: 1px solid var(--line-2); color: var(--text-2); text-align: left; }
#table .actions .pg-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 500 12px/1.35 var(--ui); }
.pg-ticks { display: inline-flex; gap: 3px; flex: none; }
.pg-ticks i { display: block; width: 5px; height: 14px; border-radius: 2px; background: var(--bg-3); }
.pg-ticks i.on { background: var(--beam-c); }
#table .pg-rate .pg-line { min-width: 0; color: var(--text-1); font-weight: 600; }
.pg-calls { display: inline-flex; gap: 4px; flex: none; }
.pg-call { display: inline-block; padding: 1px 7px; border-radius: var(--pill); border: 1px solid rgba(0, 212, 255, .55); color: var(--text-1); font: 600 11px/16px var(--num); white-space: nowrap; }
.pg-call sub { font-size: .7em; line-height: 0; vertical-align: -.2em; }

/* ---------------------------------------------------------------- the level-up beat */
.pg-beat { display: flex; align-items: center; gap: 12px; }
#table .actions .pg-beat { border-color: var(--beam-c); cursor: pointer; }
.pg-burst { position: relative; flex: none; width: 36px; height: 36px; }
.pg-mark { display: block; width: 100%; height: 100%; overflow: visible; }
.pg-arc { fill: none; stroke-width: 10; stroke-linecap: round; }
.pg-arc-c { stroke: var(--beam-c); }
.pg-arc-o { stroke: var(--beam-o); }
.pg-dot { fill: var(--neutral); }
.pg-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.pg-sparks i { position: absolute; left: -.75px; top: -23px; width: 1.5px; height: 8px; border-radius: 1px; background: var(--neutral); transform-origin: 50% 23px; opacity: 0; }
.pg-sparks i:nth-child(2) { transform: rotate(45deg); } .pg-sparks i:nth-child(3) { transform: rotate(90deg); } .pg-sparks i:nth-child(4) { transform: rotate(135deg); }
.pg-sparks i:nth-child(5) { transform: rotate(180deg); } .pg-sparks i:nth-child(6) { transform: rotate(225deg); } .pg-sparks i:nth-child(7) { transform: rotate(270deg); }
.pg-sparks i:nth-child(8) { transform: rotate(315deg); }
.pg-lvl-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pg-lvl-line { font: 800 15px/1.2 var(--display); letter-spacing: -.01em; color: var(--text-1); white-space: nowrap; }
.pg-cap { font: 500 12px/1.35 var(--ui); color: var(--text-2); }
@media (max-width: 759px) {
  #table .actions .pg-rate, #table .actions .pg-beat { grid-row: 2 / -1; grid-column: 1 / -1; align-self: start; justify-self: center; max-width: 100%; }
  #table .actions .pg-rate { justify-content: center; text-align: center; font-size: 13px; }
  #table .actions .pg-beat { gap: 10px; padding: 6px 10px; }
}

/* beside the slot the winner line keeps its one line on wider screens ("Akshay wins +300 eV") */
@media (min-width: 760px) { #table .actions:has(.pg-rate, .pg-beat, .pg-done) .waiting { flex: none; white-space: nowrap; } }

/* ---------------------------------------------------------------- the XP float (inside the bar) */
#table .control-bar .pg-float { position: absolute; right: 24px; top: 10px; z-index: 2; pointer-events: none; font: 700 13px var(--num); color: var(--beam-c); white-space: nowrap; }
/* phones: the bottom right corner, clear of the hand strip (the slot below is centered and narrower) */
@media (max-width: 759px) { #table .control-bar .pg-float { right: 14px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); } }

/* ---------------------------------------------------------------- home: the lab card */
.lab-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 280px); grid-template-areas: "k k" "main side"; gap: 6px 28px; align-items: end;
  width: 100%; box-sizing: border-box; margin: 0 0 24px; padding: 18px 24px 20px; text-align: left; cursor: pointer;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-4); box-shadow: var(--sh-3); color: var(--text-2); font: inherit; }
.lab-card[hidden] { display: none; }
.lab-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) { .lab-card:hover { border-color: var(--beam-c); } }
.lab-card.has-lvl { grid-template-areas: "lvl lvl" "k k" "main side"; }
/* on the card the band caption sits right below, so the beat shows only its line */
.lab-card > .pg-beat .pg-cap { display: none; }
.lab-card > .pg-beat { grid-area: lvl; padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.lab-k { grid-area: k; font: 600 11px var(--num); letter-spacing: .14em; color: var(--text-3); }
.lab-main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lab-lbl { font: 600 10px var(--num); letter-spacing: .12em; color: var(--text-3); }
.lab-band { font: 800 28px/1.1 var(--display); letter-spacing: -.02em; color: var(--text-1); }
.lab-cap { font: 500 13px/1.4 var(--ui); color: var(--text-2); }
.lab-side { grid-area: side; display: flex; flex-direction: column; gap: 6px; }
.lab-lv { font: 600 12px var(--num); color: var(--text-2); }
.lab-lv b { font: 800 15px var(--num); color: var(--text-1); }
.lab-bar { display: block; height: 6px; border-radius: var(--pill); background: var(--bg-2); overflow: hidden; }
.lab-bar i { display: block; height: 100%; background: var(--beam-c); transform-origin: 0 50%; }
.lab-xp { font: 600 12px var(--num); color: var(--text-2); }
@media (max-width: 759px) {
  .lab-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "k" "main" "side"; gap: 8px; padding: 16px 18px; margin-bottom: 20px; }
  .lab-card.has-lvl { grid-template-areas: "lvl" "k" "main" "side"; }
}

/* ---------------------------------------------------------------- badge disc (beat, tab) */
.pg-disc { position: relative; display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%; }
.pg-disc .pg-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.pg-disc .pg-ring circle { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 4 4; }
.pg-disc.on .pg-ring circle { stroke: var(--beam-c); stroke-width: 3; stroke-dasharray: 139; stroke-dashoffset: 0; }
.pg-glyph { position: relative; font: 800 16px/1 var(--num); color: var(--text-3); letter-spacing: -.02em; }
.pg-disc.on .pg-glyph { color: var(--text-1); }
.pg-badge .pg-burst { width: 40px; height: 40px; }
.pg-badge .pg-disc { width: 40px; height: 40px; }
.pg-badge .pg-glyph { font-size: 14px; }

/* ---------------------------------------------------------------- challenge done (the note's toast) */
#table .actions .pg-done { display: flex; align-items: center; gap: 10px; cursor: default; }
.pg-mini { position: relative; flex: none; width: 24px; height: 24px; }
.pg-mini .pg-core { position: absolute; left: 7px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--neutral); transform: scale(.6); box-shadow: var(--glow-c); }
.pg-mini .pg-sparks i { top: -14px; height: 6px; transform-origin: 50% 14px; }
.pg-done-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pg-done-t b { font: 700 13px/1.3 var(--num); color: var(--beam-c); }
@media (max-width: 759px) {
  #table .actions .pg-done { grid-row: 2 / -1; grid-column: 1 / -1; align-self: start; justify-self: center; max-width: 100%; }
}

/* ---------------------------------------------------------------- lab card rows (A11) */
.lab-rows { grid-area: rows; display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); min-width: 0; }
.lab-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lab-today { flex: 1 1 260px; }
.lab-ch { min-width: 0; font: 600 13px/1.35 var(--ui); color: var(--text-1); }
.lab-n { flex: none; font: 700 12px var(--num); color: var(--beam-c); font-variant-numeric: tabular-nums; }
.lab-badges .lab-n { color: var(--text-1); }
.lab-today.done .lab-ch { color: var(--text-2); }
.lab-streaks { flex: 1 1 100%; gap: 14px; flex-wrap: wrap; }
.lab-streak { font: 600 12px var(--num); color: var(--text-2); }
.lab-card { grid-template-areas: "k k" "main side" "rows rows"; }
.lab-card.has-lvl { grid-template-areas: "lvl lvl" "k k" "main side" "rows rows"; }
@media (max-width: 759px) {
  .lab-card { grid-template-areas: "k" "main" "side" "rows"; }
  .lab-card.has-lvl { grid-template-areas: "lvl" "k" "main" "side" "rows"; }
  .lab-rows { gap: 8px 18px; }
  .lab-today { flex-basis: 100%; }
}

/* ---------------------------------------------------------------- Collection tabs + badge grid */
.coll-tabs { flex: none; display: flex; gap: 6px; margin: 0 0 14px; padding: 3px; border-radius: var(--pill); background: var(--bg-2); align-self: flex-start; max-width: 100%; }
.coll-tabs[hidden] { display: none; }
.coll-tab { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--pill); background: none; color: var(--text-2); font: 600 13px var(--ui); white-space: nowrap; cursor: pointer; }
.coll-tab[aria-selected="true"] { background: var(--bg-0); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--beam-c); }
.coll-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pg-bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-bottom: 6px; }
.pg-btile { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-areas: "d n" "d h"; column-gap: 12px; row-gap: 2px; align-items: center;
  padding: 10px 12px; border-radius: var(--r-3); background: var(--bg-2); border: 1px dashed var(--line-2); }
.pg-btile.on { border-style: solid; border-color: var(--line); }
.pg-btile .pg-disc { grid-area: d; }
.pg-bname { grid-area: n; align-self: end; font: 700 14px/1.2 var(--ui); color: var(--text-2); }
.pg-btile.on .pg-bname { color: var(--text-1); }
.pg-bhint { grid-area: h; align-self: start; font: 500 12px/1.35 var(--ui); color: var(--text-3); }
@media (max-width: 759px) { .pg-bgrid { grid-template-columns: minmax(0, 1fr); gap: 8px; } }
@media (min-width: 760px) and (max-width: 1099px) { .pg-bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- the session summary (A6) */
.pg-sum-modal { z-index: 60; }
.pg-sum-box { width: min(460px, 100%); }
.pg-rows { margin: 0 0 16px; display: flex; flex-direction: column; }
.pg-srow { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pg-srow dt { font: 500 14px var(--ui); color: var(--text-2); }
.pg-srow dd { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; text-align: right; }
.pg-sv { font: 700 16px var(--num); color: var(--text-1); font-variant-numeric: tabular-nums; }
.pg-best { font: 800 15px/1.25 var(--display); }
.pg-best sub { font-size: .7em; line-height: 0; vertical-align: -.25em; }
.pg-snames { font: 500 12px/1.35 var(--ui); color: var(--beam-c); }
.pg-slv { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.pg-sband { font: 800 13px var(--display); color: var(--beam-c); }
.pg-sdays { margin: 8px 0 0; font: 600 13px var(--num); color: var(--text-2); }
.pg-sbtns { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
@media (min-width: 760px) { .pg-sbtns { flex-direction: row; gap: 10px; } .pg-sbtns > button { flex: 1 1 0; margin-top: 16px; } }

/* ---------------------------------------------------------------- motion (none under reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  /* the beats share one clock: --t-lvl (1.2 s) from the arcs or ring to the last line; a re-render
     resumes them through --pg-d, a tap (.skip) jumps to the end */
  .pg-lvl .pg-arc-c { animation: pgArcC calc(var(--t-lvl) / 3) var(--spring) both; animation-delay: var(--pg-d, 0ms); }
  .pg-lvl .pg-arc-o { animation: pgArcO calc(var(--t-lvl) / 3) var(--spring) both; animation-delay: var(--pg-d, 0ms); }
  .pg-lvl .pg-dot { transform-box: fill-box; transform-origin: center; animation: pgDot 500ms var(--ease-out) both; animation-delay: calc(var(--pg-d, 0ms) + 250ms); }
  .pg-badge .pg-ring circle { animation: pgRing calc(var(--t-lvl) / 2) var(--ease-out) both; animation-delay: var(--pg-d, 0ms); }
  .pg-badge .pg-glyph { animation: pgDot 500ms var(--spring) both; animation-delay: calc(var(--pg-d, 0ms) + 300ms); }
  .pg-beat .pg-sparks i { animation: pgSpark 360ms var(--ease-out) both; animation-delay: calc(var(--pg-d, 0ms) + 420ms); }
  .pg-beat .pg-lvl-t { animation: pgText 360ms var(--ease-out) both; animation-delay: calc(var(--pg-d, 0ms) + 480ms); }
  .pg-beat.skip .pg-arc, .pg-beat.skip .pg-dot, .pg-beat.skip .pg-lvl-t, .pg-beat.skip .pg-sparks i, .pg-beat.skip .pg-ring circle, .pg-beat.skip .pg-glyph { animation: none; }
  /* challenge done: the mini collision (a white core flash and 8 sparks, as a formation's) */
  .pg-done .pg-core { animation: pgCore 400ms var(--ease-out) both; animation-delay: var(--pg-d, 0ms); }
  .pg-done .pg-sparks i { animation: pgSpark 400ms var(--ease-out) both; animation-delay: calc(var(--pg-d, 0ms) + 60ms); }
  .pg-sum-modal .pg-sum-box { animation: pgSheet 240ms var(--ease-out) both; }
  .pg-sum-modal .pg-srow { animation: pgIn 240ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms + 120ms); }
  .pg-sum-modal .lab-bar i { animation: pgFill 600ms var(--ease-out) 240ms both; }
  .lab-today.done .lab-n { animation: pgDot 500ms var(--spring) both; }
  #table .actions .pg-rate .pg-calls .pg-call { animation: pgPop 220ms var(--spring) both; }
  #table .actions .pg-rate .pg-calls .pg-call:nth-child(2) { animation-delay: 60ms; }
  #table .actions .pg-rate, #table .actions .pg-beat, #table .actions .pg-done { animation: pgIn 240ms var(--ease-out) both; }
  #table .control-bar .pg-float { animation: pgFloat 1200ms var(--ease-out) both; }
  .lab-bar i { animation: pgFill 600ms var(--ease-out) both; }
}
@keyframes pgArcC { from { transform: translateX(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pgArcO { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pgDot { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes pgSpark { 0% { opacity: 1; scale: .2; } 100% { opacity: 0; scale: 1; } }
@keyframes pgText { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pgPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes pgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pgFloat { 0% { opacity: 0; transform: translateY(10px); } 25% { opacity: 1; transform: translateY(0); } 60% { opacity: 1; transform: translateY(-8px); } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes pgFill { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes pgRing { from { stroke-dashoffset: 139; } to { stroke-dashoffset: 0; } }
@keyframes pgCore { 0% { opacity: 1; transform: scale(.4); } 45% { opacity: 1; transform: scale(1.4); } 100% { opacity: 1; transform: scale(.6); } }
@keyframes pgSheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
/* ---------------------------------------------------------------- end progress */
