/*
 * Manhali Modern: student (learner) area.
 *
 * A calm, reading-first shell: the academy's header sits on the warm canvas, content is a single
 * centred column, and the lesson player drops the chrome entirely. Markup is injected by js/student.js.
 *
 * Signature: the lesson trail (.trail in css/components.css, hydrated by core.js from data-trail).
 */

:root { --content-max: 1180px; --learner-top-h: 64px; --topbar-h: var(--learner-top-h); }

.app { min-block-size: 100dvh; background: var(--canvas); }
.main { display: flex; flex-direction: column; min-inline-size: 0; }
.page { padding-block: 16px 56px; }

/* ── Header ────────────────────────────────────────────── */
.learner-top {
  position: sticky; inset-block-start: 0; z-index: 40;
  background: color-mix(in oklch, var(--canvas), transparent 8%); backdrop-filter: saturate(1.4) blur(12px);
  border-block-end: 1px solid transparent; transition: border-color var(--dur);
}
body:has(.main[data-scrolled]) .learner-top { border-block-end-color: var(--border); }
.learner-top-inner {
  display: flex; align-items: center; gap: 20px; block-size: var(--learner-top-h);
  inline-size: 100%; max-inline-size: var(--content-max); margin-inline: auto; padding-inline: var(--page-pad);
}
.academy-mark { display: inline-flex; align-items: center; gap: 10px; flex: none; font-weight: var(--weight-bold); font-size: var(--text-md); }
.academy-mark .logo-tile { inline-size: 34px; block-size: 34px; border-radius: 10px; font-size: 17px; }

