/* Drills and Progress screens, Blue Felt premium. Uses the tokens defined in styles.css.
   Motion, all off under Reduce Motion:
     answer badge pop     300ms cubic-bezier(.2,.9,.25,1.2)   the mark lands on the button you picked
     explanation rise     380ms expo-out, 120ms after the tap   so it never lands on top of the tap
     round segments       180ms colour ease                     the bar fills as you answer
     trend line draw      1200ms ease-in-out, 200ms delay      plays once per visit
     trend end dot pop    320ms at 1350ms                      after the line arrives
     leak bars fill       900ms ease-in-out, 120ms apart */

/* ---------- drills: picker ---------- */
.dr-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dr-tile { position: relative; min-height: 176px; color: var(--text); }
.dr-tile .t { font-size: 18px; font-stretch: 125%; letter-spacing: -0.02em; }
.dr-tile.focus { box-shadow: inset 0 1px 0 var(--gold), inset 0 0 0 1.5px rgba(216,192,138,0.55), 0 18px 30px -18px rgba(0,0,0,0.8); }
.dr-badge { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: rgba(216,192,138,0.14); color: var(--gold); font-size: 11.5px; font-weight: 700; }
.dr-meter { height: 5px; border-radius: 3px; background: rgba(243,239,228,0.08); overflow: hidden; }
.dr-meter span { display: block; height: 100%; border-radius: 3px; background: var(--foil); }
.dr-tile .foot { font-size: 12.5px; color: var(--muted); }

/* ---------- drills: a run ---------- */
.dr-run { max-width: 760px; gap: 16px; }
.dr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dr-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 6px; margin-left: -6px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; transition: color 180ms ease-out, background-color 180ms ease-out; }
.dr-back:hover { color: var(--text); background: rgba(243,239,228,0.05); }
.dr-where { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dr-where b { color: var(--text); }
.dr-segs { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.dr-segs span { height: 5px; border-radius: 3px; background: rgba(243,239,228,0.10); transition: background-color 180ms ease-out; }
.dr-segs span.right { background: var(--gold); }
.dr-segs span.wrong { background: var(--bad-mark); }
.dr-segs span.now { background: rgba(243,239,228,0.4); }
.dr-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dr-title h2 { margin: 0; font-size: 30px; }
.dr-alltime { font-size: 12.5px; color: var(--dim); }
.dr-q { display: flex; flex-direction: column; gap: 12px; }
.dr-card {
  border-radius: 20px; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px;
  background: linear-gradient(180deg, rgba(17,42,80,0.94), rgba(12,33,64,0.94)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line), var(--shadow);
}
.dr-card .prompt { font-size: 19px; font-weight: 600; line-height: 1.45; }
.dr-chipstat .v { font-size: 22px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dr-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dr-opt {
  position: relative; min-height: 64px; padding: 10px 44px 10px 46px; border: 0; border-radius: 16px; text-align: left; color: var(--text);
  background: rgba(7,20,40,0.55); box-shadow: inset 0 0 0 1.5px rgba(243,239,228,0.14);
  font-size: 17px; font-weight: 750; font-stretch: 112%; font-variant-numeric: tabular-nums;
  transition: transform 120ms ease-out, box-shadow 160ms ease-out, background-color 160ms ease-out, opacity 160ms ease-out;
}
.dr-opt:hover:not(:disabled) { background: rgba(243,239,228,0.07); box-shadow: inset 0 0 0 1.5px rgba(216,192,138,0.55); }
.dr-opt:active:not(:disabled) { transform: scale(.97); }
.dr-opt:disabled { cursor: default; }
.dr-key { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; font-stretch: 100%; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-2); }
.dr-opt.right { background: rgba(91,224,165,0.10); box-shadow: inset 0 0 0 1.5px var(--good); }
.dr-opt.wrong { background: rgba(242,115,122,0.10); box-shadow: inset 0 0 0 1.5px var(--bad); }
.dr-opt.dim { opacity: 0.45; }
.dr-mark { position: absolute; right: 12px; top: 50%; margin-top: -11px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--night); animation: drPop 300ms cubic-bezier(.2,.9,.25,1.2) both; }
.dr-mark.ok { background: var(--good); }
.dr-mark.no { background: var(--bad); }
@keyframes drPop { 0% { opacity: 0; transform: scale(.4); } 70% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: none; } }
.dr-answer {
  border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, rgba(17,42,80,0.94), rgba(12,33,64,0.94)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line);
  animation: drRise 380ms cubic-bezier(.16,1,.3,1) 120ms both;
}
@keyframes drRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dr-roundup { padding: 10px 12px; border-radius: 10px; background: rgba(216,192,138,0.08); box-shadow: inset 2px 0 0 var(--gold); font-size: 14px; }
.dr-next { align-self: stretch; min-height: 56px; font-size: 16px; }
.dr-keys { font-size: 12.5px; color: var(--dim); }

