/* ==========================================================================
   Lumen LMS — course player
   Palette from H&E staining: hematoxylin (--lm-brand) for actions and done,
   eosin (--lm-mark) for "you are here" and progress.
   ========================================================================== */

:root {
	--lm-brand: #4a3aa7;
	--lm-mark: #d63f7a;
	--lm-font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
	--lm-top-h: 60px;
	--lm-bottom-h: 68px;
	--lm-side-w: 340px;
	--lm-radius: 12px;
	--lm-ease: cubic-bezier(.2, .7, .2, 1);
}

:root {
	--lm-bg: #f1f2f6;
	--lm-surface: #ffffff;
	--lm-surface-2: #f6f7fa;
	--lm-ink: #1a1c2b;
	--lm-ink-2: #383c50;
	--lm-muted: #5d6274;
	--lm-line: #e2e4eb;
	--lm-line-2: #cfd2dd;
	--lm-brand-fg: var(--lm-brand);
	--lm-brand-soft: color-mix(in srgb, var(--lm-brand) 9%, #fff);
	--lm-mark-fg: var(--lm-mark);
	--lm-mark-soft: color-mix(in srgb, var(--lm-mark) 9%, #fff);
	--lm-ok: #17784f;
	--lm-ok-soft: #e6f4ec;
	--lm-bad: #b93a31;
	--lm-bad-soft: #fbebea;
	--lm-shadow: 0 1px 2px rgba(26, 28, 43, .05), 0 8px 24px -12px rgba(26, 28, 43, .14);
	color-scheme: light;
}

/* ---------- Base ---------- */
html.lm-html, body.lumen-player-page {
	margin: 0;
	padding: 0;
	background: var(--lm-bg);
	height: 100%;
}
body.lumen-player-page { overflow: hidden; }
.lm-player, .lm-player *, .lm-toast { box-sizing: border-box; }
.lm-player {
	position: fixed;
	inset: 0;
	display: grid;
	grid-template-columns: var(--lm-side-w) minmax(0, 1fr);
	grid-template-rows: var(--lm-top-h) minmax(0, 1fr) var(--lm-bottom-h);
	grid-template-areas: "top main" "side main" "side bottom";
	background: var(--lm-bg);
	color: var(--lm-ink);
	font-family: var(--lm-font);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	transition: grid-template-columns .28s var(--lm-ease);
}
html[data-lm-side="closed"] .lm-player { grid-template-columns: 0 minmax(0, 1fr); }
html[data-lm-side="closed"] .lm-top { visibility: hidden; }
.lm-player.no-side { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "bottom"; }
.lm-when-narrow { display: none; }
.lm-player a { color: inherit; }
.lm-player button { font: inherit; }
.lm-ic { width: 20px; height: 20px; flex: none; }
[dir="rtl"] .lm-ic-left, [dir="rtl"] .lm-ic-right { transform: scaleX(-1); }
.lm-sr, .lm-player .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lm-skip {
	position: fixed; z-index: 100; inset-inline-start: 12px; top: -60px;
	background: var(--lm-brand); color: #fff; padding: 10px 14px; border-radius: 10px; font-family: var(--lm-font);
}
.lm-skip:focus { top: 10px; }
.lm-player :focus-visible {
	outline: 3px solid color-mix(in srgb, var(--lm-brand-fg) 55%, transparent);
	outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.lm-iconbtn {
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--lm-ink-2);
	cursor: pointer;
	text-decoration: none;
	flex: none;
}
.lm-iconbtn:hover { background: var(--lm-surface-2); color: var(--lm-ink); }
.lm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 18px;
	border: 1px solid var(--lm-line-2);
	border-radius: 10px;
	background: var(--lm-surface);
	color: var(--lm-ink);
	font-weight: 600;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.lm-btn:hover { border-color: var(--lm-muted); }
.lm-btn--primary { background: var(--lm-brand); border-color: var(--lm-brand); color: #fff; }
.lm-btn--primary:hover { background: color-mix(in srgb, var(--lm-brand) 86%, #000); border-color: transparent; }
.lm-btn[disabled], .lm-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.lm-btn.is-busy { opacity: .7; pointer-events: none; }
.lm-btn .lm-ic { width: 18px; height: 18px; }

/* ---------- Top bar ---------- */
.lm-top {
	grid-area: top;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 8px;
	background: var(--lm-surface);
	border-bottom: 1px solid var(--lm-line);
	border-inline-end: 1px solid var(--lm-line);
	overflow: hidden;
	min-width: 0;
	z-index: 30;
}
.lm-top__titles {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
	padding: 0 4px;
	line-height: 1.25;
}
.lm-top__course {
	font-weight: 700;
	font-size: 15.5px;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.lm-top__course:hover { text-decoration: underline; text-underline-offset: 3px; }
.lm-top__section {
	font-size: 13px;
	color: var(--lm-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.lm-top__end { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.lm-exit { flex: none; }

/* Shown when the course menu is hidden on a wide screen. */
.lm-reopen {
	display: none;
	position: fixed;
	top: 14px;
	inset-inline-start: 14px;
	z-index: 25;
	align-items: center;
	gap: 6px;
	height: 38px;
	padding: 0 14px 0 10px;
	border: 1px solid var(--lm-line);
	border-radius: 10px;
	background: var(--lm-surface);
	color: var(--lm-ink-2);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	box-shadow: var(--lm-shadow);
	cursor: pointer;
}
.lm-reopen:hover { color: var(--lm-ink); border-color: var(--lm-line-2); }
html[data-lm-side="closed"] .lm-reopen { display: inline-flex; }
html[data-lm-side="closed"] .lm-stage { padding-top: 68px; }
.lm-top__ring { display: inline-flex; align-items: center; gap: 7px; margin: 0 8px 0 4px; }
.lm-top__ring .lm-ring__val { display: none; }
.lm-top__ring .lm-ring circle { stroke-width: 4.2; }
.lm-top__pct { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--lm-ink-2); }

/* ---------- Progress ring ---------- */
.lm-ring {
	--size: 36px;
	position: relative;
	display: inline-grid;
	place-items: center;
	width: var(--size);
	height: var(--size);
	flex: none;
}
.lm-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.lm-ring circle { fill: none; stroke-width: 3.4; }
.lm-ring__bg { stroke: var(--lm-line); }
.lm-ring__fg { stroke: var(--lm-mark-fg); stroke-linecap: round; transition: stroke-dashoffset .7s var(--lm-ease); }
.lm-ring__val { position: relative; font-size: calc(var(--size) * .3); font-weight: 700; letter-spacing: -.02em; }
.lm-ring__val small { font-size: .7em; font-weight: 600; }

/* ---------- Sidebar ---------- */
.lm-side {
	grid-area: side;
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
	background: var(--lm-surface);
	border-inline-end: 1px solid var(--lm-line);
	overflow: hidden;
	z-index: 20;
}
html[data-lm-side="closed"] .lm-side { visibility: hidden; }
.lm-side__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 18px 10px;
}
.lm-side__title { font-weight: 700; font-size: 15px; }
.lm-side__count { font-size: 13px; color: var(--lm-muted); white-space: nowrap; }
.lm-filter {
	position: relative;
	display: block;
	margin: 0 14px 8px;
}
.lm-filter .lm-ic { position: absolute; inset-inline-start: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--lm-muted); pointer-events: none; }
.lm-filter input {
	width: 100%;
	height: 38px;
	padding: 0 12px;
	padding-inline-start: 36px;
	border: 1px solid var(--lm-line);
	border-radius: 10px;
	background: var(--lm-surface-2);
	color: var(--lm-ink);
	font: inherit;
	font-size: 14.5px;
}
.lm-filter input:focus { outline: none; border-color: var(--lm-brand-fg); background: var(--lm-surface); }
.lm-side__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 28px; }

/* ---------- The track: sections and lesson nodes on a spine ---------- */
.lm-track { --spine-x: 31px; }
.lm-sec { border-top: 1px solid var(--lm-line); }
.lm-sec:first-child { border-top: 0; }
.lm-sec__head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr) auto 18px;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 13px 16px;
	border: 0;
	background: var(--lm-surface);
	color: var(--lm-ink);
	text-align: start;
	cursor: pointer;
}
.lm-sec__head:hover { background: var(--lm-surface-2); }
.lm-sec__num {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	border: 1.5px solid var(--lm-line-2);
	font-size: 13.5px;
	font-weight: 700;
	color: var(--lm-muted);
}
.lm-sec.is-done .lm-sec__num { background: var(--lm-brand-soft); border-color: transparent; color: var(--lm-brand-fg); }
.lm-sec__title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.lm-sec__count { font-size: 12.5px; color: var(--lm-muted); font-variant-numeric: tabular-nums; }
.lm-sec__chev { width: 18px; height: 18px; color: var(--lm-muted); transition: transform .2s var(--lm-ease); }
.lm-sec:not(.is-open) .lm-sec__chev { transform: rotate(-90deg); }
[dir="rtl"] .lm-sec:not(.is-open) .lm-sec__chev { transform: rotate(90deg); }
.lm-sec__list {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0 0 10px;
}
.lm-sec:not(.is-open) .lm-sec__list { display: none; }
.lm-sec__list::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 24px;
	inset-inline-start: var(--spine-x);
	width: 2px;
	margin-inline-start: -1px;
	background: var(--lm-line);
}
.lm-item { position: relative; margin: 0; }
.lm-item.is-completed::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	inset-inline-start: var(--spine-x);
	width: 2px;
	margin-inline-start: -1px;
	background: var(--lm-brand-fg);
	opacity: .55;
}
.lm-item:last-child::before { bottom: 50%; }
.lm-item__row {
	position: relative;
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 8px 16px;
	color: var(--lm-ink-2);
	text-decoration: none;
	font-size: 14.5px;
	line-height: 1.35;
}
a.lm-item__row:hover { background: var(--lm-surface-2); color: var(--lm-ink); }
.lm-node {
	position: relative;
	z-index: 1;
	justify-self: center;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid var(--lm-line-2);
	background: var(--lm-surface);
	transition: background-color .25s, border-color .25s, box-shadow .25s;
}
.lm-node .lm-ic { width: 12px; height: 12px; display: none; stroke-width: 3; }
.lm-item.is-completed .lm-node { background: var(--lm-brand-fg); border-color: var(--lm-brand-fg); color: var(--lm-surface); }
.lm-item.is-completed .lm-node__check { display: block; }
.lm-item.is-locked .lm-node { background: var(--lm-surface-2); border-color: var(--lm-line); color: var(--lm-muted); width: 20px; height: 20px; }
.lm-item.is-locked .lm-node__lock { display: block; width: 11px; height: 11px; stroke-width: 2.4; }
.lm-item.is-locked .lm-item__title { color: var(--lm-muted); }
.lm-item.is-current .lm-item__row { background: var(--lm-mark-soft); color: var(--lm-ink); }
.lm-item.is-current .lm-item__title { font-weight: 700; }
.lm-item.is-current:not(.is-completed) .lm-node { border-color: var(--lm-mark-fg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lm-mark-fg) 22%, transparent); }
.lm-item.is-current:not(.is-completed) .lm-node::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lm-mark-fg); }
.lm-item.is-current.is-completed .lm-node { box-shadow: 0 0 0 4px color-mix(in srgb, var(--lm-mark-fg) 26%, transparent); }
.lm-item__meta { display: flex; gap: 8px; color: var(--lm-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lm-item__q { display: inline-flex; align-items: center; gap: 3px; }
.lm-item__q .lm-ic { width: 14px; height: 14px; }
.lm-tag { font-style: normal; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--lm-surface-2); color: var(--lm-muted); border: 1px solid var(--lm-line); }
.lm-item.is-hidden, .lm-sec.is-hidden { display: none; }
.lm-track.is-filtering .lm-sec__list { display: block; }
.lm-empty-note { padding: 16px 18px; color: var(--lm-muted); font-size: 14.5px; margin: 0; }

/* ---------- Main stage ---------- */
.lm-main {
	grid-area: main;
	overflow-y: auto;
	overflow-x: hidden;
	min-width: 0;
	scroll-padding-top: 16px;
	outline: none;
}
.lm-stage {
	max-width: 1060px;
	margin: 0 auto;
	padding: 30px clamp(14px, 3vw, 40px) 56px;
}
.lm-stage.is-wide { max-width: none; }
.lm-lesson-head { margin: 0 0 20px; }
.lm-lesson-head__pos { margin: 0 0 6px; font-size: 14px; color: var(--lm-muted); font-variant-numeric: tabular-nums; }
.lm-lesson-head__title {
	margin: 0;
	font-size: clamp(24px, 2.4vw + 10px, 33px);
	line-height: 1.18;
	font-weight: 700;
	letter-spacing: -.012em;
	color: var(--lm-ink);
	text-wrap: balance;
}

/* ---------- Lesson frame ---------- */
.lm-frame-wrap {
	position: relative;
	background: #fff;
	border: 1px solid var(--lm-line);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: var(--lm-shadow);
	min-height: 200px;
}
.lm-frame {
	display: block;
	width: 100%;
	height: 420px;
	border: 0;
	background: #fff;
	color-scheme: light;
	transition: height .18s ease-out;
}
.lm-frame-wrap.is-fill .lm-frame { height: max(420px, calc(100dvh - var(--lm-top-h) - var(--lm-bottom-h) - 64px)); transition: none; }
.lm-frame-wrap:fullscreen { border-radius: 0; border: 0; overflow: auto; }
.lm-frame-wrap:fullscreen .lm-frame { height: 100% !important; min-height: 100vh; }
.lm-frame-wrap__loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	background: #fff;
	transition: opacity .25s;
}
.lm-frame-wrap__loading span {
	width: 8px; height: 8px; border-radius: 50%;
	background: color-mix(in srgb, var(--lm-brand) 55%, #fff);
	animation: lm-pulse 1s infinite ease-in-out both;
}
.lm-frame-wrap__loading span:nth-child(2) { animation-delay: .15s; }
.lm-frame-wrap__loading span:nth-child(3) { animation-delay: .3s; }
.lm-frame-wrap.is-ready .lm-frame-wrap__loading { opacity: 0; pointer-events: none; }
@keyframes lm-pulse { 0%, 80%, 100% { transform: scale(.55); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.lm-frame-wrap__full {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, .92);
	color: #383c50;
	border: 1px solid #e2e4eb;
	opacity: 0;
	transition: opacity .2s;
}
.lm-frame-wrap__full:hover { background: #fff; color: #1a1c2b; }
.lm-frame-wrap:hover .lm-frame-wrap__full, .lm-frame-wrap__full:focus-visible { opacity: 1; }
@media (hover: none) { .lm-frame-wrap__full { opacity: .9; } }
.lm-frame-wrap:fullscreen .lm-frame-wrap__full { display: none; }

/* ---------- Bottom bar ---------- */
.lm-bottom {
	grid-area: bottom;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
	padding: 0 14px;
	padding-bottom: env(safe-area-inset-bottom);
	background: var(--lm-surface);
	border-top: 1px solid var(--lm-line);
	z-index: 10;
}
.lm-nav {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	max-width: 100%;
	padding: 7px 10px;
	border-radius: 10px;
	text-decoration: none;
	color: var(--lm-ink);
}
.lm-nav--next { justify-self: end; text-align: end; }
.lm-nav--prev { justify-self: start; }
a.lm-nav:hover { background: var(--lm-surface-2); }
.lm-nav .lm-ic { color: var(--lm-muted); }
.lm-nav__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lm-nav__dir { font-size: 12.5px; color: var(--lm-muted); }
.lm-nav__title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }
.lm-nav[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.lm-nav[aria-disabled="true"]:hover { background: transparent; }
.lm-bottom__center { display: flex; justify-content: center; }
.lm-status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 16px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
}
.lm-status--done { background: var(--lm-ok-soft); color: var(--lm-ok); }
.lm-status--done .lm-ic { stroke-width: 2.6; }
.lm-status--todo { background: transparent; color: var(--lm-muted); border: 1px dashed var(--lm-line-2); cursor: pointer; }
.lm-status--todo:hover { color: var(--lm-ink); border-color: var(--lm-muted); }
.lm-complete.is-pop { animation: lm-pop .45s var(--lm-ease); }
@keyframes lm-pop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* ---------- Toast ---------- */
.lm-toast {
	position: fixed;
	left: 50%;
	bottom: calc(var(--lm-bottom-h) + 14px);
	z-index: 60;
	max-width: min(92vw, 520px);
	padding: 12px 18px;
	border-radius: 12px;
	background: var(--lm-ink);
	color: var(--lm-surface);
	font-family: var(--lm-font);
	font-size: 15px;
	line-height: 1.4;
	box-shadow: var(--lm-shadow);
	opacity: 0;
	transform: translate(-50%, 8px);
	pointer-events: none;
	transition: opacity .2s, transform .25s var(--lm-ease);
}
.lm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Gate (login, locked, not enrolled) ---------- */
.lm-gate { padding: clamp(24px, 8vh, 90px) 16px 40px; }
.lm-panel {
	max-width: 520px;
	margin: 0 auto;
	padding: 32px;
	background: var(--lm-surface);
	border: 1px solid var(--lm-line);
	border-radius: 18px;
	box-shadow: var(--lm-shadow);
}
.lm-gate__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--lm-brand-soft); color: var(--lm-brand-fg); margin-bottom: 14px; }
.lm-gate__icon .lm-ic { width: 24px; height: 24px; }
.lm-h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
.lm-h2 { font-size: 22px; line-height: 1.25; margin: 0 0 8px; }
.lm-muted { color: var(--lm-muted); }
.lm-panel .lm-btn { margin-top: 12px; }
.lm-login form p { margin: 0 0 14px; }
.lm-login label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.lm-login input[type="text"], .lm-login input[type="password"] {
	width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--lm-line-2); border-radius: 10px;
	background: var(--lm-surface); color: var(--lm-ink); font: inherit;
}
.lm-login .login-remember label { display: inline-flex; gap: 8px; align-items: center; font-weight: 400; }
.lm-login input[type="submit"] {
	height: 44px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--lm-brand); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}