.learner-tabs { display: flex; align-items: center; gap: 2px; min-inline-size: 0; }
.learner-tabs a {
  position: relative; display: inline-flex; align-items: center; block-size: 36px; padding-inline: 12px; border-radius: 99px;
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted-foreground); white-space: nowrap;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.learner-tabs a:hover { color: var(--foreground); background: var(--hover); }
.learner-tabs a[aria-current="page"] { color: var(--foreground); background: var(--card); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.learner-tabs a[aria-current="page"]::after {
  content: ""; position: absolute; inset-block-end: 5px; inset-inline-start: 50%; translate: -50% 0;
  inline-size: 4px; block-size: 4px; border-radius: 50%; background: var(--brand);
}
[dir="rtl"] .learner-tabs a[aria-current="page"]::after { translate: 50% 0; }

.learner-top .end { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.learner-top .notif-dot {
  position: absolute; inset-block-start: 8px; inset-inline-end: 8px; inline-size: 7px; block-size: 7px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 2px var(--canvas);
}
.learner-top [data-popup="notif"] { position: relative; }
.account-trigger {
  display: inline-flex; align-items: center; gap: 8px; block-size: 36px; padding-inline: 3px 8px; border-radius: 99px;
  font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background-color var(--dur-fast);
}
[dir="rtl"] .account-trigger { padding-inline: 3px 8px; }
.account-trigger:hover, .account-trigger[data-open] { background: var(--hover); }
.account-trigger .icon-sm { color: var(--muted-foreground); }
.account-popup { inline-size: 264px; }
.account-card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 6px; }
.account-popup .menu-item[aria-current="page"] { background: var(--selected); }
.account-popup .menu-item .badge { margin-inline-start: auto; }
.notif-popup { inline-size: 340px; padding: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.notif-row { align-items: flex-start; padding-inline: 14px; }

/* ── Phones ────────────────────────────────────────────── */
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 14px; }
.more-link {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
.more-link .icon { color: var(--muted-foreground); }
.more-link[aria-current="page"] { border-color: var(--brand); }
.more-link[aria-current="page"] .icon { color: var(--brand); }
.more-link .badge { margin-inline-start: auto; }
@media (max-width: 1023px) {
  :root { --learner-top-h: 56px; }
  .learner-top-inner { gap: 8px; }
  .main { padding-block-end: 72px; }
  .toaster { inset-block-end: 84px; inset-inline: 16px; }
  .floating-bar, .save-bar { inset-block-end: 80px; }
}

/* ── Page intro ────────────────────────────────────────── */
.greeting { display: flex; flex-direction: column; gap: 6px; padding-block: 16px 4px; }
.greeting h1 { font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1.2; font-weight: var(--weight-bold); }
.greeting p { color: var(--muted-foreground); max-inline-size: 60ch; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--muted-foreground); }
.back-link:hover { color: var(--foreground); }

/* ── Resume hero: the one big moment on home ──────────── */
.resume {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: stretch;
  padding: 28px; border-radius: var(--radius-xl); overflow: hidden;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.resume .copy { display: flex; flex-direction: column; gap: 14px; min-inline-size: 0; }
.resume .course-name { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted-foreground); }
.resume h2 { font-family: var(--font-display); font-size: clamp(26px, 3.2vw, 36px); line-height: 1.2; font-weight: var(--weight-bold); text-wrap: balance; }
.resume .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--text-sm); color: var(--muted-foreground); }
.resume .facts > span { display: inline-flex; align-items: center; gap: 6px; }
.resume .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-block-start: auto; }
.resume .trail-box { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.resume .trail-box .row { justify-content: space-between; font-size: var(--text-xs); color: var(--muted-foreground); }
@media (max-width: 860px) { .resume { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 18px; } .resume .poster { order: -1; min-block-size: 180px; } }

/* Video poster: a still of the lesson with a play button (used by resume and course pages) */
.poster {
  position: relative; display: grid; place-items: center; min-block-size: 220px; border-radius: 16px; overflow: hidden; isolation: isolate;
  background: radial-gradient(120% 90% at 20% 10%, color-mix(in oklch, var(--brand), white 30%), transparent 60%),
              linear-gradient(150deg, color-mix(in oklch, var(--brand), black 25%), color-mix(in oklch, var(--primary), black 55%));
  color: white;
}
.poster::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.22;
  background-image: radial-gradient(circle, white 1.2px, transparent 1.6px); background-size: 16px 16px;
  mask-image: linear-gradient(to bottom, transparent, black 60%);
}
.poster .play {
  display: grid; place-items: center; inline-size: 64px; block-size: 64px; border-radius: 50%;
  background: oklch(1 0 0 / 0.95); color: var(--primary); box-shadow: 0 8px 24px oklch(0 0 0 / 0.25);
  transition: scale var(--dur-fast) var(--ease-out);
}
.poster .play .icon { inline-size: 26px; block-size: 26px; margin-inline-start: 3px; fill: currentColor; }
a.poster:hover .play, .poster:hover .play { scale: 1.06; }
.poster .stamp { position: absolute; inset-block-end: 12px; inset-inline-start: 12px; padding: 4px 10px; border-radius: 99px; background: oklch(0 0 0 / 0.45); font-family: var(--font-num); font-size: var(--text-xs); }
.poster .kicker { position: absolute; inset-block-start: 12px; inset-inline-start: 12px; display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; background: oklch(1 0 0 / 0.16); font-size: var(--text-xs); backdrop-filter: blur(6px); }

/* ── Course tiles (enrolled courses) ─────────────────── */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--grid-gap); }
.course-tile { display: flex; flex-direction: column; overflow: hidden; }
.course-tile .cover { block-size: 118px; }
.course-tile .body { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; flex: 1; }
.course-tile .title { font-size: var(--text-base); font-weight: var(--weight-bold); line-height: 1.4; }
/* The title link stretches over the tile; real buttons inside sit above it */
.course-tile .btn, .course-tile .body a:not(.title a) { position: relative; z-index: 1; }
.course-tile .title a::after { content: ""; position: absolute; inset: 0; }
.course-tile { position: relative; transition: box-shadow var(--dur-fast), border-color var(--dur-fast); }
.course-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.course-tile .by { font-size: var(--text-xs); color: var(--muted-foreground); }
.course-tile .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-start: auto; font-size: var(--text-xs); color: var(--muted-foreground); }
.course-tile .foot .num { color: var(--foreground); font-weight: var(--weight-medium); }
.course-tile[data-state="done"] .cover::before { content: ""; position: absolute; inset: 0; background: color-mix(in oklch, var(--success), transparent 88%); }

