/* Statistics v2 — Blupoli: visual adaptation of the approved pastel dashboards.
   Metrics and interactions remain owned by stats.js; no illustrative data. */
body.puzzles-app[data-puzzles-screen="stats"] .statistics-page {
  --stats-quiet:var(--surface-soft);
  --stats-cyan:var(--surface-aqua);
  --stats-pink:var(--surface-coral);
  --stats-gold:var(--surface-yellow);
  --stats-violet:var(--surface-violet);
  color:var(--text);
}
.statistics-page .activity-hub-nav {display:flex;gap:8px;overflow-x:auto;white-space:nowrap;padding:16px 2px 8px}
.statistics-page .activity-hub-nav a {padding:10px 16px;border-radius:999px;border:1px solid var(--line);font-weight:760;background:var(--surface);color:var(--text-secondary)}
.statistics-page .activity-hub-nav a[aria-current="page"] {background:var(--stats-violet);color:var(--app-accent-ink,var(--brand-violet));border-color:var(--surface-soft)}
:where(body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-hero){
  position:relative;isolation:isolate;min-height:238px;overflow:hidden;
  padding:clamp(22px,3.5vw,45px);margin-top:12px;border-radius:28px;
  background:var(--surface-soft);
  border:1px solid var(--line);box-shadow:var(--shadow-soft);
  align-items:center;
}
:where(.statistics-page .statistics-hero>div:first-child){position:relative;z-index:1;max-width:750px}
:where(body.puzzles-app[data-puzzles-screen="stats"] .statistics-hero h1){
  font-size:clamp(2.05rem,4.8vw,4.3rem);line-height:1;letter-spacing:-.055em;font-weight:900;
  background:none;
  color:var(--text);
}
:where(.statistics-page .statistics-hero .kicker){color:var(--app-accent-ink,var(--brand-violet));font-weight:850;letter-spacing:.16em}
:where(.statistics-page .statistics-hero p){max-width:590px;line-height:1.55}
.statistics-page .statistics-hero-art{display:flex;align-items:center;justify-content:center;gap:0;pointer-events:none;min-width:220px;transform:rotate(-12deg);filter:drop-shadow(0 12px 10px var(--surface-soft))}
.statistics-page .statistics-hero-art i{display:grid;place-items:center;position:relative;width:92px;height:126px;border:9px solid var(--surface);border-radius:18px;background:var(--stats-violet);font-size:3rem;font-style:normal;font-weight:900;color:var(--brand-violet)}
.statistics-page .statistics-hero-art i:nth-child(1){transform:rotate(-22deg) translate(22px,12px);background:var(--stats-pink);color:var(--brand-coral)}
.statistics-page .statistics-hero-art i:nth-child(2){z-index:1;transform:translateY(-10px);background:var(--stats-cyan);color:var(--brand-aqua)}
.statistics-page .statistics-hero-art i:nth-child(3){transform:rotate(20deg) translate(-24px,18px);background:var(--stats-gold);color:var(--brand-yellow)}
body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-scope{margin-top:14px;border-left:1px solid var(--line);border-radius:21px;padding:19px 23px}
.statistics-page .statistics-section-heading h2{font-size:clamp(1.08rem,1.8vw,1.35rem)}
.statistics-page .statistics-scope-tabs{border:0;background:var(--surface-soft);border-radius:999px;padding:5px}
.statistics-page .statistics-scope-tabs button{border-radius:999px;min-height:43px}
.statistics-page .statistics-scope-tabs button[aria-pressed="true"],
.statistics-page .statistics-periods button[aria-pressed="true"]{background:var(--brand-violet);color:#fff;box-shadow:0 3px 12px var(--surface-soft)}
.statistics-page .statistics-scope-selectors select{border-radius:13px}
.statistics-page .statistics-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px}
body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-kpi{
  min-height:133px;padding:17px 19px;border-radius:17px;gap:8px;background:var(--stats-violet);
  border:1px solid var(--surface-soft)
}
.statistics-page .statistics-kpi:nth-child(4n + 2){background:var(--stats-cyan)!important}
.statistics-page .statistics-kpi:nth-child(4n + 3){background:var(--stats-gold)!important}
.statistics-page .statistics-kpi:nth-child(4n + 4){background:var(--stats-pink)!important}
.statistics-page .statistics-kpi::before{border-radius:17px 17px 0 0}
.statistics-page .statistics-kpi-head{display:flex;align-items:center;gap:10px}
.statistics-page .statistics-kpi-icon{display:grid;place-items:center;flex:none;width:39px;height:39px;border-radius:13px;background:var(--surface);font-size:1.38rem;color:var(--app-accent-ink,var(--brand-violet))}
.statistics-page .statistics-kpi>span{font-size:.71rem;letter-spacing:0;text-transform:none}
.statistics-page .statistics-kpi strong{font-size:clamp(1.65rem,2.5vw,2.4rem);overflow-wrap:anywhere}
.statistics-page .statistics-kpi small{font-size:.71rem}
body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-card{
  border-radius:20px;padding:clamp(17px,2.1vw,25px);
  box-shadow:var(--shadow-soft);background:var(--surface)
}
.statistics-page .statistics-card-head h2{font-size:clamp(1.08rem,1.65vw,1.38rem);font-weight:850}
.statistics-page .statistics-card .kicker{font-size:.66rem;color:var(--app-accent-ink,var(--brand-violet))}
.statistics-page .statistics-grid--primary{grid-template-columns:minmax(0,5fr) minmax(0,7fr)}
.statistics-page .statistics-activity-chart{border-radius:13px;background:var(--surface-soft);border-top:0;min-width:0}
.statistics-page .statistics-activity-bar i{border-radius:9px 9px 3px 3px;min-height:3px;background:var(--brand-violet)}
.statistics-page .statistics-periods{border-radius:999px}
.statistics-page .statistics-performance-item{background:var(--surface-soft);border-radius:13px;min-height:100px}
.statistics-page .statistics-breakdown-row{padding:12px;border-radius:13px}
.statistics-page .statistics-breakdown-track{height:11px}
.statistics-page .statistics-history-row{border:1px solid var(--line);padding:12px;border-radius:13px}
.statistics-page .stitch-stats-time-row{border-radius:13px;background:var(--surface-soft)}
.statistics-page .stitch-stats-calendar-card{margin-top:16px}
.statistics-page .stitch-stats-week-grid{max-width:100%}
.statistics-page .statistics-data-note{border-radius:17px}
.statistics-page :where(a,button,select):focus-visible{outline:3px solid var(--brand-aqua);outline-offset:3px}
@media (max-width:1100px){
  .statistics-page .statistics-hero-art{min-width:155px}
  .statistics-page .statistics-hero-art i{width:66px;height:98px;font-size:2.4rem}
}
@media (max-width:900px){
  .statistics-page .statistics-hero-art{display:none}
  .statistics-page .statistics-grid--primary{grid-template-columns:1fr}
}
@media (max-width:650px){
  body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-hero{padding:20px;border-radius:19px;min-height:unset}
  .statistics-page .statistics-hero-actions{width:100%;flex-wrap:wrap}
  .statistics-page .statistics-hero-actions .button{flex:1 1 135px}
  body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-scope{display:block;padding:17px}
  .statistics-page .statistics-scope-tabs{display:grid;width:100%;grid-template-columns:repeat(3,minmax(0,1fr))}
  .statistics-page .statistics-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  body.puzzles-app[data-puzzles-screen="stats"] .statistics-page .statistics-kpi{padding:13px;min-height:128px}
  .statistics-page .statistics-kpi-icon{width:32px;height:32px;font-size:1.1rem}
  .statistics-page .statistics-card-head--controls{align-items:stretch}
}
@media(max-width:380px){
  .statistics-page .statistics-kpi strong{font-size:1.4rem}
  .statistics-page .statistics-section-heading{flex-wrap:wrap}
  .statistics-page .statistics-scope-badge{max-width:100%}
}
@media(prefers-reduced-motion:reduce){.statistics-page *{scroll-behavior:auto!important}}