/* ==========================================================================
   Questions
   ========================================================================== */
.lm-quiz { margin-top: 28px; scroll-margin-top: 16px; }
.lm-qcard {
	background: var(--lm-surface);
	border: 1px solid var(--lm-line);
	border-radius: 18px;
	padding: clamp(18px, 3vw, 34px);
	box-shadow: var(--lm-shadow);
}
.lm-qintro { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.lm-qintro__title { margin: 0 0 4px; font-size: 22px; line-height: 1.25; font-weight: 700; }
.lm-qintro__meta { margin: 0; color: var(--lm-muted); font-size: 15px; }
.lm-qintro__stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--lm-ink-2); }
.lm-qintro__stats li { display: inline-flex; align-items: center; gap: 6px; }
.lm-qintro__stats li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lm-line-2); }
.lm-qintro__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.lm-qtop { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.lm-qtop__pos { font-size: 14px; font-weight: 600; color: var(--lm-muted); font-variant-numeric: tabular-nums; }
.lm-dots { display: flex; flex-wrap: wrap; gap: 5px; max-width: 60%; }
.lm-dot {
	width: 10px; height: 10px; padding: 0; border-radius: 50%;
	border: 1.5px solid var(--lm-line-2); background: transparent; cursor: default;
}
button.lm-dot { cursor: pointer; }
.lm-dot.is-answered { background: var(--lm-brand-fg); border-color: var(--lm-brand-fg); }
.lm-dot.is-right { background: var(--lm-ok); border-color: var(--lm-ok); }
.lm-dot.is-wrong { background: var(--lm-bad); border-color: var(--lm-bad); }
.lm-dot.is-here { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lm-mark-fg) 35%, transparent); border-color: var(--lm-mark-fg); }

