/* ============================================================
   Design tokens
   ============================================================ */
:root{
  --font-ui:'Figtree',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-display:'Newsreader',Georgia,'Times New Roman',serif;

  --bg:#e9eef1;
  --bg-glow:radial-gradient(1200px 520px at 8% -10%, rgba(31,108,92,.16), transparent 55%),
            radial-gradient(900px 480px at 96% 0%, rgba(46,90,122,.12), transparent 50%),
            linear-gradient(180deg, #f4f7f8 0%, #e9eef1 42%, #e4eaed 100%);
  --surface:#ffffff;
  --surface-2:#f5f8f9;
  --surface-3:#e8eef1;
  --text:#152028;
  --text-2:#445560;
  --text-3:#7a8a94;
  --border:#d5dee4;
  --border-2:#c0ccd4;

  --accent:#1f6c5c;
  --accent-hover:#185749;
  --accent-soft:#e3f2ee;
  --accent-line:#b7d8cf;
  --on-accent:#ffffff;

  --ok:#1f6b45;
  --ok-soft:#e3f3ea;
  --warn:#9a6b16;
  --warn-soft:#f7efd9;
  --bad:#b1423a;
  --bad-soft:#f8e7e5;

  --r-sm:8px;
  --r-md:12px;
  --r-lg:18px;
  --r-full:999px;

  --sh-1:0 1px 2px rgba(21,32,40,.04);
  --sh-2:0 10px 28px -18px rgba(21,32,40,.22);
  --sh-3:0 28px 56px -24px rgba(21,32,40,.38);
}

body[data-track="beautician"]{
  --bg-glow:radial-gradient(1200px 520px at 8% -10%, rgba(154,77,92,.14), transparent 55%),
            radial-gradient(900px 480px at 96% 0%, rgba(122,74,98,.10), transparent 50%),
            linear-gradient(180deg, #f8f4f5 0%, #f1eaec 42%, #ebe3e6 100%);
  --accent:#9a4d5c;
  --accent-hover:#823f4d;
  --accent-soft:#f6e9ec;
  --accent-line:#e4c4cb;
}

html[data-mode="dark"]{
  --bg:#10161a;
  --bg-glow:radial-gradient(1000px 480px at 10% -8%, rgba(61,150,130,.18), transparent 55%),
            radial-gradient(800px 420px at 100% 0%, rgba(70,120,150,.12), transparent 50%),
            linear-gradient(180deg, #141c21 0%, #10161a 100%);
  --surface:#1a2228;
  --surface-2:#212a31;
  --surface-3:#2a343c;
  --text:#eef3f6;
  --text-2:#b7c4cd;
  --text-3:#84939e;
  --border:#2e3942;
  --border-2:#3d4a55;

  --accent:#5fbfab;
  --accent-hover:#79cfbd;
  --accent-soft:#1d322e;
  --accent-line:#355950;
  --on-accent:#0d1614;

  --ok:#7dcea0;
  --ok-soft:#1c2d24;
  --warn:#d4b06a;
  --warn-soft:#2c2518;
  --bad:#e09088;
  --bad-soft:#2f1f1d;

  --sh-1:0 1px 2px rgba(0,0,0,.35);
  --sh-2:0 10px 28px -18px rgba(0,0,0,.55);
  --sh-3:0 28px 56px -24px rgba(0,0,0,.7);
}
html[data-mode="dark"] body[data-track="beautician"]{
  --bg-glow:radial-gradient(1000px 480px at 10% -8%, rgba(190,110,125,.16), transparent 55%),
            radial-gradient(800px 420px at 100% 0%, rgba(140,90,120,.10), transparent 50%),
            linear-gradient(180deg, #1a1417 0%, #141014 100%);
  --accent:#d896a2;
  --accent-hover:#e4aab4;
  --accent-soft:#322025;
  --accent-line:#52343b;
}

/* ============================================================
   Base
   ============================================================ */
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html{-webkit-text-size-adjust:100%;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg);
  background-image:var(--bg-glow);
  color:var(--text);
  font-family:var(--font-ui);
  font-size:15px;
  line-height:1.55;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
body[data-lang="ne"]{ font-family:'Noto Sans Devanagari',var(--font-ui); }
body[data-lang="ne"] .display{ font-family:'Noto Sans Devanagari',serif; }
body.modal-open{ overflow:hidden; }

.display{ font-family:var(--font-display); font-weight:600; letter-spacing:-.01em; }

a{color:var(--accent);}
button,input,textarea{font:inherit;color:inherit;}
button{cursor:pointer;}

:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-radius:4px;
}

.wrap{ width:100%; max-width:1080px; margin:0 auto; padding:0 16px; }
.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;
}

/* ============================================================
   App bar
   ============================================================ */
.appbar{
  position:sticky; top:0; z-index:60;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter:saturate(1.6) blur(12px);
  -webkit-backdrop-filter:saturate(1.6) blur(12px);
  border-bottom:1px solid var(--border);
}
@supports not (backdrop-filter:blur(1px)){ .appbar{ background:var(--surface); } }

.appbar-row{
  display:flex; align-items:center; gap:12px;
  min-height:60px; padding-top:8px; padding-bottom:8px;
}
.brand{ display:flex; align-items:center; gap:11px; min-width:0; flex:1; }
.brand-mark{
  width:44px; height:44px; flex-shrink:0;
  border-radius:11px;
  background:var(--accent-soft);
  border:1px solid var(--accent-line);
  display:flex; align-items:center; justify-content:center;
  color:var(--accent);
}
.brand-mark svg{ width:20px; height:20px; display:none; }
body[data-track="barista"] .brand-mark .ic-cup{ display:block; }
body[data-track="beautician"] .brand-mark .ic-beauty{ display:block; }
.brand-text{ min-width:0; display:flex; flex-direction:column; }
.brand-title{
  font-family:var(--font-display); font-weight:600;
  font-size:15.5px; line-height:1.2; letter-spacing:-.01em;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
body[data-lang="ne"] .brand-title{ font-family:'Noto Sans Devanagari',serif; }
.brand-sub{
  font-size:11.5px; color:var(--text-3); line-height:1.3;
}

.appbar-tools{ display:flex; align-items:center; gap:8px; flex-shrink:0; }

.lbl-short{ display:none; }

/* reclaim width for the title on small screens */
@media (max-width:520px){
  .brand-mark{ width:34px; height:34px; border-radius:10px; }
  .brand-mark svg{ width:18px; height:18px; }
  .brand{ gap:9px; }
  .brand-title{ font-size:13.5px; }
  .brand-sub{ display:none; }
  .seg-btn{ padding:6px 9px; font-size:12px; }
  .lbl-full{ display:none; }
  .lbl-short{ display:inline; }
  .appbar-tools{ gap:6px; }
  .icon-btn{ width:44px; height:44px; }
}

.seg{
  display:flex; padding:3px; gap:2px;
  background:var(--surface-3);
  border:1px solid var(--border);
  border-radius:var(--r-full);
}
.seg-btn{
  border:none; background:transparent; color:var(--text-2);
  font-size:12.5px; font-weight:500;
  padding:6px 12px; border-radius:var(--r-full);
  min-height:32px; white-space:nowrap;
  transition:background .15s ease,color .15s ease;
}
.seg-btn[aria-pressed="true"]{
  background:var(--surface); color:var(--text);
  box-shadow:var(--sh-1); font-weight:600;
}

.icon-btn{
  width:44px; height:44px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text-2);
  border-radius:10px;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover{ background:var(--surface-3); color:var(--text); }
.icon-btn svg{ width:18px; height:18px; }
html[data-mode="dark"] .ic-sun{ display:none; }
html[data-mode="light"] .ic-moon{ display:none; }

/* Data menu popover */
.menu-wrap{ position:relative; }
.menu{
  position:absolute; right:0; top:calc(100% + 8px);
  min-width:212px; padding:6px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-md);
  box-shadow:var(--sh-2);
  display:none; z-index:70;
}
.menu.open{ display:block; }
.menu button{
  display:flex; align-items:center; gap:10px; width:100%;
  border:none; background:transparent; text-align:left;
  font-size:13.5px; color:var(--text-2);
  padding:9px 10px; border-radius:var(--r-sm); min-height:40px;
}
.menu button:hover{ background:var(--surface-3); color:var(--text); }
.menu button.danger:hover{ background:var(--bad-soft); color:var(--bad); }
.menu hr{ border:none; border-top:1px solid var(--border); margin:5px 2px; }
.menu svg{ width:15px; height:15px; flex-shrink:0; opacity:.7; }

/* ============================================================
   Track tabs
   ============================================================ */
.tabs{ display:flex; gap:4px; }
.tab{
  flex:1; min-width:0;
  border:none; background:transparent;
  padding:10px 12px 12px;
  border-bottom:2.5px solid transparent;
  color:var(--text-3);
  text-align:left;
  transition:color .15s ease, border-color .15s ease;
}
.tab:hover{ color:var(--text-2); }
.tab[aria-selected="true"]{ color:var(--text); border-bottom-color:var(--accent); }
.tab-label{
  display:block; font-size:14px; font-weight:600; line-height:1.3;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.tab-meta{
  display:flex; align-items:center; gap:7px;
  font-size:11.5px; color:var(--text-3); margin-top:5px;
}
.tab-bar{
  flex:1; max-width:96px; height:4px; border-radius:2px;
  background:var(--border); overflow:hidden;
}
.tab-bar i{
  display:block; height:100%; width:0%;
  background:var(--accent); border-radius:2px;
  transition:width .45s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   Cards & shared blocks
   ============================================================ */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-1);
}


main{ padding-bottom:64px; }

.path-strip{
  margin:18px 0 0;
  padding:16px 18px 4px;
  display:grid; gap:10px;
}
@media (min-width:720px){
  .path-strip{ grid-template-columns:repeat(3,1fr); gap:14px; padding:20px 4px 2px; }
}
.path-item{ min-width:0; }
.path-kicker{
  font-size:10.5px; font-weight:700; letter-spacing:.08em;
  text-transform:uppercase; color:var(--accent); margin-bottom:4px;
}
body[data-lang="ne"] .path-kicker{ text-transform:none; letter-spacing:.02em; font-size:11px; }
.path-title{
  font-family:var(--font-display); font-weight:600;
  font-size:17px; line-height:1.25; letter-spacing:-.015em;
}
body[data-lang="ne"] .path-title{ font-family:'Noto Sans Devanagari',serif; }
.path-text{ font-size:12.8px; color:var(--text-2); margin-top:4px; line-height:1.45; max-width:36ch; }

.overview{
  position:relative; overflow:hidden;
  background:linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, var(--accent-soft)), var(--surface));
}
.overview::before{
  content:""; position:absolute; inset:auto -20% -40% auto;
  width:220px; height:220px; border-radius:50%;
  background:radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events:none;
}

