/* screen-stats.css — owner: js/screens/stats.js

   Only .scr-stats-* class names are defined here. Every colour is a token from
   css/base.css; .card .bar .chip .ring .star belong to css/components.css and are
   only ever tuned from inside a .scr-stats-* scope (the same licence
   css/screen-lesson.css takes with .ring).

   Two things this file is careful about:
     - the calendar and the seven-day strip never say anything with colour alone.
       A climbed day is a FILLED dot / a TALL bar; a rest day is an outline dot /
       a stub. Colour is the second signal, never the only one.
     - everything fits at 320px: the calendar column width is fluid, the dot has a
       max size, and the hero drops to one column when the card gets narrow.
*/

.scr-stats{
  display:flex; flex-direction:column; gap:var(--sp-4);
  padding-block:var(--sp-4) var(--sp-7);
}
.scr-stats-h1{ line-height:1.15; }
.scr-stats-subhead{ margin-top:var(--sp-2); }
.scr-stats-note{ line-height:1.35; }
.scr-stats-big{ font-size:30px; font-weight:800; line-height:1.05; }

/* ================================================================== hero === */

.scr-stats-hero{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:var(--sp-2) var(--sp-4);
}
.scr-stats-hero-ring{
  --ring-size:104px; --ring-w:4.4px;
  grid-column:1; grid-row:1;
  position:relative; flex:0 0 auto;
  width:var(--ring-size); height:var(--ring-size);
}
.scr-stats-hero-level{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:1px;
}
.scr-stats-hero-num{ font-size:36px; font-weight:800; line-height:1; }
.scr-stats-hero-cap{
  font-size:10px; font-weight:800; letter-spacing:.10em; color:var(--ink-soft);
}
.scr-stats-hero-mochi{
  grid-column:2; grid-row:1 / span 2;
  justify-self:end; align-self:center;
}
.scr-stats-hero-xp{
  grid-column:1; grid-row:2;
  text-align:center;
  font-size:15px; font-weight:700; color:var(--ink-soft);
}
.scr-stats-hero-xp-num{
  font-size:22px; font-weight:800; color:var(--ink);
}
.scr-stats-hero-next{
  grid-column:1 / -1; grid-row:3;
  padding-top:var(--sp-1);
}

@media (max-width:340px){
  .scr-stats-hero{ grid-template-columns:auto minmax(0,1fr); }
  .scr-stats-hero-ring{ --ring-size:88px; }
  .scr-stats-hero-num{ font-size:30px; }
}

/* ================================================================ streak === */

.scr-stats-streak,
.scr-stats-goal{
  display:flex; flex-direction:column; gap:var(--sp-3);
}
.scr-stats-streak-top{
  display:flex; align-items:center; flex-wrap:wrap;
  gap:var(--sp-2) var(--sp-3);
}
.scr-stats-flame{ font-size:34px; line-height:1; }
.scr-stats-streak-count{ min-width:0; }
.scr-stats-chips{
  display:flex; flex-wrap:wrap; gap:var(--sp-2);
  margin-left:auto;
}

/* --- 28-day calendar --- */

.scr-stats-cal{ display:flex; flex-direction:column; gap:var(--sp-2); }
.scr-stats-cal-head,
.scr-stats-cal-grid{
  display:grid; grid-template-columns:repeat(7, minmax(0,1fr));
  gap:var(--sp-2);
}
.scr-stats-cal-wd{
  text-align:center;
  font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft);
}
.scr-stats-cal-cell{ display:grid; place-items:center; }

.scr-stats-day{
  display:block;
  width:min(22px, 100%); aspect-ratio:1 / 1;
  border:2px solid var(--line); border-radius:var(--r-pill);
  background:transparent;
}
.scr-stats-day.is-on{
  background:var(--flame); border-color:var(--flame);
}
.scr-stats-day.is-today{
  box-shadow:0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}

.scr-stats-legend{
  display:flex; align-items:center; flex-wrap:wrap;
  gap:var(--sp-1) var(--sp-2);
  padding-top:var(--sp-1);
}
.scr-stats-legend .scr-stats-day{ width:13px; flex:0 0 auto; }
.scr-stats-legend .scr-stats-day + span{ margin-inline-end:var(--sp-2); }

/* ============================================================ daily goal === */

.scr-stats-goal-top{
  display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3);
}

.scr-stats-spark{
  display:grid; grid-template-columns:repeat(7, minmax(0,1fr));
  gap:var(--sp-2); align-items:end;
}
.scr-stats-spark-col{ display:flex; flex-direction:column; align-items:center; gap:var(--sp-1); }
.scr-stats-spark-track{
  display:flex; align-items:flex-end; justify-content:center;
  width:100%; height:44px;
}
.scr-stats-spark-bar{
  display:block; width:100%; max-width:20px;
  height:10px; border-radius:var(--r-pill);
  background:var(--line);
}
.scr-stats-spark-bar.is-on{ height:100%; background:var(--flame); }
.scr-stats-spark-day{
  font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft);
}
.scr-stats-spark-day.is-today{ color:var(--brand); }

/* ========================================================= words learned === */

.scr-stats-learned{
  display:flex; align-items:center; gap:var(--sp-4);
}
.scr-stats-learned-icon{ font-size:38px; line-height:1; flex:0 0 auto; }
.scr-stats-learned-copy{ min-width:0; }
.scr-stats-learned-copy .t-lead{ line-height:1.2; }
.scr-stats-learned-copy .t-small{ padding-top:var(--sp-1); }

/* ================================================================= units === */

.scr-stats-units{ display:flex; flex-direction:column; gap:var(--sp-3); }
.scr-stats-unit-list{ display:flex; flex-direction:column; gap:var(--sp-2); }

