/* ============================================================================
 * mastery-os.css — the Mastery OS design-system component classes.
 * Ported verbatim from the approved UI/UX prototype (temp/Ui uX assets/
 * prototype.html). Colour tokens live in index.html :root (--parch, --phy, etc.).
 * Loaded globally via index.html <link>. The prototype's harness chrome
 * (.app/.phone frame, .ctrl/.seg viewport toggle, screen switcher) is NOT ported.
 * Phone-frame rules became real `@media (max-width:767px)` breakpoints.
 * ========================================================================== */

:root {
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --press: inset 0 1px 0 rgba(255,255,255,.28), 0 2px 0 rgba(0,0,0,.16), 0 4px 9px rgba(0,0,0,.14);
  --press-active: inset 0 1px 0 rgba(255,255,255,.2);
  --raise: 0 2px 9px rgba(0,0,0,.07);
}

/* ── Section heading ───────────────────────────────────────────────────── */
.mos .sec { font-size: 13px; font-weight: 500; color: var(--ink2); margin: 0 0 10px; }
.mos .stk > * { margin-bottom: 16px; } .mos .stk > *:last-child { margin-bottom: 0; }

/* ── Daily test hero ───────────────────────────────────────────────────── */
.mos .daily { background: var(--esha); border-radius: var(--r-lg); padding: 17px; display: flex; align-items: center; gap: 14px; color: #fff; cursor: pointer; box-shadow: 0 6px 16px rgba(83,74,183,.26); }
.mos .daily .ic { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.17); display: flex; align-items: center; justify-content: center; flex: none; }
.mos .daily .tx { flex: 1; } .mos .daily .tx b { font-size: 16px; font-weight: 500; display: block; } .mos .daily .tx span { font-size: 12.5px; opacity: .9; }
.mos .daily .go { background: #fff; color: var(--esha); border-radius: var(--r-pill); padding: 10px 19px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.mos .dailyhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mos .dailyhead .sec { margin: 0; }
.mos .daysneet { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--bad); background: var(--badL); border: 0.5px solid #f3d3d3; border-radius: var(--r-pill); padding: 6px 12px; white-space: nowrap; }

/* ── Subject cards ─────────────────────────────────────────────────────── */
.mos .subjects { display: grid; gap: 12px; grid-template-columns: repeat(3,1fr); }
.mos .scard { background: var(--card); border: 0.5px solid var(--line); border-radius: 15px; padding: 14px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 11px; }
.mos .scard:before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.mos .scard.phy:before { background: var(--phy); } .mos .scard.che:before { background: var(--che); } .mos .scard.bio:before { background: var(--bio); }
.mos .sct { display: flex; align-items: center; gap: 9px; }
.mos .sci { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.mos .sci.phy { background: var(--phyL); color: var(--phy); } .mos .sci.che { background: var(--cheL); color: var(--che); } .mos .sci.bio { background: var(--bioL); color: var(--bio); }
.mos .scn { font-size: 14.5px; font-weight: 500; } .mos .scu { font-size: 11.5px; color: var(--ink2); }
.mos .scmid { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mos .scpct { font-size: 25px; font-weight: 500; line-height: 1; } .mos .sclab { font-size: 10.5px; color: var(--ink3); }
.mos .scbtn { display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--r-pill); padding: 10px; font-size: 12.5px; font-weight: 500; color: #fff; cursor: pointer; }
.mos .scbtn.phy { background: var(--phy); } .mos .scbtn.che { background: var(--che); } .mos .scbtn.bio { background: var(--bio); }

/* ── Module tiles ──────────────────────────────────────────────────────── */
.mos .mods { display: grid; gap: 9px; grid-template-columns: repeat(6,1fr); }
.mos .mod { background: var(--card); border: 0.5px solid var(--line); border-radius: 13px; padding: 13px 4px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; }
.mos .mod span { font-size: 10.5px; color: #444441; line-height: 1.2; }

/* ── Esha CTA ──────────────────────────────────────────────────────────── */
.mos .ecta { display: flex; align-items: center; gap: 11px; background: var(--card); border: 0.5px solid var(--line); border-radius: 14px; padding: 12px 15px; cursor: pointer; }
.mos .ecta .t { flex: 1; } .mos .ecta .t b { font-size: 13.5px; font-weight: 500; display: block; } .mos .ecta .t span { font-size: 12px; color: var(--ink2); }

/* ── Quiz ──────────────────────────────────────────────────────────────── */
.mos .qcard { background: #F6FAFE; border: 0.5px solid var(--line); border-radius: 15px; overflow: hidden; }
.mos .qcard.phy { background: #F6FAFE; } .mos .qcard.che { background: #F2FAF6; } .mos .qcard.bio { background: #FDF5F8; }
.mos .qstripe { height: 5px; background: var(--phy); }
.mos .qcard.che .qstripe { background: var(--che); } .mos .qcard.bio .qstripe { background: var(--bio); }
.mos .qpad { padding: 16px; display: flex; flex-direction: column; gap: 13px; }
.mos .qtop { display: flex; justify-content: space-between; align-items: center; }
.mos .qsurface { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--phyD); }
.mos .qcard.che .qsurface { color: var(--cheD); } .mos .qcard.bio .qsurface { color: var(--bioD); }
.mos .qsurface .tag { background: var(--phyL); color: var(--phyD); border-radius: 6px; padding: 3px 8px; font-size: 11px; }
.mos .qcard.che .qsurface .tag { background: var(--cheL); color: var(--cheD); } .mos .qcard.bio .qsurface .tag { background: var(--bioL); color: var(--bioD); }
.mos .qcount { font-size: 12.5px; color: var(--ink2); }
.mos .qdots { display: flex; gap: 3px; flex-wrap: wrap; }
.mos .qdots i { width: 13px; height: 5px; border-radius: var(--r-pill); background: #dad6ca; }
.mos .qdots i.done { background: var(--phy); } .mos .qdots i.cur { background: var(--phyD); width: 19px; }
.mos .qcard.che .qdots i.done { background: var(--che); } .mos .qcard.che .qdots i.cur { background: var(--cheD); }
.mos .qcard.bio .qdots i.done { background: var(--bio); } .mos .qcard.bio .qdots i.cur { background: var(--bioD); }
/* Quiz progress bar — replaces the "1 / N" counter + dot row. Subject-tinted fill. */
.mos .qprog { height: 6px; border-radius: var(--r-pill); background: #E4E0D4; overflow: hidden; margin-top: 2px; }
.mos .qprog > i { display: block; height: 100%; background: var(--phy); border-radius: var(--r-pill); transition: width .35s ease; }
.mos .qcard.che .qprog > i { background: var(--che); } .mos .qcard.bio .qprog > i { background: var(--bio); }
.mos .qstem { font-size: 15px; line-height: 1.55; }
.mos .qopt { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 11px; border: 0.5px solid #e0dccf; background: #fbfaf7; font-size: 14.5px; margin-bottom: 8px; cursor: pointer; }
.mos .qkey { width: 24px; height: 24px; border-radius: 7px; background: #F1EFE8; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 500; color: var(--ink2); flex: none; }
.mos .qopt.ok { border: 1.5px solid var(--ok); background: var(--okL); } .mos .qopt.ok .qkey { background: var(--ok); color: #fff; } .mos .qopt.ok .qm { color: var(--ok); }
.mos .qopt.no { border: 1.5px solid var(--bad); background: var(--badL); } .mos .qopt.no .qkey { background: var(--bad); color: #fff; } .mos .qopt.no .qm { color: var(--bad); }
.mos .qot { flex: 1; } .mos .qm { font-size: 18px; display: inline-flex; }
.mos .qlearn { display: flex; align-items: center; gap: 11px; background: var(--eshaL); border: 0.5px solid #cecbf6; border-radius: 12px; padding: 10px 13px; font-size: 13.5px; color: var(--esha); cursor: pointer; }
.mos .qlearn b { font-weight: 500; }
.mos .qfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mos .qnext { background: var(--phy); color: #fff; border-radius: var(--r-pill); padding: 10px 22px; font-size: 13.5px; font-weight: 500; cursor: pointer; border: none; font-family: inherit; }
.mos .qcard.che .qnext { background: var(--che); } .mos .qcard.bio .qnext { background: var(--bio); }
.mos .qlater { font-size: 13.5px; color: var(--ink2); background: #fff; border: 0.5px solid var(--line2); border-radius: var(--r-pill); padding: 10px 18px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); font-family: inherit; }
.mos .qlater:active { transform: translateY(1px); }

/* ── Mock portal + scorecard ───────────────────────────────────────────── */
.mos .mock-hero { background: var(--card); border: 0.5px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 13px; align-items: flex-start; }
.mos .mock-badge { font-size: 11.5px; background: var(--eshaL); color: var(--esha); border-radius: var(--r-pill); padding: 5px 12px; font-weight: 500; }
.mos .mock-title { font-size: 21px; font-weight: 500; }
.mos .mock-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.mos .mock-meta span { font-size: 12.5px; background: #F1EFE8; border: 0.5px solid var(--line); border-radius: var(--r-sm); padding: 7px 11px; color: var(--ink2); } .mos .mock-meta b { color: var(--ink); font-weight: 500; }
.mos .mbtn { background: var(--esha); color: #fff; border-radius: var(--r-pill); padding: 12px 26px; font-size: 14.5px; font-weight: 500; cursor: pointer; border: none; font-family: inherit; }
.mos .scard2 { background: var(--card); border: 0.5px solid var(--line); border-radius: 15px; padding: 17px; display: flex; flex-direction: column; gap: 13px; }
.mos .sbig { font-size: 30px; font-weight: 500; } .mos .sbig span { font-size: 16px; color: var(--ink3); }
.mos .srow { display: flex; align-items: center; gap: 11px; }
.mos .sname { width: 78px; font-size: 13px; font-weight: 500; }
.mos .strack { flex: 1; height: 9px; border-radius: var(--r-pill); background: #F1EFE8; overflow: hidden; } .mos .strack > i { display: block; height: 100%; border-radius: var(--r-pill); }
.mos .sval { width: 66px; text-align: right; font-size: 12px; color: var(--ink2); }
.mos .sweak { display: flex; flex-wrap: wrap; gap: 7px; }
.mos .stag { font-size: 12px; background: #F1EFE8; border: 0.5px solid var(--line); border-radius: var(--r-pill); padding: 5px 11px; color: #444441; }
.mos .sfoc { display: flex; gap: 10px; background: var(--badL); border: 0.5px solid #f3d3d3; border-radius: 12px; padding: 11px 13px; align-items: flex-start; }
.mos .sfoc > .ic { color: var(--bad); } .mos .sfoc div { font-size: 13px; color: #791F1F; line-height: 1.5; } .mos .sfoc b { font-weight: 500; }

/* ── Library list ──────────────────────────────────────────────────────── */
.mos .listcard { background: var(--card); border: 0.5px solid var(--line); border-radius: 15px; padding: 4px 15px; }
.mos .lrow { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 0.5px solid #efece2; cursor: pointer; } .mos .lrow:last-child { border-bottom: 0; }
.mos .lrow .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mos .lrow .t { flex: 1; font-size: 13.5px; } .mos .lrow .t b { font-weight: 500; } .mos .lrow .t span { color: var(--ink3); font-size: 12px; }
.mos .lrow .go { color: var(--ink2); }

/* ── Profile ───────────────────────────────────────────────────────────── */
.mos .phead { display: flex; align-items: center; gap: 14px; background: var(--card); border: 0.5px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.mos .pav { width: 52px; height: 52px; border-radius: 50%; background: var(--esha); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 500; flex: none; }
.mos .pid { flex: 1; } .mos .pid b { font-size: 15.5px; font-weight: 500; display: block; } .mos .pid span { font-size: 12.5px; color: var(--ink2); }
.mos .pstats { display: grid; gap: 10px; grid-template-columns: repeat(4,1fr); }
.mos .pstat { background: var(--parch); border-radius: 12px; padding: 12px; text-align: center; } .mos .pstat b { font-size: 20px; font-weight: 500; display: block; } .mos .pstat span { font-size: 10.5px; color: var(--ink2); }
.mos .pcard { background: var(--card); border: 0.5px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mos .acct { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 12px; border: 0.5px solid #e0dccf; background: #fff; font-size: 14px; cursor: pointer; } .mos .acct > .ic { color: var(--ink2); }
.mos .danger { border: 0.5px solid #f0c8c8; background: var(--badL); border-radius: 12px; padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.mos .danger .t { font-size: 13px; color: #791F1F; line-height: 1.55; } .mos .danger .t b { font-weight: 500; }
.mos .delbtn { align-self: flex-start; font-size: 13px; font-weight: 500; color: #fff; background: var(--bad); border-radius: var(--r-pill); padding: 9px 16px; cursor: pointer; border: none; font-family: inherit; }

/* ── Gamified syllabus level-path ──────────────────────────────────────── */
.mos .path { position: relative; padding: 4px 0; max-width: 540px; margin: 0 auto; }
.mos .path:before { content: ""; position: absolute; left: 23px; top: 34px; bottom: 34px; width: 4px; background: var(--sa,#185FA5); opacity: .22; border-radius: 4px; }
.mos .lvl-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.mos .lvl-node { position: relative; flex: none; width: 48px; display: flex; justify-content: center; }
.mos .lvl-row.current .lvl-node { filter: drop-shadow(0 0 7px var(--sa,#185FA5)); }
.mos .lvl-star { position: absolute; top: -4px; right: -2px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.mos .lvl-card { flex: 1; background: var(--card); border: 0.5px solid var(--line); border-radius: 13px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.mos .lvl-row.current .lvl-card { border: 1.5px solid var(--sa,#185FA5); box-shadow: 0 0 0 3px var(--saL,#E6F1FB); }
.mos .lvl-row.future { opacity: .5; }
.mos .lvl-l { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mos .lvl-t { font-size: 13.5px; font-weight: 500; } .mos .lvl-m { font-size: 11.5px; color: var(--ink3); }
.mos .lvl-pill { font-size: 10.5px; font-weight: 500; color: #fff; background: var(--sa,#185FA5); border-radius: var(--r-pill); padding: 3px 9px; white-space: nowrap; }
.mos .lvl-chev { color: var(--ink3); }
.mos .lvl-bar { display: flex; gap: 2px; margin-top: 7px; height: 9px; }
.mos .lvl-bar i { flex: 1; border-radius: 2px; }
.mos .lvl-cn { font-size: 10.5px; color: var(--ink3); margin-top: 5px; }
.mos .subtabs { display: flex; gap: 7px; margin-bottom: 14px; justify-content: center; }
.mos .subtabs button { border: 0.5px solid var(--line); background: #fff; font-family: inherit; font-size: 12.5px; padding: 7px 14px; border-radius: var(--r-pill); color: var(--ink2); cursor: pointer; }
.mos .subtabs button.on.phy { background: var(--phy); color: #fff; border-color: var(--phy); }
.mos .subtabs button.on.che { background: var(--che); color: #fff; border-color: var(--che); }
.mos .subtabs button.on.bio { background: var(--bio); color: #fff; border-color: var(--bio); }

/* ── ConceptLearn page chrome ──────────────────────────────────────────── */
.mos .cnav2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; background: #fff; border: 0.5px solid var(--line); border-radius: 13px; padding: 7px 8px; }
.mos .cnavbtn { display: flex; align-items: center; gap: 6px; font-family: inherit; font-size: 12.5px; color: var(--ink2); background: transparent; border: none; border-radius: var(--r-pill); padding: 7px 13px; cursor: pointer; }
.mos .cnav2 .cnavbtn:hover { background: var(--parch); }
.mos .ctest2 { font-family: inherit; font-size: 13px; font-weight: 500; color: #fff; border: none; border-radius: var(--r-pill); padding: 9px 18px; cursor: pointer; }
.mos .cpage.phy .ctest2 { background: var(--phy); } .mos .cpage.che .ctest2 { background: var(--che); } .mos .cpage.bio .ctest2 { background: var(--bio); }
.mos .chead-row { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.mos .cshield { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.mos .cpct2 { font-size: 13px; font-weight: 500; }
.mos .chead-txt { flex: 1; }
.mos .cunit { font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.mos .cpage.phy .cunit { color: var(--phy); } .mos .cpage.che .cunit { color: var(--che); } .mos .cpage.bio .cunit { color: var(--bio); }
.mos .chead-txt h4 { font-size: 21px; font-weight: 500; margin: 0; }
.mos .chead-txt .ph { font-size: 13px; color: var(--ink2); margin-top: 3px; }

/* ── Top nav (sub-page) ────────────────────────────────────────────────── */
.mos .topnav { display: flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px; color: var(--ink2); background: #fff; border: 0.5px solid var(--line); border-radius: var(--r-pill); padding: 7px 13px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.mos .chip2 { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink2); background: var(--parch); border-radius: var(--r-pill); padding: 5px 11px; }
.mos .chip2 b { color: var(--ink); font-weight: 500; } .mos .chip2.fire b { color: #993C1D; }

/* ── Level-up sheet overlay ────────────────────────────────────────────── */
.mos-scrim { position: fixed; inset: 0; background: rgba(8,10,20,.5); display: flex; align-items: center; justify-content: center; z-index: 60; }
.mos-sheet { background: #fff; border-radius: 22px; padding: 26px; width: 264px; text-align: center; box-shadow: 0 12px 34px rgba(0,0,0,.32); }
.mos-sheet h4 { font-size: 21px; font-weight: 500; margin: 12px 0 5px; color: var(--ink); }
.mos-sheet p { font-size: 13px; color: var(--ink2); margin: 0 0 18px; line-height: 1.55; }
.mos-sheet .okk { background: var(--esha); color: #fff; border-radius: var(--r-pill); padding: 11px 0; font-size: 14.5px; font-weight: 500; cursor: pointer; border: none; width: 100%; font-family: inherit; }

/* ── Global level badge — one always-on medallion, top-right on every screen.
   pointer-events:none so it never blocks the control beneath it. On level-up it
   runs a ~2s celebration pop (suppressed under prefers-reduced-motion). ──────── */
.gLevel { position: fixed; top: 10px; left: 50%; right: auto; transform: translateX(-50%); z-index: 55; pointer-events: none; }
.gLevel svg { filter: drop-shadow(0 1px 4px rgba(0,0,0,.16)); }
.gLevel.cel { animation: gLevelPop 2s ease; transform-origin: center; }
@keyframes gLevelPop { 0% { transform: translateX(-50%) scale(1); } 14% { transform: translateX(-50%) scale(1.34); } 38% { transform: translateX(-50%) scale(1.08); } 64% { transform: translateX(-50%) scale(1.18); } 100% { transform: translateX(-50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .gLevel.cel { animation: none; } }

/* When the Esha desktop side-panel is open, shift the main content left by the
   panel width so it is never hidden behind Esha (mobile uses --esha-height at the
   bottom instead, so this is md+ only). Panel width matches ChatWidget:968
   (md:w-[30vw] min 380 max 560). */
@media (min-width: 768px) {
  .esha-shift { transition: padding-right .5s ease; }
  body.esha-open .esha-shift { padding-right: clamp(380px, 30vw, 560px); }
}

/* ── Tactile press + raise (shared) ────────────────────────────────────── */
.mos .scbtn, .mos .qnext, .mos .mbtn, .mos .daily .go, .mos .ctest2, .mos .delbtn, .mos-sheet .okk {
  box-shadow: var(--press); transition: transform .07s ease, box-shadow .07s ease;
}
.mos .scbtn:active, .mos .qnext:active, .mos .mbtn:active, .mos .daily .go:active, .mos .ctest2:active, .mos .delbtn:active, .mos-sheet .okk:active {
  transform: translateY(2px); box-shadow: var(--press-active);
}
.mos .mod, .mos .acct, .mos .lvl-card, .mos .unit { transition: transform .07s ease, box-shadow .07s ease; }
.mos .mod:hover, .mos .acct:hover, .mos .lvl-card:hover, .mos .unit:hover { box-shadow: var(--raise); }
.mos .mod:active, .mos .acct:active, .mos .lvl-card:active, .mos .unit:active { transform: translateY(1px); }

/* ── Responsive (the prototype's phone-frame rules as real breakpoints) ── */
@media (max-width: 767px) {
  .mos .subjects { grid-template-columns: 1fr; }
  .mos .mods { grid-template-columns: repeat(3,1fr); }
  .mos .qfoot { flex-wrap: wrap; }
  .mos .pstats { grid-template-columns: repeat(2,1fr); }
  .mos .cnav2 .cnavbtn span { display: none; }
  .mos .chead-row { flex-wrap: wrap; }
}

/* ── App-wide "reduce motion" honouring ─────────────────────────────────────
 * When the OS/browser asks for reduced motion, collapse decorative animations
 * and transitions to near-instant everywhere (functional loaders degrade to a
 * static icon — acceptable, and brief). Component-level opt-ins (ShinyButton,
 * LevelBadge, the .gLevel celebration above) still apply on top of this. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