.statistics-page .stitch-stats-simple-distribution{width:100%;display:grid;gap:14px;padding:16px}
.statistics-page .stitch-stats-simple-row{display:grid;gap:8px}
.statistics-page .stitch-stats-simple-row>span{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.statistics-page .stitch-stats-simple-row strong{font-size:.83rem}
.statistics-page .stitch-stats-simple-row small{font-size:.72rem;color:var(--text-secondary)}
.statistics-page .stitch-stats-simple-track{height:14px;border-radius:99px;background:var(--surface-soft);overflow:hidden}
.statistics-page .stitch-stats-simple-track i{display:block;height:100%;border-radius:inherit;background:var(--brand-violet)}

/* Stats history: real completed sessions and restorable snapshots. */
.statistics-page .statistics-history-tabs{display:flex;gap:6px;flex-wrap:wrap;padding:3px;margin-bottom:12px;background:var(--surface-soft);border-radius:12px}
.statistics-page .statistics-history-tabs button{flex:1;min-height:44px;min-width:110px;padding:9px 12px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--text);font:inherit;font-size:.82rem;font-weight:750;cursor:pointer}
.statistics-page .statistics-history-tabs button[aria-selected=true]{background:var(--surface);border-color:var(--line);box-shadow:var(--shadow-soft)}
.statistics-page .statistics-history-tabs button span{font-size:.74rem;color:var(--text-subtle)}
.statistics-page .statistics-history-results{display:grid;gap:7px;min-width:0}
.statistics-page .statistics-history-results .statistics-history-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;align-items:center}
.statistics-page .statistics-history-action{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 12px;border-radius:9px;background:var(--brand-coral);color:#fff;font-size:.78rem;font-weight:800;text-decoration:none;white-space:nowrap}
.statistics-page .statistics-history-tabs button:focus-visible,.statistics-page .statistics-history-action:focus-visible{outline:3px solid var(--brand-aqua);outline-offset:2px}
@media(max-width:600px){.statistics-page .statistics-history-results .statistics-history-row{grid-template-columns:minmax(0,1fr) auto;gap:8px}.statistics-page .statistics-history-results .statistics-history-row>span:nth-child(2){text-align:right}.statistics-page .statistics-history-action{grid-column:1/-1;width:100%}}
@media(prefers-reduced-motion:reduce){.statistics-page .statistics-history-action{transition:none}}
