/* BIOMED REWIRED - course lessons. Adds only what lesson.css / library.css do not cover. */
.crs-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.crs-lead { max-width: 76ch; font-size: 1.05rem; line-height: 1.7; color: #dce8fa; margin: 0 0 22px; }
.crs-storage, .crs-planned { max-width: 76ch; font-size: .9rem; line-height: 1.6; color: var(--muted); margin: 18px 0 0; }
.crs-planned { color: #cfe0f6; }

/* Course index */
.crs-parts { display: grid; gap: 12px; max-width: 900px; counter-reset: none; }
.crs-part-box { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px solid rgba(40,200,255,.4); border-radius: 12px; background: linear-gradient(180deg, rgba(12,34,68,.9), rgba(7,20,42,.92)); }
a.crs-part-box:hover { border-color: var(--cyan); background: rgba(25,211,240,.1); }
.crs-part.is-soon .crs-part-box { border-style: dashed; border-color: rgba(255,255,255,.22); background: rgba(8,22,44,.55); color: #b7c6de; }
.crs-part-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.crs-part-main b { font-size: 1.05rem; color: #fff; }
.crs-part.is-soon .crs-part-main b { color: #d4e0f2; }
.crs-part-main small { font-size: .86rem; line-height: 1.45; color: var(--muted); }
.crs-part-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.crs-soon { color: #c3d1e8; border-style: dashed; background: transparent; white-space: nowrap; }

/* Lesson */
.crs-obj { max-width: 76ch; border: 1.5px solid rgba(40,200,255,.35); border-radius: 12px; padding: 16px 20px 8px; margin: 0 0 18px; background: rgba(5,16,34,.55); }
.crs-obj h2, .crs-prog-h { font-size: 1.15rem; margin: 0 0 8px; }
.crs-obj p { margin: 0 0 8px; color: #dce8fa; }
.crs-obj .les-list { margin-bottom: 12px; }
.crs-progress { max-width: 76ch; border: 1.5px solid rgba(40,200,255,.35); border-radius: 12px; padding: 16px 20px; margin: 0 0 18px; background: rgba(8,22,44,.7); }
.crs-prog-status { margin: 0 0 8px; }
.crs-prog-list { display: grid; gap: 4px; margin: 0 0 10px; list-style: none; }
.crs-prog-note { font-size: .86rem; line-height: 1.55; color: var(--muted); margin: 0 0 10px; }
.crs-done-msg { margin: 0 0 10px; padding: 10px 14px; border-radius: 8px; border-left: 4px solid #31d36a; background: rgba(49,211,106,.14); }
.crs-reset, .crs-markbtn { font: inherit; font-size: .9rem; font-weight: 600; border-radius: 8px; padding: 9px 16px; min-height: 44px; border: 1.5px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.crs-reset:hover, .crs-markbtn:hover { border-color: var(--cyan); background: rgba(25,211,240,.1); }
.crs-markbtn.is-on { background: rgba(49,211,106,.16); border-color: #31d36a; }
.crs-mark { margin: 18px 0 0; }
.crs-tick { margin-left: auto; color: #6fe3a0; font-weight: 700; min-width: 1em; }
.toc a { align-items: baseline; }

/* Glossary links and dialog */
.gloss { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline dotted var(--cyan); text-decoration-thickness: 2px; text-underline-offset: 4px; border-radius: 3px; }
.gloss:hover { background: rgba(25,211,240,.16); }
.crs-gloss-body { padding: 16px 20px 22px; font-size: 1rem; line-height: 1.65; }
.crs-gloss-body p { margin: 0 0 10px; }
.crs-gloss-more a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

/* Diagram: scroll sideways instead of shrinking labels on narrow screens */
.crs-fig-scroll { overflow-x: auto; background: #07142b; border: 1.5px solid rgba(40,200,255,.35); border-radius: 12px; padding: 10px; }
.crs-fig-scroll img { display: block; width: 100%; min-width: 640px; height: auto; }

/* Previous / next */
.crs-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; max-width: 900px; }
.crs-pn > * { display: grid; gap: 4px; padding: 14px 16px; border: 1.5px solid rgba(40,200,255,.4); border-radius: 12px; background: rgba(8,22,44,.7); }
.crs-pn a:hover { border-color: var(--cyan); background: rgba(25,211,240,.1); }
.crs-pn small { color: var(--muted); font-size: .78rem; }
.crs-pn b { color: #fff; }
.crs-pn-next { text-align: right; justify-items: end; }
.crs-pn.has-prev .crs-pn-back { order: 3; grid-column: 1 / -1; }
.crs-pn .is-soon { border-style: dashed; border-color: rgba(255,255,255,.22); color: #b7c6de; }

@media (max-width: 640px) {
  .crs-part-box { flex-wrap: wrap; }
  .crs-part-side { width: 100%; justify-content: flex-start; padding-left: 38px; }
  .crs-pn { grid-template-columns: 1fr; }
  .crs-pn-next { text-align: left; justify-items: start; }
  .crs-obj, .crs-progress { padding-left: 14px; padding-right: 14px; }
}

/* Keep wide content (tables, the scrollable diagram) from stretching the page on narrow screens */
.crs .les-layout { grid-template-columns: 290px minmax(0, 1fr); }
.crs .les-body { min-width: 0; }
@media (max-width: 960px) { .crs .les-layout { grid-template-columns: minmax(0, 1fr); } }

/* Touch targets: at least 44 px for course quiz controls (course pages only) */
.crs .q-check { min-height: 44px; padding: 10px 20px; }
.crs .q-opt { min-height: 44px; align-items: center; }
.crs .q-opt input { margin-top: 0; width: 20px; height: 20px; }

/* Diagram scroll cue */
.crs-fig-wrap { position: relative; }
.crs-scroll-hint { display: none; align-items: center; justify-content: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: rgba(25,211,240,.14); border: 1px solid rgba(25,211,240,.55); color: #dff8ff; font-size: .9rem; font-weight: 600; }
.crs-fig-wrap.can-scroll .crs-scroll-hint { display: flex; }
.crs-fig-wrap.can-scroll.at-end .crs-scroll-hint { display: none; }
.crs-fig-wrap.can-scroll:not(.at-end)::after { content: ""; position: absolute; top: 44px; right: 1.5px; bottom: 12px; width: 44px; border-radius: 0 12px 12px 0; pointer-events: none; background: linear-gradient(90deg, rgba(10,28,58,0), rgba(10,28,58,.95)); }
.crs-fig-scroll { scrollbar-width: auto; scrollbar-color: var(--cyan) #0b1b36; }
.crs-fig-scroll::-webkit-scrollbar { height: 12px; }
.crs-fig-scroll::-webkit-scrollbar-track { background: #0b1b36; border-radius: 6px; }
.crs-fig-scroll::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 6px; }
@media (max-width: 400px) {
  .lesson.crs { padding-left: 12px; padding-right: 12px; }
  .crs-part-main b { font-size: 1rem; }
}

.crs-unver { display: block; margin-top: 6px; font-size: .88rem; line-height: 1.55; color: #ffd9b3; }
.crs-unver .chip { margin-right: 4px; }
.crs-personal { list-style: disc; }

/* Readability: lift small supporting text on course pages */
.crs .crs-prog-note, .crs .sec-sources, .crs .quiz-note { font-size: .92rem; }
.crs .chip { font-size: .78rem; }

/* Saved-answer notice inside quiz feedback */
.crs .q-restored { font-size: .92rem; opacity: .85; margin: 0 0 .5rem; }
.crs .crs-prog-note a { text-decoration: underline; }

/* Tall (portrait) diagrams: keep proportions, never force sideways scrolling */
.fig-art.fig-tall { display: flex; justify-content: center; }
.fig-art.fig-tall img { display: block; width: 100%; max-width: 440px; height: auto; }
@media (min-width: 700px) { .fig-art.fig-tall img { width: auto; max-width: 100%; max-height: min(86vh, 860px); } }
@media (max-width: 520px) { .fig-art.fig-tall { padding: 6px; margin-left: -10px; margin-right: -10px; } }

/* Tap-to-enlarge for tall diagrams (small screens only) */
.crs-enlarge { display: none; margin-top: 8px; min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600; color: #fff; background: rgba(25,211,240,.14); border: 1.5px solid var(--cyan); border-radius: 10px; cursor: pointer; }
.crs-enlarge:hover { background: rgba(25,211,240,.26); }
@media (max-width: 520px) { .crs-enlarge { display: inline-flex; align-items: center; } }
dialog#crs-enlarge { width: min(96vw, 680px); max-width: 96vw; padding: 0; color: #eaf2ff; background: #0a1c3a; border: 1.5px solid rgba(40,200,255,.5); border-radius: 14px; }
dialog#crs-enlarge::backdrop { background: rgba(2,8,20,.78); }
.crs-enl-hint { margin: 0; padding: 8px 16px; font-size: .88rem; color: #a9bbd6; }
.crs-enl-scroll { overflow: auto; max-height: 72vh; margin: 0 8px 12px; background: #07142b; border-radius: 10px; }
.crs-enl-scroll img { display: block; width: 100%; max-width: 480px; margin: 0 auto; height: auto; }

/* Enlarge viewer for wide diagrams: fills the pop-up width, so turning the phone sideways makes it larger */
dialog#crs-enlarge.fit { width: 96vw; }
dialog#crs-enlarge.fit .crs-enl-scroll img { width: 100%; min-width: 0; max-width: none; margin: 0; }
@media (orientation: landscape) { dialog#crs-enlarge.fit .crs-enl-scroll img { min-width: 640px; } }
.crs-enl-scroll { touch-action: pan-x pan-y pinch-zoom; }
@media (orientation: landscape) and (max-height: 500px) { .crs-enl-scroll { max-height: 70vh; } }