.lm-qtext { font-size: 19px; line-height: 1.55; color: var(--lm-ink); margin: 0 0 6px; }
.lm-qhint { font-size: 14px; color: var(--lm-muted); margin: 0 0 16px; }
.lm-choices { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lm-choice {
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr) 22px;
	align-items: start;
	gap: 14px;
	width: 100%;
	padding: 13px 16px;
	border: 1.5px solid var(--lm-line-2);
	border-radius: 13px;
	background: var(--lm-surface);
	color: var(--lm-ink);
	font-size: 16.5px;
	line-height: 1.5;
	text-align: start;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}
.lm-choice:hover:not([disabled]) { border-color: var(--lm-brand-fg); }
.lm-choice__key {
	display: grid; place-items: center;
	width: 32px; height: 32px; margin-top: -3px;
	border-radius: 50%;
	border: 1.5px solid var(--lm-line-2);
	color: var(--lm-muted);
	font-weight: 700; font-size: 14px;
	transition: background-color .15s, color .15s, border-color .15s;
}
.lm-choices.is-multi .lm-choice__key { border-radius: 9px; }
.lm-choice__body { padding-top: 1px; min-width: 0; overflow-wrap: anywhere; }
.lm-choice__mark { width: 22px; height: 22px; margin-top: 2px; }
.lm-choice__mark .lm-ic { width: 22px; height: 22px; stroke-width: 2.6; }
.lm-choice[aria-pressed="true"], .lm-choice[aria-checked="true"] { border-color: var(--lm-brand-fg); background: var(--lm-brand-soft); }
.lm-choice[aria-pressed="true"] .lm-choice__key, .lm-choice[aria-checked="true"] .lm-choice__key { background: var(--lm-brand-fg); border-color: var(--lm-brand-fg); color: var(--lm-surface); }
.lm-choice[disabled] { cursor: default; }
.lm-choices.is-graded .lm-choice:not(.is-right):not(.is-wrong) { opacity: .7; }
.lm-choice.is-right { border-color: var(--lm-ok); background: var(--lm-ok-soft); opacity: 1; }
.lm-choice.is-right .lm-choice__key { background: var(--lm-ok); border-color: var(--lm-ok); color: var(--lm-surface); }
.lm-choice.is-right .lm-choice__mark { color: var(--lm-ok); }
.lm-choice.is-wrong { border-color: var(--lm-bad); background: var(--lm-bad-soft); }
.lm-choice.is-wrong .lm-choice__key { background: var(--lm-bad); border-color: var(--lm-bad); color: var(--lm-surface); }
.lm-choice.is-wrong .lm-choice__mark { color: var(--lm-bad); }