.module{
  transition:transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.module:hover{ box-shadow:var(--sh-2); border-color:color-mix(in srgb, var(--accent) 28%, var(--border)); }
.module.open{ border-color:color-mix(in srgb, var(--accent) 40%, var(--border)); }

.training{
  margin-top:18px; padding:0;
  background:linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--surface)), var(--surface));
  border:1px solid var(--accent-line);
  overflow:hidden;
}
.training-item{
  align-items:flex-start;
  background:var(--surface);
  box-shadow:none;
  transition:border-color .15s ease, background .15s ease;
}
.training-item:hover{ border-color:var(--accent); background:color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
.tag-cert{ background:var(--ok-soft); color:var(--ok); border-color:transparent; }
.tag-learn{ background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }

@keyframes riseIn{
  from{ opacity:0; transform:translateY(8px); }
  to{ opacity:1; transform:translateY(0); }
}
.path-strip .path-item,
.overview,
.module,
.training{
  animation:riseIn .45s ease both;
}
.path-strip .path-item:nth-child(2){ animation-delay:.05s; }
.path-strip .path-item:nth-child(3){ animation-delay:.1s; }
.overview{ animation-delay:.08s; }


/* ---------- Overview ---------- */
.overview{
  margin:20px 0 18px;
  padding:18px;
  display:grid;
  gap:18px;
  grid-template-columns:1fr;
}
@media (min-width:760px){
  .overview{ grid-template-columns:auto 1fr; align-items:center; padding:22px 24px; }
}
.ov-ring{ display:flex; align-items:center; gap:16px; }
.ring{ position:relative; width:78px; height:78px; flex-shrink:0; }
.ring svg{ width:100%; height:100%; transform:rotate(-90deg); }
.ring .track-c{ stroke:var(--border); }
.ring .val-c{
  stroke:var(--accent); stroke-linecap:butt;
  transition:stroke-dasharray .55s cubic-bezier(.4,0,.2,1);
}
/* the round cap renders as a stray dot when the value is zero */
.ring .val-c.has-value{ stroke-linecap:round; }
.ring-num{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:700; letter-spacing:-.02em;
}
.ov-heading{ font-size:16px; font-weight:600; line-height:1.3; }
.ov-hint{ font-size:12.5px; color:var(--text-3); margin-top:3px; max-width:34ch; }

.ov-right{ display:flex; flex-direction:column; gap:14px; min-width:0; }
.stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.stat{
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--r-md);
  padding:10px 12px;
  min-width:0;
}
.stat-v{ font-size:19px; font-weight:700; letter-spacing:-.02em; line-height:1.2; }
.stat-l{
  font-size:10.5px; color:var(--text-3); margin-top:2px;
  text-transform:uppercase; letter-spacing:.06em; font-weight:500;
  overflow:hidden; text-overflow:ellipsis;
}
body[data-lang="ne"] .stat-l{ text-transform:none; letter-spacing:0; font-size:11px; }

