/* Learner-paced study pages. Scoped independently of the old scene player. */
.hm-study { --hm-ink:#e9e7e0; --hm-muted:#a7b2bd; --hm-blue:#8cbef3; --hm-green:#b3d4b7; --hm-warm:#edc287; color:var(--hm-ink); max-width:1240px; margin:auto; padding:32px 32px 54px; }
.hm-study * { box-sizing:border-box; }
.hm-study [hidden] { display:none!important; }
.hm-study a { color:var(--hm-blue); }
.hm-study p,.hm-study li { max-width:none; }
.hm-study p { margin:0 0 1rem; }
.hm-study h1 { font-size:clamp(2.3rem,4.8vw,3.7rem); margin:13px 0 12px; }
.hm-study h2 { font-size:1.95rem; margin:0 0 18px; }
.hm-study h2:focus { outline:none; }
.hm-study h3 { font-family:inherit; font-size:1.02rem; font-weight:600; margin:0 0 12px; line-height:1.5; }
.hm-study button,.hm-study input,.hm-study select { font:inherit; }
.hm-study button,.hm-study summary,.hm-study select { cursor:pointer; }
.hm-study button { min-height:44px; border:1px solid #495867; border-radius:5px; background:transparent; color:var(--hm-ink); padding:8px 14px; }
.hm-study button:hover { border-color:var(--hm-blue); background:#25313c; }
.hm-study button:disabled { opacity:.45; cursor:default; }
.hm-study :focus-visible { outline:3px solid var(--hm-blue); outline-offset:4px; }
.hm-study .hm-breadcrumb { display:flex; flex-wrap:wrap; gap:9px; font-size:.82rem; color:var(--hm-muted); }
.hm-study .hm-breadcrumb a { color:var(--hm-muted); text-decoration:none; }
.hm-study .hm-breadcrumb a:hover { text-decoration:underline; }
.hm-study .hm-heading { display:flex; justify-content:space-between; align-items:end; gap:30px; margin:24px 0 28px; }
.hm-study .hm-kicker { font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; font-weight:600; color:var(--hm-green); margin:0; }
.hm-study .hm-description { color:#b8c1ca; font-size:1.03rem; max-width:650px; margin:0; }
.hm-study .hm-prereq { font-size:.78rem; color:var(--hm-muted); text-align:right; max-width:200px; margin:0 0 4px; flex:none; }
.hm-study .hm-prereq strong { display:block; color:#d6dce2; font-weight:500; }
.hm-study .hm-tabs { display:flex; gap:5px; overflow-x:auto; padding:8px 0 12px; border-bottom:1px solid #3b4652; margin-bottom:28px; scrollbar-width:thin; position:sticky; top:var(--hm-header-height,64px); z-index:8; background:#161a20; scroll-margin-top:calc(var(--hm-header-height,64px) + 8px); }
.hm-study .hm-tabs a { display:block; flex:none; color:#b8c1ca; padding:10px 15px; text-decoration:none; font-size:.89rem; border-radius:4px; min-height:44px; }
.hm-study .hm-tabs a[aria-current="step"] { color:#142019; background:var(--hm-green); }
.hm-study .hm-tabs a:hover { color:#fff; background:#29343f; }
.hm-study .hm-tabs a[aria-current="step"]:hover { color:#142019; background:#c4e0c7; }
.hm-study .hm-tabs span { font-size:.73rem; opacity:.75; margin-right:7px; }
.hm-study .hm-panel { padding:0; scroll-margin-top:100px; border:0; }
.hm-study:not(.hm-ready) .hm-panel { margin-bottom:70px; }
.hm-study .hm-layout { display:grid; grid-template-columns:minmax(0,.92fr) minmax(0,1.18fr); grid-template-areas:"intro visual" "prose visual"; grid-template-rows:auto 1fr; gap:0 42px; align-items:start; }
.hm-study .hm-layout > .hm-section-intro { grid-area:intro; }
.hm-study .hm-layout > .hm-prose { grid-area:prose; }
.hm-study .hm-layout > :last-child { grid-area:visual; }
.hm-study .hm-mobile-menu { display:none; }
.hm-study .hm-prose { font-size:.98rem; line-height:1.7; }
.hm-study .hm-section-number { color:var(--hm-muted); font-size:.76rem; letter-spacing:.12em; text-transform:uppercase; margin:0 0 12px; }
.hm-study .hm-maths { font-family:Georgia,"Times New Roman",serif; font-size:1.3rem; letter-spacing:.01em; line-height:1.8; }
.hm-study sup { font-size:.65em; line-height:0; }
.hm-study .hm-rule { border-left:2px solid var(--hm-green); padding:8px 0 8px 17px; margin:22px 0; }
.hm-study .hm-rule p { margin:0; }
.hm-study .hm-note { color:var(--hm-muted); font-size:.82rem; line-height:1.6; }
.hm-study .hm-note strong { color:var(--hm-warm); font-weight:500; }
.hm-study .hm-visual { border:1px solid #394551; background:#111820; border-radius:8px; overflow:hidden; min-width:0; }
.hm-study .hm-visual-top { display:flex; justify-content:space-between; gap:14px; align-items:center; padding:18px 22px 12px; font-size:.75rem; color:var(--hm-muted); }
.hm-study .hm-visual-top strong { color:#dbe3e9; font-weight:500; font-size:.83rem; }
.hm-study .hm-visual svg { display:block; width:100%; height:auto; }
.hm-study .hm-visual svg text { font-family:Georgia,"Times New Roman",serif; fill:#e9edf0; }
.hm-study .hm-visual-caption { padding:0 22px 20px; font-size:.86rem; color:#bcc8d1; margin:0; min-height:50px; }
.hm-study .hm-visual-caption p { margin:0; }
.hm-study .hm-visual-controls { display:flex; flex-wrap:wrap; gap:8px; padding:16px 20px; background:#1b252f; border-top:1px solid #394551; }
.hm-study .hm-visual-controls button { font-size:.83rem; }
.hm-study .hm-visual-controls button[aria-pressed="true"] { background:#c9dfed; border-color:#c9dfed; color:#152633; }
.hm-study .hm-visual-controls .hm-play { margin-left:auto; color:var(--hm-blue); }
.hm-study .hm-clip { border-top:1px solid #394551; padding:16px 20px; background:#1b252f; }
.hm-study .hm-clip summary { font-size:.88rem; color:var(--hm-blue); min-height:28px; }
.hm-study .hm-clip video { width:100%; display:block; margin-top:14px; border-radius:3px; }
.hm-study .hm-clip p { margin:10px 0 0; font-size:.79rem; color:var(--hm-muted); }
.hm-study .hm-key { display:flex; flex-wrap:wrap; gap:10px 21px; font-size:.77rem; color:var(--hm-muted); margin:12px 0 16px; }
.hm-study .hm-key span::before { content:""; display:inline-block; width:8px; height:8px; border-radius:2px; background:var(--color); margin-right:8px; }
.hm-study .hm-steps { padding:0; list-style:none; margin:22px 0; counter-reset:working; }
.hm-study .hm-steps li { position:relative; counter-increment:working; padding:12px 12px 12px 42px; border-bottom:1px solid #303b46; line-height:1.6; }
.hm-study .hm-steps li::before { content:counter(working); position:absolute; top:16px; left:10px; color:#9eabb7; font-size:.75rem; }
.hm-study .hm-steps li.hm-selected { background:#202d36; border-radius:4px; }
.hm-study .hm-steps p { margin:0; }
.hm-study .hm-steps .hm-maths { font-size:1.21rem; }
.hm-study .hm-steps .hm-note { font-size:.82rem; }
.hm-study .hm-check { border:1px solid #405448; border-radius:6px; padding:16px 18px; margin:18px 0; background:#1b2924; }
.hm-study .hm-check p:last-child { margin:0; }
.hm-study .hm-toggle-row { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0; }
.hm-study .hm-toggle-row button[aria-pressed="true"] { color:#142019; background:var(--hm-green); }
.hm-study .hm-example { padding:20px 23px; }
.hm-study .hm-example .hm-maths { font-size:1.36rem; margin-bottom:13px; }
.hm-study .hm-example .hm-note { color:#abbac7; }
.hm-study .hm-example-line { border-bottom:1px solid #2b3a45; padding-bottom:13px; }
.hm-study .hm-equation-label { font-family:inherit; color:var(--hm-muted); font-size:.8rem; }
.hm-study .hm-slider-grid { padding:18px 22px 8px; display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.hm-study .hm-slider-grid label { display:block; font-size:.83rem; color:#c4ced7; }
.hm-study .hm-slider-grid output { float:right; color:#fff; }
.hm-study input[type="range"] { width:100%; display:block; height:36px; accent-color:var(--hm-blue); margin:6px 0 0; }
.hm-study select { background:#1e2b37; color:var(--hm-ink); border:1px solid #526473; border-radius:4px; padding:7px; min-height:44px; }
.hm-study .hm-graph-settings { padding:0 22px 18px; display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:.83rem; }
.hm-study .hm-graph-settings label { display:flex; align-items:center; gap:10px; }
.hm-study .hm-graph-readout { font-size:1.24rem; text-align:center; padding:12px 12px 0; font-family:Georgia,serif; }
.hm-study .hm-graph [data-vertex] { cursor:grab; touch-action:none; }
.hm-study .hm-graph [data-vertex]:active { cursor:grabbing; }
.hm-study .hm-practice-layout { display:grid; grid-template-columns:minmax(0,.72fr) minmax(0,1.4fr); gap:45px; }
.hm-study .hm-questions { display:grid; gap:14px; }
.hm-study .hm-question { padding:21px 24px; border:1px solid #3a4652; border-radius:6px; background:#1b242d; }
.hm-study .hm-question h3 { font-size:.78rem; letter-spacing:.08em; text-transform:uppercase; color:var(--hm-green); }
.hm-study .hm-question .hm-maths { margin:4px 0 13px; }
.hm-study .hm-question details { margin-top:12px; font-size:.9rem; }
.hm-study .hm-question summary { min-height:36px; color:var(--hm-blue); padding:3px 0; }
.hm-study .hm-question details[open] summary { margin-bottom:10px; }
.hm-study .hm-question details p { margin:0 0 10px; }
.hm-study .hm-question details p:last-child { margin:0; }
.hm-study .hm-question details .hm-maths { font-size:1.15rem; }
.hm-study .hm-summary-list { margin:20px 0; padding-left:20px; }
.hm-study .hm-summary-list li { margin-bottom:14px; }
.hm-study .hm-tuition { background:#d5e1d6; color:#1b2c23; padding:30px; border-radius:7px; }
.hm-study .hm-tuition h3 { font:500 1.85rem/1.15 Newsreader,Georgia,serif; color:#1b2c23; }
.hm-study .hm-tuition p { font-size:.97rem; }
.hm-study .hm-tuition a { color:#1b2c23; font-weight:600; }
.hm-study .hm-tuition .hm-note { color:#405748; }
.hm-study .hm-bottom { display:flex; align-items:center; justify-content:space-between; gap:18px; border-top:1px solid #3b4652; padding-top:20px; margin-top:32px; }
.hm-study .hm-bottom p { margin:0; font-size:.8rem; color:var(--hm-muted); }
.hm-study .hm-bottom div { display:flex; gap:8px; }
.hm-study .hm-bottom button { font-size:.87rem; }
.hm-study .hm-bottom .hm-next { color:#16271e; border-color:var(--hm-green); background:var(--hm-green); }
.hm-study .hm-js-only { display:none; }
.hm-study.hm-ready .hm-js-only { display:flex; }
.hm-study.hm-ready .hm-slider-grid { display:grid; }
.hm-study details > summary { min-height:44px; padding-top:7px; padding-bottom:7px; }
@media(max-width:850px) {
  .hm-study { padding:24px 22px 40px; }
  .hm-study .hm-heading { align-items:start; }
  .hm-study .hm-prereq { display:none; }
  .hm-study .hm-layout,.hm-study .hm-practice-layout { grid-template-columns:1fr; gap:24px; }
  .hm-study .hm-layout { grid-template-areas:"intro" "visual" "prose"; grid-template-rows:auto; gap:18px; }
  .hm-study #remember .hm-layout { grid-template-areas:"intro" "prose" "visual"; }
  .hm-study .hm-section-intro h2 { margin-bottom:0; }
  .hm-study .hm-description { font-size:.96rem; }
  .hm-study h1 { font-size:2.65rem; }
  .hm-study .hm-visual { max-width:640px; width:100%; margin:0 auto; }
  .hm-study .hm-bottom { align-items:start; }
  .hm-study .hm-bottom p { max-width:180px; }
}
@media(max-width:480px) {
  .hm-study { padding:22px 16px 34px; }
  .hm-study .hm-heading { margin:22px 0; }
  .hm-study h1 { font-size:2.35rem; }
  .hm-study h2 { font-size:1.7rem; }
  .hm-study .hm-tabs { margin-bottom:22px; }
  .hm-study.hm-ready .hm-tabs a { display:none; }
  .hm-study.hm-ready .hm-mobile-menu { display:flex; align-items:center; width:100%; gap:13px; color:var(--hm-muted); font-size:.83rem; }
  .hm-study .hm-mobile-menu select { flex:1; min-width:0; }
  .hm-study .hm-tabs a { padding:10px 12px; }
  .hm-study .hm-visual svg text { font-size:24px; }
  .hm-study .hm-visual svg text[font-size="36"] { font-size:36px; }
  .hm-study .hm-visual svg text[font-size="28"] { font-size:28px; }
  .hm-study .hm-visual-top { padding:14px 15px 8px; }
  .hm-study .hm-visual-caption { padding:0 15px 16px; font-size:.82rem; }
  .hm-study .hm-maths { font-size:1.22rem; }
  .hm-study .hm-example { padding:20px 16px; }
  .hm-study .hm-example .hm-maths { font-size:1.15rem; }
  .hm-study .hm-slider-grid { gap:14px; padding:15px 15px 5px; }
  .hm-study .hm-graph-settings { padding:0 15px 15px; }
  .hm-study .hm-question { padding:19px 17px; }
  .hm-study .hm-bottom { flex-direction:column; gap:12px; }
  .hm-study .hm-bottom div { width:100%; justify-content:space-between; }
  .hm-study .hm-bottom p { max-width:none; }
  .hm-study .hm-tuition { padding:25px 21px; }
}
@media print {
  @page { margin:16mm; }
  .masthead,footer,.skip-link,.hm-study .hm-tabs,.hm-study .hm-bottom,.hm-study .hm-clip,.hm-study .hm-js-only,.hm-study .hm-tuition,.hm-study .hm-visual-controls,.hm-study .hm-slider-grid,.hm-study .hm-graph-settings { display:none!important; }
  body,.hm-study { background:white!important; color:#151515!important; }
  .hm-study { padding:0; max-width:none; --hm-ink:#151515; --hm-muted:#444; --hm-blue:#222; --hm-green:#222; --hm-warm:#222; }
  .hm-study * { color:inherit!important; background-color:transparent!important; border-color:#aaa!important; box-shadow:none!important; }
  .hm-study .hm-panel,.hm-study .hm-panel[hidden] { display:block!important; margin:24pt 0; }
  .hm-study .hm-layout,.hm-study .hm-practice-layout { display:block; }
  .hm-study .hm-layout > * { margin-bottom:14pt; }
  .hm-study .hm-heading { display:block; }
  .hm-study .hm-prereq { display:block; text-align:left; max-width:none; margin-top:12pt; }
  .hm-study h1 { font-size:26pt; }
  .hm-study h2 { font-size:20pt; }
  .hm-study h2,.hm-study h3,.hm-study summary { break-after:avoid; }
  .hm-study .hm-visual { break-inside:avoid; max-width:150mm; margin:12pt 0; }
  /* Invert the existing dark vector palette onto paper, including a solid
     ground so labels remain readable when background printing is disabled. */
  .hm-study .hm-visual svg { background-color:#111820!important; filter:grayscale(1) invert(1); print-color-adjust:exact; -webkit-print-color-adjust:exact; }
  .hm-study details::details-content { content-visibility:visible!important; }
  .hm-study details { break-inside:auto; }
  .hm-study summary { font-weight:600; list-style:none; }
}

/* Shared lesson components. */
.hm-study .hm-reading { max-width:780px; }
.hm-study .hm-working-line { border-bottom:1px solid #2b3a45; padding-bottom:13px; margin-bottom:16px; }
.hm-study .hm-working-line:last-child { border-bottom:0; padding-bottom:0; margin-bottom:0; }
.hm-study .hm-working-line .hm-maths { margin-bottom:7px; }
.hm-study .hm-working-line .hm-note { margin:0; }
.hm-study .hm-indent { margin-left:1.1em; }
.hm-study .hm-cancelled { text-decoration:line-through; text-decoration-color:var(--hm-warm); color:var(--hm-warm); }
.hm-study .hm-prose details { border-top:1px solid #394551; padding-top:8px; margin:17px 0; }
.hm-study .hm-prose details summary { color:var(--hm-blue); font-size:.92rem; }
.hm-study .hm-prose details[open] summary { margin-bottom:10px; }
@media(max-width:480px) { .hm-study .hm-visual-top { flex-wrap:wrap; gap:3px 12px; } }
.hm-study .hm-region-checkbox { display:flex; align-items:center; gap:9px; width:100%; min-height:44px; font-size:.86rem; }
.hm-study .hm-region-checkbox input { width:19px; height:19px; accent-color:var(--hm-green); }
.hm-study [data-sign-widget] .hm-visual-controls label { display:flex; align-items:center; gap:8px; font-size:.84rem; }
.hm-study .hm-question .hm-visual { margin-bottom:18px; }

/* Chapter 4: keep manual selectors and point coordinates readable on phones. */
.hm-study [data-ch4-plot] { overflow: visible; }
.hm-study [data-poly-widget] select, .hm-study [data-mapping-widget] select { max-width: 100%; }
.hm-study [data-poly-widget] label, .hm-study [data-reciprocal-widget] label, .hm-study [data-intersections-widget] label, .hm-study [data-mapping-widget] label { display: grid; gap: 8px; max-width: 100%; }
.hm-study .hm-point-table { padding: 12px 18px; overflow-x: auto; }
.hm-study .hm-point-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.hm-study .hm-point-table caption { text-align: left; padding-bottom: 12px; color: #adbdca; }
.hm-study .hm-point-table th, .hm-study .hm-point-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #2b3945; white-space: nowrap; }

.hm-study [data-intersections-widget] .hm-visual-controls { align-items: end; }
.hm-study [data-poly-widget] label.hm-region-checkbox { display: flex; align-items: center; }

/* Straight-line controls and equal-scale geometry diagrams. */
.hm-study [data-gradient-widget] label, .hm-study [data-directions-widget] label, .hm-study [data-model-widget] label { display: grid; gap: 8px; max-width: 100%; }
.hm-study [data-directions-widget] .hm-visual-controls { align-items: end; }
.hm-study [data-model-widget] label.hm-region-checkbox { display: flex; align-items: center; }
.hm-study [data-model-widget] .hm-point-table th, .hm-study [data-model-widget] .hm-point-table td { white-space: normal; }

/* Keep every division stage visible while the learner chooses a focus. */
.hm-study .hm-division-row { padding:12px; border-left:3px solid transparent; }
.hm-study .hm-division-row[aria-current="step"] { border-left-color:var(--hm-green); background:#20312e; }
.hm-study [data-claim-widget] .hm-visual-controls label { display:grid; gap:6px; min-width:0; }

/* Chapter 10: an equation selector must fit even a narrow phone column. */
.hm-study [data-equation-widget] .hm-visual-controls label { display:grid; gap:8px; flex:1; min-width:0; max-width:100%; }
.hm-study [data-equation-widget] select { width:100%; min-width:0; max-width:100%; }

/* Column vectors and arrow notation remain legible without a maths renderer. */
.hm-column-vector { display:inline-block; vertical-align:middle; border-left:1.6px solid currentColor; border-right:1.6px solid currentColor; border-radius:35% / 15%; padding:2px 9px; margin:3px 4px; line-height:1.2; }
.hm-column-vector > span { display:inline-grid; grid-template-rows:auto auto; gap:3px; text-align:center; }
.hm-arrow-vector { display:inline-block; position:relative; padding-top:.15em; white-space:nowrap; }
.hm-arrow-vector::before { content:'→'; position:absolute; top:-.45em; left:0; right:0; font-size:.8em; line-height:1; text-align:center; }
.hm-study [data-vector-widget] .hm-visual-controls label { display:grid; flex:1 1 190px; min-width:0; max-width:100%; gap:7px; font-size:.9rem; }
.hm-study [data-vector-widget] select,.hm-study [data-vector-widget] input { width:100%; min-width:0; max-width:100%; }
.hm-study [data-vector-widget] input[type="range"] { min-height:44px; accent-color:#b3d4b7; }
.hm-vector-control-line { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.hm-vector-control-line output { font-variant-numeric:tabular-nums; color:#b3d4b7; }

/* Differentiation controls retain native keyboard behaviour on small screens. */
.hm-study [data-diff-widget] .hm-visual-controls label { display:grid; flex:1 1 190px; min-width:0; max-width:100%; gap:7px; font-size:.9rem; }
.hm-study [data-diff-widget] select,.hm-study [data-diff-widget] input { width:100%; min-width:0; max-width:100%; }
.hm-study [data-diff-widget] input[type="range"] { min-height:44px; accent-color:#b3d4b7; }
.hm-diff-control-line { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.hm-diff-control-line output { font-variant-numeric:tabular-nums; color:#b3d4b7; }

/* Integration controls show actual values while retaining native input behaviour. */
.hm-study [data-integral-widget] .hm-visual-controls label { display:grid; flex:1 1 190px; min-width:0; max-width:100%; gap:7px; font-size:.9rem; }
.hm-study [data-integral-widget] select,.hm-study [data-integral-widget] input { width:100%; min-width:0; max-width:100%; }
.hm-study [data-integral-widget] input[type="range"] { min-height:44px; accent-color:#b3d4b7; }
.hm-integral-control-line { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.hm-integral-control-line output { font-variant-numeric:tabular-nums; color:#b3d4b7; }

/* Exponential and logarithmic models: native controls, explicit labels. */
.hm-study [data-exp-widget] .hm-visual-controls label { display:grid; flex:1 1 190px; min-width:0; max-width:100%; gap:7px; font-size:.9rem; }
.hm-study [data-exp-widget] select,.hm-study [data-exp-widget] input { width:100%; min-width:0; max-width:100%; }
.hm-study [data-exp-widget] input[type="range"] { min-height:44px; accent-color:#b3d4b7; }
.hm-exp-control-line { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.hm-exp-control-line output { font-variant-numeric:tabular-nums; color:#b3d4b7; }