/* ── Section heading on learner pages (title + link) ───── */
.section-head { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.section-head .end { margin-inline-start: auto; }

/* ── This week: seven days, one dot per lesson finished ─ */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week .day { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 4px; border-radius: 12px; }
.week .day .name { font-size: var(--text-xs); color: var(--muted-foreground); }
.week .day .trail { justify-content: center; min-block-size: 30px; align-content: flex-end; max-inline-size: 36px; }
.week .day .trail:empty::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); opacity: 0.6; }
.week .day[data-today] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.week .day[data-today] .name { color: var(--foreground); font-weight: var(--weight-medium); }

/* ── Date chip + session rows (live classes) ─────────── */
.date-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
  inline-size: 52px; block-size: 56px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.1;
}
.date-chip .d { font-family: var(--font-num); font-size: var(--text-lg); font-weight: var(--weight-bold); }
.date-chip .m { font-size: 11px; color: var(--muted-foreground); }
.date-chip[data-live] { background: var(--destructive-soft); border-color: transparent; color: var(--destructive-soft-foreground); }
.date-chip[data-live] .m { color: inherit; }
.session-row { display: flex; align-items: center; gap: 14px; padding: 14px var(--card-pad); border-block-start: 1px solid var(--border); }
.session-row:first-child { border-block-start: 0; }
.session-row .info { display: flex; flex-direction: column; gap: 3px; min-inline-size: 0; flex: 1; }
.session-row .info .t { font-weight: var(--weight-medium); }
.session-row .info .s { font-size: var(--text-xs); color: var(--muted-foreground); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.session-row .info .s > span { display: inline-flex; align-items: center; gap: 5px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--destructive-soft-foreground); }
.live-pill::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--destructive); }
@media (prefers-reduced-motion: no-preference) { .live-pill::before { animation: live-blink 1.4s ease-in-out infinite; } @keyframes live-blink { 50% { opacity: 0.35; } } }
@media (max-width: 640px) { .session-row { flex-wrap: wrap; } .session-row .btn { inline-size: 100%; } }

/* ── Certificate (paper) ──────────────────────────────── */
.cert {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 18px; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in oklch, var(--primary-soft), var(--card) 55%), var(--card) 60%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.cert::before { content: ""; position: absolute; inset: 8px; border: 1px solid color-mix(in oklch, var(--brand), transparent 70%); border-radius: 10px; pointer-events: none; }
.cert .seal {
  display: grid; place-items: center; inline-size: 44px; block-size: 44px; border-radius: 50%;
  background: var(--primary); color: var(--primary-foreground); box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand), transparent 80%);
}
.cert .kind { font-size: var(--text-xs); color: var(--muted-foreground); }
.cert .course { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.3; font-weight: var(--weight-bold); }
.cert .meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; font-size: var(--text-xs); color: var(--muted-foreground); margin-block-start: auto; padding-block-start: 10px; border-block-start: 1px dashed var(--border-strong); }
.cert .actions { position: relative; display: flex; gap: 6px; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--grid-gap); }

/* ── Player (lesson, quiz, path player) ───────────────────
   <div class="app" data-page="lesson" data-layout="player"> > .player-bar + .player (> .player-main + .player-aside) */