.ov-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:1px solid transparent; border-radius:10px;
  padding:10px 16px; min-height:42px;
  font-size:13.5px; font-weight:600;
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary{ background:var(--accent); color:var(--on-accent); }
.btn-primary:hover{ background:var(--accent-hover); }
.btn-primary:disabled{ opacity:.5; cursor:default; }
.btn-quiet{ background:var(--surface); border-color:var(--border-2); color:var(--text-2); }
.btn-quiet:hover{ background:var(--surface-3); color:var(--text); }
.btn svg{ width:16px; height:16px; }

.saved-chip{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; color:var(--text-3);
  opacity:0; transition:opacity .3s ease;
}
.saved-chip.show{ opacity:1; }
.saved-chip svg{ width:13px; height:13px; color:var(--ok); }

/* ---------- Toolbar ---------- */
.toolbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin-bottom:16px;
}
.search{
  position:relative; flex:1 1 220px; min-width:0;
}
.search svg.mag{
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  width:16px; height:16px; color:var(--text-3); pointer-events:none;
}
.search input{
  width:100%;
  border:1px solid var(--border-2);
  background:var(--surface);
  border-radius:10px;
  padding:10px 36px 10px 36px;
  min-height:42px;
  font-size:14px;
}
.search input::placeholder{ color:var(--text-3); }
.search-clear{
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  width:28px; height:28px; border:none; background:transparent;
  color:var(--text-3); border-radius:6px;
  display:none; align-items:center; justify-content:center;
}
.search-clear.show{ display:flex; }
.search-clear:hover{ background:var(--surface-3); color:var(--text); }
.search-clear svg{ width:14px; height:14px; }

