.basics-understand {
  width: 100%; min-height: 0; height: 100%; display: block; overflow: hidden;
  border: 0; border-radius: 0; background: transparent; padding: 0;
}
.basics-understand__panel { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); gap: var(--space-3); }
.basics-understand__panel-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.basics-understand__panel-header h3 { margin: 0; font-size: var(--text-lg); }
.basics-understand__eyebrow { color: var(--mode-soft-text); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: .04em; text-transform: uppercase; }
.basics-understand__panel-body { min-height: 0; display: grid; gap: var(--space-3); align-content: start; overflow: auto; padding-right: 2px; }
.basics-understand__prompt,.basics-understand__instruction,.basics-understand__takeaway,.basics-understand__insight { margin:0; padding: var(--space-3); border-radius: var(--radius-md); background: var(--mode-soft); color: var(--mode-soft-text); line-height: var(--leading-normal); }
.basics-understand__graph-host { min-height: 0; }
.basics-understand__action-row { display:flex; flex-wrap:wrap; gap:var(--space-2); align-items:center; }
.basics-understand__button { min-height: var(--touch-target-min); padding: 0 var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--surface-base); color:var(--text-primary); font:inherit; font-weight:var(--weight-semibold); cursor:pointer; }
.basics-understand__button--primary { border-color:var(--mode-accent); background:var(--mode-soft); color:var(--mode-soft-text); }
.basics-understand__button:focus-visible,.basics-understand select:focus-visible,.basics-understand input:focus-visible { outline:3px solid var(--focus-ring); outline-offset:2px; }
.basics-understand__status { color:var(--text-secondary); font-size:var(--text-sm); }

