/* my-stats.css - the shared "สถิติของฉัน" page (mocks.html, quiz.html). Pairs with my-stats.js.
   Uses the board's --qb-* tokens, so it follows quiz.html's dark theme too. */
.ms { display:flex; flex-direction:column; gap:14px; max-width:720px; margin:0 auto; color:var(--qb-ink); font-variant-numeric:tabular-nums; }
.ms-h { font-family:'Prompt',sans-serif; font-weight:700; font-size:22px; letter-spacing:-.01em; margin:0 2px 2px; }
.ms-h small { display:block; font-family:'Inter','Prompt',sans-serif; font-size:12.5px; font-weight:500; color:var(--qb-ink-faint); letter-spacing:0; margin-top:3px; }
.ms-card { background:var(--qb-surface); border:1px solid var(--qb-hair); border-radius:18px; box-shadow:var(--qb-shadow); padding:18px 18px 16px; }
.ms-sec { font-family:'Prompt',sans-serif; font-size:11.5px; font-weight:700; letter-spacing:.06em; color:var(--qb-pink-ink); margin-bottom:12px; }
.ms-note { font-size:11.5px; color:var(--qb-ink-faint); margin-top:10px; line-height:1.5; }
.ms-empty { text-align:center; color:var(--qb-ink-faint); font-size:13px; padding:30px 8px; line-height:1.6; }

/* rank bar (same look and reading as ReadingLab's dashboard rank bar, DESIGN.md "Soft iOS": best on the left) */
.ms-rank { --rc:var(--qb-ink-faint); }
.ms-rank-track-wrap { position:relative; padding:13px 0 3px; }
.ms-rank-track { height:8px; border-radius:8px; background:color-mix(in srgb, var(--qb-ink) 9%, transparent); position:relative; overflow:hidden; }
.ms-rank-fill { position:absolute; left:0; top:0; height:100%; width:0; border-radius:8px; background:var(--rc); transition:width .7s cubic-bezier(.2,.8,.2,1); }
.ms-rank-pin { position:absolute; top:50%; left:0; transform:translate(-50%,-50%); transition:left .7s cubic-bezier(.2,.8,.2,1); z-index:1; }
.ms-rank-pin i { width:26px; height:26px; border-radius:50%; background:var(--qb-surface); border:2px solid var(--rc); color:var(--rc);
  display:flex; align-items:center; justify-content:center; box-shadow:0 1px 2px rgba(26,27,38,.04), 0 4px 14px rgba(26,27,38,.08); }
.ms-rank-pin svg { width:12px; height:12px; }
.ms-rank-ends { display:flex; justify-content:space-between; margin-top:2px; font-size:10.5px; font-weight:700; color:var(--qb-ink-faint); }
.ms-rank-cap { text-align:center; margin-top:6px; }
.ms-rank-top { font-size:13px; font-weight:800; color:var(--rc); }
.ms-rank-sub { font-size:11.5px; color:var(--qb-ink-soft); margin-top:1px; }
.ms-rank.ghost .ms-rank-pin { display:none; }
.ms-rank.sm .ms-rank-track-wrap { padding:9px 0 1px; }
.ms-rank.sm .ms-rank-track { height:6px; }
.ms-rank.sm .ms-rank-pin i { width:18px; height:18px; border-width:2px; }
.ms-rank.sm .ms-rank-pin svg { width:9px; height:9px; }