.chips{ display:flex; gap:6px; }
.chip{
  border:1px solid var(--border-2);
  background:var(--surface);
  color:var(--text-2);
  border-radius:var(--r-full);
  padding:8px 14px; min-height:38px;
  font-size:12.5px; font-weight:500;
  white-space:nowrap;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.chip:hover{ background:var(--surface-3); }
.chip[aria-pressed="true"]{
  background:var(--accent); border-color:var(--accent); color:var(--on-accent); font-weight:600;
}

/* ============================================================
   Module cards
   ============================================================ */
.track[hidden]{ display:none; }
.modules{ display:flex; flex-direction:column; gap:12px; }

.module{ overflow:hidden; }
.module[data-hidden="true"]{ display:none; }

.mod-head{
  display:flex; align-items:center; gap:13px; width:100%;
  border:none; background:transparent;
  padding:15px 16px; text-align:left;
  transition:background .15s ease;
}
.mod-head:hover{ background:var(--surface-2); }
.mod-badge{
  flex-shrink:0; width:34px; height:34px;
  border-radius:10px;
  background:var(--surface-3);
  border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:700; color:var(--text-2);
  font-variant-numeric:tabular-nums;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.module.complete .mod-badge{
  background:var(--ok-soft); border-color:transparent; color:var(--ok);
}
.module.complete .mod-badge svg{ width:16px; height:16px; }
.mod-titles{ flex:1; min-width:0; display:flex; flex-direction:column; }
.mod-kicker{
  font-size:10.5px; font-weight:600; letter-spacing:.09em;
  text-transform:uppercase; color:var(--text-3);
}
body[data-lang="ne"] .mod-kicker{ text-transform:none; letter-spacing:.02em; font-size:11px; }
.mod-title{
  font-family:var(--font-display); font-weight:600;
  font-size:16.5px; line-height:1.3; letter-spacing:-.01em;
  margin-top:1px;
}
body[data-lang="ne"] .mod-title{ font-family:'Noto Sans Devanagari',serif; }
.mod-right{ display:flex; align-items:center; gap:12px; flex-shrink:0; }
.mod-count{
  font-size:12px; font-weight:600; color:var(--text-3);
  font-variant-numeric:tabular-nums;
}
.module.complete .mod-count{ color:var(--ok); }
.chev{ width:18px; height:18px; color:var(--text-3); transition:transform .25s ease; }
.module.open .chev{ transform:rotate(180deg); }

.mod-body{ display:none; padding:0 16px 16px; }
.module.open .mod-body{ display:block; }

.sec-label{
  font-size:10.5px; font-weight:600; letter-spacing:.09em;
  text-transform:uppercase; color:var(--text-3);
  margin:6px 0 8px;
}
body[data-lang="ne"] .sec-label{ text-transform:none; letter-spacing:.02em; font-size:11.5px; }

/* ---------- Steps ---------- */
.steps{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:7px; }
.step{
  display:flex; align-items:flex-start; gap:11px;
  border:1px solid var(--border);
  background:var(--surface-2);
  border-radius:var(--r-md);
  padding:10px 12px;
  transition:border-color .2s ease, background .2s ease;
}
.step[data-hidden="true"]{ display:none; }
.step.done{ background:transparent; border-color:var(--border); }
.step.flash{ animation:flash 1.6s ease; }
@keyframes flash{
  0%,100%{ box-shadow:0 0 0 0 transparent; }
  15%,60%{ box-shadow:0 0 0 3px var(--accent-soft); border-color:var(--accent); }
}

.step-check{
  flex-shrink:0; margin-top:1px;
  width:24px; height:24px; border-radius:50%;
  border:1.5px solid var(--border-2);
  background:transparent;
  display:flex; align-items:center; justify-content:center;
  color:transparent;
  transition:background .18s ease, border-color .18s ease, color .18s ease;
}
.step-check:hover{ border-color:var(--accent); }
.step-check svg{ width:13px; height:13px; }
.step.done .step-check{
  background:var(--ok); border-color:var(--ok); color:#fff;
}
html[data-mode="dark"] .step.done .step-check{ color:#141311; }

.step-main{ flex:1; min-width:0; }
.step-text{ font-size:13.8px; line-height:1.45; }
.step.done .step-text{ color:var(--text-3); text-decoration:line-through; text-decoration-thickness:1px; }
.step-meta{ display:flex; align-items:center; gap:8px; margin-top:6px; flex-wrap:wrap; }

.tag{
  display:inline-flex; align-items:center; gap:4px;
  font-size:10.5px; font-weight:600; letter-spacing:.03em;
  padding:2.5px 7px; border-radius:5px;
  background:var(--surface-3); color:var(--text-3);
  border:1px solid var(--border);
}
.tag svg{ width:11px; height:11px; }
.tag.t-video{ background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }

.step-open{
  display:inline-flex; align-items:center; gap:5px;
  font-size:12px; font-weight:600;
  color:var(--accent); text-decoration:none;
  padding:3px 0;
}
.step-open:hover{ text-decoration:underline; }
.step-open svg{ width:12px; height:12px; }

/* ---------- Source / notes / quiz ---------- */
.source{
  display:flex; align-items:center; gap:9px;
  margin-top:12px; padding:10px 12px;
  border:1px dashed var(--border-2);
  border-radius:var(--r-md);
  text-decoration:none; color:var(--text-2);
  font-size:12.8px;
  transition:background .15s ease, border-color .15s ease;
}
.source:hover{ background:var(--surface-2); border-color:var(--accent); color:var(--text); }
.source svg{ width:14px; height:14px; flex-shrink:0; color:var(--text-3); }
.source b{ font-weight:600; }

.notes{ margin-top:14px; }
.notes textarea{
  width:100%; min-height:74px; resize:vertical;
  border:1px solid var(--border);
  background:var(--surface-2);
  border-radius:var(--r-md);
  padding:10px 12px;
  font-size:13.5px; line-height:1.5;
}
.notes textarea::placeholder{ color:var(--text-3); }
.notes textarea:focus{ background:var(--surface); }

.quiz-row{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  margin-top:14px; padding-top:14px;
  border-top:1px solid var(--border);
}
.score-pill{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; font-weight:600;
  padding:5px 10px; border-radius:var(--r-full);
  background:var(--surface-3); color:var(--text-3);
}
.score-pill.pass{ background:var(--ok-soft); color:var(--ok); }
.score-pill.partial{ background:var(--warn-soft); color:var(--warn); }
.score-pill svg{ width:12px; height:12px; }

/* ---------- Training & certification panel (compact by default) ---------- */
.training-fold{ margin:0; }
.training-summary{
  list-style:none;
  display:flex; align-items:center; gap:12px;
  padding:14px 16px;
  cursor:pointer;
  user-select:none;
  min-height:48px;
}
.training-summary::-webkit-details-marker{ display:none; }
.training-summary:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:-2px;
  border-radius:var(--r-md);
}
.training-summary-main{ flex:1; min-width:0; display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px; }
.training-title{
  font-family:var(--font-display); font-weight:600;
  font-size:16px; letter-spacing:-.015em; line-height:1.25;
}
body[data-lang="ne"] .training-title{ font-family:'Noto Sans Devanagari',serif; }
.training-count{
  font-size:12.2px; font-weight:600;
  color:var(--text-3);
  padding:2px 8px;
  border-radius:var(--r-full);
  background:var(--surface-3);
}
.training-summary .chev{ width:18px; height:18px; color:var(--text-3); transition:transform .25s ease; flex-shrink:0; }
.training-fold[open] .training-summary .chev{ transform:rotate(180deg); }
.training-fold[open] .training-summary{
  border-bottom:1px solid var(--accent-line);
  background:color-mix(in srgb, var(--accent-soft) 30%, transparent);
}
.training-body{ padding:12px 16px 16px; }
.training-hint{ font-size:12.6px; color:var(--text-2); line-height:1.45; max-width:62ch; }
.training-list{ display:flex; flex-direction:column; gap:8px; margin-top:12px; }
.training-item{
  display:flex; align-items:flex-start; gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:var(--r-md);
  background:var(--surface);
  text-decoration:none; color:inherit;
  transition:border-color .15s ease, background .15s ease;
}
.training-item:hover{ border-color:var(--accent); }
.training-main{ flex:1; min-width:0; }
.training-name{ display:block; font-size:13.4px; font-weight:600; color:var(--accent); line-height:1.35; }
.training-note{ display:block; font-size:12px; color:var(--text-3); margin-top:2px; line-height:1.4; }
.training-item .tag{ flex-shrink:0; margin-top:1px; font-size:11px; }
.tag-free,.tag-cert{ background:var(--ok-soft); color:var(--ok); border-color:transparent; }
.tag-learn{ background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.tag-paid{ background:var(--surface-3); color:var(--text-3); }
.tag-official{ background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }

/* ---------- Empty state ---------- */
.empty{
  display:none; text-align:center; padding:44px 20px;
  color:var(--text-3); font-size:14px;
}
.empty.show{ display:block; }
.empty svg{ width:28px; height:28px; margin-bottom:10px; opacity:.5; }

/* ---------- Track complete banner ---------- */
.done-banner{
  display:none; align-items:center; gap:11px;
  margin-bottom:14px; padding:13px 16px;
  background:var(--ok-soft);
  border:1px solid transparent;
  border-radius:var(--r-md);
  color:var(--ok); font-size:13.5px; font-weight:600;
}
.done-banner.show{ display:flex; }
.done-banner svg{ width:19px; height:19px; flex-shrink:0; }

footer{
  text-align:center; font-size:12px; color:var(--text-3);
  padding:8px 16px 32px; line-height:1.6;
}

/* ============================================================
   Toast
   ============================================================ */
.toast{
  position:fixed; z-index:90;
  left:12px; right:12px;
  bottom:calc(12px + env(safe-area-inset-bottom,0px));
  max-width:440px; margin:0 auto;
  background:var(--surface);
  border:1px solid var(--border-2);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-3);
  padding:14px 16px;
  display:none;
  transform:translateY(12px); opacity:0;
  transition:transform .25s ease, opacity .25s ease;
}
.toast.show{ display:block; transform:translateY(0); opacity:1; }
.toast-text{ font-size:13.5px; line-height:1.45; }
.toast-text b{ font-weight:600; }
.toast-actions{ display:flex; gap:8px; margin-top:12px; }
.toast-actions .btn{ flex:1; }

/* ============================================================
   Password gate
   ============================================================ */
body.locked{
  /* avoid overflow:hidden — it can block typing in fixed inputs on mobile */
  margin:0;
}
body.locked #app{
  display:none !important;
  pointer-events:none !important;
}
.gate{
  position:fixed; inset:0; z-index:9999;
  display:flex; align-items:center; justify-content:center;
  padding:24px 18px;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(31,108,92,.22), transparent 55%),
    radial-gradient(700px 420px at 92% 8%, rgba(46,90,122,.14), transparent 50%),
    var(--bg);
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  pointer-events:auto;
}
.gate.hidden{ display:none !important; }
.gate-card{
  width:100%; max-width:380px;
  padding:28px 24px 24px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-3);
  position:relative;
  z-index:1;
  pointer-events:auto;
}
.gate-lang{
  position:absolute; top:14px; right:14px;
  display:inline-flex; gap:4px;
  padding:3px;
  border-radius:var(--r-full);
  background:var(--surface-2);
  border:1px solid var(--border);
}
.gate-lang .seg-btn{
  min-height:36px; min-width:40px;
  padding:0 10px;
  border:0; border-radius:var(--r-full);
  background:transparent;
  color:var(--text-2);
  font:inherit; font-size:12.5px; font-weight:600;
  cursor:pointer;
}
.gate-lang .seg-btn[aria-pressed="true"]{
  background:var(--surface);
  color:var(--text);
  box-shadow:var(--sh-1);
}
.gate-mark{
  width:48px; height:48px;
  display:grid; place-items:center;
  border-radius:14px;
  background:var(--accent-soft);
  color:var(--accent);
  margin-bottom:16px;
}
.gate-mark svg{ width:26px; height:26px; }
.gate-title{
  margin:0;
  font-family:var(--font-display);
  font-size:26px; font-weight:600;
  letter-spacing:-.02em;
  color:var(--text);
  line-height:1.2;
}
body[data-lang="ne"] .gate-title{ font-family:'Noto Sans Devanagari',serif; }
.gate-hint{
  margin:8px 0 0;
  font-size:13.5px;
  color:var(--text-2);
  line-height:1.45;
}
.gate-label{
  display:block;
  margin:18px 0 6px;
  font-size:12.5px;
  font-weight:600;
  color:var(--text-2);
}
.gate-input{
  width:100%;
  box-sizing:border-box;
  padding:12px 14px;
  min-height:48px;
  border:1px solid var(--border-2);
  border-radius:var(--r-md);
  background:var(--surface);
  color:var(--text);
  font:inherit; font-size:16px;
  pointer-events:auto;
  -webkit-user-select:text;
  user-select:text;
  position:relative;
  z-index:3;
}
.gate-input:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
  border-color:var(--accent);
  background:var(--surface);
}
.gate-error{
  margin:10px 0 0;
  font-size:13px;
  color:var(--bad);
  line-height:1.4;
}
.gate-submit{
  width:100%;
  margin-top:16px;
  min-height:48px;
  justify-content:center;
}