.app[data-layout="player"] { display: flex; flex-direction: column; }
.player-bar {
  position: sticky; inset-block-start: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  block-size: 58px; padding-inline: 14px; background: color-mix(in oklch, var(--canvas), transparent 6%);
  backdrop-filter: blur(12px); border-block-end: 1px solid var(--border);
}
.player-bar .where { display: flex; flex-direction: column; min-inline-size: 0; line-height: 1.3; }
.player-bar .where .c { font-size: var(--text-xs); color: var(--muted-foreground); }
.player-bar .where .l { font-weight: var(--weight-bold); font-size: var(--text-sm); }
.player-bar .end { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.player-bar .overall { display: flex; align-items: center; gap: 10px; font-size: var(--text-xs); color: var(--muted-foreground); }
.player-bar .overall .progress { inline-size: 120px; }

.player { display: grid; grid-template-columns: minmax(0, 1fr) 360px; flex: 1; min-block-size: 0; }
.app[data-aside="closed"] .player { grid-template-columns: minmax(0, 1fr) 0; }
.app[data-aside="closed"] .player-aside { display: none; }
.player-main { display: flex; flex-direction: column; gap: 20px; padding: 20px clamp(16px, 3vw, 36px) 48px; min-inline-size: 0; }
.player-main > * { inline-size: 100%; max-inline-size: 980px; margin-inline: auto; }
.player-aside {
  position: sticky; inset-block-start: 58px; block-size: calc(100dvh - 58px); overflow: auto;
  border-inline-start: 1px solid var(--border); background: var(--background);
}

/* Video stage. The academy watermark is its logo in one corner (position, width 5–30% and opacity
   10–100% are academy settings; hidden for YouTube/Vimeo embeds). data-corner="top-start|top-end|bottom-start|bottom-end" */
.stage {
  position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; isolation: isolate;
  background: oklch(0.16 0.01 60); color: white; box-shadow: var(--shadow-md);
}
.stage .poster { position: absolute; inset: 0; border-radius: 0; min-block-size: 0; }
.stage .watermark {
  --wm-width: 15%; --wm-opacity: 0.5;
  position: absolute; z-index: 2; inset-block-start: 16px; inset-inline-end: 16px; inline-size: var(--wm-width); min-inline-size: 72px;
  display: flex; align-items: center; gap: 8px; opacity: var(--wm-opacity); pointer-events: none; user-select: none;
  font-weight: var(--weight-bold); font-size: clamp(11px, 1.2vw, 15px); color: white; text-shadow: 0 1px 2px oklch(0 0 0 / 0.4); white-space: nowrap;
}
.stage .watermark .logo-tile { inline-size: 2.2em; block-size: 2.2em; border-radius: 0.6em; font-size: inherit; }
.stage .watermark[data-corner="top-start"] { inset-inline: 16px auto; }
.stage .watermark[data-corner^="bottom"] { inset-block: auto 64px; }
.stage .watermark[data-corner="bottom-start"] { inset-inline: 16px auto; }
.stage .resume-chip {
  position: absolute; z-index: 3; inset-block-end: 64px; inset-inline-start: 50%; translate: -50% 0;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px;
  background: oklch(1 0 0 / 0.95); color: var(--foreground); font-size: var(--text-sm); font-weight: var(--weight-medium); box-shadow: var(--shadow-md);
}
[dir="rtl"] .stage .resume-chip { translate: 50% 0; }
.stage .resume-chip .icon { color: var(--primary); }
.stage .volume { display: inline-flex; align-items: center; gap: 6px; }
.stage .volume .bar { inline-size: 56px; block-size: 4px; border-radius: 99px; background: linear-gradient(to right, white 70%, oklch(1 0 0 / 0.3) 0); }
.stage .controls {
  position: absolute; z-index: 3; inset-inline: 0; inset-block-end: 0; display: flex; align-items: center; gap: 10px; padding: 26px 14px 12px;
  background: linear-gradient(to top, oklch(0 0 0 / 0.6), transparent); direction: ltr;
}
.stage .controls .btn { color: white; }
.stage .controls .btn:hover { background: oklch(1 0 0 / 0.14); }
.stage .scrub { position: relative; flex: 1; block-size: 4px; border-radius: 99px; background: oklch(1 0 0 / 0.28); }
.stage .scrub > span { position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: var(--value); border-radius: inherit; background: var(--brand); }
.stage .scrub > span::after { content: ""; position: absolute; inset-inline-end: -6px; inset-block-start: -4px; inline-size: 12px; block-size: 12px; border-radius: 50%; background: white; }
.stage .time { font-family: var(--font-num); font-size: var(--text-xs); color: oklch(1 0 0 / 0.85); white-space: nowrap; }

.lesson-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.lesson-head .titles { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; min-inline-size: 0; }
.lesson-head h1 { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1.25; font-weight: var(--weight-bold); }
.lesson-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prose-block { font-size: var(--text-md); line-height: 1.85; max-inline-size: 72ch; display: flex; flex-direction: column; gap: 14px; }
.prose-block h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); line-height: 1.4; margin-block-start: 6px; }
.prose-block ul { padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 6px; }