/* ---------- progress ---------- */
.pg-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.pg-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pg-card {
  border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  background: linear-gradient(180deg, rgba(17,42,80,0.92), rgba(12,33,64,0.92)); box-shadow: inset 0 1px 0 var(--gold-line), inset 0 0 0 1px var(--line);
}
.pg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pg-title { font-size: 16px; font-weight: 750; }
.pg-k { font-size: 13.5px; color: var(--muted); }
.pg-note { font-size: 12px; color: var(--dim); }
.pg-num { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-num b { color: var(--gold); font-size: 16px; }
.pg-emptyline { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.pg-trend-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pg-big { font-size: 52px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.pg-change { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.pg-change.good { background: rgba(91,224,165,0.12); color: var(--good); }
.pg-change.bad { background: rgba(242,115,122,0.12); color: var(--bad); }
.pg-change span { display: grid; }
.pg-chartbox { position: relative; height: 84px; }
.pg-spark { display: block; overflow: visible; }
.pg-spark.still .line, .pg-spark.still .dot { animation: none; stroke-dashoffset: 0; }
.pg-spark .base { stroke: rgba(243,239,228,0.10); stroke-width: 1; fill: none; }
.pg-spark .line { stroke: var(--gold); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: pgDraw 1200ms cubic-bezier(.65,0,.35,1) 200ms forwards; }
.pg-spark .dot { fill: var(--gold); stroke: #0e2445; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: drPop 320ms cubic-bezier(.2,.9,.25,1.2) 1350ms both; }
@keyframes pgDraw { to { stroke-dashoffset: 0; } }
.pg-hits { position: absolute; inset: 0; display: flex; }
.pg-hits span { flex: 1; }
.pg-hits span:hover { background: linear-gradient(90deg, transparent 49%, rgba(243,239,228,0.18) 50%, transparent 51%); }
.pg-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }

.pg-squares { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 3px; }
.pg-squares span { aspect-ratio: 1; border-radius: 3px; background: rgba(243,239,228,0.12); }
.pg-squares span.on { background: var(--gold); }

.pg-leak { display: flex; flex-direction: column; gap: 7px; padding: 12px 14px; border-radius: 14px; background: rgba(7,20,40,0.45); box-shadow: inset 0 0 0 1px var(--line); }
.pg-leak .name { font-size: 14.5px; font-weight: 600; }
.pg-leak .lost { font-size: 15px; font-weight: 800; font-stretch: 112%; color: var(--bad); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-bar { display: block; height: 6px; border-radius: 3px; background: rgba(243,239,228,0.07); overflow: hidden; }
.pg-bar span { display: block; height: 100%; border-radius: 3px; background: var(--foil); transform-origin: left center; animation: fill 900ms cubic-bezier(.65,0,.35,1) both; }
.pg-bar.thin { height: 5px; }
.pg-fix { display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; }
.pg-fix a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.pg-fix a span { color: var(--gold); }
.pg-fix a:hover span, .pg-fix a.pg-practise:hover { color: var(--gold-hi); }
.pg-fix a.pg-practise { color: var(--muted); }

.pg-list { display: flex; flex-direction: column; }
.pg-drill { display: grid; grid-template-columns: minmax(120px, 1fr) 1.4fr 72px; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13.5px; border-radius: 6px; }
.pg-drill:first-child { border-top: 0; }
.pg-drill:hover { background: rgba(243,239,228,0.04); }
.pg-drill .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-mistake { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); text-align: left; font-size: 13.5px; border-radius: 6px; transition: background-color 180ms ease-out; }
.pg-mistake:first-child { border-top: 0; }
.pg-mistake:hover { background: rgba(243,239,228,0.05); }
.pg-mistake .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pg-mistake .street { font-size: 11.5px; color: var(--dim); text-transform: capitalize; }
.pg-mistake .loss { color: var(--bad); font-weight: 750; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .pg-top, .pg-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dr-tile { min-height: 0; }
  .dr-next .kbd, .dr-key { display: none; }
  .dr-run { gap: 12px; }
  .dr-title h2 { font-size: 26px; }
  .dr-card { padding: 16px; }
  .dr-card .prompt { font-size: 17px; }
  .dr-options { gap: 8px; }
  .dr-opt { min-height: 60px; padding: 10px 36px 10px 16px; font-size: 16px; }
  .dr-key { left: 10px; }
  .dr-mark { right: 8px; }
  .dr-keys { display: none; }
  .dr-next { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 14px 30px -10px rgba(0,0,0,0.9); }
  .pg-big { font-size: 44px; }
  .pg-card { padding: 16px; }
  .pg-drill { grid-template-columns: minmax(0, 1fr) 80px 64px; }
  .pg-squares { grid-template-columns: repeat(14, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-spark .line { stroke-dashoffset: 0; }
}