/* ============================================================
   Quiz modal
   ============================================================ */
.overlay{
  position:fixed; inset:0; z-index:100;
  background:rgba(20,17,14,.62);
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
  display:none;
  align-items:flex-start; justify-content:center;
  overflow-y:auto; overscroll-behavior:contain;
}
.overlay.open{ display:flex; }
.modal{
  background:var(--surface);
  width:100%; max-width:680px;
  min-height:100%;
  display:flex; flex-direction:column;
}
@media (min-width:760px){
  .overlay{ padding:32px 20px; align-items:center; }
  .modal{ min-height:auto; border-radius:var(--r-lg); box-shadow:var(--sh-3); max-height:calc(100vh - 64px); }
}

.modal-head{
  position:sticky; top:0; z-index:2;
  display:flex; align-items:center; gap:12px;
  padding:15px 18px;
  background:var(--surface);
  border-bottom:1px solid var(--border);
}
@media (min-width:760px){ .modal-head{ border-radius:var(--r-lg) var(--r-lg) 0 0; } }
.modal-head-text{ flex:1; min-width:0; }
.modal-title{
  font-family:var(--font-display); font-weight:600;
  font-size:16.5px; line-height:1.3; letter-spacing:-.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
body[data-lang="ne"] .modal-title{ font-family:'Noto Sans Devanagari',serif; }
.modal-sub{ font-size:11.5px; color:var(--text-3); margin-top:2px; }

.modal-body{ padding:6px 18px; flex:1; }
@media (min-width:760px){ .modal-body{ overflow-y:auto; } }

/* difficulty tier bands inside a quiz */
.tier{
  display:flex; flex-direction:column; gap:2px;
  margin:18px 0 2px; padding:11px 13px;
  background:var(--surface-3);
  border-left:3px solid var(--accent);
  border-radius:0 var(--r-sm) var(--r-sm) 0;
}
.tier:first-child{ margin-top:10px; }
.tier-core{ border-left-color:var(--ok); }
.tier-applied{ border-left-color:var(--accent); }
.tier-advanced{ border-left-color:var(--warn); }
.tier-name{ font-size:12.5px; font-weight:700; letter-spacing:.02em; }
.tier-desc{ font-size:11.5px; color:var(--text-3); }

.q{ padding:18px 0; border-bottom:1px solid var(--border); }
.q:last-child{ border-bottom:none; }
.q-num{
  font-size:10.5px; font-weight:600; letter-spacing:.09em;
  text-transform:uppercase; color:var(--text-3);
}
body[data-lang="ne"] .q-num{ text-transform:none; letter-spacing:.02em; }
.q-title{ font-size:14.5px; font-weight:600; line-height:1.45; margin:5px 0 11px; }

.opt{
  display:flex; align-items:flex-start; gap:10px;
  border:1px solid var(--border);
  background:var(--surface-2);
  border-radius:10px;
  padding:11px 12px; margin-bottom:7px;
  font-size:13.5px; line-height:1.45;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease;
}
.opt:hover{ border-color:var(--border-2); }
.opt input{ margin:2px 0 0; accent-color:var(--accent); flex-shrink:0; }
.opt:has(input:checked){ border-color:var(--accent); background:var(--accent-soft); }
/* graded states must outrank the :has(:checked) selector above */
.opt.locked.correct{ border-color:var(--ok); background:var(--ok-soft); }
.opt.locked.incorrect{ border-color:var(--bad); background:var(--bad-soft); }
.opt.locked.correct .opt-text{ font-weight:600; }
.opt.correct .opt-mark,.opt.incorrect .opt-mark{ display:flex; }
.opt-mark{
  display:none; align-items:center; margin-left:auto; flex-shrink:0;
}
.opt-mark svg{ width:15px; height:15px; }
.opt.correct .opt-mark{ color:var(--ok); }
.opt.incorrect .opt-mark{ color:var(--bad); }
.opt.locked{ cursor:default; }

.explain{
  display:none;
  margin-top:9px; padding:10px 12px;
  background:var(--surface-3);
  border-left:2.5px solid var(--accent);
  border-radius:0 var(--r-sm) var(--r-sm) 0;
  font-size:12.8px; line-height:1.55; color:var(--text-2);
}
.explain.show{ display:block; }

.modal-foot{
  position:sticky; bottom:0; z-index:2;
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:14px 18px calc(14px + env(safe-area-inset-bottom,0px));
  background:var(--surface);
  border-top:1px solid var(--border);
}
@media (min-width:760px){ .modal-foot{ border-radius:0 0 var(--r-lg) var(--r-lg); } }
.result{
  display:none; align-items:center; gap:8px;
  font-size:13.5px; font-weight:600;
  padding:8px 14px; border-radius:10px;
  background:var(--surface-3); color:var(--text-2);
}
.result.show{ display:inline-flex; }
.result.pass{ background:var(--ok-soft); color:var(--ok); }
.result.partial{ background:var(--warn-soft); color:var(--warn); }
.result svg{ width:15px; height:15px; }

/* ============================================================
   Motion / print
   ============================================================ */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    transition-duration:.01ms !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
  }
}

