/* Treatment | Exam mode switch (header) and the Exam panel. */
.mode { display: flex; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; }
.mode button { border: 0; background: none; min-height: 36px; padding: 0 16px; border-radius: 9px; font: 600 14px "Plus Jakarta Sans", system-ui, sans-serif; color: var(--muted); cursor: pointer; }
.mode button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0002; }
.mode button.on[data-mode="exam"] { color: var(--indigo); }

/* In exam mode the treatment panels, the meridian rail (its highlight would give the channel away),
   the point label and the 3D caption (they name the point) are hidden. */
.app.exam .tabs, .app.exam #casePanel, .app.exam #merPanel, .app.exam .rail, .app.exam .mwiz { display: none; }
.app.exam .pcap, .app.exam .lbl.sel { display: none !important; }
.app.exam { grid-template-columns: 0 minmax(0, 3fr) minmax(0, 7fr); }
@media (max-width: 1280px) and (min-width: 861px) { .app.exam { grid-template-columns: 0 minmax(0, 3fr) minmax(0, 7fr); } }
.app.exam aside { padding: 28px clamp(20px, 4vw, 56px); }
.app.exam :is(#examPanel, #quizPanel), .app.exam aside > .legal { max-width: 920px; margin-inline-start: auto; margin-inline-end: auto; }
.app.exam .tools .long { display: none; }
@media (max-width: 860px) { .app.exam .stage { height: 34svh; min-height: 240px; } .app.exam aside { padding: 16px 16px 32px; } }

/* Question bar: back to the menu, where you are, progress. */
:is(#examPanel, #quizPanel) .qbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
:is(#examPanel, #quizPanel) .qbar .back { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-height: 38px; padding: 0 12px; font: 600 14px "Plus Jakarta Sans", system-ui, sans-serif; color: var(--indigo); cursor: pointer; flex: none; }
:is(#examPanel, #quizPanel) .qbar .back:hover { background: var(--indigo-soft); }
:is(#examPanel, #quizPanel) .qbar .qt { font: 700 11px "JetBrains Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
:is(#examPanel, #quizPanel) .qbar .qn { margin-inline-start: auto; font: 700 13px "JetBrains Mono", ui-monospace, monospace; color: var(--ink); flex: none; }
:is(#examPanel, #quizPanel) .prog { height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 18px; overflow: hidden; }
:is(#examPanel, #quizPanel) .prog i { display: block; height: 100%; background: var(--indigo); transition: width .25s; }

:is(#examPanel, #quizPanel) h1 { font-size: 24px; margin: 0 0 16px; }
:is(#examPanel, #quizPanel) .qp { font-size: 19px; line-height: 1.3; margin: 0 0 14px; letter-spacing: -.01em; }
:is(#examPanel, #quizPanel) .modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
:is(#examPanel, #quizPanel) .modes button { border: 0; background: none; border-radius: 9px; padding: 8px 6px; text-align: center; cursor: pointer; font: inherit; color: var(--muted); min-height: 44px; }
:is(#examPanel, #quizPanel) .modes button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0002; }
:is(#examPanel, #quizPanel) .modes b { display: block; font-size: 14px; }
:is(#examPanel, #quizPanel) .modes span { font-size: 11px; line-height: 1.3; display: block; }
:is(#examPanel, #quizPanel) .review { display: flex; gap: 8px; margin-bottom: 14px; }
:is(#examPanel, #quizPanel) .ma s { color: #a12a2e; }
:is(#examPanel, #quizPanel) .topics { display: grid; gap: 10px; margin-bottom: 16px; }
:is(#examPanel, #quizPanel) .topics button { text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 16px; cursor: pointer; font: inherit; color: var(--ink); min-height: 44px; }
:is(#examPanel, #quizPanel) .topics button:hover { border-color: var(--indigo); background: var(--indigo-soft); }
:is(#examPanel, #quizPanel) .topics b { display: block; font-size: 16px; margin-bottom: 2px; }
:is(#examPanel, #quizPanel) .topics span { font-size: 13px; color: var(--muted); }
:is(#examPanel, #quizPanel) .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
:is(#examPanel, #quizPanel) .opts.one { grid-template-columns: 1fr; }
:is(#examPanel, #quizPanel) .he, :is(#examPanel, #quizPanel) [dir="rtl"] { direction: rtl; text-align: right; }
:is(#examPanel, #quizPanel) .ctx { font-size: 14px; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; line-height: 1.5; }
:is(#examPanel, #quizPanel) .opts button { min-height: 48px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; font: 600 14px "Plus Jakarta Sans", system-ui, sans-serif; color: var(--ink); cursor: pointer; text-align: start; line-height: 1.25; display: flex; align-items: center; gap: 10px; }
:is(#examPanel, #quizPanel) .opts button:hover:not(:disabled) { border-color: var(--indigo); background: var(--indigo-soft); }
:is(#examPanel, #quizPanel) .opts button:disabled { cursor: default; opacity: .75; }
:is(#examPanel, #quizPanel) .opts button.ok { border-color: #00c76a; background: #e9fbf2; color: #00804a; opacity: 1; }
:is(#examPanel, #quizPanel) .opts button.bad { border-color: var(--pain); background: #fdecec; color: #a12a2e; opacity: 1; }
:is(#examPanel, #quizPanel) .tapme { background: var(--indigo-soft); color: var(--indigo); border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; }
:is(#examPanel, #quizPanel) .fb { margin-top: 14px; border-radius: 12px; padding: 12px 14px; font-size: 14px; background: #f3f5ff; }
:is(#examPanel, #quizPanel) .fb.ok { background: #e9fbf2; } :is(#examPanel, #quizPanel) .fb.half { background: #fff3e6; } :is(#examPanel, #quizPanel) .fb.bad { background: #fdecec; }
:is(#examPanel, #quizPanel) .fb p { margin: 6px 0 0; color: var(--ink); }
:is(#examPanel, #quizPanel) .badge { font: 700 10.5px "Plus Jakarta Sans", system-ui, sans-serif; font-style: normal; text-transform: uppercase; letter-spacing: .04em; background: #f5b400; color: #3d2c00; border-radius: 5px; padding: 1px 6px; margin-inline-end: 4px; vertical-align: middle; }
:is(#examPanel, #quizPanel) .badge.alt { background: #dbeafe; color: #1e3a8a; }
:is(#examPanel, #quizPanel) .qnav { display: flex; gap: 8px; margin-top: 14px; }
:is(#examPanel, #quizPanel) .next { flex: 1; min-height: 44px; border: 0; background: var(--indigo); color: #fff; border-radius: 12px; font: 700 15px "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; }
:is(#examPanel, #quizPanel) .act { min-height: 44px; border: 1px solid var(--line); background: #fff; color: var(--indigo); border-radius: 12px; padding: 0 14px; font: 600 14px "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; }
:is(#examPanel, #quizPanel) .score { font: 800 44px "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: -.03em; margin: 0 0 18px; color: var(--indigo); }
:is(#examPanel, #quizPanel) .miss { border-top: 1px solid var(--line); padding: 10px 0; font-size: 13.5px; }
:is(#examPanel, #quizPanel) .mq { font-weight: 600; margin-bottom: 3px; }
:is(#examPanel, #quizPanel) .ma { color: var(--muted); }
:is(#examPanel, #quizPanel) .ma b { color: var(--ink); font-family: "JetBrains Mono", ui-monospace, monospace; }

/* Adopted from flash-card-flex: stats strip, numbered options, result ring, leave dialog. */
:is(#examPanel, #quizPanel) .he-ui { direction: rtl; text-align: right; }
:is(#examPanel, #quizPanel) .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin: 0 0 16px; }
:is(#examPanel, #quizPanel) .stats .cell { border-radius: 10px; padding: 6px 8px; text-align: center; background: var(--bg); }
:is(#examPanel, #quizPanel) .stats b { display: block; font: 800 18px "Plus Jakarta Sans", system-ui, sans-serif; }
:is(#examPanel, #quizPanel) .stats span { font-size: 11.5px; color: var(--muted); }
:is(#examPanel, #quizPanel) .stats .c { background: #e9fbf2; } :is(#examPanel, #quizPanel) .stats .c b { color: #00804a; }
:is(#examPanel, #quizPanel) .stats .w { background: #fdecec; } :is(#examPanel, #quizPanel) .stats .w b { color: #a12a2e; }
:is(#examPanel, #quizPanel) .stats .s { background: #fff6dc; } :is(#examPanel, #quizPanel) .stats .s b { color: #9a6a00; }
:is(#examPanel, #quizPanel) .stats .r b, :is(#examPanel, #quizPanel) .stats .a b { color: var(--indigo); }
:is(#examPanel, #quizPanel) .stats.big b { font-size: 24px; }
:is(#examPanel, #quizPanel) .opts .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); font: 700 13px "Plus Jakarta Sans", system-ui, sans-serif; font-style: normal; }
:is(#examPanel, #quizPanel) .opts button.ok .n { background: #00c76a; color: #fff; }
:is(#examPanel, #quizPanel) .opts button.bad .n { background: var(--pain); color: #fff; }
:is(#examPanel, #quizPanel) .opts button.picked { border-color: var(--indigo); background: var(--indigo-soft); opacity: 1; }
:is(#examPanel, #quizPanel) .opts button.picked .n { background: var(--indigo); color: #fff; }
:is(#examPanel, #quizPanel) .keys { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }
@media (hover: none) { :is(#examPanel, #quizPanel) .keys { display: none; } }
:is(#examPanel, #quizPanel) .res { display: flex; align-items: center; gap: 20px; margin: 4px 0 16px; flex-wrap: wrap; }
:is(#examPanel, #quizPanel) .ring { width: 128px; height: 128px; flex: none; }
:is(#examPanel, #quizPanel) .ring circle { fill: none; stroke-width: 12; }
:is(#examPanel, #quizPanel) .ring .track { stroke: var(--line); }
:is(#examPanel, #quizPanel) .ring .val { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; transition: stroke-dasharray .8s ease; }
:is(#examPanel, #quizPanel) .ring .val.pass { stroke: #00c76a; } :is(#examPanel, #quizPanel) .ring .val.fail { stroke: var(--pain); }
:is(#examPanel, #quizPanel) .ring text { text-anchor: middle; dominant-baseline: middle; }
:is(#examPanel, #quizPanel) .ring .pct { font: 800 26px "Plus Jakarta Sans", system-ui, sans-serif; fill: var(--ink); }
:is(#examPanel, #quizPanel) .ring .lbl { font: 600 10px "Plus Jakarta Sans", system-ui, sans-serif; fill: var(--muted); }
:is(#examPanel, #quizPanel) .grade { font: 800 22px "Plus Jakarta Sans", system-ui, sans-serif; margin: 0 0 4px; }
:is(#examPanel, #quizPanel) .grade.pass { color: #00804a; } :is(#examPanel, #quizPanel) .grade.fail { color: #a12a2e; }
:is(#examPanel, #quizPanel) .rtxt p { margin: 2px 0; }
:is(#examPanel, #quizPanel) .qnav.col { flex-direction: column; }
:is(#examPanel, #quizPanel) .qnav.wrap { flex-wrap: wrap; margin: -6px 0 14px; }
:is(#examPanel, #quizPanel) .leave { padding: 8px 0; }
:is(#examPanel, #quizPanel) .topics button:disabled { opacity: .5; cursor: not-allowed; }
:is(#examPanel, #quizPanel) .topics em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--indigo); background: var(--indigo-soft); border-radius: 6px; padding: 2px 6px; margin-inline-start: 6px; }
:is(#examPanel, #quizPanel) .modes { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { :is(#examPanel, #quizPanel) .modes { grid-template-columns: repeat(2, 1fr); } }
:is(#examPanel, #quizPanel) .he-ui .ma b, :is(#examPanel, #quizPanel) .he-ui .qn { font-family: "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: 0; }
.mode button.paused::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--boost); margin-inline-start: 6px; vertical-align: middle; }

/* Exit lives at the bottom of the question screen, pinned so it stays in reach while scrolling. */
:is(#examPanel, #quizPanel) .qexit { position: sticky; bottom: 0; margin: 16px 0 0; padding: 10px 0; background: linear-gradient(transparent, #fff 30%); }
:is(#examPanel, #quizPanel) .qexit .exit { width: 100%; min-height: 46px; border: 2px solid #d64545; background: #fff; color: #c03030; border-radius: 12px; font: 700 15px "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; }
:is(#examPanel, #quizPanel) .qexit .exit:hover, :is(#examPanel, #quizPanel) .qexit .exit:focus-visible { background: #d64545; color: #fff; outline: none; }
.app.exam aside { display: flex; flex-direction: column; }
.app.exam :is(#examPanel, #quizPanel) { flex: 1 0 auto; display: flex; flex-direction: column; }
.app.exam :is(#examPanel, #quizPanel) > .he-ui { flex: 1 0 auto; display: flex; flex-direction: column; }
:is(#examPanel, #quizPanel) .qexit { margin-top: auto; padding-top: 16px; }
:is(#examPanel, #quizPanel) .qnav { scroll-margin-bottom: 90px; }
/* Phones: the page scrolls, not the panel, so Exit pins to the screen, just above the tab bar (58px, side-nav.css; the iOS
   app lifts the bar by the home indicator, --sab). */
@media (max-width: 860px) {
  .app.exam:not(.study-anat) > aside { overflow: visible; }
  :is(#examPanel, #quizPanel) .qexit { bottom: calc(58px + var(--sab, 0px)); }
  :is(#examPanel, #quizPanel) .qnav { scroll-margin-bottom: 150px; }
}

/* Learn mode flip cards. */
:is(#examPanel, #quizPanel) .fc-deck { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 4px 0 6px; }
:is(#examPanel, #quizPanel) .fc { all: unset; display: block; width: 100%; max-width: 640px; height: clamp(260px, 46svh, 420px); perspective: 1400px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:is(#examPanel, #quizPanel) .fc:focus-visible .fc-face { outline: 3px solid #f5b400; outline-offset: 3px; }
:is(#examPanel, #quizPanel) .fc-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
:is(#examPanel, #quizPanel) .fc.flipped .fc-inner { transform: rotateY(180deg); }
:is(#examPanel, #quizPanel) .fc-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px 30px; border-radius: 26px; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: auto; box-shadow: 0 18px 40px -18px rgba(30, 34, 90, .45), 0 2px 6px rgba(30, 34, 90, .08); }
:is(#examPanel, #quizPanel) .fc-face.front { background: radial-gradient(120% 90% at 15% 0%, #5b63e6 0%, #3a3fae 45%, #22255f 100%); color: #fff; }
:is(#examPanel, #quizPanel) .fc-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, #fffaf0 0%, #f4f1ff 100%); color: var(--ink); border: 1px solid #e6e2fb; }
:is(#examPanel, #quizPanel) .fc-tag { position: absolute; top: 16px; inset-inline-start: 20px; font: 700 10.5px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
:is(#examPanel, #quizPanel) .fc-ctx { font-size: 14px; opacity: .8; max-width: 52ch; }
:is(#examPanel, #quizPanel) .fc-q { font: 700 clamp(19px, 2.4vw, 26px)/1.3 "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: -.015em; max-width: 30ch; }
:is(#examPanel, #quizPanel) .fc-a { margin: 0; font: 800 clamp(22px, 3vw, 32px)/1.2 "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: -.02em; color: #2f348f; max-width: 26ch; }
:is(#examPanel, #quizPanel) .fc-ex { font-size: 14px; line-height: 1.45; color: #4a4f68; max-width: 52ch; }
:is(#examPanel, #quizPanel) .fc-hint { position: absolute; bottom: 16px; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); }
:is(#examPanel, #quizPanel) .fc-nav { display: flex; align-items: center; gap: 18px; }
:is(#examPanel, #quizPanel) .fc-arrow { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--indigo); font: 600 26px/1 "Plus Jakarta Sans", system-ui, sans-serif; cursor: pointer; box-shadow: 0 2px 6px rgba(30, 34, 90, .08); transition: transform .15s, background .15s; }
:is(#examPanel, #quizPanel) .fc-arrow:hover:not(:disabled) { background: var(--indigo-soft); transform: scale(1.06); }
:is(#examPanel, #quizPanel) .fc-arrow:disabled { opacity: .35; cursor: default; }
:is(#examPanel, #quizPanel) .fc-count { font: 700 14px "JetBrains Mono", ui-monospace, monospace; color: var(--ink); min-width: 70px; text-align: center; }
:is(#examPanel, #quizPanel) .fc-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 420px; }
:is(#examPanel, #quizPanel) .fc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
:is(#examPanel, #quizPanel) .fc-dots i.seen { background: #b8bdf3; }
:is(#examPanel, #quizPanel) .fc-dots i.on { background: var(--indigo); transform: scale(1.35); }
@media (prefers-reduced-motion: reduce) { :is(#examPanel, #quizPanel) .fc-inner { transition: none; } }
.app.exam :is(#examPanel, #quizPanel) { width: 100%; box-sizing: border-box; }
:is(#examPanel, #quizPanel) .fc-deck + .keys { text-align: center; }
:is(#examPanel, #quizPanel) .he-ui .fc-count, :is(#examPanel, #quizPanel) .he-ui .fc-tag { font-family: "Plus Jakarta Sans", system-ui, sans-serif; letter-spacing: 0; }
/* The page footer cites the course for the Treatment notes; the Exam tab does not show it. */
.app.exam aside > .legal:not(.exam-legal), .app:not(.exam) .exam-legal { display: none; }

/* Multi-select (select all that apply), countdown, explanation links, Show on body */
:is(#examPanel, #quizPanel) .opts.multi { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
:is(#examPanel, #quizPanel) .opts.multi button { min-height: 44px; }
:is(#examPanel, #quizPanel) .opts button.miss { border: 2px dashed #00c76a; opacity: 1; }
:is(#examPanel, #quizPanel) .qbar .qtimer { font: 700 13px "JetBrains Mono", ui-monospace, monospace; color: var(--indigo); background: var(--indigo-soft); border-radius: 8px; padding: 2px 8px; flex: none; }
:is(#examPanel, #quizPanel) .qlinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
:is(#examPanel, #quizPanel) .act.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
:is(#examPanel, #quizPanel) .miss .act.sm { margin-top: 6px; }
:is(#examPanel, #quizPanel) .timer-opt { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
:is(#examPanel, #quizPanel) .timer-opt input { width: 18px; height: 18px; accent-color: var(--indigo); }

/* Study → Anatomy: the anatomy-layers viewer fills everything under the header. */
.study-view button.on { color: var(--indigo); }
.study-view[hidden] { display: none; }
/* Phones: no room beside Treatment | Study, so the switch takes its own row under it. */
@media (max-width: 860px) {
  .bar:has(.study-view:not([hidden])) { height: auto; flex-wrap: wrap; row-gap: 6px; column-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .study-view { order: 3; flex: 1 0 100%; }
  .study-view button { flex: 1; }
}

/* Quiz tab: the anatomy dock would name the highlighted part — keep it closed. */
.app.quiz #anatDock { display: none !important; }
#quizPanel .qz-card { border: 1px solid var(--line); background: #fff; border-radius: 14px; overflow: hidden; }
#quizPanel .qz-card > button { width: 100%; border: 0; border-radius: 0; }
#quizPanel .qz-card .qz-pool { display: block; margin-top: 4px; font-size: 12px; }
/* The card itself starts the quiz; the pill says so. */
#quizPanel .topics .qz-card .qz-go { display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 999px; background: var(--indigo); color: #fff; font-size: 13px; font-weight: 700; }
#quizPanel .topics .qz-card button:disabled .qz-go { background: var(--muted); }
#quizPanel .qz-set { border-top: 1px solid var(--line); padding: 0 16px; font-size: 13px; }
#quizPanel .qz-set summary { cursor: pointer; padding: 10px 0; color: var(--indigo); font-weight: 600; min-height: 24px; }
#quizPanel .qz-set label { display: flex; align-items: center; gap: 8px; min-height: 40px; }
#quizPanel .qz-set label[hidden] { display: none; }
#quizPanel .qz-num { justify-content: space-between; }
#quizPanel .qz-num input { width: 84px; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: inherit; }
#quizPanel .qz-check input { width: 18px; height: 18px; accent-color: var(--indigo); }
#quizPanel .qz-set[open] { padding-bottom: 10px; }
#quizPanel .qz-own { border-top: 1px solid var(--line); padding: 4px 16px 8px; font-size: 13px; }
#quizPanel .qz-own > b { display: block; padding: 8px 0 2px; }
#quizPanel .qz-own label { display: flex; align-items: center; gap: 8px; min-height: 40px; }
#quizPanel .qz-own label .muted { margin-inline-start: auto; font-size: 12px; }
#quizPanel .qz-own p { margin: 4px 0 0; }