/* hero */
.ms-hero .ms-rank { padding:2px 4px 0; }
.ms-kpis { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:16px; }
.ms-kpi { background:var(--qb-hair-soft); border-radius:12px; padding:11px 10px; text-align:center; }
.ms-kpi b { display:block; font-size:20px; font-weight:800; line-height:1.15; letter-spacing:-.01em; }
.ms-kpi b small { font-size:11px; font-weight:600; color:var(--qb-ink-faint); }
.ms-kpi span { display:block; font-size:11px; color:var(--qb-ink-faint); margin-top:3px; line-height:1.3; }
.ms-kpi b.up { color:var(--qb-good); } .ms-kpi b.down { color:#B4434F; }

/* per subject */
.ms-subjs { display:grid; grid-template-columns:1fr; gap:14px; }
.ms-subj-head { display:flex; align-items:center; gap:10px; margin-bottom:4px; }
.ms-glyph { width:30px; height:30px; border-radius:9px; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  font-size:10.5px; font-weight:800; letter-spacing:.02em; color:#fff; background:var(--sc); }
.ms-subj-name { flex:1; min-width:0; font-family:'Prompt',sans-serif; font-weight:600; font-size:15px; line-height:1.25; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ms-subj-n { font-size:11.5px; color:var(--qb-ink-faint); white-space:nowrap; }
.ms-chart { margin-top:14px; }
.ms-chart svg { display:block; width:100%; height:auto; overflow:visible; }
.ms-legend { display:flex; gap:14px; font-size:11px; color:var(--qb-ink-faint); margin-top:6px; }
.ms-legend span { display:inline-flex; align-items:center; gap:6px; }
.ms-legend i { width:14px; height:0; border-top:2.5px solid var(--sc); border-radius:2px; }
.ms-legend i.g { border-top:2px dashed var(--qb-ink-faint); }
.ms-read { display:flex; align-items:baseline; gap:8px; margin-top:12px; padding-top:12px; border-top:1px solid var(--qb-hair-soft); font-size:12.5px; color:var(--qb-ink-soft); line-height:1.45; }
.ms-read b { font-weight:800; white-space:nowrap; }
.ms-read small { display:block; font-size:11.5px; color:var(--qb-ink-faint); margin-top:1px; }
.ms-subj-one { font-size:17px; font-weight:800; color:var(--sc); }
.ms-read b.up { color:var(--qb-good); } .ms-read b.down { color:#B4434F; } .ms-read b.flat { color:var(--qb-ink); }

/* weak categories */
.ms-cat { padding:10px 0; border-top:1px solid var(--qb-hair-soft); }
.ms-cat:first-child { border-top:0; padding-top:2px; }
.ms-cat-top { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:6px; }
.ms-cat-name { font-size:13.5px; font-weight:600; min-width:0; }
.ms-cat-name em { display:block; font-style:normal; font-size:11px; font-weight:500; color:var(--qb-ink-faint); margin-top:1px; }
.ms-cat-pct { font-size:14px; font-weight:800; white-space:nowrap; }
.ms-cat-pct small { font-size:11px; font-weight:600; color:var(--qb-ink-faint); margin-left:4px; }
.ms-cat-bar { position:relative; height:8px; border-radius:5px; background:var(--qb-hair-soft); }
.ms-cat-fill { position:absolute; left:0; top:0; bottom:0; width:0; border-radius:5px; transition:width .7s cubic-bezier(.2,.8,.2,1); }
.ms-cat-g { position:absolute; top:-4px; bottom:-4px; width:2px; margin-left:-1px; border-radius:2px; background:var(--qb-ink); opacity:.55; }
.ms-cat-legend { display:flex; gap:14px; font-size:11px; color:var(--qb-ink-faint); margin:-4px 0 10px; }
.ms-cat-legend span { display:inline-flex; align-items:center; gap:6px; }
.ms-cat-legend i { width:12px; height:6px; border-radius:3px; background:var(--qb-pink); }
.ms-cat-legend i.g { width:2px; height:12px; background:var(--qb-ink); opacity:.55; }

/* history */
.ms-hist { display:flex; flex-direction:column; }
.ms-row { display:grid; grid-template-columns:48px 1fr 104px; align-items:center; gap:12px; padding:11px 6px; margin:0 -6px;
  border-top:1px solid var(--qb-hair-soft); border-radius:10px; cursor:pointer; transition:background .15s; }
.ms-row:first-child { border-top-color:transparent; }
.ms-row:hover { background:var(--qb-hair-soft); }
.ms-row:focus-visible { outline:2px solid var(--qb-pink); outline-offset:-2px; }
.ms-score { font-size:15px; font-weight:800; text-align:center; border-radius:10px; padding:7px 0; color:var(--sc); background:color-mix(in srgb, var(--sc) 12%, transparent); }
.ms-row-name { font-size:13.5px; font-weight:600; line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ms-row-sub { font-size:11px; color:var(--qb-ink-faint); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ms-row-rank { font-size:11px; color:var(--qb-ink-faint); text-align:right; }
.ms-row-rank b { color:var(--rc); font-weight:800; }
.ms-mini { position:relative; height:4px; border-radius:3px; background:var(--qb-hair-soft); margin-top:6px; }
.ms-mini i { position:absolute; top:50%; width:9px; height:9px; margin:-4.5px 0 0 -4.5px; border-radius:50%; background:var(--rc); box-shadow:0 0 0 2px var(--qb-surface); }
.ms-sep { display:inline-block; width:1px; height:9px; background:var(--qb-hair); margin:0 7px; vertical-align:-1px; }
.ms-more { display:block; width:100%; margin-top:8px; padding:10px; border:0; border-radius:10px; background:var(--qb-hair-soft);
  font:inherit; font-size:12.5px; font-weight:600; color:var(--qb-ink-soft); cursor:pointer; }
.ms-more:hover { color:var(--qb-ink); }
@media (max-width:520px) {
  .ms-card { padding:16px 14px 14px; border-radius:16px; }
  .ms-kpi b { font-size:18px; }
  .ms-row { grid-template-columns:44px 1fr 78px; gap:10px; }
}
/* the scorecard after submitting reuses the rank bar */
.scorecard-context .ms-rank, .qb-res-rank .ms-rank { margin:2px 0 6px; }