@media print{
  .appbar,.toolbar,.ov-actions,.quiz-row,.overlay,.toast,.source,.gate{ display:none !important; }
  .mod-body{ display:block !important; }
  .training-fold > .training-body{ display:block !important; }
  body{ background:#fff; }
  .card{ box-shadow:none; break-inside:avoid; }
}

/* touch targets */
.seg-btn{ min-height:44px; min-width:44px; }
.chip{ min-height:44px; }
.step-check{ width:28px; height:28px; margin-top:0; }
@media (max-width:520px){
  .icon-btn{ width:44px; height:44px; }
}

/* ---- Module reading + video streaming ---- */
.mod-about{
  margin:0 0 14px;
  padding:12px 14px;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--r-md);
}
.mod-about p{
  margin:0 0 10px;
  font-size:13.8px;
  line-height:1.55;
  color:var(--text-2);
}
.mod-about p:last-child{ margin-bottom:0; }

.lesson-player{
  margin:0 0 16px;
  padding:12px;
  border:1px solid var(--accent-line);
  border-radius:var(--r-md);
  background:linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 45%, var(--surface)), var(--surface));
}
.lesson-tip{
  margin:0 0 10px;
  font-size:13.5px;
  line-height:1.5;
  color:var(--text);
}
.lesson-tip-kicker{
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--accent);
  margin-bottom:4px;
}
body[data-lang="ne"] .lesson-tip-kicker{ text-transform:none; letter-spacing:.02em; }
.lesson-tip p{ margin:0; color:var(--text-2); }