/* Curriculum (player aside and course page) */
.curriculum-head { position: sticky; inset-block-start: 0; z-index: 1; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 14px; background: var(--background); border-block-end: 1px solid var(--border); }
.curriculum-head .row { justify-content: space-between; }
.module { border-block-end: 1px solid var(--border); }
.module > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none;
  font-weight: var(--weight-bold); font-size: var(--text-sm);
}
.module > summary::-webkit-details-marker { display: none; }
.module > summary .count { margin-inline-start: auto; font-family: var(--font-num); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--muted-foreground); }
.module > summary > .icon { color: var(--muted-foreground); transition: rotate var(--dur-fast); }
.module[open] > summary > .icon { rotate: 180deg; }
.module > summary:hover { background: var(--hover); }
.lesson-list { display: flex; flex-direction: column; padding: 0 8px 10px; }
.lesson-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--foreground); text-align: start; inline-size: 100%;
}
a.lesson-item:hover { background: var(--hover); }
.lesson-item .mark {
  display: grid; place-items: center; flex: none; inline-size: 22px; block-size: 22px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--border-strong); color: var(--muted-foreground);
}
.lesson-item .mark .icon { inline-size: 12px; block-size: 12px; }
.lesson-item[data-state="done"] .mark { background: var(--brand); color: white; box-shadow: none; }
.lesson-item[data-state="current"] { background: var(--primary-soft); color: var(--primary-soft-foreground); font-weight: var(--weight-medium); }
.lesson-item[data-state="current"] .mark { background: var(--card); box-shadow: inset 0 0 0 2.5px var(--brand); }
.lesson-item[data-state="locked"] { color: var(--muted-foreground); }
.lesson-item[data-state="locked"] .mark { box-shadow: none; outline: 1.5px dashed var(--border-strong); outline-offset: -1.5px; }
.lesson-item .t { flex: 1; min-inline-size: 0; line-height: 1.4; }
.lesson-item .kind { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: var(--text-xs); color: var(--muted-foreground); font-family: var(--font-num); }
.lesson-item .kind .icon { inline-size: 14px; block-size: 14px; }
.lesson-item[data-state="current"] .kind { color: inherit; }

/* Resources and notes */
.resource { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.resource:hover { border-color: var(--border-strong); }
.resource .grow { min-inline-size: 0; }
.note { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.note .at { flex: none; font-family: var(--font-num); font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--primary-soft-foreground); background: var(--primary-soft); border-radius: 99px; padding: 2px 8px; align-self: flex-start; }

.lesson-nav { display: flex; gap: 12px; }
.lesson-nav a { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); min-inline-size: 0; }
.lesson-nav a:hover { border-color: var(--border-strong); }
.lesson-nav a.next { text-align: end; }
.lesson-nav .k { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted-foreground); }
.lesson-nav a.next .k { justify-content: flex-end; }
.lesson-nav .t { font-weight: var(--weight-medium); }

@media (max-width: 1023px) {
  .player { grid-template-columns: minmax(0, 1fr); }
  .player-aside { display: none; }
  .player-bar .overall .progress { inline-size: 64px; }
  .player-bar .where .c { display: none; }
  .player-main > .stage { border-radius: 0; margin-inline: calc(clamp(16px, 3vw, 36px) * -1); inline-size: auto !important; max-inline-size: none !important; }
}
@media (max-width: 640px) { .lesson-nav { flex-direction: column; } }

