.page-shell {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 2.5rem;
}

.site-header {
  padding: 1.1rem 0 0.6rem;
}

.site-header .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.6rem;
}

.site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.site-brand strong {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  white-space: nowrap;
}

.site-brand span {
  color: var(--muted);
}

.version-pill {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.hero {
  margin: 1.2rem 0 1.8rem;
  background: linear-gradient(130deg, #e4f0e8 0%, #f6f0e3 100%);
  border: 1px solid #d4dfd6;
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.platform-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.4rem;
  padding: clamp(1.15rem, 2.6vw, 2rem);
}

.platform-hero h1 {
  max-width: 850px;
  font-size: clamp(2.05rem, 4.2vw, 3.65rem);
  letter-spacing: 0;
}

.home-lead {
  margin: 0 0 1rem;
  color: #445160;
  max-width: 780px;
  font-size: clamp(1rem, 1.2vw, 1.1rem);
}

.hero-actions,
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.1rem;
}

.blocks-root {
  display: grid;
  gap: 1rem;
}

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.platform-section {
  margin: 2.25rem 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 1.1rem;
}

.section-heading p {
  color: var(--muted);
}

.section-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chapter-grid,
.manim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}

.chapter-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.chapter-card,
.manim-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chapter-card {
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.chapter-link-card {
  color: inherit;
  text-decoration: none;
  min-height: 205px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.chapter-link-card:hover {
  transform: translateY(-2px);
  border-color: #b9cbb6;
  box-shadow: var(--shadow-strong);
}

.chapter-card-worked {
  position: relative;
  border-color: #8fc59b;
  background:
    linear-gradient(90deg, rgba(62, 125, 88, 0.13), rgba(62, 125, 88, 0.02) 46%),
    var(--surface);
}

.chapter-card-worked::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: #3f7d58;
}

.chapter-card-worked:hover {
  border-color: #3f7d58;
}

.chapter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 1.8rem;
}

.chapter-number {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-card h3,
.manim-card h3 {
  margin: 0;
  font-size: 1.04rem;
}

.chapter-link-card h3 {
  font-size: 1.18rem;
}

.chapter-card p,
.manim-card p {
  margin: 0;
}

.chapter-link-card p {
  color: var(--muted);
}

.chapter-link-card .chapter-meta {
  align-self: end;
  padding-top: 0.35rem;
  border-top: 1px solid #eef1ea;
}

.chapter-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  width: fit-content;
  border: 1px solid #cfded1;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: #edf5ea;
  color: #31503b;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill-light {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.92);
  color: #17222b;
}

.status-pill-worked {
  border-color: #9fd0a9;
  background: #e7f5ea;
  color: #22613e;
}

.notion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.1rem;
}

.notion-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notion-card-rich {
  overflow: hidden;
  --card-c1: #2b7189;
  --card-c2: #a8c4d2;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.notion-card-rich:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.notion-media-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.notion-media {
  min-height: 128px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(125deg, var(--card-c1) 0%, var(--card-c2) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.48);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
}

.notion-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #17222b;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.notion-formula {
  display: inline-flex;
  width: fit-content;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(25, 30, 35, 0.24);
  color: #f5f9ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.78rem;
}

.notion-card-content {
  padding: 0.85rem 0.9rem 0.95rem;
  display: grid;
  gap: 0.5rem;
}

.notion-card-title {
  margin: 0;
  font-size: 1.03rem;
}

.notion-card-subtitle {
  margin: 0;
  color: #2f3d4f;
  font-weight: 600;
  font-size: 0.95rem;
}

.notion-card-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.card-links {
  margin-top: 0.25rem;
}

.manim-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.manim-preview {
  min-height: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.16) 1px, transparent 1px),
    linear-gradient(135deg, #17222b 0%, #30465c 58%, #d96c3f 100%);
  background-size: 22px 22px, 22px 22px, auto;
  color: #fff;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  position: relative;
}

.manim-preview .status-pill {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
}

.manim-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #111827;
  display: block;
}

.manim-play-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
}

