/* Afsar Space v1 design tokens. Written 18 Nov 2026 from DESIGN.md (locked 13 Nov 2026), batch 1 as redrawn
   16 Nov 2026 in version B indigo, and his two decisions of 18 Nov 2026:
   1. Version B in indigo: one brand colour on the solid button and the current tab only.
   2. Each grade has its own colour, on the grade letter and its reward moment only. S, SS and SS+ are gold.
   Day is the default; night follows the phone (prefers-color-scheme). data-theme="day|night" on <html> forces one.
   Every pair used for text is checked by app/tools/contrast.py (small text 4.5:1, big answer 3:1). */

:root{
  /* Ground and text */
  --bg:#FFFFFF;        /* ground, every screen */
  --tx:#111214;        /* ink: titles, figures, the grade-screen button */
  --mu:#63666D;        /* quiet: times, labels, notes, inactive tabs */
  --ln:#E6E7EA;        /* row separators */
  --sf:#F3F3F5;        /* surface: draft boxes, tiles (tappable or quoted) */
  --sh:#FFFFFF;        /* sheet ground */
  --dim:#C9CAD0;       /* dimmed parent behind a sheet */
  --scrim:rgba(17,18,20,.46); /* the veil over a screen while a sheet is open (added 18 Nov 2026, step 3) */

  /* State colours (status text and dots only; every state also has a word) */
  --need:#9A5C00;      /* Needs you, amber */
  --ok:#137544;        /* Done, on track */
  --risk:#C2362D;      /* At risk */
  --rk:#2F6FEB;        /* Working: a helper is working */

  /* Brand, version B indigo: the solid button and the current tab, nothing else */
  --br:#4A2FC8;        /* solid button ground */
  --brt:#FFFFFF;       /* text on the solid button */
  --brx:#4A2FC8;       /* brand as text or icon on the ground (current tab, focus ring) */

  /* Grade colours, F to SS+. --g-x: the big letter, lit scale step and confetti (big text, 3:1).
     --g-x-t: the same grade as small text on the ground (4.5:1). --g-x-on: text on a lit step of that colour. */
  --g-f:#DE4A54; --g-f-t:#C3303B; --g-f-on:#111214;   /* Coral */
  --g-e:#B06E3C; --g-e-t:#975A2B; --g-e-on:#111214;   /* Bronze */
  --g-d:#7C8698; --g-d-t:#5F6878; --g-d-on:#111214;   /* Silver */
  --g-c:#12964F; --g-c-t:#0E7A40; --g-c-on:#111214;   /* Green */
  --g-b:#2F6FEB; --g-b-t:#2F6FEB; --g-b-on:#FFFFFF;   /* Blue: a good normal day */
  --g-a:#B32DBF; --g-a-t:#B32DBF; --g-a-on:#FFFFFF;   /* Magenta: kept clear of the brand indigo */
  --g-s:#A67C00; --g-s-t:#856300; --g-s-on:#111214;   /* Gold */
  --g-ss:#A67C00; --g-ss-t:#856300; --g-ss-on:#111214;/* Gold, on the gold plate */
  --g-plate:#FFCB45;   /* the gold plate behind SS and SS+, same by day and night */
  --g-plate-tx:#111214;/* ink on the gold plate */
  --g-ring:#111214;    /* SS+ only: an ink ring round the plate, so the top step is never mistaken for SS */
  --cf4:#C9CAD0;       /* the one grey in the confetti */

  /* Current grade (set by [data-g]); default B */
  --gc:var(--g-b); --gct:var(--g-b-t); --gco:var(--g-b-on);

  /* Type (DESIGN.md section 3) */
  --font:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --font-big:Archivo,Inter,system-ui,sans-serif;   /* big answer only, weight 800, width 72 to 80% */
  --big-stretch:72%;
  --fs-big:104px; --fs-big-reward:176px; --fs-big-min:78px;
  --fs-title:26px; --fs-card:19px; --fs-row:14px; --fs-btn:15px; --fs-note:12.5px; --fs-small:11.5px; --fs-tab:10.5px;

  /* Layout (DESIGN.md section 4) */
  --tabbar:60px; --btn-h:50px; --btn-r:13px; --hit:44px; --pad:18px; --bar:3px;
  --icon:26px; --icon-subject:40px; --lysa-cheer:40px;

  /* Motion: only at reward moments */
  --t-tap:100ms; --ease-pop:cubic-bezier(.2,.9,.3,1.15);

  color-scheme:light dark;
}