.scr-stats-unit{
  --accent:var(--brand);
  display:grid; grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center; gap:var(--sp-3);
  width:100%; min-height:64px;
  padding:var(--sp-3); text-align:left;
  user-select:none; -webkit-user-select:none;
  transition:transform .12s ease-out, border-color .12s ease-out;
}
.scr-stats-unit:hover{ border-color:var(--accent); }
.scr-stats-unit:active{ transform:translateY(2px); }

.scr-stats-unit-icon{
  display:grid; place-items:center;
  width:36px; height:36px; font-size:24px; line-height:1;
}
.scr-stats-unit-body{ display:block; min-width:0; }
.scr-stats-unit-title{
  display:block; font-size:15px; font-weight:800; line-height:1.25;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.scr-stats-unit-bar{ display:block; margin-top:6px; }
.scr-stats-unit .bar-fill{ background:var(--accent); }

.scr-stats-unit-side{
  display:flex; align-items:center; gap:var(--sp-2);
  flex:0 0 auto;
}
.scr-stats-unit-lock{ font-size:15px; line-height:1; }
.scr-stats-unit-stars{
  display:inline-flex; align-items:center; gap:2px;
  font-size:13px; font-weight:700; line-height:1; color:var(--ink-soft);
  white-space:nowrap;
}
.scr-stats-unit-stars b{ font-weight:800; color:var(--ink); }
.scr-stats-unit-stars .star{ font-size:15px; }

.scr-stats-unit.is-locked{ opacity:.65; }
.scr-stats-unit.is-locked .scr-stats-unit-title{ color:var(--ink-soft); }
.scr-stats-unit.is-locked .bar-fill{ background:var(--locked); }

/* =========================================================== empty state === */

.scr-stats-empty{
  display:flex; flex-direction:column; align-items:center; gap:var(--sp-3);
  padding:var(--sp-5) var(--sp-4);
}
.scr-stats-empty-copy{ max-width:28ch; }
.scr-stats-empty .btn{ margin-top:var(--sp-2); }

/* ================================================================ memory === */

/* The review schedule made visible. Owner: js/screens/stats.js. */

.scr-stats-mem,
.scr-stats-fmts{
  display:flex; flex-direction:column; gap:var(--sp-3);
}
.scr-stats-sub{ margin-top:var(--sp-2); }

.scr-stats-mem-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:var(--sp-2);
}
.scr-stats-mem-fig{
  flex:1 1 0; min-width:0; text-align:center;
}
.scr-stats-mem-fig .t-small{ line-height:1.2; }
.scr-stats-mem-when{ margin-top:calc(var(--sp-1) * -1); }

/* --- the ladder --- */

.scr-stats-rungs{
  display:flex; flex-direction:column; gap:var(--sp-2);
}
.scr-stats-rung{
  display:grid;
  grid-template-columns:minmax(84px, auto) 1fr 22px;
  align-items:center; gap:var(--sp-2);
}
.scr-stats-rung-name{
  display:flex; flex-direction:column; min-width:0; line-height:1.15;
}
.scr-stats-rung-name b{ font-size:13px; font-weight:800; color:var(--ink); }
.scr-stats-rung-gap{
  font-style:normal; font-size:11px; font-weight:700; color:var(--ink-soft);
}
.scr-stats-rung-num{
  font-size:13px; font-weight:800; text-align:right; color:var(--ink);
}
/* A rung nobody is standing on is still worth drawing — it is the road ahead —
   but it must not read as data. */
.scr-stats-rung.is-empty{ opacity:.45; }

/* --- cards that keep slipping --- */

.scr-stats-trickies{
  display:flex; flex-direction:column; gap:var(--sp-2);
}
.scr-stats-tricky{
  display:flex; align-items:center; gap:var(--sp-3);
  padding:var(--sp-2) var(--sp-3);
  border:2px solid var(--line); border-radius:var(--r-md);
  background:var(--bg);
}
.scr-stats-tricky-jp{
  flex:0 0 auto; min-width:1.6em; text-align:center;
  font-size:26px; font-weight:700; line-height:1.1; color:var(--ink);
}
.scr-stats-tricky-copy{ display:flex; flex-direction:column; min-width:0; flex:1 1 auto; }
.scr-stats-tricky-en{
  font-size:14px; font-weight:800; line-height:1.2; color:var(--ink);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.scr-stats-tricky-note{
  line-height:1.2;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
/* nowrap plus flex:0 0 auto: the pill keeps its words whole and the copy column
   (min-width:0, ellipsised) is what gives way on a narrow phone. */
.scr-stats-tricky-tag{
  flex:0 0 auto;
  padding:3px 8px; border-radius:999px;
  background:var(--brand-soft); color:var(--brand-dark);
  font-size:10px; white-space:nowrap;
}

/* ========================================================= question types === */

.scr-stats-fmt-list{
  display:flex; flex-direction:column; gap:var(--sp-2);
}
.scr-stats-fmt{
  display:grid;
  grid-template-columns:minmax(96px, auto) 1fr 34px;
  align-items:center; gap:var(--sp-2);
}
.scr-stats-fmt-name{
  font-size:13px; font-weight:800; line-height:1.15; color:var(--ink);
  min-width:0; overflow:hidden; text-overflow:ellipsis;
}
.scr-stats-fmt-num{
  font-size:13px; font-weight:800; text-align:right; color:var(--ink);
}
/* Never colour alone: the number beside the bar always says the same thing. */
.scr-stats-fmt-bar.is-weak .bar-fill{ background:var(--bad); }

@media (max-width:359px){
  .scr-stats-rung{ grid-template-columns:minmax(72px, auto) 1fr 20px; }
  .scr-stats-fmt{ grid-template-columns:minmax(80px, auto) 1fr 32px; }
}