/* ── Quiz ─────────────────────────────────────────────── */
.quiz-wrap { display: flex; flex-direction: column; gap: 22px; inline-size: 100%; max-inline-size: 760px; margin-inline: auto; padding: 24px 16px 48px; }
.quiz-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.quiz-top .timer { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--border); font-family: var(--font-num); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.quiz-top .timer[data-low] { color: var(--destructive-soft-foreground); background: var(--destructive-soft); border-color: transparent; }
.question { display: flex; flex-direction: column; gap: 16px; padding: 26px; }
.question .qn { font-size: var(--text-xs); color: var(--muted-foreground); }
.question h2 { font-size: var(--text-xl); line-height: 1.5; font-weight: var(--weight-bold); }
.answers { display: flex; flex-direction: column; gap: 10px; }
.answer { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--card); text-align: start; inline-size: 100%; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.answer:hover { border-color: var(--border-strong); }
.answer .key { display: grid; place-items: center; flex: none; inline-size: 30px; block-size: 30px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.answer[data-checked] { border-color: var(--brand); background: color-mix(in oklch, var(--primary-soft), var(--card) 40%); }
.answer[data-checked] .key { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.answer[data-result="right"] { border-color: var(--success); background: var(--success-soft); }
.answer[data-result="wrong"] { border-color: var(--destructive); background: var(--destructive-soft); }
.answer .verdict { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-bold); }
.quiz-foot { display: flex; align-items: center; gap: 10px; }
.quiz-foot .end { margin-inline-start: auto; display: flex; gap: 8px; }
.score { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 32px 24px; text-align: center; }
.score .ring { --size: 128px; --stroke: 10px; }
.score .ring > span { font-size: var(--text-2xl); }
.score h1 { font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1.2; }
.score p { color: var(--muted-foreground); max-inline-size: 48ch; }
.score .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; inline-size: 100%; max-inline-size: 460px; }
.score .facts > div { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.score .facts .v { font-family: var(--font-num); font-size: var(--text-lg); font-weight: var(--weight-bold); }
.score .facts .k { font-size: var(--text-xs); color: var(--muted-foreground); }

/* ── Path (a sequence of courses) ────────────────────── */
.path-steps { position: relative; display: flex; flex-direction: column; gap: 12px; }
.path-step { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
.path-step .node {
  position: relative; z-index: 1; display: grid; place-items: center; inline-size: 40px; block-size: 40px; border-radius: 50%;
  background: var(--card); box-shadow: inset 0 0 0 2px var(--border-strong); font-family: var(--font-num); font-weight: var(--weight-bold);
}
.path-step:not(:last-child)::before { content: ""; position: absolute; inset-block: 40px -12px; inset-inline-start: 19px; inline-size: 2px; background: var(--border); }
.path-step[data-state="done"] .node { background: var(--brand); color: white; box-shadow: none; }
.path-step[data-state="done"]:not(:last-child)::before { background: var(--brand); }
.path-step[data-state="current"] .node { box-shadow: inset 0 0 0 3px var(--brand); color: var(--primary-soft-foreground); }
.path-step[data-state="locked"] .node { color: var(--muted-foreground); box-shadow: none; outline: 2px dashed var(--border-strong); outline-offset: -2px; }
.path-step .card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.path-step[data-state="locked"] .card { background: var(--surface-2); box-shadow: none; }

/* ── Receipts, lists and misc ───────────────────────────── */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; font-size: var(--text-sm); margin: 0; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; }
.receipt-lines { display: flex; flex-direction: column; }
.receipt-lines > div { display: flex; justify-content: space-between; gap: 12px; padding-block: 10px; border-block-end: 1px solid var(--border); font-size: var(--text-sm); }
.receipt-lines > div:last-child { border-block-end: 0; }
.receipt-lines .total { font-weight: var(--weight-bold); font-size: var(--text-base); }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters .input-group { flex: 1 1 240px; max-inline-size: 360px; }

/* ── Two-pane inbox (messages, tickets) ─────────────────── */
/* Two-pane inbox inside one card (same structure as platform/messages.html, learner side) */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); block-size: calc(100dvh - var(--topbar-h) - 190px); min-block-size: 560px; overflow: hidden; }
.pane { display: flex; flex-direction: column; min-block-size: 0; min-inline-size: 0; }
.pane + .pane { border-inline-start: 1px solid var(--border); }
.pane-scroll { flex: 1; overflow-y: auto; min-block-size: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.list-head { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-block-end: 1px solid var(--border); }
.list-head .segmented { display: flex; }
.list-head .segmented > button { flex: 1; justify-content: center; padding-inline: 6px; }
.conv { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; inline-size: 100%; padding: 12px 14px; text-align: start; border-block-end: 1px solid var(--border); transition: background-color var(--dur-fast); }
.conv:hover { background: var(--hover); }
.conv[aria-current="true"] { background: color-mix(in oklch, var(--primary-soft), transparent 35%); }
.conv[aria-current="true"]::before { content: ""; position: absolute; inset-block: 10px; inset-inline-start: 0; inline-size: 3px; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--brand); }
.conv .top { display: flex; align-items: center; gap: 8px; }
.conv .name { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.conv .time { margin-inline-start: auto; font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.conv .ctx { font-size: var(--text-xs); color: var(--muted-foreground); }
.conv .preview { font-size: var(--text-sm); color: var(--muted-foreground); }
.conv .bottom { display: flex; align-items: center; gap: 6px; margin-block-start: 4px; }
.conv .unread { margin-inline-start: auto; background: var(--primary); color: var(--primary-foreground); }
.conv[data-unread] .name { font-weight: var(--weight-bold); }
.conv[data-unread] .preview { color: var(--foreground); }
.state-tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--muted-foreground); }
.state-tag .dot { inline-size: 6px; block-size: 6px; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-block-end: 1px solid var(--border); min-block-size: 62px; }
.thread-head .who { display: flex; flex-direction: column; min-inline-size: 0; flex: 1; }
.thread-head .who .name { font-weight: var(--weight-medium); font-size: var(--text-sm); }
.thread-head .who .sub { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted-foreground); }
.ctx-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 12px 14px 0; }
.ctx-bar .col { flex: 1; min-inline-size: 0; }
.ctx-bar .title { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.messages { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 12px; }
.messages .day-sep { margin-block: 10px 6px; }
.b-row { display: flex; align-items: flex-end; gap: 8px; max-inline-size: 78%; }
.b-row.in { align-self: flex-start; }
.b-row.out { align-self: flex-end; flex-direction: row-reverse; }
.b-row .avatar { margin-block-end: 18px; }
.b-stack { display: flex; flex-direction: column; gap: 3px; min-inline-size: 0; }
.b-row.out .b-stack { align-items: flex-end; }
.bubble { padding: 9px 13px; border-radius: 16px; font-size: var(--text-base); line-height: 1.7; overflow-wrap: anywhere; }
.in .bubble { background: var(--muted); border-end-start-radius: 5px; }
.out .bubble { background: var(--primary-soft); color: var(--foreground); border-end-end-radius: 5px; }
.b-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-foreground); padding-inline: 4px; }
.b-meta .read { color: var(--info); }
.composer-wrap { padding: 10px 14px 14px; }
.composer textarea { max-block-size: 140px; resize: none; line-height: 1.6; }
.closed-bar { display: flex; align-items: center; gap: 10px; margin: 10px 14px 14px; padding: 12px 14px; font-size: var(--text-sm); color: var(--muted-foreground); }
.closed-bar .icon { flex: none; }
.back-btn { display: none; }
@media (max-width: 1023px) {
  .inbox { grid-template-columns: minmax(0, 1fr); block-size: calc(100dvh - var(--topbar-h) - 230px); min-block-size: 520px; }
  .pane + .pane { border-inline-start: 0; }
  .inbox[data-view="list"] .inbox-thread, .inbox[data-view="thread"] .inbox-list { display: none; }
  .back-btn { display: inline-flex; }
  .b-row { max-inline-size: 90%; }
  .messages { padding-inline: 14px; }
  .composer-tools .hint { display: none; }
}
@media (max-width: 640px) {
  .ctx-bar { margin: 10px 10px 0; padding: 8px 10px; gap: 10px; }
  .ctx-bar .btn span { display: none; }
  .ctx-bar .btn { inline-size: var(--btn-h); padding: 0; }
}