/* Night, by the phone */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="day"]){
    --bg:#0F1012; --tx:#EDEEF0; --mu:#8E9199; --ln:#26272C; --sf:#191A1E; --sh:#191A1E; --dim:#000000; --scrim:rgba(0,0,0,.62);
    --need:#F0A52B; --ok:#3FB37F; --risk:#F0645A; --rk:#5B95FF;
    --br:#8F8BFF; --brt:#0F1012; --brx:#A5A1FF;
    --g-f:#FF7A7A; --g-f-t:#FF7A7A; --g-f-on:#0F1012;
    --g-e:#D99A6C; --g-e-t:#D99A6C; --g-e-on:#0F1012;
    --g-d:#C3CADB; --g-d-t:#C3CADB; --g-d-on:#0F1012;
    --g-c:#2BD67B; --g-c-t:#2BD67B; --g-c-on:#0F1012;
    --g-b:#5B95FF; --g-b-t:#5B95FF; --g-b-on:#0F1012;
    --g-a:#E07FEE; --g-a-t:#E07FEE; --g-a-on:#0F1012;
    --g-s:#FFCB45; --g-s-t:#FFCB45; --g-s-on:#0F1012;
    --g-ss:#FFCB45; --g-ss-t:#FFCB45; --g-ss-on:#0F1012;
    --g-ring:#EDEEF0; --cf4:#4B4E57;
  }
}
/* Night, forced */
:root[data-theme="night"]{
  --bg:#0F1012; --tx:#EDEEF0; --mu:#8E9199; --ln:#26272C; --sf:#191A1E; --sh:#191A1E; --dim:#000000; --scrim:rgba(0,0,0,.62);
  --need:#F0A52B; --ok:#3FB37F; --risk:#F0645A; --rk:#5B95FF;
  --br:#8F8BFF; --brt:#0F1012; --brx:#A5A1FF;
  --g-f:#FF7A7A; --g-f-t:#FF7A7A; --g-f-on:#0F1012;
  --g-e:#D99A6C; --g-e-t:#D99A6C; --g-e-on:#0F1012;
  --g-d:#C3CADB; --g-d-t:#C3CADB; --g-d-on:#0F1012;
  --g-c:#2BD67B; --g-c-t:#2BD67B; --g-c-on:#0F1012;
  --g-b:#5B95FF; --g-b-t:#5B95FF; --g-b-on:#0F1012;
  --g-a:#E07FEE; --g-a-t:#E07FEE; --g-a-on:#0F1012;
  --g-s:#FFCB45; --g-s-t:#FFCB45; --g-s-on:#0F1012;
  --g-ss:#FFCB45; --g-ss-t:#FFCB45; --g-ss-on:#0F1012;
  --g-ring:#EDEEF0; --cf4:#4B4E57;
  color-scheme:dark;
}
:root[data-theme="day"]{color-scheme:light}

/* Pick the current grade's colour. Use on any element that shows a grade letter or its reward moment. */
[data-g="F"]{--gc:var(--g-f);--gct:var(--g-f-t);--gco:var(--g-f-on)}
[data-g="E"]{--gc:var(--g-e);--gct:var(--g-e-t);--gco:var(--g-e-on)}
[data-g="D"]{--gc:var(--g-d);--gct:var(--g-d-t);--gco:var(--g-d-on)}
[data-g="C"]{--gc:var(--g-c);--gct:var(--g-c-t);--gco:var(--g-c-on)}
[data-g="B"]{--gc:var(--g-b);--gct:var(--g-b-t);--gco:var(--g-b-on)}
[data-g="A"]{--gc:var(--g-a);--gct:var(--g-a-t);--gco:var(--g-a-on)}
[data-g="S"]{--gc:var(--g-s);--gct:var(--g-s-t);--gco:var(--g-s-on)}
[data-g="SS"],[data-g="SS+"]{--gc:var(--g-ss);--gct:var(--g-ss-t);--gco:var(--g-ss-on)}
/* SS and SS+ sit on the gold plate: ink letter, gold lit step and gold confetti, the same by day and night */
[data-g="SS"] .grade-letter,[data-g="SS+"] .grade-letter{background:var(--g-plate);color:var(--g-plate-tx);border-radius:26px;padding:16px 18px 4px}
[data-g="SS+"] .grade-letter{box-shadow:0 0 0 3px var(--g-ring)}
[data-g="SS"],[data-g="SS+"]{--gc:var(--g-plate);--gco:var(--g-plate-tx)}

@media (prefers-reduced-motion:reduce){:root{--t-tap:0ms}}