.basics-understand__sidebar-panel { display:grid; gap:var(--space-2); margin-top:var(--space-2); padding:var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-lg); background:var(--surface-subtle); }
.basics-understand__sidebar-title { color:var(--text-primary); font-size:var(--text-sm); }
.basics-understand__sidebar-label { display:grid; gap:4px; color:var(--text-secondary); font-size:var(--text-xs); font-weight:var(--weight-semibold); }
.basics-understand__sidebar-select { min-height:var(--touch-target-min); width:100%; padding:0 var(--space-2); border:1px solid var(--border-default); border-radius:var(--radius-sm); background:var(--surface-base); color:var(--text-primary); font:inherit; font-size:var(--text-sm); }
.basics-understand__sidebar-select:focus-visible { outline:3px solid var(--focus-ring); outline-offset:2px; }
.basics-understand__sidebar-values { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-2); }
.basics-understand__sidebar-value { min-width:0; padding:var(--space-2); border-radius:var(--radius-md); background:var(--surface-base); color:var(--text-primary); font-family:var(--font-math); font-size:var(--text-sm); font-weight:var(--weight-semibold); text-align:center; }
.basics-understand__gradient-stage { position:relative; min-width:0; min-height:0; height:100%; }
.basics-understand__gradient-popin { position:absolute; z-index:5; top:var(--space-3); right:var(--space-3); width:min(390px,calc(100% - 2 * var(--space-3))); display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--space-2); align-items:center; padding:var(--space-3); border:1px solid var(--mode-accent); border-radius:var(--radius-lg); background:var(--surface-base); box-shadow:0 8px 24px rgba(23,32,51,.14); }
.basics-understand__gradient-prompt,.basics-understand__gradient-feedback { margin:0; font-size:var(--text-sm); line-height:var(--leading-snug); }
.basics-understand__gradient-prompt { color:var(--text-primary); font-weight:var(--weight-semibold); }
.basics-understand__gradient-feedback { grid-column:1/-1; padding-top:var(--space-2); border-top:1px solid var(--border-default); color:var(--mode-soft-text); }
.basics-understand__gradient-feedback[hidden] { display:none; }
.basics-understand__gradient-toggle { white-space:nowrap; }
.basics-understand__gradient-popin.is-revealed { background:var(--mode-soft); }
.basics-understand__graph-card-tools { display:flex; align-items:center; justify-content:flex-end; gap:var(--space-2); min-width:0; }
.basics-understand__graph-card-tools--function { grid-column:2; grid-row:1 / span 2; }
.basics-understand__graph-card-tools--derivative { grid-column:2; grid-row:1 / span 2; flex-wrap:wrap; }
.basics-understand__graph-values { display:flex; justify-content:flex-end; gap:var(--space-1); flex-wrap:wrap; }
.basics-understand__graph-value { display:inline-flex; align-items:center; min-height:34px; padding:.2rem .55rem; border-radius:999px; background:var(--surface-subtle); color:var(--text-primary); font-variant-numeric:tabular-nums; font-weight:var(--weight-semibold); white-space:nowrap; }
.basics-understand__graph-action { min-height:38px; padding:0 var(--space-3); white-space:nowrap; }
.basics-understand__graph-status { white-space:nowrap; text-align:right; }
.basics-understand__polynomial-entry { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--space-2) var(--space-3); align-items:end; padding:var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-lg); background:var(--surface-subtle); }
.basics-understand__polynomial-label { display:grid; gap:4px; color:var(--text-secondary); font-size:var(--text-sm); font-weight:var(--weight-semibold); }
.basics-understand__polynomial-input { min-height:var(--touch-target-min); width:100%; border:1px solid var(--border-default); border-radius:var(--radius-sm); background:var(--surface-base); color:var(--text-primary); padding:0 var(--space-3); font:inherit; font-family:var(--font-math); font-size:1.05rem; }
.basics-understand__polynomial-input[aria-invalid="true"] { border-color:var(--color-danger,#b42318); }
.basics-understand__polynomial-help,.basics-understand__polynomial-entry .basics-understand__status { grid-column:1/-1; margin:0; }
.basics-understand__polynomial-help { color:var(--text-secondary); font-size:var(--text-xs); line-height:var(--leading-normal); }
.basics-understand__coefficient-heading { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:var(--space-2); color:var(--text-secondary); }
.basics-understand__coefficient-heading span { font-size:var(--text-xs); }
.basics-understand__coefficients { display:grid; grid-template-columns:repeat(auto-fit,minmax(76px,1fr)); gap:var(--space-2); }
.basics-understand__coefficient { display:grid; gap:4px; color:var(--text-secondary); font-size:var(--text-xs); font-weight:var(--weight-semibold); }
.basics-understand__coefficient input { min-height:var(--touch-target-min); width:100%; border:1px solid var(--border-default); border-radius:var(--radius-sm); background:var(--surface-base); color:var(--text-primary); padding:0 var(--space-2); font:inherit; }
.basics-understand__notation-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:var(--space-3); }
.basics-understand__notation-card { min-width:0; display:grid; gap:var(--space-2); padding:var(--space-4); border:1px solid var(--border-default); border-radius:var(--radius-lg); background:var(--surface-subtle); }
.basics-understand__notation-card p { margin:0; color:var(--text-secondary); line-height:var(--leading-normal); }
.basics-understand__notation-formula { font-family:var(--font-math); font-size:clamp(1.7rem,4vw,2.8rem); color:var(--mode-soft-text); }
.basics-understand__equivalence,.basics-understand__rule-reveal,.basics-understand__term-result { padding:var(--space-4); border:1px solid var(--mode-accent); border-radius:var(--radius-lg); background:var(--mode-soft); color:var(--mode-soft-text); font-family:var(--font-math); font-size:clamp(1.2rem,2.8vw,1.8rem); text-align:center; }
.basics-understand__equivalence { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:var(--space-3); align-items:center; }
.basics-understand__equivalence-math { min-width:0; }
.basics-understand__equivalence-join { font-family:var(--font-ui); font-size:var(--text-sm); font-weight:var(--weight-semibold); color:var(--text-secondary); text-transform:uppercase; letter-spacing:.06em; }
.basics-understand__notation-story { display:grid; grid-template-columns:minmax(150px,.28fr) minmax(0,1fr); gap:var(--space-3); align-items:start; padding:var(--space-3) var(--space-4); border-left:4px solid var(--mode-accent); border-radius:0 var(--radius-md) var(--radius-md) 0; background:var(--surface-subtle); }
.basics-understand__notation-story-title { color:var(--text-primary); }
.basics-understand__notation-story p { margin:0; color:var(--text-secondary); font-size:var(--text-sm); line-height:var(--leading-normal); }
.basics-understand__inline-math { display:inline-block; margin:0 .12em; font-family:var(--font-math); color:var(--mode-soft-text); }
.basics-understand__operator-workspace { min-height:0; height:100%; display:grid; place-content:center; gap:var(--space-4); padding:clamp(var(--space-4),4vw,var(--space-8)); border:1px solid var(--border-default); border-radius:var(--radius-xl); background:linear-gradient(180deg,var(--surface-base),var(--surface-subtle)); }
.basics-understand__operator-equation { display:grid; grid-template-columns:auto minmax(210px,360px) auto minmax(150px,260px); gap:clamp(var(--space-2),1.5vw,var(--space-4)); align-items:center; justify-content:center; }
.basics-understand__operator-symbol,.basics-understand__operator-result { display:grid; place-items:center; min-height:84px; color:var(--mode-soft-text); font-family:var(--font-math); font-size:clamp(1.9rem,4.2vw,3.2rem); }
.basics-understand__operator-choice { min-width:0; }
.basics-understand__operator-select { width:100%; min-height:84px; padding:0 3rem 0 var(--space-4); border:2px solid var(--mode-accent); border-radius:var(--radius-lg); background:var(--surface-base); color:var(--text-primary); font-family:var(--font-math); font-size:clamp(1.55rem,3vw,2.35rem); font-weight:var(--weight-semibold); text-align:center; cursor:pointer; }
.basics-understand__operator-select:focus-visible { outline:3px solid var(--focus-ring); outline-offset:3px; }
.basics-understand__operator-equals { color:var(--text-primary); font-family:var(--font-math); font-size:clamp(2rem,4vw,3rem); text-align:center; }
.basics-understand__operator-result { min-width:0; padding:0 var(--space-4); border:1px solid var(--mode-accent); border-radius:var(--radius-lg); background:var(--mode-soft); font-weight:var(--weight-semibold); }
.basics-understand__operator-hint { max-width:760px; margin:0 auto; color:var(--text-secondary); font-size:var(--text-sm); line-height:var(--leading-normal); text-align:center; }
.basics-understand__machine-arrow { color:var(--mode-soft-text); font-size:1.55rem; font-weight:var(--weight-bold); text-align:center; }
.basics-understand__pattern-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--space-3); align-content:start; }
.basics-understand__pattern-card { min-width:0; display:grid; gap:var(--space-2); padding:var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-lg); background:linear-gradient(180deg,var(--surface-base),var(--surface-subtle)); box-shadow:0 4px 14px rgba(23,32,51,.06); }
.basics-understand__pattern-label { width:max-content; padding:.2rem .55rem; border-radius:999px; background:var(--surface-subtle); color:var(--text-secondary); font-size:var(--text-xs); font-weight:var(--weight-semibold); letter-spacing:.06em; }
.basics-understand__pattern-equation { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,.75fr); gap:var(--space-2); align-items:center; min-height:70px; }
.basics-understand__pattern-expression,.basics-understand__pattern-answer { min-width:0; font-family:var(--font-math); font-size:clamp(1.2rem,2vw,1.7rem); text-align:center; }
.basics-understand__pattern-answer { padding:.4rem .55rem; border-radius:var(--radius-md); background:var(--mode-soft); color:var(--mode-soft-text); font-weight:var(--weight-semibold); }
.basics-understand__pattern-equals { color:var(--text-primary); font-family:var(--font-math); font-size:1.45rem; font-weight:var(--weight-bold); text-align:center; }
.basics-understand__power-rule-reveal { justify-self:center; min-width:220px; }
.basics-understand__power-rule-reveal-area { display:grid; gap:var(--space-3); }
.basics-understand__power-rule-reveal-area[hidden] { display:none; }
.basics-understand__power-rule-bubble { display:grid; gap:var(--space-3); padding:clamp(var(--space-4),2.2vw,var(--space-6)); border:2px solid var(--mode-accent); border-radius:var(--radius-xl); background:var(--surface-base); box-shadow:0 10px 28px rgba(23,32,51,.10); }
.basics-understand__power-rule-heading { justify-self:center; padding:.25rem .7rem; border-radius:999px; background:var(--mode-soft); color:var(--mode-soft-text); font-size:var(--text-xs); font-weight:var(--weight-bold); letter-spacing:.08em; }
.basics-understand__power-rule-formula { display:flex; justify-content:center; align-items:baseline; flex-wrap:wrap; gap:.06em; color:var(--text-primary); font-family:var(--font-math); font-size:clamp(2rem,4.4vw,3.5rem); font-weight:var(--weight-semibold); line-height:1.15; }
.basics-understand__power-rule-formula sup { top:-.35em; position:relative; font-size:.62em; line-height:0; }
.basics-understand__rule-neutral { color:var(--text-primary); }
.basics-understand__rule-coefficient { color:#2563eb; }
.basics-understand__rule-power { color:#dc2626; }
.basics-understand__rule-variable { color:#0f766e; }
.basics-understand__power-rule-legend { display:flex; justify-content:center; gap:var(--space-2); flex-wrap:wrap; }
.basics-understand__rule-key { display:inline-flex; align-items:center; gap:.15rem; padding:.35rem .7rem; border:1px solid currentColor; border-radius:999px; background:var(--surface-subtle); font-size:var(--text-sm); }
.basics-understand__rule-key--coefficient { color:#2563eb; }
.basics-understand__rule-key--power { color:#dc2626; }
.basics-understand__rule-key--variable { color:#0f766e; }
.basics-understand__power-rule-notice { display:grid; gap:var(--space-1); padding:var(--space-3) var(--space-4); border-left:5px solid var(--mode-accent); border-radius:0 var(--radius-lg) var(--radius-lg) 0; background:var(--mode-soft); color:var(--mode-soft-text); text-align:center; box-shadow:0 4px 12px rgba(23,32,51,.06); }
.basics-understand__power-rule-notice strong { font-size:clamp(1rem,1.5vw,1.2rem); }
.basics-understand__power-rule-notice span { font-size:var(--text-sm); }
.basics-understand__term-map { min-height:0; display:grid; grid-template-columns:auto repeat(4,minmax(0,1fr)); grid-template-rows:minmax(74px,auto) 74px minmax(74px,auto); gap:0 var(--space-3); align-items:center; padding:clamp(var(--space-4),2vw,var(--space-6)); border:1px solid var(--border-default); border-radius:var(--radius-xl); background:linear-gradient(180deg,var(--surface-base),var(--surface-subtle)); }
.basics-understand__term-map-label { min-width:84px; padding-right:var(--space-3); color:var(--text-primary); font-family:var(--font-math); font-size:clamp(1.4rem,2.4vw,2rem); font-weight:var(--weight-semibold); text-align:right; white-space:nowrap; }
.basics-understand__term-map-label--top { grid-column:1; grid-row:1; }
.basics-understand__term-map-label--bottom { grid-column:1; grid-row:3; }
.basics-understand__term-token { min-width:0; min-height:62px; display:grid; place-items:center; padding:var(--space-2) var(--space-3); border:1px solid transparent; border-radius:var(--radius-lg); background:transparent; color:var(--text-primary); font-family:var(--font-math); font-size:clamp(1.25rem,2.2vw,1.9rem); font-weight:var(--weight-semibold); cursor:pointer; transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease,color .16s ease,transform .16s ease; }
.basics-understand__term-token--source { background:var(--surface-base); border-color:var(--border-default); }
.basics-understand__term-token--derivative { background:var(--mode-soft); border-color:transparent; color:var(--mode-soft-text); }
.basics-understand__term-token:hover,.basics-understand__term-token:focus-visible,.basics-understand__term-token.is-active { border-color:var(--mode-accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--mode-accent) 14%,transparent); outline:none; transform:translateY(-1px); }
.basics-understand__term-token.is-active { background:var(--mode-soft); color:var(--mode-soft-text); }
.basics-understand__term-connector { min-height:74px; display:grid; grid-template-rows:1fr auto; justify-items:center; align-items:stretch; color:var(--border-strong); transition:color .16s ease,transform .16s ease; }
.basics-understand__term-connector-line { width:2px; min-height:42px; align-self:stretch; background:currentColor; border-radius:999px; }
.basics-understand__term-connector-arrow { margin-top:-6px; font-size:1.45rem; line-height:1; font-weight:var(--weight-bold); }
.basics-understand__term-connector.is-active { color:var(--mode-accent); transform:scaleY(1.04); }
.basics-understand__term-map-instruction { margin:0; color:var(--text-secondary); font-size:var(--text-sm); text-align:center; }
.basics-understand__term-principle { padding:var(--space-3) var(--space-4); border-left:5px solid var(--mode-accent); border-radius:0 var(--radius-lg) var(--radius-lg) 0; background:var(--mode-soft); color:var(--mode-soft-text); font-weight:var(--weight-semibold); text-align:center; }

.activity-stage__content[data-basics-understand-active="true"] { grid-template-columns:minmax(210px,.52fr) minmax(0,1.48fr); gap:var(--space-5); align-items:stretch; }
.activity-stage__content[data-basics-understand-active="true"] .activity-copy h2 { font-size:clamp(1.4rem,2.2vw,2rem); margin-bottom:var(--space-2); }
.activity-stage__content[data-basics-understand-active="true"] .activity-callout { margin-top:var(--space-3); padding:var(--space-3); }
.activity-stage__content[data-basics-understand-active="true"] .math-placeholder { min-height:0; height:100%; display:block; overflow:hidden; border:0; border-radius:0; background:transparent; }
.activity-stage__content[data-basics-understand-active="true"] .math-placeholder__grid,
.activity-stage__content[data-basics-understand-active="true"] .math-placeholder__formula,
.activity-stage__content[data-basics-understand-active="true"] .math-placeholder__caption { display:none; }

@media (max-width: 900px) {
  .activity-stage__content[data-basics-understand-active="true"] { grid-template-columns:minmax(190px,.48fr) minmax(0,1.52fr); gap:var(--space-4); }
  .basics-understand__notation-grid { grid-template-columns:1fr; }
  .basics-understand__notation-card { padding:var(--space-3); }
  .basics-understand__term-map { gap:0 var(--space-2); padding:var(--space-3); }
  .basics-understand__term-token { padding:var(--space-2); font-size:clamp(1rem,1.8vw,1.45rem); }
}
@media (max-width:680px) {
  .activity-stage__content[data-basics-understand-active="true"] { grid-template-columns:1fr; align-content:start; }
  .activity-stage__content[data-basics-understand-active="true"] .math-placeholder { min-height:390px; padding:0; }
  .basics-understand { min-height:390px; }
  .basics-understand__polynomial-entry { grid-template-columns:1fr; }
  .basics-understand__polynomial-entry .basics-understand__button,.basics-understand__polynomial-help,.basics-understand__polynomial-entry .basics-understand__status { grid-column:1; }
  .basics-understand__coefficients { grid-template-columns:repeat(3,1fr); }
  .basics-understand__operator-workspace { height:auto; min-height:360px; padding:var(--space-4); }
  .basics-understand__operator-equation { grid-template-columns:auto minmax(0,1fr) auto; grid-template-areas:"operator choice equals" "result result result"; }
  .basics-understand__operator-symbol { grid-area:operator; }
  .basics-understand__operator-choice { grid-area:choice; }
  .basics-understand__operator-equals { grid-area:equals; }
  .basics-understand__operator-result { grid-area:result; min-height:72px; }
  .basics-understand__operator-select { min-height:64px; font-size:1.35rem; }
  .basics-understand__operator-symbol { min-height:64px; font-size:1.7rem; }
  .basics-understand__pattern-list { grid-template-columns:1fr; }
  .basics-understand__power-rule-formula { font-size:1.8rem; }
  .basics-understand__power-rule-notice { text-align:left; }
  .basics-understand__term-map { grid-template-columns:auto repeat(4,minmax(76px,1fr)); gap:0 var(--space-2); overflow-x:auto; padding:var(--space-3); }
  .basics-understand__term-map-label { min-width:70px; font-size:1.15rem; }
  .basics-understand__term-token { min-height:56px; font-size:1.05rem; }
  .basics-understand__term-connector { min-height:58px; }
  .basics-understand__term-connector-line { min-height:30px; }
}


/* Manual audit 2026-09-28: restore the original single-screen Understand vision.
   Desktop/laptop activities fit the available workspace; narrow screens may scroll. */
@media (min-width: 681px) {
  .basics-understand__panel { gap: var(--space-2); }
  .basics-understand__panel-header h3 { font-size: clamp(1rem, 1.45vw, var(--text-lg)); line-height: var(--leading-tight); }
  .basics-understand__panel-body { position: relative; min-height: 0; height: 100%; overflow: hidden; gap: var(--space-2); align-content: stretch; }

  .basics-understand__prompt,
  .basics-understand__instruction,
  .basics-understand__takeaway,
  .basics-understand__insight {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
  }

  .basics-understand__graph-host { min-height: 0; height: 100%; overflow: hidden; }
  .basics-understand__graph-host > .linked-gradient-explorer { min-height: 0; height: 100%; grid-template-rows: auto minmax(0, 1fr); gap: var(--space-2); }
  .basics-understand .linked-gradient-explorer__controls { gap: var(--space-2); padding: var(--space-2); }
  .basics-understand .linked-gradient-explorer__select,
  .basics-understand .linked-gradient-explorer__reveal-button { min-height: var(--touch-target-min); }
  .basics-understand .linked-gradient-explorer__graphs { min-height: 0; height: 100%; gap: var(--space-2); align-items: stretch; }
  .basics-understand .linked-gradient-explorer__card { min-height: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .basics-understand .linked-gradient-explorer__card[hidden] { display: none; }
  .basics-understand .linked-gradient-explorer__card-heading { min-height: 0; padding: var(--space-2) var(--space-3); }
  .basics-understand .linked-gradient-explorer__expression { margin-top: 2px; font-size: var(--text-xs); }
  .basics-understand .linked-gradient-explorer__diagram { min-height: 0; height: 100%; }
  .basics-understand .linked-gradient-explorer__diagram > .diagram-primitives { min-height: 176px; height: 100%; aspect-ratio: auto; }

  .activity-stage__content[data-basics-understand-active="true"] { grid-template-columns: minmax(190px, .46fr) minmax(0, 1.54fr); gap: var(--space-4); }
  .activity-stage__content[data-basics-understand-active="true"] .activity-copy { min-width: 0; }
  .activity-stage__content[data-basics-understand-active="true"] .activity-copy h2 { font-size: clamp(1.25rem, 1.8vw, 1.7rem); line-height: 1.08; margin: var(--space-1) 0 var(--space-2); }
  .activity-stage__content[data-basics-understand-active="true"] .activity-copy > p:not(.activity-overline) { font-size: var(--text-sm); line-height: var(--leading-normal); }
  .activity-stage__content[data-basics-understand-active="true"] .activity-callout { margin-top: var(--space-2); padding: var(--space-2) var(--space-3); }
  .activity-stage__content[data-basics-understand-active="true"] .activity-callout p { margin-top: var(--space-1); font-size: var(--text-sm); line-height: var(--leading-snug); }

  .basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__panel-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__gradient-stage { min-height:0; height:100%; }
  .basics-understand[data-basics-activity="curve_tangent_gradient"] .linked-gradient-explorer__controls { display:none; }
  .basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__graph-host > .linked-gradient-explorer { grid-template-rows:minmax(0,1fr); }

  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__panel-body { grid-template-rows:minmax(0,1fr); }
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__controls { display:none; }
  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-host > .linked-gradient-explorer { grid-template-rows:minmax(0,1fr); }
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__card-heading {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:auto auto;
    column-gap:var(--space-2);
    align-items:center;
  }
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__card-title { grid-column:1; grid-row:1; }
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__expression { grid-column:1; grid-row:2; }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__panel-body {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start;
  }
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry {
    min-width: 0; padding: var(--space-2); gap: var(--space-1) var(--space-2);
  }
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-help {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__graph-host { grid-column: 1 / -1; min-height: 0; }

  .basics-understand__coefficient-details { position: relative; min-width: 190px; z-index: 6; }
  .basics-understand__coefficient-summary {
    min-height: var(--touch-target-min); display: flex; align-items: center; justify-content: center;
    padding: 0 var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-md);
    background: var(--surface-base); color: var(--text-primary); font-weight: var(--weight-semibold);
    cursor: pointer; list-style-position: inside;
  }
  .basics-understand__coefficient-summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
  .basics-understand__coefficient-editor {
    position: absolute; top: calc(100% + var(--space-2)); right: 0; width: min(620px, 78vw);
    display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border-default);
    border-radius: var(--radius-lg); background: var(--surface-base); box-shadow: 0 12px 32px rgba(23, 32, 51, .16);
  }
  .basics-understand__coefficient-details:not([open]) .basics-understand__coefficient-editor { display: none; }

  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__panel-body { grid-template-rows:auto auto auto; align-content:start; }
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__panel-body,
  .basics-understand[data-basics-activity="term_by_term"] .basics-understand__panel-body { align-content: center; }

  .basics-understand__notation-card { padding: var(--space-3); }
  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__notation-card p { font-size:var(--text-sm); line-height:var(--leading-snug); }
  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__equivalence { padding:var(--space-2) var(--space-3); font-size:clamp(1rem,1.8vw,1.35rem); }
  .basics-understand__notation-formula { font-size: clamp(1.45rem, 3vw, 2.25rem); }
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__panel-body { grid-template-rows:minmax(0,1fr); }

  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__panel-body {
    grid-template-rows: minmax(0, 1fr) auto auto; align-items: stretch;
  }
  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__power-rule-bubble {
    padding:var(--space-3) var(--space-4);
  }
  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__power-rule-formula {
    font-size:clamp(1.8rem,3vw,2.8rem);
  }
  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__pattern-card {
    padding:var(--space-2) var(--space-3);
  }
  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__pattern-equation {
    min-height:58px;
  }

  .basics-understand[data-basics-activity="term_by_term"] .basics-understand__panel-body {
    grid-template-rows:minmax(0,1fr) auto auto;
    align-items:stretch;
  }
  .basics-understand[data-basics-activity="term_by_term"] .basics-understand__term-map {
    height:100%;
  }
  .basics-understand__equivalence,
  .basics-understand__rule-reveal,
  .basics-understand__term-result { padding: var(--space-3); font-size: clamp(1.05rem, 2vw, 1.5rem); }
}

@media (max-width: 680px) {
  .basics-understand__panel-body { overflow: auto; }
  .basics-understand__gradient-stage { min-height:390px; height:390px; }
  .basics-understand__gradient-popin { position:absolute; top:var(--space-2); right:var(--space-2); width:calc(100% - 2 * var(--space-2)); grid-template-columns:1fr; }
  .basics-understand__gradient-toggle { justify-self:start; }
  .basics-understand__sidebar-values { grid-template-columns:1fr 1fr; }
  .basics-understand__equivalence { grid-template-columns:1fr; }
  .basics-understand__notation-story { grid-template-columns:1fr; }
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__card-heading { grid-template-columns:1fr; }
  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools { grid-column:1; grid-row:auto; justify-content:flex-start; margin-top:var(--space-2); }
  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools--function,
  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools--derivative { flex-wrap:wrap; }
  .basics-understand__graph-values { justify-content:flex-start; }
  .basics-understand__coefficient-details { position: static; }
  .basics-understand__coefficient-summary {
    min-height: var(--touch-target-min); display: flex; align-items: center; padding: 0 var(--space-3);
    border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-base);
    font-weight: var(--weight-semibold); cursor: pointer;
  }
  .basics-understand__coefficient-editor {
    display: grid; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3);
    border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--surface-subtle);
  }
  .basics-understand__coefficient-details:not([open]) .basics-understand__coefficient-editor { display: none; }
}


/* Basics of differentiation layout pass 2026-10-05.
   Keep this topic's seven bespoke Understand activities stable inside the
   resized app shell. The visual column owns its available height on desktop,
   while individual activities adapt to the width they actually receive. */
.activity-stage__content[data-basics-understand-active="true"] {
  min-height: 0;
  height: 100%;
  grid-template-columns: clamp(210px, 23%, 290px) minmax(0, 1fr);
  gap: clamp(var(--space-3), 1.4vw, var(--space-5));
  align-items: stretch;
}

.activity-stage__content[data-basics-understand-active="true"] .activity-copy {
  min-width: 0;
  max-width: none;
  max-height: 100%;
  overflow: auto;
  padding-right: 2px;
}

.activity-stage__content[data-basics-understand-active="true"] .math-placeholder,
.activity-stage__content[data-basics-understand-active="true"] .understand-visual-host {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.activity-stage__content[data-basics-understand-active="true"] .math-placeholder {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

.activity-stage__content[data-basics-understand-active="true"] .understand-visual-host > .basics-understand {
  width: 100%;
  height: 100% !important;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  container-name: basics-understand;
  container-type: inline-size;
}

.activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel,
.activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel-body,
.activity-stage__content[data-basics-understand-active="true"] .basics-understand__gradient-stage,
.activity-stage__content[data-basics-understand-active="true"] .basics-understand__graph-host,
.activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer,
.activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__graphs,
.activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__card,
.activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__diagram {
  min-width: 0;
  min-height: 0;
}

.activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel {
  overflow: hidden;
}

.activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel-body {
  height: 100%;
}

.activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__card-heading {
  min-width: 0;
}

.activity-stage__content[data-basics-understand-active="true"] .basics-understand__graph-card-tools,
.activity-stage__content[data-basics-understand-active="true"] .basics-understand__graph-values {
  max-width: 100%;
}

.activity-stage__content[data-basics-understand-active="true"] .basics-understand__graph-action {
  max-width: 100%;
}

/* 1. Gradient on a curve: the graph remains the primary surface and the
   prompt stays a compact overlay rather than forcing the graph downward. */
.basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__gradient-stage,
.basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__graph-host,
.basics-understand[data-basics-activity="curve_tangent_gradient"] .linked-gradient-explorer {
  height: 100%;
}

.basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__gradient-popin {
  max-width: calc(100% - 2 * var(--space-3));
}

/* 2. Gradient function: graph-card controls may wrap, but they must never
   compete with the graph title for an impossible fixed width. */
.basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools {
  flex-wrap: wrap;
}

.basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-action {
  white-space: normal;
  text-align: center;
}

.basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-status {
  min-width: 0;
  white-space: normal;
}

/* 3. Polynomial explorer: keep the coefficient editor in normal flow when it
   is opened. This avoids the former popover being clipped by the full-height
   visual surface. */
.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__panel-body {
  overflow: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(220px, 1fr);
  align-content: start;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry {
  grid-column: 1;
  grid-row: 1;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__coefficient-details {
  position: static;
  min-width: 190px;
  grid-column: 2;
  grid-row: 1;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__coefficient-details[open] {
  grid-column: 1 / -1;
  grid-row: 2;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__panel-body:has(.basics-understand__coefficient-details[open]) {
  grid-template-rows: auto auto minmax(220px, 1fr);
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__coefficient-editor {
  position: static;
  width: auto;
  max-width: none;
  margin-top: var(--space-2);
  box-shadow: none;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__graph-host {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 220px;
}

.basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__panel-body:has(.basics-understand__coefficient-details[open]) .basics-understand__graph-host {
  grid-row: 3;
}

/* 4. Derivative notation: cards choose the number of columns from their real
   container width, and this text-led page may scroll rather than crop. */
.basics-understand[data-basics-activity="derivative_notation"] .basics-understand__panel-body {
  overflow: auto;
  grid-template-rows: auto auto auto;
  align-content: start;
}

.basics-understand[data-basics-activity="derivative_notation"] .basics-understand__notation-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

/* 5. d/dx operator: retain the large direct equation while allowing its
   controls to reflow inside a narrow visual column. */
.basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-equation > * {
  min-width: 0;
}

/* 6. Power-rule pattern: revealing the rule must never push content below an
   inaccessible clipped edge. */
.basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__panel-body {
  overflow: auto;
  grid-template-rows: auto auto auto;
  align-content: start;
}

.basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__pattern-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

/* 7. Term by term: preserve readable algebra instead of squeezing five grid
   columns until the terms collide. */
.basics-understand[data-basics-activity="term_by_term"] .basics-understand__panel-body {
  overflow: auto;
}

.basics-understand[data-basics-activity="term_by_term"] .basics-understand__term-map {
  min-width: 0;
}

/* Container-aware refinements. These react to the mathematics panel itself,
   so expanding/collapsing Topics no longer leaves the graphs in the wrong
   breakpoint merely because the browser viewport did not change. */
@container basics-understand (max-width: 840px) {
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__card-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__card-title,
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__expression,
  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools {
    grid-column: 1;
    grid-row: auto;
  }

  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-card-tools {
    justify-content: flex-start;
    margin-top: var(--space-1);
  }

  .basics-understand[data-basics-activity="gradient_function"] .basics-understand__graph-values {
    justify-content: flex-start;
  }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__panel-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(220px, 1fr);
  }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry,
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__coefficient-details,
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__graph-host {
    grid-column: 1;
  }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-help {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__notation-story {
    grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr);
  }
}

@container basics-understand (max-width: 700px) {
  .basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__gradient-popin {
    top: var(--space-2);
    right: var(--space-2);
    width: min(300px, calc(100% - 2 * var(--space-2)));
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-2);
  }

  .basics-understand[data-basics-activity="curve_tangent_gradient"] .basics-understand__gradient-toggle {
    justify-self: start;
  }

  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__diagram > .diagram-primitives,
  .basics-understand[data-basics-activity="polynomial_explorer"] .linked-gradient-explorer__diagram > .diagram-primitives {
    min-height: 150px;
  }

  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-equation {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "operator choice equals"
      "result result result";
    gap: var(--space-2);
  }

  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-symbol { grid-area: operator; }
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-choice { grid-area: choice; }
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-equals { grid-area: equals; }
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-result {
    grid-area: result;
    min-height: 64px;
  }

  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-select,
  .basics-understand[data-basics-activity="differentiation_machine"] .basics-understand__operator-symbol {
    min-height: 64px;
    font-size: clamp(1.35rem, 5cqw, 1.9rem);
  }

  .basics-understand[data-basics-activity="term_by_term"] .basics-understand__term-map {
    min-width: 620px;
    grid-template-columns: auto repeat(4, minmax(104px, 1fr));
    gap: 0 var(--space-2);
    padding: var(--space-3);
  }
}

@container basics-understand (max-width: 520px) {
  .basics-understand[data-basics-activity="gradient_function"] .linked-gradient-explorer__graphs,
  .basics-understand[data-basics-activity="polynomial_explorer"] .linked-gradient-explorer__graphs {
    grid-template-columns: minmax(0, 1fr);
  }

  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__notation-grid,
  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__notation-story,
  .basics-understand[data-basics-activity="derivative_notation"] .basics-understand__equivalence {
    grid-template-columns: minmax(0, 1fr);
  }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry .basics-understand__button,
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-help,
  .basics-understand[data-basics-activity="polynomial_explorer"] .basics-understand__polynomial-entry .basics-understand__status {
    grid-column: 1;
  }

  .basics-understand[data-basics-activity="power_rule_pattern"] .basics-understand__pattern-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Short laptop windows keep interactive diagrams usable by trimming decorative
   spacing; text-led activities scroll inside the panel instead of being cut off. */
html[data-ui-density="compact"] .activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel,
html[data-ui-density="tight"] .activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel {
  gap: var(--space-1);
}

html[data-ui-density="compact"] .activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__card-heading,
html[data-ui-density="tight"] .activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__card-heading {
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
}

html[data-ui-density="tight"] .activity-stage__content[data-basics-understand-active="true"] .linked-gradient-explorer__diagram > .diagram-primitives {
  min-height: 140px;
}

html[data-ui-density="tight"] .activity-stage__content[data-basics-understand-active="true"] .basics-understand__notation-card,
html[data-ui-density="tight"] .activity-stage__content[data-basics-understand-active="true"] .basics-understand__pattern-card {
  padding: var(--space-2);
}

/* When the shell leaves too little room for a useful side-by-side teaching
   column, move the explanation above the visual. Phones remain natural-height. */
@media (max-width: 1100px) {
  .activity-stage__content[data-basics-understand-active="true"] {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .activity-stage__content[data-basics-understand-active="true"] .activity-copy {
    max-width: 78ch;
    max-height: none;
    overflow: visible;
  }

  .activity-stage__content[data-basics-understand-active="true"] .math-placeholder {
    min-height: 460px;
    height: min(68vh, 680px);
  }
}

@media (max-width: 680px) {
  .activity-stage__content[data-basics-understand-active="true"] .math-placeholder,
  .activity-stage__content[data-basics-understand-active="true"] .understand-visual-host {
    min-height: 390px;
    height: auto;
    overflow: visible;
  }

  .activity-stage__content[data-basics-understand-active="true"] .understand-visual-host > .basics-understand {
    height: auto !important;
    min-height: 390px;
    max-height: none;
    overflow: visible;
  }

  .activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel {
    height: auto;
    min-height: 390px;
    overflow: visible;
  }

  .activity-stage__content[data-basics-understand-active="true"] .basics-understand__panel-body {
    height: auto;
    overflow: auto;
  }
}