.video-frame{
  position:relative;
  width:100%;
  aspect-ratio:16 / 9;
  border-radius:12px;
  overflow:hidden;
  background:#0b1216;
  border:1px solid var(--border);
}
.video-frame iframe{
  position:absolute; inset:0;
  width:100%; height:100%;
  border:0;
}
.player-open{ margin-top:8px; display:inline-flex; }

.step.active-lesson{
  border-color:var(--accent);
  background:var(--accent-soft);
}
.step-select{
  border:none; background:transparent; text-align:left;
  padding:0; width:100%; cursor:pointer; color:inherit; font:inherit;
}
.step-select:hover .step-text{ color:var(--accent); }

/* ============================================================
   Video poster
   ============================================================
   A YouTube embed costs several hundred KB of player code. Rendering one
   per module meant twelve of them loaded before the learner watched
   anything. We show the thumbnail instead and build the real player only
   when it is asked for. */
.video-poster{
  position:absolute; inset:0;
  width:100%; height:100%;
  padding:0; border:0; margin:0;
  background:#0b1216; cursor:pointer;
  display:block; overflow:hidden;
}
.video-poster img{
  width:100%; height:100%; object-fit:cover;
  display:block; opacity:.86;
  transition:opacity .2s ease, transform .35s ease;
}
.video-poster:hover img{ opacity:1; transform:scale(1.02); }
.video-play{
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:60px; height:60px; border-radius:50%;
  background:rgba(12,18,22,.78);
  border:1.5px solid rgba(255,255,255,.55);
  display:grid; place-items:center;
  transition:background .2s ease, transform .2s ease;
}
.video-poster:hover .video-play{ background:var(--accent); transform:translate(-50%,-50%) scale(1.06); }
.video-play svg{ width:22px; height:22px; color:#fff; margin-left:3px; }

/* ============================================================
   Practice checklist
   ============================================================
   Watching a video moves knowledge. Doing the thing moves skill. Every
   item here is meant to be observable: you can look and say yes or no. */
.practice{ margin-top:18px; }
.practice-box{
  border:1px solid var(--accent-line);
  background:var(--accent-soft);
  border-radius:var(--r-md);
  padding:15px 16px;
}
.practice-box.complete{ border-color:var(--ok); }
.practice-head{ display:flex; gap:12px; align-items:flex-start; }
.practice-head > svg{
  width:22px; height:22px; flex:none; margin-top:2px; color:var(--accent);
}
.practice-title{ font-size:14.5px; font-weight:650; line-height:1.35; color:var(--text); }
.practice-intro{ font-size:12.5px; line-height:1.5; color:var(--text-2); margin-top:4px; }
.practice-gear{
  margin-top:12px; padding:9px 11px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r-sm); font-size:12.5px; line-height:1.5; color:var(--text-2);
}
.practice-gear b{ color:var(--text); font-weight:600; }