.manim-card-content {
  padding: 0.95rem;
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.algebra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.algebra-lab {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.algebra-lab h3 {
  margin: 0;
  font-size: 1.05rem;
}

.algebra-lab label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  min-width: 0;
}

.algebra-lab .parameter-control {
  display: grid;
  grid-template-columns: minmax(6.8rem, auto) 3.1rem minmax(110px, 1fr);
  width: 100%;
  gap: 0.55rem;
  align-items: center;
  color: #1f2937;
}

.parameter-control span {
  font-size: 0.9rem;
}

.parameter-control strong {
  justify-self: start;
  min-width: 2.5rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  color: #fff;
  text-align: center;
  font-size: 0.88rem;
}

.param-blue strong {
  background: #176b87;
}

.param-red strong {
  background: #d8444d;
}

.param-green strong {
  background: #3f7d58;
}

.param-orange strong {
  background: #d96c3f;
}

.algebra-lab input[type="range"] {
  width: 100%;
}

.expression-display {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faf8;
  padding: 0.65rem 0.75rem;
  font-size: clamp(0.96rem, 1vw, 1.05rem);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.formula-display {
  background: #fbfcfa;
  color: #1f2937;
  font-size: clamp(0.9rem, 0.95vw, 1rem);
}

.calculation-display {
  border-color: #c8d9c8;
  background: #eef5eb;
}

.area-board,
.square-board {
  min-height: 190px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f9f7;
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.distribution-board {
  --left-width: 3fr;
  --right-width: 4fr;
  min-height: 210px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f9f7;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 64px minmax(92px, var(--left-width)) minmax(92px, var(--right-width));
  grid-template-rows: 42px minmax(132px, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.area-dimension {
  position: relative;
  display: grid;
  place-items: center;
  color: #1f2937;
  font-weight: 900;
  font-size: clamp(0.84rem, 1vw, 0.94rem);
  line-height: 1;
  text-align: center;
  padding: 0.1rem 0.35rem 0.58rem;
  overflow-wrap: anywhere;
}

.area-dimension::before,
.area-dimension::after {
  content: "";
  position: absolute;
  background: var(--dimension-color, #54606e);
}

.area-dimension::after {
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.22rem;
  height: 3px;
  border-radius: 999px;
}

.area-dimension::before {
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.05rem;
  height: 9px;
  background:
    linear-gradient(90deg, var(--dimension-color, #54606e) 0 3px, transparent 3px calc(100% - 3px), var(--dimension-color, #54606e) calc(100% - 3px));
}

.area-dimension.param-blue {
  --dimension-color: #176b87;
}

.area-dimension.param-red {
  --dimension-color: #d8444d;
}

.area-dimension.param-green {
  --dimension-color: #3f7d58;
}

.area-dimension.param-orange {
  --dimension-color: #d96c3f;
}

.corner-label {
  grid-column: 1;
  grid-row: 1;
}

.corner-label::before,
.corner-label::after {
  display: none;
}

.top-label {
  grid-column: 2;
  grid-row: 1;
}

.top-label-right {
  grid-column: 3;
}

.side-label {
  grid-column: 1;
  grid-row: 2;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 0.35rem 0.58rem 0.35rem 0.1rem;
}

.side-label::after {
  inset: 0.45rem auto 0.45rem 0.22rem;
  width: 3px;
  height: auto;
}

.side-label::before {
  display: none;
}

.dimensioned-square-board {
  --a-size: 5fr;
  --b-size: 2fr;
  min-height: 260px;
  grid-template-columns: 64px minmax(110px, var(--a-size)) minmax(72px, var(--b-size));
  grid-template-rows: 42px minmax(110px, var(--a-size)) minmax(72px, var(--b-size));
  gap: 0.45rem;
}

.dimensioned-square-board .top-label {
  grid-row: 1;
}

.dimensioned-square-board .side-label {
  grid-column: 1;
}

.side-label-bottom {
  grid-column: 1;
  grid-row: 3;
}

.dimensioned-square-board .square-piece-a2 {
  grid-column: 2;
  grid-row: 2;
}

.dimensioned-square-board .square-piece-ab-top {
  grid-column: 3;
  grid-row: 2;
}

.dimensioned-square-board .square-piece-ab-bottom {
  grid-column: 2;
  grid-row: 3;
}

.dimensioned-square-board .square-piece-b2 {
  grid-column: 3;
  grid-row: 3;
}

.distribution-board .area-piece {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  min-height: 132px;
  color: #fff;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.13);
}

.distribution-board .area-piece + .area-piece {
  border-left: 1px solid rgba(255, 255, 255, 0.85);
}

.area-product {
  font-size: clamp(0.9rem, 1.3vw, 1.05rem);
  font-weight: 800;
  line-height: 1.15;
}

.area-piece strong {
  display: block;
  margin-top: 0.22rem;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.area-piece {
  min-height: 72px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
}

.term-blue { background: #176b87; }
.term-green { background: #3f7d58; }
.term-orange { background: #d96c3f; }
.term-red { background: #ff5257; }
.term-mixed { background: #6f5cc2; }

.distribution-board .term-blue { background: #176b87; }
.distribution-board .term-red { background: #d8444d; }

.factor-flow,
.division-board {
  min-height: 190px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faf8;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  font-size: 1.18rem;
}

.flow-arrow {
  color: var(--accent);
  font-weight: 900;
}

.factor-color-flow {
  display: grid;
  grid-template-columns: auto auto auto auto auto;
  align-content: center;
  gap: 0.75rem;
}

.factor-row,
.factor-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  font-weight: 900;
}

.factor-token,
.inside-token,
.term-source {
  border-radius: 999px;
  padding: 0.08rem 0.36rem;
}

.factor-token {
  background: #e7f0ea;
  color: #1d7b53;
  box-shadow: inset 0 0 0 2px rgba(29, 123, 83, 0.22);
}

.term-source-blue {
  color: #176b87;
}

.term-source-orange {
  color: #d96c3f;
}

.inside-token.term-source-blue {
  background: #e6f2f5;
}

.inside-token.term-source-orange {
  background: #fbe8db;
}

.factor-result strong {
  color: #111827;
}

.factor-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  margin-right: 0.28rem;
  vertical-align: -0.05rem;
}

.factor-dot { background: #1d7b53; }
.blue-dot { background: #176b87; }
.orange-dot { background: #d96c3f; }

.division-board .remainder {
  width: 100%;
  text-align: center;
  color: var(--ok);
  font-weight: 800;
}

.polynomial-division {
  display: grid;
  align-items: stretch;
  justify-content: stretch;
  gap: 0.85rem;
  min-height: 330px;
  font-size: 1rem;
}

.division-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.48fr);
  justify-content: center;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  color: #111827;
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  font-weight: 900;
}

.division-left,
.division-right {
  min-height: 190px;
}

.division-left {
  padding: 2.7rem 1rem 0 0;
  text-align: right;
}

.division-right {
  border-left: 3px solid #111827;
}

.division-divisor {
  padding: 0.7rem 0.85rem 0.45rem;
  border-bottom: 3px solid #111827;
  min-height: 2.65rem;
}

.division-quotient {
  padding: 0.8rem 0.85rem 0;
  color: var(--muted);
}

.division-quotient.is-filled {
  color: #176b87;
}

.division-dividend {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
}

.division-work {
  display: grid;
  gap: 0.18rem;
  justify-items: end;
  margin-top: 0.3rem;
}

.division-row {
  min-width: 12.5rem;
  padding: 0.24rem 0.42rem 0.2rem;
  text-align: right;
  animation: division-row-in 260ms ease-out both;
}

.division-row.subtract {
  color: #d8444d;
  border-top: 2px solid #111827;
}

.division-row.result {
  color: #d96c3f;
}

.division-row.remainder {
  width: auto;
  color: var(--ok);
  border-top: 2px solid #111827;
  font-size: 1.35rem;
}

.division-focus {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.focus-pill {
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  background: #eef2f0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  opacity: 0.48;
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.division-focus.xterm .focus-blue,
.division-focus.first-product .focus-purple,
.division-focus.first-remainder .focus-purple,
.division-focus.constant .focus-orange,
.division-focus.second-product .focus-orange,
.division-focus.done .focus-orange {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}

.focus-blue {
  background: #e6f2f5;
  color: #176b87;
}

.focus-purple {
  background: #ede9fb;
  color: #6f5cc2;
}

.focus-orange {
  background: #fbe8db;
  color: #d96c3f;
}

.division-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  text-align: center;
}

.division-controls {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.division-controls .btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

@keyframes division-row-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.equation-balance {
  min-height: 170px;
  display: grid;
  grid-template-columns: 1fr 36px 1fr;
  align-items: end;
  gap: 0.6rem;
}

.balance-pan {
  min-height: 92px;
  border: 2px solid #9ab0a0;
  border-radius: 8px;
  background: #f8faf8;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  font-size: 1.05rem;
  font-weight: 900;
}

.balance-pivot {
  height: 130px;
  border-bottom: 8px solid #54606e;
  position: relative;
}

.balance-pivot::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 8px;
  height: 112px;
  transform: translateX(-50%);
  background: #54606e;
  border-radius: 999px;
}

.equation-solver-lab {
  grid-column: 1 / -1;
}

.equation-solver-toolbar,
.equation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.equation-solver-toolbar {
  justify-content: space-between;
}

.equation-start {
  background: #eef5eb;
  border-color: #c8d9c8;
}

.equation-solver-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(280px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.equivalence-balance {
  position: relative;
  min-height: 315px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(84, 96, 110, 0.12) 49% 51%, transparent 51%),
    linear-gradient(180deg, #fbfcfa 0%, #f4f7f2 100%);
}

.solver-stand {
  position: absolute;
  left: 50%;
  top: 92px;
  width: 8px;
  height: 154px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #54606e;
}

.solver-stand::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 112px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #54606e;
}

.solver-pivot {
  position: absolute;
  left: 50%;
  top: 75px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 24px solid #54606e;
  z-index: 2;
}

.solver-beam {
  position: absolute;
  left: 50%;
  top: 86px;
  width: min(92%, 680px);
  height: 220px;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.solver-beam-line {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 0;
  height: 8px;
  border-radius: 999px;
  background: #54606e;
}

.solver-chain {
  position: absolute;
  top: 6px;
  width: 2px;
  height: 48px;
  background: #9aa5b1;
}

.solver-chain::before,
.solver-chain::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 2px;
  height: 54px;
  background: #9aa5b1;
}

.solver-chain::before {
  left: -48px;
  transform: rotate(62deg);
  transform-origin: top center;
}

.solver-chain::after {
  right: -48px;
  transform: rotate(-62deg);
  transform-origin: top center;
}

.solver-chain-left {
  left: 22%;
}

.solver-chain-right {
  right: 22%;
}

.solver-pan {
  position: absolute;
  top: 54px;
  width: 39%;
  min-height: 118px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  gap: 0.35rem;
  padding: 0.7rem;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 18px rgba(22, 31, 38, 0.08);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.solver-pan-left {
  left: 0;
  color: #176b87;
}

.solver-pan-right {
  right: 0;
  color: #d96c3f;
}

.solver-pan strong {
  color: var(--text);
  font-size: clamp(1.04rem, 2vw, 1.45rem);
  line-height: 1.15;
  text-align: center;
}

.solver-pan-name {
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.solver-weight-row {
  min-height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solver-weight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  min-height: 1.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 5px 10px rgba(22, 31, 38, 0.15);
  animation: solver-weight-in 0.22s ease-out;
}

.solver-weight-addition {
  background: #1d7b53;
}

.solver-weight-division {
  background: #6f5cc2;
}

@keyframes solver-weight-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.equation-command-panel {
  display: grid;
  gap: 0.75rem;
}

.equation-step-label {
  color: var(--muted);
  font-weight: 800;
}

.equation-command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.equation-command-grid label {
  display: grid;
  gap: 0.25rem;
  align-items: start;
}

.equation-command-grid select,
.equation-command-grid input {
  width: 100%;
  min-height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.28rem 0.55rem;
  font: inherit;
}

.equation-actions .btn[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.equation-feedback {
  min-height: 3.1rem;
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: #f8faf8;
  padding: 0.7rem 0.85rem;
  color: var(--muted);
  font-weight: 750;
}

.equation-feedback-ok {
  border-left-color: #1d7b53;
  background: #eef7f0;
  color: #22613e;
}

.equation-feedback-warn {
  border-left-color: #d96c3f;
  background: #fff3ec;
  color: #793c24;
}

.equation-feedback-error {
  border-left-color: #9f2f2f;
  background: #f8e7e7;
  color: #7a2323;
}

.equation-resolution,
.equation-verification {
  display: grid;
  gap: 0.45rem;
}

.equation-verification[hidden] {
  display: none;
}

.equation-resolution h4,
.equation-verification h4 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.98rem;
}

.equation-resolution ol {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.45rem;
}

.equation-resolution li {
  padding-left: 0.15rem;
}

.equation-resolution li span,
.equation-resolution li em {
  display: block;
  color: var(--muted);
  font-size: 0.93rem;
  font-style: normal;
}

.equation-resolution li strong {
  display: block;
  color: var(--text);
  font-size: 1.02rem;
}

.linear-system-lab {
  grid-column: 1 / -1;
}

.quad-control-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.7rem;
  align-items: center;
}

.quad-control-row label {
  display: inline-grid;
  grid-template-columns: auto 4.6rem;
  gap: 0.4rem;
  align-items: center;
}

.quad-control-row input {
  width: 4.6rem;
  min-height: 2.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.25rem 0.45rem;
  font: inherit;
  font-weight: 800;
}

.delta-positive {
  border-color: #9fd0a9;
  background: #eef7f0;
  color: #22613e;
}

.delta-zero {
  border-color: #f0c1a8;
  background: #fff3ec;
  color: #793c24;
}

.delta-negative {
  border-color: #e6b8b8;
  background: #f8e7e7;
  color: #7a2323;
}

.parabola-board {
  display: grid;
  grid-template-columns: 1fr;
}

.parabola-case {
  display: grid;
  gap: 0.28rem;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 0.65rem;
}

.parabola-case.is-active {
  border-color: #176b87;
  background: #eef6f8;
}

.parabola-case strong {
  font-size: 0.9rem;
}

.parabola-case span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.parabola-case p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.parabola-current {
  grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  max-width: none;
}

.parabola-copy {
  display: grid;
  gap: 0.32rem;
}

.parabola-mini {
  width: 100%;
  max-height: 110px;
  color: #176b87;
}

.parabola-current.is-concave .parabola-mini {
  color: #d96c3f;
}

.parabola-current.is-linear .parabola-mini {
  color: #697586;
}

.parabola-axis {
  stroke: #54606e;
  stroke-width: 3;
}

.parabola-curve {
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
}

.parabola-root {
  fill: #1d7b53;
  stroke: #fff;
  stroke-width: 2;
}

.linear-system-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(360px, 1.28fr);
  gap: 1rem;
  align-items: start;
}

.linear-system-panel {
  display: grid;
  gap: 0.75rem;
}

.linear-system-display {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faf8;
  padding: 0.75rem;
}

.system-brace {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 7vw, 5.4rem);
  line-height: 0.82;
  color: #54606e;
}

.system-equations {
  display: grid;
  gap: 0.5rem;
}

.system-equation {
  display: block;
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
  line-height: 1.2;
}

.system-equation-blue {
  color: #176b87;
}

.system-equation-orange {
  color: #d96c3f;
}

.graph-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  display: block;
}

.graph-canvas-compact {
  aspect-ratio: 16 / 7.4;
}

.derived-function-stack {
  display: grid;
  gap: 0.65rem;
}

.coming-soon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.coming-soon-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
}

.coming-soon-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.coming-soon-card p {
  margin: 0;
  color: var(--muted);
}

.chapter-roadmap {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-roadmap li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfa;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
}

.interval-picker-grid,
.interval-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.interval-picker-grid label {
  display: inline-grid;
  grid-template-columns: auto minmax(6.3rem, 1fr);
  gap: 0.45rem;
  align-items: center;
  flex: 1 1 12rem;
}

.interval-picker-grid select {
  width: 100%;
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  font: inherit;
  font-weight: 800;
}

.interval-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 1.8rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
}

.interval-chip-i {
  background: #176b87;
}

.interval-chip-j {
  background: #d96c3f;
}

.interval-mode-row .btn.is-active {
  border-color: #176b87;
  background: #eef6f8;
  color: #0d4f66;
  box-shadow: inset 0 0 0 1px rgba(23, 107, 135, 0.18);
}

.interval-line {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faf8;
  padding: 0.45rem;
  overflow: hidden;
}

.interval-svg {
  display: block;
  width: 100%;
  height: auto;
}

.interval-main-axis,
.interval-row-axis,
.interval-tick {
  stroke: #54606e;
  stroke-linecap: round;
}

.interval-main-axis {
  stroke-width: 3;
}

.interval-axis-arrow {
  fill: #54606e;
}

.interval-row-axis {
  stroke-width: 2;
  opacity: 0.28;
}

.interval-tick {
  stroke-width: 2;
}

.interval-number,
.interval-row-label,
.interval-empty {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 850;
}

.interval-number {
  fill: #65717f;
  font-size: 12px;
  text-anchor: middle;
}

.interval-row-label {
  font-size: 18px;
}

.interval-segment {
  stroke-width: 8;
  stroke-linecap: round;
}

.interval-endpoint {
  stroke-width: 3;
}

.interval-empty {
  fill: #65717f;
  font-size: 18px;
  text-anchor: middle;
}

#interval-result {
  display: grid;
  gap: 0.25rem;
}

#interval-result span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.sign-table {
  display: grid;
  grid-template-columns: 1.2fr repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.sign-table > * {
  padding: 0.45rem 0.3rem;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}

@media (max-width: 900px) {
  .page-shell {
    width: calc(100vw - 1rem);
    padding-top: 0.8rem;
  }

  .site-header .title-row,
  .site-brand,
  .platform-hero {
    align-items: flex-start;
  }

  .site-header .title-row,
  .platform-hero {
    grid-template-columns: 1fr;
  }

  .site-brand {
    flex-direction: column;
    gap: 0.15rem;
  }

  .hero {
    padding: 1rem;
    margin-top: 0.8rem;
  }

  .platform-hero h1 {
    font-size: clamp(2rem, 9vw, 2.55rem);
  }

  .hero-actions .btn {
    flex: 1 1 8.5rem;
  }

  .notion-grid {
    grid-template-columns: 1fr;
  }

  .algebra-lab {
    padding: 0.9rem;
  }

  .equation-solver-layout {
    grid-template-columns: 1fr;
  }

  .linear-system-layout {
    grid-template-columns: 1fr;
  }

  .control-row {
    gap: 0.75rem;
  }

  .chapter-grid,
  .chapter-grid-wide,
  .manim-grid {
    grid-template-columns: 1fr;
  }

  .chapter-link-card {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .algebra-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .equation-solver-toolbar,
  .equation-actions {
    align-items: stretch;
  }

  .equation-solver-toolbar > *,
  .equation-actions .btn {
    width: 100%;
  }

  .equation-solver-toolbar label {
    display: grid;
    width: 100%;
  }

  .equation-solver-toolbar select {
    width: 100%;
  }

  .equation-command-grid {
    grid-template-columns: 1fr;
  }

  .quad-control-row {
    flex-wrap: wrap;
  }

  .quad-control-row label {
    grid-template-columns: auto minmax(4.4rem, 1fr);
    flex: 1 1 7rem;
  }

  .quad-control-row input {
    width: 100%;
  }

  .parabola-current {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .equivalence-balance {
    min-height: 292px;
  }

  .solver-beam {
    width: 96%;
  }

  .solver-pan {
    width: 42%;
    min-height: 112px;
    padding: 0.55rem 0.45rem;
  }

  .solver-pan-name {
    font-size: 0.68rem;
  }

  .solver-pan strong {
    font-size: 0.96rem;
  }
}

@media (max-width: 430px) {
  .page-shell {
    width: calc(100vw - 0.5rem);
  }

  .site-header .title-row {
    align-items: flex-start;
  }

  .site-brand strong {
    white-space: normal;
  }

  .version-pill {
    font-size: 0.82rem;
  }

  .platform-section {
    margin: 2rem 0;
  }

  .algebra-lab input[type="range"] {
    width: 100%;
  }

  .algebra-lab .parameter-control {
    grid-template-columns: 1fr auto;
  }

  .parameter-control input[type="range"] {
    grid-column: 1 / -1;
  }

  .graph-canvas {
    aspect-ratio: 4 / 3;
  }

  .parabola-board {
    grid-template-columns: 1fr;
  }

  .equivalence-balance {
    min-height: 285px;
  }

  .solver-pan {
    width: 42%;
    min-height: 112px;
    padding: 0.55rem 0.45rem;
  }

  .solver-pan strong {
    font-size: 0.95rem;
  }

  .sign-table {
    font-size: 0.82rem;
  }
}

/* Chapitre 4: opérations, composition et bijections */
.function-labs-grid {
  align-items: start;
}

.function-definition-row,
.function-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
}

.function-chip {
  padding: 0.32rem 0.58rem;
  border-left: 4px solid currentColor;
  background: #f7f9f7;
  font-weight: 800;
}

.function-chip-blue,
.text-blue {
  color: #176b87;
}

.function-chip-orange,
.text-orange {
  color: #d96c3f;
}

.text-green {
  color: #2f855a;
}

.function-readout {
  display: grid;
  gap: 0.22rem;
  min-height: 4.15rem;
  align-content: center;
}

.function-readout strong {
  font-size: 1.02rem;
}

.function-readout span,
.function-readout small {
  color: var(--muted);
  font-weight: 650;
}

.function-readout .text-blue,
.function-readout .text-orange,
.function-readout .text-green {
  font-weight: 850;
}

.function-readout .text-blue {
  color: #176b87;
}

.function-readout .text-orange {
  color: #d96c3f;
}

.function-readout .text-green {
  color: #2f855a;
}

.function-formula-line {
  line-height: 1.55;
}

.height-step {
  display: block;
  line-height: 1.35;
}

.function-legend {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 750;
}

.function-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-line {
  display: inline-block;
  width: 1.8rem;
  height: 0;
  border-top: 3px solid;
}

.legend-blue {
  border-color: #176b87;
}

.legend-orange {
  border-color: #d96c3f;
}

.legend-green {
  border-color: #2f855a;
}

.legend-dashed {
  border-color: #54606e;
  border-top-style: dashed;
}

.function-pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 0.35rem;
  min-height: 4.4rem;
}

.pipeline-stage {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.18rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-top: 4px solid #54606e;
  border-radius: 6px;
  background: #f8faf8;
  padding: 0.5rem 0.35rem;
  text-align: center;
}

.pipeline-stage span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.pipeline-stage strong {
  font-size: 1.06rem;
}

.pipeline-blue {
  border-top-color: #176b87;
}

.pipeline-orange {
  border-top-color: #d96c3f;
}

.pipeline-input {
  border-top-color: #2f855a;
}

.pipeline-arrow {
  align-self: center;
  color: #65717f;
  font-size: 1.35rem;
  font-weight: 850;
}

.bijection-status {
  display: grid;
  gap: 0.22rem;
  border-left: 5px solid;
  padding: 0.6rem 0.72rem;
  background: #f8faf8;
}

.bijection-status span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.bijection-yes {
  border-color: #2f855a;
}

.bijection-yes strong {
  color: #246c49;
}

.bijection-no {
  border-color: #c94747;
}

.bijection-no strong {
  color: #a83434;
}

@media (max-width: 560px) {
  .function-pipeline {
    grid-template-columns: 1fr;
  }

  .pipeline-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .function-definition-row {
    align-items: stretch;
  }

  .function-chip {
    flex: 1 1 100%;
  }
}