.lm-feedback {
	margin-top: 18px;
	padding: 0;
	animation: lm-rise .3s var(--lm-ease);
}
.lm-feedback__head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16.5px; color: var(--lm-ok); }
.lm-feedback.is-wrong .lm-feedback__head { color: var(--lm-bad); }
.lm-feedback__sub { font-size: 14px; color: var(--lm-ink-2); margin: 2px 0 0; }
.lm-feedback__exp { margin-top: 14px; }
.lm-feedback__exp-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--lm-ink-2); }
@keyframes lm-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.lm-qactions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.lm-qactions__end { display: flex; gap: 10px; margin-inline-start: auto; }
.lm-qnote { font-size: 14px; color: var(--lm-muted); }

.lm-result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
.lm-result__score { display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; background: var(--lm-surface-2); border: 6px solid var(--lm-line); position: relative; }
.lm-result.is-pass .lm-result__score { border-color: var(--lm-ok); }
.lm-result.is-fail .lm-result__score { border-color: var(--lm-bad); }
.lm-result__pct { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.lm-result__pct small { font-size: .55em; }
.lm-result__raw { font-size: 13.5px; color: var(--lm-muted); margin-top: 4px; }
.lm-result__title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.lm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 13.5px; font-weight: 700; }
.lm-pill--ok { background: var(--lm-ok-soft); color: var(--lm-ok); }
.lm-pill--bad { background: var(--lm-bad-soft); color: var(--lm-bad); }
.lm-pill .lm-ic { width: 15px; height: 15px; stroke-width: 2.6; }
.lm-result__meta { margin: 8px 0 0; color: var(--lm-muted); font-size: 14.5px; }
.lm-result__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }

.lm-review { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.lm-review__item { border: 1px solid var(--lm-line); border-radius: 14px; padding: 16px 18px; background: var(--lm-surface); }
.lm-review__head { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; }
.lm-review__n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--lm-surface); background: var(--lm-bad); }
.lm-review__item.is-right .lm-review__n { background: var(--lm-ok); }
.lm-review__q { font-size: 16.5px; line-height: 1.5; }
.lm-review__rows { margin: 10px 0 0; padding-inline-start: 40px; display: grid; gap: 4px; font-size: 15px; }
.lm-review__rows dt { font-size: 13px; color: var(--lm-muted); margin-top: 6px; }
.lm-review__rows dd { margin: 0; }
.lm-review details { margin: 10px 0 0 40px; }
[dir="rtl"] .lm-review details { margin: 10px 40px 0 0; }
.lm-review summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--lm-brand-fg); }
.lm-review details > div { margin-top: 8px; }

/* Rich text inside questions/explanations is rendered into a shadow root; this sizes the host. */
.lm-rich { display: block; min-width: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
	.lm-player, html[data-lm-side="closed"] .lm-player { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "bottom"; }
	html[data-lm-side="closed"] .lm-top { visibility: visible; }
	html[data-lm-side="closed"] .lm-reopen { display: none; }
	html[data-lm-side="closed"] .lm-stage { padding-top: 30px; }
	.lm-top { border-inline-end: 0; }
	.lm-when-wide { display: none; }
	.lm-when-narrow { display: block; }
	.lm-side {
		position: fixed;
		top: var(--lm-top-h);
		bottom: 0;
		inset-inline-start: 0;
		width: min(88vw, 370px);
		visibility: hidden;
		transform: translateX(-102%);
		transition: transform .28s var(--lm-ease), visibility 0s .28s;
		box-shadow: var(--lm-shadow);
		z-index: 40;
	}
	[dir="rtl"] .lm-side { transform: translateX(102%); }
	html[data-lm-drawer="open"] .lm-side { visibility: visible; transform: none; transition: transform .28s var(--lm-ease); }
	.lm-scrim { position: fixed; inset: var(--lm-top-h) 0 0 0; background: rgba(17, 17, 28, .42); z-index: 35; }
	.lm-nav__title { max-width: 18ch; }
}
@media (max-width: 640px) {
	:root { --lm-top-h: 56px; --lm-bottom-h: 64px; }
	.lm-top__section { display: none; }
	.lm-top__ring { margin: 0 2px; }
	.lm-stage { padding: 18px 10px 40px; }
	.lm-frame-wrap { border-radius: 12px; }
	.lm-nav__title { display: none; }
	.lm-nav { padding: 6px; }
	.lm-bottom { gap: 6px; padding: 0 8px; padding-bottom: env(safe-area-inset-bottom); }
	.lm-status, .lm-bottom .lm-btn { padding: 0 12px; font-size: 14.5px; }
	.lm-qintro { grid-template-columns: 1fr; }
	.lm-qintro__actions { justify-content: flex-start; }
	.lm-qtext { font-size: 17.5px; }
	.lm-choice { gap: 10px; padding: 12px; font-size: 16px; grid-template-columns: 30px minmax(0, 1fr) 20px; }
	.lm-result { grid-template-columns: 1fr; justify-items: start; }
	.lm-dots { max-width: 100%; }
	.lm-panel { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
	.lm-player *, .lm-player, .lm-toast { transition: none !important; animation: none !important; }
}

/* Mark as complete: a compact button, so Previous and Next keep their room. */
.lm-bottom .lm-btn.lm-complete, .lm-bottom .lm-status { min-height: 36px; padding: 0 14px; font-size: 14px; gap: 6px; }
.lm-bottom .lm-complete .lm-ic, .lm-bottom .lm-status .lm-ic { width: 16px; height: 16px; }
@media (max-width: 640px) {
	.lm-bottom .lm-btn.lm-complete, .lm-bottom .lm-status { min-height: 34px; padding: 0 11px; font-size: 13.5px; }
	.lm-nav { gap: 4px; }
	.lm-nav__dir { font-size: 13.5px; }
}
@media (max-width: 380px) {
	/* Arrows only on very narrow phones; the words stay for screen readers. */
	.lm-nav__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
	.lm-nav { padding: 8px; }
}