.practice-items{ list-style:none; margin:13px 0 0; padding:0; display:grid; gap:7px; }
.practice-item{
  display:flex; gap:11px; align-items:flex-start;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r-sm); padding:10px 11px;
  transition:border-color .18s ease, background .18s ease;
}
.practice-item.on{ border-color:var(--ok); background:var(--ok-soft); }
.practice-check{
  flex:none; margin-top:1px;
  width:24px; height:24px; border-radius:6px;
  border:1.5px solid var(--border-2);
  background:var(--surface);
  display:flex; align-items:center; justify-content:center;
  color:transparent; cursor:pointer;
  position:relative;
  transition:background .18s ease, border-color .18s ease, color .18s ease;
}
/* 44px hit area without a 44px box — the visible control stays small,
   the thing a thumb has to find does not. */
.practice-check::after{
  content:""; position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:44px; height:44px;
}
.practice-check:hover{ border-color:var(--accent); }
.practice-check svg{ width:13px; height:13px; }
.practice-item.on .practice-check{ background:var(--ok); border-color:var(--ok); color:#fff; }
.practice-text{ font-size:13.5px; line-height:1.5; color:var(--text-2); }
.practice-item.on .practice-text{ color:var(--text); }
.practice-foot{ margin-top:11px; display:flex; justify-content:flex-end; }
.practice-count{ font-size:12px; font-weight:600; color:var(--text-3); }
.practice-box.complete .practice-count{ color:var(--ok); }

/* The lesson checkbox is the most-tapped control in the app; give it the
   same generous hit area. */
.step-check{ position:relative; }
.step-check::after{
  content:""; position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:44px; height:44px;
}

/* ============================================================
   Spaced review card
   ============================================================ */
.review{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  justify-content:space-between;
}
.review-main{ display:flex; gap:13px; align-items:flex-start; min-width:230px; flex:1; }
.review-main > svg{ width:22px; height:22px; flex:none; margin-top:2px; color:var(--text-3); }
.review.has-due .review-main > svg{ color:var(--accent); }
.review-title{ font-size:15px; font-weight:650; letter-spacing:-.01em; }
.review-sub{ font-size:13px; line-height:1.5; color:var(--text-2); margin-top:3px; max-width:62ch; }
.review-side{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.review-mastered{ font-size:12px; font-weight:600; color:var(--text-3); }

/* ============================================================
   Quiz — fieldset semantics
   ============================================================
   Each question is a fieldset so a screen reader ties the options to the
   question they belong to instead of announcing loose radio buttons. */
fieldset.q{ border:0; margin:0; padding:18px 0; border-bottom:1px solid var(--border); }
fieldset.q:last-of-type{ border-bottom:none; }
.q-legend{ display:block; width:100%; padding:0; }
.q-legend .q-num{ display:block; }
.q-legend .q-title{ display:block; }
.q-from{
  font-size:11.5px; font-weight:600; color:var(--text-3);
  margin:-6px 0 10px;
}

/* ============================================================
   Confirm dialog
   ============================================================
   Replaces window.confirm, which ignored the app's fonts, its dark mode
   and its Devanagari type. */
.confirm-overlay{ z-index:200; align-items:center; padding:24px 18px; }
.confirm-modal{
  max-width:420px; min-height:auto;
  border-radius:var(--r-lg); box-shadow:var(--sh-3);
  display:block;
}
.confirm-body{ padding:24px 24px 4px; }
.confirm-title{ font-size:18px; font-weight:650; letter-spacing:-.015em; line-height:1.3; }
.confirm-text{ font-size:14px; line-height:1.6; color:var(--text-2); margin-top:8px; }
.confirm-foot{
  display:flex; gap:9px; justify-content:flex-end;
  padding:18px 24px 22px; flex-wrap:wrap;
}
.btn-danger{ background:var(--bad); color:#fff; border-color:var(--bad); }
.btn-danger:hover{ filter:brightness(.93); }

/* ============================================================
   Fatal error
   ============================================================
   If content fails to load, say so in both languages rather than showing
   a blank page. */
.fatal{
  position:fixed; inset:0; z-index:9998;
  display:grid; place-items:center; padding:24px 18px;
  background:var(--bg);
}
.fatal-card{
  max-width:440px; width:100%;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r-lg); box-shadow:var(--sh-2);
  padding:26px 24px;
  font-family:var(--font-ui, system-ui, sans-serif);
}
.fatal-title{ font-size:17px; font-weight:650; line-height:1.3; }
.fatal-text{ font-size:14px; line-height:1.6; color:var(--text-2); margin:7px 0 0; }
.fatal-alt{ margin-top:18px; }
.fatal-card .btn{ margin-top:20px; width:100%; justify-content:center; }

@media print{
  .review, .video-poster, .practice-check{ display:none !important; }
  .practice-box{ background:#fff; border-color:#ccc; }
  .practice-item{ break-inside:avoid; }
}
