/* Course hub and lesson pages. Shared tokens come from ui.css. */
* {box-sizing:border-box}
a {color:var(--ms-green)}
button {font:inherit;cursor:pointer}
.course-shell {width:min(1160px,calc(100% - 48px));margin:22px auto 48px}
.course-hero h1, .lesson-head h1 {margin:0;font-size:clamp(26px,3.4vw,38px);line-height:1.2}
.course-hero p {margin:6px 0 14px;color:var(--ms-secondary)}
.course-search {display:flex;flex-direction:column;gap:6px;max-width:560px;font-weight:600;font-size:14px}
.course-search input {font:inherit;font-weight:400;padding:10px 12px;border:1px solid var(--ms-line);border-radius:8px;background:var(--ms-paper)}
.course-status {min-height:1.4em;color:var(--ms-secondary);font-size:14px}
.course-status a {font-weight:600}
.notice {border-left:3px solid #c08a2c;background:#fbf4e4;padding:10px 14px;border-radius:6px;margin:12px 0}
.course-tabs {display:flex;flex-wrap:wrap;gap:8px;margin:18px 0 6px}
.course-tabs button {border:1px solid var(--ms-line);background:var(--ms-paper);border-radius:999px;padding:8px 14px;color:var(--ms-ink)}
.course-tabs button[aria-pressed="true"] {background:var(--ms-green);border-color:var(--ms-green);color:#fff}
.course-tabs small {opacity:.75;margin-left:4px}
.chapter {margin-top:22px}
.chapter h2 {font-size:18px;margin:0 0 8px;display:flex;gap:10px;align-items:baseline}
.chapter h2 small {font-weight:400;color:var(--ms-secondary);font-size:13px}
.lessons {list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:8px}
.lessons li {display:flex;align-items:stretch;border:1px solid var(--ms-line);border-radius:var(--ms-radius);background:var(--ms-paper);overflow:hidden}
.lessons li.done {border-color:#9fbea9}
.lessons .open {flex:1;display:grid;grid-template-columns:auto 1fr;gap:2px 10px;padding:10px 12px;text-decoration:none;color:var(--ms-ink)}
.lessons .num {grid-row:span 2;font-variant-numeric:tabular-nums;color:var(--ms-secondary);font-size:13px;padding-top:2px}
.lessons .title {font-weight:600}
.lessons .meta {font-size:12px;color:var(--ms-secondary)}
.lessons .present {display:flex;align-items:center;padding:0 12px;border-left:1px solid var(--ms-line);font-size:13px;text-decoration:none;color:var(--ms-green);white-space:nowrap}
.lessons .present:hover, .lessons .open:hover {background:#eef3ea}

/* Lesson page */
.lesson-shell {width:min(1440px,calc(100% - 28px));margin:14px auto 30px}
.crumbs {font-size:13px;color:var(--ms-secondary);margin-bottom:4px}
.lesson-head {display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px 18px;margin-bottom:12px}
.lesson-head .num {color:var(--ms-secondary);font-weight:500;margin-right:8px;font-variant-numeric:tabular-nums}
.lesson-actions {display:flex;flex-wrap:wrap;gap:8px}
.lesson-actions a, .lesson-actions button, .tool-row button, .editor button {border:1px solid var(--ms-line);background:var(--ms-paper);border-radius:7px;padding:7px 12px;color:var(--ms-green);text-decoration:none;font-size:14px}
.lesson-actions a[aria-disabled="true"] {pointer-events:none;opacity:.45}
.lesson-grid {display:grid;grid-template-columns:minmax(300px,0.9fr) minmax(0,1.6fr);grid-template-areas:"video stage" "steps stage";gap:12px;align-items:start}
.video-panel {grid-area:video}
.stage-panel {grid-area:stage;position:sticky;top:8px}
.steps-panel {grid-area:steps;border:1px solid var(--ms-line);border-radius:var(--ms-radius);background:var(--ms-paper);padding:12px 14px}
video {width:100%;aspect-ratio:9/16;max-height:62vh;background:#101a17;border-radius:var(--ms-radius);display:block}
video.landscape {aspect-ratio:16/9}
.video-status {font-size:13px;color:var(--ms-secondary);margin:6px 2px}
.stage {position:relative;height:calc(100vh - 150px);min-height:420px;border:1px solid var(--ms-line);border-radius:var(--ms-radius);overflow:hidden;background:#eef2ea}
.stage iframe {position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent}
.stage canvas {position:absolute;inset:0;width:100%;height:100%;pointer-events:none;touch-action:none}
.stage[data-tool="pen"] canvas, .stage[data-tool="laser"] canvas {pointer-events:auto;cursor:crosshair}
.laser {position:absolute;width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;background:rgba(230,40,40,.85);box-shadow:0 0 14px 6px rgba(240,60,60,.45);pointer-events:none}
.stage-loading {position:absolute;inset:auto 0 0 0;padding:8px 12px;background:rgba(255,254,250,.9);font-size:13px;color:var(--ms-secondary)}
.tool-row {display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}
.tool-row button[aria-pressed="true"] {background:var(--ms-green);color:#fff;border-color:var(--ms-green)}
.tool-row .hint {font-size:12px;color:var(--ms-secondary);margin-left:auto}
.steps-panel h2 {font-size:16px;margin:0 0 8px;display:flex;justify-content:space-between;gap:8px}
.steps-panel h2 small {font-weight:400;font-size:12px;color:var(--ms-secondary)}
.steps {list-style:none;margin:0;padding:0;display:grid;gap:4px}
.steps button {width:100%;text-align:left;border:1px solid transparent;background:none;border-radius:7px;padding:7px 9px;color:var(--ms-ink);display:flex;gap:8px}
.steps button:hover {background:#eef3ea}
.steps li[aria-current="step"] button {background:#e3ede1;border-color:#b9cfb8;font-weight:600}
.steps .index {color:var(--ms-secondary);font-variant-numeric:tabular-nums;min-width:1.6em}
.step-note {white-space:pre-wrap;margin:10px 0 4px;padding:8px 10px;background:#f2f5ee;border-radius:7px;font-size:14px}
.step-note:empty {display:none}
.lesson-note {white-space:pre-wrap;font-size:14px;color:var(--ms-ink);margin:8px 0}
.lesson-note:empty {display:none}
.chips {display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.chips button {border:1px solid var(--ms-line);background:#f7f9f4;border-radius:999px;padding:4px 10px;font-size:13px;color:var(--ms-ink)}
.chips button:hover {border-color:var(--ms-green)}
.steps-panel h3 {font-size:14px;margin:14px 0 4px}
.disclaimer {font-size:12px;color:var(--ms-secondary);margin:12px 0 0}
.editor {border-top:1px dashed var(--ms-line);margin-top:12px;padding-top:10px;display:grid;gap:8px}
.editor .row {display:flex;flex-wrap:wrap;gap:6px}
.editor label {display:grid;gap:4px;font-size:13px;font-weight:600}
.editor input, .editor textarea {font:inherit;font-weight:400;border:1px solid var(--ms-line);border-radius:7px;padding:7px 9px;background:#fff}
.editor textarea {min-height:64px;resize:vertical}
.editor .save {background:var(--ms-green);color:#fff;border-color:var(--ms-green)}
.editor .state {font-size:12px;color:var(--ms-secondary)}

@media (max-width:900px) {
  .lesson-grid {grid-template-columns:1fr;grid-template-areas:"video" "stage" "steps"}
  .stage-panel {position:static}
  .stage {height:62vh}
  video {max-height:46vh}
}

/* Presentation mode: the 3D stage fills the screen, the video floats, steps run along the bottom. */
body.present motion-header, body.present .crumbs {display:none}
body.present .lesson-shell {width:100%;margin:0;padding:10px 14px}
body.present .lesson-head {margin-bottom:8px}
body.present .lesson-head h1 {font-size:clamp(28px,3vw,44px)}
body.present .lesson-grid {grid-template-columns:minmax(0,1fr) minmax(260px,24vw);grid-template-rows:auto minmax(0,1fr);grid-template-areas:"stage video" "stage steps";height:calc(100vh - 78px)}
body.present .stage-panel {position:static;display:flex;flex-direction:column;min-height:0;height:100%}
body.present .stage {flex:1;height:auto;min-height:0}
body.present .steps-panel {overflow:auto;min-height:0;max-height:100%}
body.present .editor {display:none}
body.present .steps button {font-size:19px;padding:10px 12px}
body.present .step-note {font-size:19px}
body.present video {max-height:38vh}
body.present.video-off .video-panel {display:none}
body.present.video-off .lesson-grid {grid-template-areas:"stage steps" "stage steps"}
@media print {.stage-panel,.video-panel,.tool-row,.editor {display:none}}

.motion-panel{margin:0 0 8px;padding:10px 13px;background:#fff;border:1px solid #cbdde9;border-radius:10px}
.motion-panel[hidden]{display:none}
.motion-heading,.motion-buttons{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.motion-heading{justify-content:space-between;margin-bottom:7px}
.motion-heading h2{font-size:16px;margin:0;color:#1d3c55}
.motion-heading select{min-width:7em;max-width:100%;min-height:34px;border:1px solid #c5d7e5;border-radius:6px;padding:3px 7px;color:#243f58;background:white;font:inherit}
.motion-buttons button,.return-step{font:inherit;cursor:pointer}
.motion-buttons button{min-height:36px;padding:5px 12px;border:1px solid #c9daeb;border-radius:7px;background:#f4f8ff;color:#234b73}
.motion-buttons button[aria-pressed=true]{color:white;background:#265bb6;border-color:#265bb6}
.return-step{border:0;background:transparent;padding:4px 0;margin-top:3px;color:#2957a0}
.stage-panel:has(.motion-panel:not([hidden])) .stage{height:clamp(340px,calc(100svh - 290px),790px);min-height:0}
body.present .stage-panel:has(.motion-panel:not([hidden])) .stage{height:auto}
.lesson-shell [hidden],.course-shell [hidden]{display:none!important}

.motion-subject-label {display:none}
.motion-panel {
  --motion-blue:#265bb1;
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px 12px;align-items:center;
  margin-bottom:10px;
  padding:14px 16px;
  border:1px solid #cdddec;
  border-radius:14px;
  background:#fff;
  box-shadow:0 2px 7px #213e6310;
}
.motion-panel .motion-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  grid-column:1/-1;gap:8px 16px;margin-bottom:0;
}
.motion-panel h2 {font-size:17px;line-height:1.35;color:#193550;font-weight:680}
.motion-panel .motion-subject {display:flex;align-items:center;gap:8px;min-width:0;max-width:100%}
.motion-panel .motion-subject-label {display:inline;color:#4b637d;font:550 12px/1.4 system-ui,sans-serif;white-space:nowrap}
.motion-panel .motion-picker {display:block;position:relative;min-width:0}
.motion-panel .motion-picker::after {
  content:"";position:absolute;right:15px;top:calc(50% - 4px);width:6px;height:6px;
  border:solid #486580;border-width:0 1.75px 1.75px 0;transform:rotate(45deg);pointer-events:none;
}
.motion-panel select {
  display:block;max-width:100%;min-width:0;min-height:42px;padding:8px 36px 8px 12px;
  appearance:none;-webkit-appearance:none;border:1px solid #c4d5e6;border-radius:9px;
  color:#1d3f61;background:#f6f9fd;font:600 14px/1.4 system-ui,sans-serif;cursor:pointer;
}
.motion-panel .motion-buttons {display:flex;flex-wrap:wrap;gap:7px}
.motion-panel .motion-buttons button {
  display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;padding:8px 14px;
  appearance:none;-webkit-appearance:none;color:#263f59;background:#f4f8fd;border:1px solid #cddbeb;
  border-radius:9px;font:600 14px/1.4 system-ui,sans-serif;
}
.motion-panel .motion-buttons button::before {
  content:"";box-sizing:border-box;width:12px;height:12px;border:1.5px solid #879db6;border-radius:50%;
}
.motion-panel .motion-buttons button[aria-pressed=true] {
  color:#fff;background:var(--motion-blue);border-color:var(--motion-blue);
}
.motion-panel .motion-buttons button[aria-pressed=true]::before {
  border:3.5px solid #fff;background:transparent;
}
.motion-panel .return-step {
  display:inline-flex;align-items:center;grid-column:2;grid-row:2;justify-self:end;min-height:36px;margin:0;padding:4px 2px;
  color:#245695;background:none;border:0;font:560 13px/1.4 system-ui,sans-serif;appearance:none;-webkit-appearance:none;
}
.motion-panel :is(button,select):focus-visible {outline:3px solid #78a9ed;outline-offset:2px}
@media (hover:hover) {
  .motion-panel .motion-buttons button:not([aria-pressed=true]):hover,
  .motion-panel select:hover {border-color:#8faed1;background:#eaf2fc}
  .motion-panel .return-step:hover {text-decoration:underline}
}
@media (pointer:coarse) {
  .motion-panel :is(.motion-buttons button,select,.return-step) {min-height:44px}
}
@media(max-width:520px) {
  .motion-panel {padding:12px}
  .motion-panel .motion-heading {align-items:flex-start}
  .motion-panel .motion-subject-label {display:none}
  .motion-panel .motion-buttons {grid-column:1/-1}
  .motion-panel .return-step {grid-column:1/-1;grid-row:auto;justify-self:start}
}
@media(min-width:901px){body:not(.present) .lesson-grid:has(.motion-panel):has(#video[hidden]){grid-template-rows:auto minmax(0,1fr)}}

.course-library-link{display:inline-block;margin-bottom:12px;color:#235da3;text-underline-offset:3px;font-weight:600}

/* Keep a usable anatomical viewport after the inspector and playback controls
   take their share of the lesson panel, including in the iPad app's shorter web view. */
body:not(.present) .stage-panel[data-course-model] .stage{height:clamp(620px,calc(100svh - 235px),860px)}
@media(max-width:520px){
  body:not(.present) .stage-panel[data-course-model] .stage{height:clamp(560px,82svh,720px)}
}

.source-tabs {display:flex;flex-wrap:wrap;gap:4px;width:fit-content;max-width:100%;margin:8px 0 18px;padding:4px;background:#e8efe9;border-radius:12px}
.source-tabs button {min-height:40px;padding:7px 15px;background:transparent;border:0;border-radius:8px;color:var(--ms-green);font-weight:600}
.source-tabs button[aria-selected=true] {background:var(--ms-paper);box-shadow:0 1px 4px #21443824;color:var(--ms-ink)}
.short-filters {display:flex;gap:12px 20px;align-items:end;flex-wrap:wrap;margin:16px 0}
.short-filters label {display:grid;gap:4px;font-size:13px;font-weight:600}
.short-filters select {font:inherit;color:var(--ms-ink);background:var(--ms-paper);border:1px solid var(--ms-line);border-radius:7px;padding:8px}
#shortCount,.short-track,.short-state {font-size:13px;color:var(--ms-secondary)}
.short-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr));gap:16px}
.short-card {display:flex;flex-direction:column;overflow:hidden;background:var(--ms-paper);border:1px solid var(--ms-line);border-radius:var(--ms-radius);color:var(--ms-ink);text-decoration:none;scroll-margin-top:72px}
.short-card:hover,.short-card:focus-visible {border-color:var(--ms-green)}
.short-cover {position:relative;aspect-ratio:16/9;background:#e4eee8 url('brand-symbol.png') center/48px no-repeat}
.short-cover img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.short-cover .duration {position:absolute;bottom:8px;right:8px;background:#10281fe6;color:white;border-radius:4px;padding:2px 7px;font-size:13px;font-variant-numeric:tabular-nums}
.short-card h2 {font-size:17px;line-height:1.45;margin:3px 13px 14px}
.short-track {margin:12px 13px 0}
.short-state {margin:auto 13px 12px;color:var(--ms-green)}
.lesson-resources {display:grid;justify-items:start;gap:6px;margin:12px 0;font-size:14px}
.lesson-outline {margin-top:12px;padding-top:12px;border-top:1px solid var(--ms-line)}
.lesson-outline h2 {font-size:16px;margin:0 0 6px}
.lesson-outline p,.lesson-outline ol {margin:6px 0;font-size:14px;line-height:1.65}
.lesson-outline ol {padding-left:1.6em}
.lesson-outline li + li {margin-top:6px}
