.simulations-page {
  --simulation-teal: #15989b;
  --simulation-teal-dark: #0b696f;
  --simulation-coral: #f27972;
  --simulation-yellow: #f4c95d;
  --simulation-paper: #f4f8f7;
  background:
    radial-gradient(circle at 10% 11%, rgba(21, 152, 155, 0.11), transparent 25rem),
    radial-gradient(circle at 90% 34%, rgba(242, 121, 114, 0.1), transparent 27rem),
    var(--simulation-paper);
}

.simulation-app-body {
  height: 100dvh;
  overflow: hidden;
}

.simulation-app-body > .site-header,
.simulation-app-body .simulations-hero,
.simulation-app-body .simulations-next,
.simulation-app-body > .legal-footer {
  display: none;
}

.simulation-app-body .simulations-shell {
  display: grid;
  width: 100%;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 10px clamp(10px, 1.6vw, 24px) 12px;
  overflow: hidden;
}

.simulation-app-bar {
  display: none;
  grid-template-columns: minmax(220px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 62px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d6e3e2;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(7, 50, 75, 0.08);
}

.simulation-app-body .simulation-app-bar { display: grid; }

.simulation-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.simulation-app-brand > a {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
}

.simulation-app-brand img { width: 40px; height: 40px; object-fit: contain; }
.simulation-app-brand > span { display: grid; gap: 1px; }
.simulation-app-brand small { color: var(--muted); font-size: 0.66rem; font-weight: 800; }
.simulation-app-brand strong { color: var(--blue-dark); font-size: 0.94rem; }

.simulation-subject-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(145px, 1fr));
  gap: 5px;
  padding: 4px;
  background: #e9efee;
  border-radius: 13px;
}

.simulation-subject-switch button {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  color: var(--muted);
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
}

.simulation-subject-switch button.active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 4px 14px rgba(7, 52, 73, 0.08);
}

.simulation-subject-switch button:disabled { opacity: 0.55; }
.simulation-subject-switch button > b { color: var(--simulation-teal); font-size: 1.15rem; }
.simulation-subject-switch button > span { display: grid; font-size: 0.8rem; font-weight: 900; }
.simulation-subject-switch button small { color: var(--muted); font-size: 0.62rem; font-weight: 750; }

.simulation-exit {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  padding: 9px 13px;
  color: var(--blue-dark);
  background: #f5f8f7;
  border: 1px solid #d6e3e2;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 900;
}

.simulation-exit:hover { background: #e8f3f1; }

.simulation-app-body .simulation-switcher { display: none; }

.simulation-app-body .simulation-catalog { display: none; }

.simulation-app-body .simulation-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-margin-top: 0;
}

.simulations-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(46px, 7vw, 92px) 0 80px;
}

.simulation-catalog {
  margin-top: clamp(8px, 2vw, 24px);
  padding: clamp(26px, 4vw, 50px);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d6e3e2;
  border-radius: 30px;
  box-shadow: 0 24px 70px rgba(7, 50, 75, 0.09);
}

.simulation-catalog-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
  margin-bottom: 28px;
}

.simulation-catalog-head h2 {
  max-width: 720px;
  margin: 0;
  color: var(--blue-dark);
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.04;
}

.simulation-catalog-head > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.65;
}

.catalog-subject-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
  padding: 6px;
  background: #e8efee;
  border-radius: 17px;
}

.catalog-subject-tabs button {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font: inherit;
}

.catalog-subject-tabs button.active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 7px 20px rgba(7, 52, 73, 0.08);
}

.catalog-subject-tabs button > b { color: var(--simulation-teal); font-size: 1.65rem; }
.catalog-subject-tabs button > span { display: grid; text-align: start; }
.catalog-subject-tabs button strong { font-size: 1rem; }
.catalog-subject-tabs button small { color: var(--muted); font-size: 0.72rem; font-weight: 750; }

.simulation-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.simulation-card {
  position: relative;
  display: grid;
  min-height: 300px;
  align-content: start;
  gap: 14px;
  padding: 24px;
  overflow: hidden;
  color: var(--blue-dark);
  background: linear-gradient(145deg, #fff, #f7faf9);
  border: 1px solid #d6e3e2;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(7, 50, 75, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

a.simulation-card:hover {
  border-color: var(--simulation-teal);
  box-shadow: 0 20px 42px rgba(7, 50, 75, 0.13);
  transform: translateY(-4px);
}

.simulation-card-number {
  position: absolute;
  inset: 18px auto auto 18px;
  color: #8a999b;
  font-size: 0.74rem;
  font-weight: 900;
}

.simulation-card-icon {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  color: var(--simulation-teal-dark);
  background: #e2f3f1;
  border-radius: 18px;
  font-size: 1.45rem;
  font-weight: 900;
}

.simulation-card > div { display: grid; gap: 7px; }
.simulation-card small { color: var(--simulation-teal-dark); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.04em; }
.simulation-card h3 { margin: 0; color: var(--blue-dark); font-size: 1.45rem; }
.simulation-card p { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 700; line-height: 1.55; }
.simulation-card > strong { align-self: end; margin-top: auto; color: var(--simulation-teal-dark); font-size: 0.8rem; }
.simulation-card > strong i { font-style: normal; font-size: 1rem; }

.simulation-card.coming-soon {
  min-height: 270px;
  opacity: 0.72;
  background: #f7f9f8;
  border-style: dashed;
}

.physics-catalog .simulation-card-icon { color: #7a62c8; background: #eeeafd; }
.physics-catalog a.simulation-card { border-color: #cfc6ef; }
.physics-catalog a.simulation-card:hover { border-color: #7a62c8; box-shadow: 0 20px 42px rgba(88, 65, 165, 0.16); }
.physics-catalog a.simulation-card > strong,
.physics-catalog a.simulation-card small { color: #604aa9; }

.simulations-page:not(.simulation-app-body) .simulation-switcher,
.simulations-page:not(.simulation-app-body) .simulation-panel {
  display: none;
}

.simulations-kicker {
  margin: 0 0 10px;
  color: var(--simulation-teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.simulations-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.72fr);
  align-items: center;
  gap: clamp(42px, 8vw, 120px);
  min-height: 430px;
  padding: 0 clamp(0px, 3vw, 40px) clamp(54px, 8vw, 92px);
}

.simulations-hero h1 {
  margin: 0;
  color: var(--blue-dark);
  font-size: clamp(3rem, 6.7vw, 6.7rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.simulations-hero h1 em {
  color: var(--simulation-teal);
  font-style: normal;
}

.simulations-hero > div:first-child > p:last-child {
  max-width: 690px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.simulations-hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 18px;
  min-height: 320px;
  padding: 48px 34px 34px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(21, 152, 155, 0.24);
  border-radius: 30px;
  box-shadow: 0 28px 70px rgba(7, 56, 85, 0.13);
  transform: rotate(-1.8deg);
}

.simulations-hero-card::before,
.simulations-hero-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.simulations-hero-card::before {
  inset: -18px auto auto -18px;
  width: 54px;
  height: 54px;
  background: var(--simulation-yellow);
}

.simulations-hero-card::after {
  inset: auto -20px 24px auto;
  width: 42px;
  height: 42px;
  background: var(--simulation-coral);
}

.simulations-hero-card > span {
  position: absolute;
  inset: 20px 24px auto auto;
  color: var(--simulation-teal-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.simulations-hero-card > strong {
  color: var(--simulation-coral);
  font-size: 2rem;
}

.simulations-hero-card > small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 800;
}

.simulations-page:not(.simulation-app-body) .simulations-hero {
  min-height: 340px;
  padding-bottom: 46px;
}

.simulations-page:not(.simulation-app-body) .simulations-hero-card { min-height: 250px; }

.hero-fraction,
.stacked-fraction {
  display: inline-grid;
  min-width: 64px;
  grid-template-rows: 1fr 3px 1fr;
  align-items: center;
  justify-items: center;
  color: inherit;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.hero-fraction { font-size: 3rem; }
.hero-fraction i,
.stacked-fraction i {
  width: 100%;
  height: 3px;
  background: currentColor;
  border-radius: 999px;
}

.hero-mixed {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
  font-size: 3.5rem;
}

.hero-mixed span {
  display: grid;
  grid-template-rows: 1fr 3px 1fr;
  min-width: 54px;
  align-items: center;
  justify-items: center;
  font-size: 2.25rem;
  line-height: 1;
}

.hero-mixed em {
  width: 100%;
  height: 3px;
  background: currentColor;
  border-radius: 999px;
}

.simulation-switcher {
  position: sticky;
  z-index: 20;
  top: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 4vw, 46px);
  margin: 0 0 22px;
  padding: 13px 16px;
  background: rgba(244, 248, 247, 0.92);
  border: 1px solid rgba(188, 211, 208, 0.82);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(7, 50, 75, 0.1);
  backdrop-filter: blur(18px);
}

.simulation-switcher-title {
  display: grid;
  min-width: 150px;
  gap: 2px;
}

.simulation-switcher-title span {
  color: var(--simulation-teal-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.simulation-switcher-title strong {
  color: var(--blue-dark);
  font-size: 0.96rem;
}

.simulation-switcher-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #9fc9c5 transparent;
}

.simulation-switcher-tabs button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 9px 12px;
  color: var(--muted);
  text-align: start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #d5e3e1;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  flex: 0 0 210px;
}

.simulation-switcher-tabs button > b {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--simulation-teal-dark);
  background: #e1f1ef;
  border-radius: 11px;
  font-size: 0.74rem;
}

.simulation-switcher-tabs button > span { display: grid; gap: 1px; }
.simulation-switcher-tabs button strong { color: var(--blue-dark); font-size: 0.86rem; }
.simulation-switcher-tabs button small { color: var(--muted); font-size: 0.7rem; font-weight: 750; }

.simulation-switcher-tabs button.active {
  background: #fff;
  border-color: var(--simulation-teal);
  box-shadow: 0 6px 18px rgba(7, 52, 73, 0.09), inset 0 -3px 0 var(--simulation-teal);
}

.simulation-switcher-tabs button.active > b {
  color: #fff;
  background: var(--simulation-teal);
}

.simulation-panel {
  margin-top: 0;
  scroll-margin-top: 178px;
}

.fraction-lab {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid #d6e3e2;
  border-radius: 32px;
  box-shadow: 0 25px 80px rgba(7, 50, 75, 0.1);
}

.fraction-lab-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 4vw, 48px);
  border-bottom: 1px solid #dfe9e8;
}

.fraction-lab-head h2,
.simulations-next h2 {
  margin: 0;
  color: var(--blue-dark);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
}

.fraction-lab-head p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.fraction-lab-badge {
  padding: 9px 14px;
  color: var(--simulation-teal-dark);
  background: #e2f3f1;
  border: 1px solid #b8dedb;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.fraction-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.65fr);
  direction: rtl;
}

.fraction-controls {
  padding: clamp(26px, 3vw, 40px);
  background: #f7faf9;
  border-inline-end: 1px solid #dfe9e8;
}

.fraction-controls form { margin-top: 0; }

.fraction-expression-list {
  display: grid;
  gap: 10px;
}

.fraction-expression-row {
  position: relative;
  --row-color: #f27972;
}

.fraction-expression-row:nth-child(2) { --row-color: #15989b; }
.fraction-expression-row:nth-child(3) { --row-color: #7a62c8; }
.fraction-expression-row:nth-child(4) { --row-color: #e0a424; }
.fraction-expression-row:nth-child(5) { --row-color: #2778c4; }
.fraction-expression-row:nth-child(6) { --row-color: #bd5793; }

.fraction-expression-row .math-entry-shell {
  min-height: 70px;
  padding-inline-end: 42px;
  border-color: #d4dfde;
  box-shadow: 0 6px 18px rgba(7, 52, 73, 0.045);
}

.fraction-expression-row.active .math-entry-shell,
.fraction-expression-row .math-entry-shell:focus-within {
  border-color: var(--row-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--row-color) 14%, transparent), 0 10px 24px rgba(7, 52, 73, 0.08);
}

.fraction-expression-row .math-entry-index { background: var(--row-color); }

.fraction-row-remove {
  position: absolute;
  z-index: 4;
  inset: 50% 10px auto auto;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #879497;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transform: translateY(-50%);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
}

.fraction-row-remove:hover {
  color: #9d2c2c;
  background: #fff0ef;
}

.fraction-expression-list .fraction-expression-row:only-child .fraction-row-remove { display: none; }

.fraction-add-row {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 11px;
  color: var(--simulation-teal-dark);
  background: #edf7f5;
  border: 1px dashed #8bc9c4;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
}

.fraction-add-row:hover { background: #dff1ee; }
.fraction-add-row:disabled { cursor: not-allowed; opacity: 0.55; }

.math-entry-label {
  display: block;
  margin-bottom: 9px;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.math-entry-shell {
  display: grid;
  grid-template-columns: 34px 28px minmax(0, 1fr);
  align-items: center;
  min-height: 78px;
  padding: 10px 14px;
  direction: ltr;
  background: #fff;
  border: 2px solid #c9d9d8;
  border-radius: 17px;
  box-shadow: 0 10px 25px rgba(7, 52, 73, 0.06);
}

.math-entry-shell:focus-within {
  border-color: var(--simulation-teal);
  box-shadow: 0 0 0 4px rgba(21, 152, 155, 0.12), 0 12px 28px rgba(7, 52, 73, 0.08);
}

.math-entry-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: var(--simulation-coral);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.math-entry-equals {
  color: #9aa7a9;
  font-size: 1.35rem;
  font-weight: 900;
}

.latex-input-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  direction: ltr;
}

.math-entry-shell input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 4px 0;
  color: transparent;
  caret-color: transparent;
  direction: ltr;
  text-align: left;
  background: transparent;
  border: 0;
  outline: none;
  font: inherit;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 800;
}

.math-entry-shell input::placeholder {
  color: transparent;
  font-size: 0.78em;
  font-weight: 700;
}

.latex-input-render {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  direction: ltr;
  color: var(--blue-dark);
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 900;
  line-height: 1;
}

.latex-input-render .stacked-fraction {
  min-width: 46px;
  grid-template-rows: 1fr 2px 1fr;
  font-size: 0.72em;
}

.latex-input-render .stacked-fraction i { height: 2px; }

.latex-input-render .mixed-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
}

.latex-input-render .latex-raw,
.latex-input-render .latex-placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latex-input-render .latex-raw {
  font-size: 0.82em;
  letter-spacing: 0.01em;
}

.latex-input-render .latex-placeholder {
  color: #a3afb2;
  font-size: 0.68em;
  font-weight: 700;
}

.latex-entry-shell:focus-within .latex-input-render::after {
  content: "";
  width: 2px;
  height: 36px;
  margin-inline-start: 2px;
  background: var(--blue-dark);
  border-radius: 999px;
  animation: latex-caret 1s steps(1) infinite;
}

.math-entry-help {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.math-entry-help b { color: var(--blue-dark); }

.math-entry-live {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--simulation-teal-dark);
  font-size: 0.77rem;
  font-weight: 900;
}

.math-entry-live i {
  width: 8px;
  height: 8px;
  background: var(--simulation-teal);
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(21, 152, 155, 0.12);
}

.fraction-error {
  margin: 18px 0 0;
  padding: 10px 12px;
  color: #9d2c2c;
  background: #fff0ef;
  border: 1px solid #f4c0bb;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.fraction-examples {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #dfe9e8;
}

.fraction-examples > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.fraction-examples > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  direction: ltr;
}

.fraction-examples button {
  min-width: 62px;
  padding: 9px 12px;
  color: var(--simulation-teal-dark);
  background: #fff;
  border: 1px solid #b9d8d6;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.fraction-examples button:hover { background: #e7f5f3; }

.fraction-result {
  display: grid;
  gap: 24px;
  padding: clamp(28px, 4vw, 52px);
  min-width: 0;
}

.fraction-result-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 28px;
}

.fraction-result-summary > p {
  grid-row: 1 / 3;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 104px;
  margin: 0;
  padding: 16px;
  color: var(--simulation-teal-dark);
  text-align: center;
  background: #e5f4f2;
  border-radius: 18px;
  font-size: 0.83rem;
  font-weight: 900;
}

.fraction-equation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  direction: ltr;
  color: var(--blue-dark);
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
}

.fraction-equation .stacked-fraction {
  min-width: 58px;
  font-size: 0.62em;
}

.fraction-equation .mixed-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
}

.fraction-result-summary > span {
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 800;
}

.fraction-conversions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fraction-conversions article {
  display: grid;
  min-height: 112px;
  align-content: center;
  justify-items: center;
  padding: 16px;
  background: #fbfcfc;
  border: 1px solid #dbe7e6;
  border-radius: 16px;
}

.fraction-conversions small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.fraction-conversions strong {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  color: var(--blue-dark);
  direction: ltr;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  line-height: 1.1;
}

.fraction-conversions strong .stacked-fraction {
  min-width: 50px;
  font-size: 0.82em;
}

.fraction-conversions strong .mixed-display {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  direction: ltr;
}

.fraction-visual-block,
.fraction-number-line-block {
  padding: clamp(20px, 3vw, 30px);
  background: #f8fbfa;
  border: 1px solid #dbe7e6;
  border-radius: 20px;
}

.fraction-visual-block header,
.fraction-number-line-block header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.fraction-visual-block small,
.fraction-number-line-block small {
  color: var(--simulation-teal-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.fraction-visual-block h3,
.fraction-number-line-block h3 {
  margin: 2px 0 0;
  color: var(--blue-dark);
  font-size: 1.2rem;
}

.fraction-visual-block header > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.fraction-units {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px 16px;
}

.fraction-circle-card {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.fraction-circle-card svg {
  display: block;
  width: min(138px, 100%);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 8px 12px rgba(7, 52, 73, 0.09));
}

.fraction-circle-card > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.fraction-slice {
  fill: #fff;
  stroke: var(--blue-dark);
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.fraction-slice.filled { fill: #42b5aa; }

.fraction-circle-card.partial .fraction-slice.filled {
  fill: #f39772;
}

.fraction-visual-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.fraction-number-line {
  min-height: 144px;
  overflow: hidden;
  direction: ltr;
}

.number-line-empty {
  display: grid;
  min-height: 144px;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.fraction-number-line svg {
  display: block;
  width: 100%;
  min-width: 560px;
  height: 144px;
}

.equivalence-lab { margin-top: 0; }

.equivalence-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.65fr);
}

.equivalence-controls {
  padding: clamp(26px, 3vw, 40px);
  background: #f7faf9;
  border-inline-end: 1px solid #dfe9e8;
}

.equivalence-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 28px;
  padding: 5px;
  background: #e7efee;
  border-radius: 14px;
}

.equivalence-mode-switch button {
  min-height: 48px;
  padding: 9px 12px;
  color: #637174;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.equivalence-mode-switch button.active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 5px 16px rgba(7, 52, 73, 0.09);
}

.compact-math-entry { min-height: 68px; }

.equivalence-factor-label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--blue-dark);
  font-size: 0.84rem;
  font-weight: 900;
}

.equivalence-factor-label input {
  width: 100%;
  min-height: 54px;
  padding: 8px;
  color: var(--blue-dark);
  text-align: center;
  background: #fff;
  border: 2px solid #c9d9d8;
  border-radius: 13px;
  outline: 0;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 900;
}

.equivalence-factor-label input:focus {
  border-color: var(--simulation-teal);
  box-shadow: 0 0 0 4px rgba(21, 152, 155, 0.12);
}

.equivalence-examples button { min-width: auto; }

.equivalence-result {
  display: grid;
  gap: 24px;
  min-width: 0;
  padding: clamp(28px, 4vw, 52px);
}

.equivalence-result-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 24px;
}

.equivalence-result-head > span {
  grid-row: 1 / 3;
  display: grid;
  min-width: 104px;
  min-height: 100%;
  place-items: center;
  padding: 15px;
  color: var(--simulation-teal-dark);
  background: #e5f4f2;
  border-radius: 18px;
  font-size: 0.84rem;
  font-weight: 900;
}

.equivalence-equation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  direction: ltr;
  color: var(--blue-dark);
  font-size: clamp(1.9rem, 4vw, 3.45rem);
  font-weight: 900;
}

.equivalence-equation .stacked-fraction {
  min-width: 52px;
  font-size: 0.7em;
}

.equivalence-equation .operation-symbol { color: var(--simulation-coral); }

.equivalence-result-head > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
}

.equivalence-rule {
  padding: 18px 20px;
  color: var(--blue-dark);
  direction: ltr;
  text-align: center;
  background: #fff8e7;
  border: 1px solid #f0d995;
  border-radius: 16px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 900;
}

.equivalence-rule b { color: var(--simulation-coral); }

.equivalence-visual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  background: #f8fbfa;
  border: 1px solid #dbe7e6;
  border-radius: 20px;
}

.equivalence-visual article {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.equivalence-visual small {
  color: var(--simulation-teal-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.equivalence-visual strong {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  color: var(--blue-dark);
  direction: ltr;
  font-size: 1.55rem;
}

.equivalence-visual strong .stacked-fraction {
  min-width: 46px;
  font-size: 0.82em;
}

.equivalence-arrow {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff;
  background: var(--simulation-coral);
  border-radius: 999px;
  font-size: 1.45rem;
  font-weight: 900;
}

.equivalence-circles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.equivalence-circles svg {
  width: min(128px, calc(50% - 6px));
  min-width: 88px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 7px 11px rgba(7, 52, 73, 0.08));
}

.equivalence-circles .fraction-slice.filled { fill: #42b5aa; }

.equivalence-takeaway {
  margin: 0;
  padding: 18px 20px;
  color: var(--muted);
  background: #f2f7f6;
  border-inline-start: 5px solid var(--simulation-teal);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 750;
}

.equivalence-takeaway b { color: var(--blue-dark); }

.fraction-lesson-workspace {
  display: grid;
  grid-template-columns: minmax(285px, 0.72fr) minmax(0, 1.65fr);
}

.lesson-controls {
  padding: clamp(26px, 3vw, 40px);
  background: #f7faf9;
  border-inline-end: 1px solid #dfe9e8;
}

.lesson-inputs { display: grid; gap: 14px; }

.lesson-math-input {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.lesson-input-shell {
  position: relative;
  display: grid;
  min-height: 84px;
  align-items: center;
  padding: 10px 18px;
  direction: ltr;
  background: #fff;
  border: 2px solid #c9d9d8;
  border-radius: 16px;
}

.lesson-math-input:nth-child(1) .lesson-input-shell { border-inline-start: 6px solid var(--simulation-teal); }
.lesson-math-input:nth-child(2) .lesson-input-shell { border-inline-start: 6px solid var(--simulation-coral); }

.lesson-input-shell:focus-within {
  border-color: var(--simulation-teal);
  box-shadow: 0 0 0 4px rgba(21, 152, 155, 0.1);
}

.lesson-input-shell input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 2rem;
}

.lesson-input-shell > i {
  display: flex;
  align-items: center;
  pointer-events: none;
  color: var(--blue-dark);
  font-size: 2rem;
  font-style: normal;
  font-weight: 900;
}

.lesson-input-shell > i .stacked-fraction { min-width: 48px; font-size: 0.72em; }
.lesson-input-shell > i .mixed-display,
.lesson-visual-grid .mixed-display { display: inline-flex; align-items: center; gap: 8px; direction: ltr; }

.lesson-input-shell:focus-within > i::after {
  content: "";
  width: 2px;
  height: 36px;
  margin-inline-start: 6px;
  background: var(--blue-dark);
  animation: latex-caret 1s steps(1) infinite;
}

.lesson-result {
  display: grid;
  gap: 22px;
  min-width: 0;
  padding: clamp(28px, 4vw, 52px);
}

.lesson-equation {
  display: flex;
  min-height: 94px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  direction: ltr;
  color: var(--blue-dark);
  background: linear-gradient(145deg, #edf7f5, #fff);
  border: 1px solid #d4e6e3;
  border-radius: 20px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 900;
}

.lesson-equation .stacked-fraction { min-width: 58px; font-size: 0.66em; }
.lesson-equation .lesson-symbol { color: var(--simulation-coral); }

.lesson-explanation {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.lesson-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-visual-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.lesson-visual-grid article {
  display: grid;
  min-height: 235px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 20px;
  background: #f9fbfb;
  border: 1px solid #dbe7e6;
  border-radius: 18px;
}

.lesson-visual-grid article.result { background: #fff8e7; border-color: #efd894; }
.lesson-visual-grid small { color: var(--muted); font-weight: 900; }
.lesson-visual-grid strong { display: flex; min-height: 52px; align-items: center; color: var(--blue-dark); font-size: 1.65rem; }
.lesson-visual-grid strong .stacked-fraction { min-width: 46px; font-size: 0.8em; }
.lesson-visual-grid article > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lesson-visual-grid svg { width: min(142px, 100%); height: auto; filter: drop-shadow(0 7px 10px rgba(7, 52, 73, 0.08)); }

.lesson-number-line {
  min-height: 138px;
  padding: 14px;
  overflow-x: auto;
  background: #f8fbfa;
  border: 1px solid #dbe7e6;
  border-radius: 18px;
}

.lesson-number-line svg { display: block; width: 100%; min-width: 560px; height: 120px; }

.common-denominator-badge {
  padding: 16px 20px;
  color: var(--simulation-teal-dark);
  text-align: center;
  background: #e5f4f2;
  border-radius: 15px;
  font-weight: 900;
}

.common-denominator-badge b { color: var(--blue-dark); font-size: 1.35rem; }

.operation-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
  background: #e7efee;
  border-radius: 14px;
}

.operation-switch button {
  min-height: 48px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.operation-switch button.active { color: var(--blue-dark); background: #fff; box-shadow: 0 5px 16px rgba(7, 52, 73, 0.09); }

.operation-steps {
  display: grid;
  gap: 8px;
}

.operation-steps p {
  margin: 0;
  padding: 12px 16px;
  color: var(--blue-dark);
  direction: ltr;
  text-align: center;
  background: #fbfcfc;
  border: 1px solid #dbe7e6;
  border-radius: 12px;
  font-weight: 850;
}

.simulations-next {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: end;
  gap: 40px;
  margin-top: clamp(60px, 8vw, 100px);
  padding: 0 clamp(0px, 3vw, 40px);
}

.simulations-next-list {
  display: grid;
  gap: 10px;
}

.simulations-next-list span {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid #d9e5e4;
  border-radius: 12px;
  font-weight: 800;
}

.simulations-next-list b { color: var(--simulation-teal); }

.derivative-card .simulation-card-icon { color: #d95953; background: #ffebe9; }
.derivative-card:hover { border-color: #f27972 !important; }
.derivative-lab { --derivative-blue: #2778c4; --derivative-coral: #f27972; --derivative-ink: #102b46; }
.derivative-badge { color: #a9433f; background: #ffebe9; border-color: #f4c3bf; }

.derivative-workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.68fr) minmax(0, 1.7fr);
  direction: rtl;
}

.derivative-controls {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: clamp(24px, 3vw, 38px);
  background: #f7fafb;
  border-inline-end: 1px solid #dfe8ec;
}

.derivative-function-field { display: grid; gap: 9px; color: var(--derivative-ink); font-size: 0.8rem; font-weight: 900; }
.derivative-function-shell { display: flex; min-height: 62px; align-items: center; gap: 9px; padding: 8px 13px; background: #fff; border: 2px solid #cad9e3; border-radius: 14px; box-shadow: 0 8px 22px rgba(16, 43, 70, 0.06); direction: ltr; }
.derivative-function-shell:focus-within { border-color: var(--derivative-blue); box-shadow: 0 0 0 4px rgba(39, 120, 196, 0.12); }
.derivative-function-shell b { color: var(--derivative-blue); font-family: Georgia, serif; font-size: 1.15rem; white-space: nowrap; }
.derivative-function-shell math-field { width: 100%; min-width: 0; padding: 7px 2px; color: var(--derivative-ink); background: transparent; border: 0; outline: 0; font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 700; direction: ltr; --caret-color: var(--derivative-blue); --selection-background-color: rgba(39, 120, 196, 0.18); --contains-highlight-background-color: transparent; --smart-fence-color: var(--derivative-blue); }
.derivative-function-shell math-field::part(container) { border: 0; }

.derivative-math-toolbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; direction: ltr; }
.derivative-math-toolbar button { display: grid; min-width: 0; min-height: 38px; place-items: center; padding: 5px; color: #405c70; background: #fff; border: 1px solid #d4e0e7; border-radius: 9px; cursor: pointer; font: 800 0.75rem/1 Georgia, serif; }
.derivative-math-toolbar button:hover { color: #fff; background: var(--derivative-blue); border-color: var(--derivative-blue); }
.toolbar-fraction { display: inline-grid; grid-template-rows: auto 1px auto; min-width: 18px; align-items: center; }
.toolbar-fraction i { font-style: normal; font-size: 0.64rem; }
.toolbar-fraction em { height: 1px; background: currentColor; }
.derivative-error { margin: -8px 0 0; padding: 9px 11px; color: #a23f3a; background: #fff0ef; border: 1px solid #f3c7c4; border-radius: 10px; font-size: 0.72rem; font-weight: 800; }

.derivative-presets { display: flex; flex-wrap: wrap; gap: 7px; direction: ltr; }
.derivative-presets button { min-height: 36px; padding: 6px 11px; color: #536779; background: #fff; border: 1px solid #d7e2e8; border-radius: 9px; cursor: pointer; font: 800 0.78rem/1.2 Georgia, serif; }
.derivative-presets button:hover,
.derivative-presets button.active { color: #fff; background: var(--derivative-blue); border-color: var(--derivative-blue); }

.derivative-slider { display: grid; gap: 10px; }
.derivative-slider > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--derivative-ink); font-size: 0.78rem; }
.derivative-slider output { min-width: 58px; padding: 5px 8px; color: #1d65a9; text-align: center; background: #e6f1fb; border-radius: 8px; font-weight: 900; direction: ltr; }
.derivative-slider input { width: 100%; accent-color: var(--derivative-blue); cursor: pointer; direction: ltr; }
.derivative-help { display: grid; gap: 5px; padding: 12px 13px; color: #657787; background: #fff; border: 1px dashed #cbd9e1; border-radius: 11px; font-size: 0.68rem; line-height: 1.55; }
.derivative-help strong { color: var(--derivative-ink); }
.derivative-help span { direction: ltr; text-align: left; }

.derivative-stage { min-width: 0; padding: clamp(20px, 3vw, 38px); background: #fff; }
.derivative-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.derivative-metrics article { display: grid; gap: 4px; min-height: 76px; align-content: center; padding: 12px 15px; background: #f5f8fa; border: 1px solid #dce6eb; border-radius: 14px; }
.derivative-metrics article.primary { color: #fff; background: linear-gradient(135deg, #2778c4, #15989b); border-color: transparent; box-shadow: 0 11px 28px rgba(39, 120, 196, 0.18); }
.derivative-metrics small { color: #708191; font-size: 0.65rem; font-weight: 850; }
.derivative-metrics .primary small { color: rgba(255, 255, 255, 0.78); }
.derivative-metrics strong { color: var(--derivative-ink); font-size: clamp(1.05rem, 2vw, 1.5rem); direction: ltr; }
.derivative-metrics .primary strong { color: #fff; }

.derivative-canvas-wrap { position: relative; min-height: 410px; overflow: hidden; background: #fbfdfe; border: 1px solid #d6e3e9; border-radius: 21px; box-shadow: inset 0 0 40px rgba(39, 120, 196, 0.035); touch-action: none; }
.derivative-canvas-wrap canvas { display: block; width: 100%; height: 410px; cursor: grab; }
.derivative-canvas-wrap canvas:active { cursor: grabbing; }
.graph-legend { position: absolute; inset: 13px 13px auto auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 7px 9px; color: #536779; background: rgba(255, 255, 255, 0.9); border: 1px solid #dce6eb; border-radius: 10px; font-size: 0.66rem; font-weight: 850; }
.graph-legend span { display: inline-flex; align-items: center; gap: 5px; }
.graph-legend i { width: 18px; height: 3px; background: var(--derivative-blue); border-radius: 4px; }
.graph-legend .tangent i { background: var(--derivative-coral); }
.graph-drag-hint { position: absolute; inset: auto auto 12px 12px; padding: 6px 9px; color: #466072; background: rgba(255, 255, 255, 0.88); border-radius: 8px; font-size: 0.65rem; font-weight: 800; pointer-events: none; }

.derivative-equations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 14px; }
.derivative-equations article { min-width: 0; padding: 15px 17px; background: #f5f8fa; border: 1px solid #dce6eb; border-radius: 14px; }
.derivative-equations article.tangent-equation-card { background: #fff4f2; border-color: #f2cbc7; }
.derivative-equations small { display: block; margin-bottom: 7px; color: #708191; font-size: 0.65rem; font-weight: 900; }
.derivative-equations strong { display: block; overflow-wrap: anywhere; color: var(--derivative-ink); font: 800 clamp(0.92rem, 1.7vw, 1.15rem)/1.35 Georgia, serif; direction: ltr; }
.derivative-equations p { margin: 6px 0 0; color: #687987; font-size: 0.7rem; font-weight: 700; }

.circuit-lab { --circuit-violet: #7558c7; --circuit-ink: #102b46; }
.circuit-lab-head { align-items: center; }

.circuit-power {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  padding: 11px 15px;
  color: #97413c;
  background: #fff0ef;
  border: 1px solid #f1c7c3;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.circuit-power span {
  width: 12px;
  height: 12px;
  background: #db625b;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(219, 98, 91, 0.12);
}

.circuit-power.active { color: #0b696f; background: #e6f6f3; border-color: #b7dfda; }
.circuit-power.active span { background: #15989b; box-shadow: 0 0 0 5px rgba(21, 152, 155, 0.13), 0 0 16px rgba(21, 152, 155, 0.45); }
.circuit-power b { font-size: 0.82rem; }

.circuit-workspace {
  display: grid;
  grid-template-columns: minmax(275px, 0.65fr) minmax(0, 1.7fr);
  direction: rtl;
}

.circuit-controls {
  display: grid;
  align-content: start;
  gap: 25px;
  padding: clamp(24px, 3vw, 38px);
  background: #f7f8fb;
  border-inline-end: 1px solid #dfe5eb;
}

.circuit-controls fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.circuit-controls legend { margin-bottom: 9px; color: var(--circuit-ink); font-size: 0.78rem; font-weight: 900; }
.circuit-mode > div,
.circuit-count > div { display: grid; gap: 7px; padding: 5px; background: #e8ecf1; border-radius: 13px; }
.circuit-mode > div { grid-template-columns: repeat(2, 1fr); }
.circuit-count > div { grid-template-columns: repeat(3, 1fr); }

.circuit-mode button,
.circuit-count button {
  min-height: 42px;
  color: #657487;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 900;
}

.circuit-mode button.active,
.circuit-count button.active { color: var(--circuit-ink); background: #fff; box-shadow: 0 4px 13px rgba(16, 43, 70, 0.09); }

.circuit-slider { display: grid; gap: 10px; }
.circuit-slider > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--circuit-ink); font-size: 0.8rem; }
.circuit-slider b { display: inline-flex; align-items: center; gap: 7px; }
.circuit-slider output { min-width: 55px; padding: 5px 8px; color: #604aa9; text-align: center; background: #eeeafd; border-radius: 8px; font-weight: 900; direction: ltr; }
.circuit-slider input { width: 100%; accent-color: var(--circuit-violet); cursor: pointer; }
.resistor-controls { display: grid; gap: 20px; }
.resistor-control[hidden] { display: none; }
.resistor-control i { width: 11px; height: 11px; background: var(--resistor-color); border-radius: 4px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--resistor-color) 15%, transparent); }

.circuit-stage { min-width: 0; padding: clamp(20px, 3vw, 38px); background: #fff; }
.circuit-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.circuit-metrics article { display: grid; gap: 5px; min-height: 84px; align-content: center; padding: 13px 16px; background: #f5f7f9; border: 1px solid #dce4ea; border-radius: 15px; }
.circuit-metrics article.primary { color: #fff; background: linear-gradient(135deg, #7558c7, #4e84c4); border-color: transparent; box-shadow: 0 12px 28px rgba(93, 83, 180, 0.2); }
.circuit-metrics small { color: #718092; font-size: 0.68rem; font-weight: 850; }
.circuit-metrics .primary small { color: rgba(255, 255, 255, 0.75); }
.circuit-metrics strong { color: var(--circuit-ink); font-size: clamp(1.25rem, 2.5vw, 1.8rem); direction: ltr; }
.circuit-metrics .primary strong { color: #fff; }

.circuit-canvas {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 20%, rgba(117, 88, 199, 0.22), transparent 32%),
    radial-gradient(circle at 20% 80%, rgba(21, 152, 155, 0.16), transparent 34%),
    #102b46;
  border: 1px solid #183b5b;
  border-radius: 22px;
  box-shadow: inset 0 0 60px rgba(4, 20, 34, 0.35);
}

.circuit-canvas svg { display: block; width: 100%; min-height: 390px; }
.circuit-wire { fill: none; stroke: #9fb2c3; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.circuit-wire.base { stroke: #6f879a; }
.circuit-wire.branch { stroke-width: 6; }
.battery line { stroke: #ffd166; stroke-width: 10; stroke-linecap: round; }
.battery .battery-short { stroke-width: 6; }
.battery text { fill: #ffd166; font-size: 24px; font-weight: 900; text-anchor: middle; }
.battery .battery-label { fill: #fff; font-size: 18px; direction: ltr; }
.circuit-switch circle { fill: #fff; stroke: #7fe0d7; stroke-width: 5; }
.circuit-switch line { stroke: #7fe0d7; stroke-width: 9; stroke-linecap: round; transform-origin: 245px 100px; transition: transform 240ms ease; }
.circuit-switch.open line { transform: rotate(-28deg); }

.svg-resistor rect { fill: #f27972; stroke: #ffc0bc; stroke-width: 3; }
.svg-resistor.purple rect { fill: #7558c7; stroke: #bcaef0; }
.svg-resistor.teal rect { fill: #15989b; stroke: #75d6d1; }
.svg-resistor text { fill: #fff; font-size: 17px; font-weight: 900; text-anchor: middle; }
.svg-resistor .value { fill: #c8d6e2; font-size: 15px; direction: ltr; }
.svg-resistor.inactive { display: none; }
.series-network.inactive,
.parallel-network.inactive,
.parallel-branch.inactive { display: none; }
.branch-current { fill: #7fe0d7; font-size: 14px; font-weight: 900; direction: ltr; }

.current-flow circle { fill: #7fe0d7; filter: url(#current-glow); }
.current-flow.paused { display: none; }
.circuit-canvas.low-current .current-flow { opacity: 0.42; }
.circuit-status { position: absolute; inset: auto 16px 14px auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; color: #dce8f1; background: rgba(7, 27, 44, 0.75); border: 1px solid rgba(159, 178, 195, 0.25); border-radius: 999px; font-size: 0.7rem; font-weight: 800; }
.circuit-status span { width: 8px; height: 8px; background: #7fe0d7; border-radius: 50%; box-shadow: 0 0 10px #7fe0d7; }
.circuit-status.open span { background: #f27972; box-shadow: none; }

.circuit-explanation { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr); gap: 12px; margin-top: 16px; }
.circuit-explanation > div { min-width: 0; padding: 16px 18px; background: #f5f7f9; border: 1px solid #dce4ea; border-radius: 15px; }
.circuit-explanation small { display: block; margin-bottom: 7px; color: #718092; font-size: 0.68rem; font-weight: 900; }
.circuit-explanation strong { color: var(--circuit-ink); font-size: clamp(0.86rem, 1.7vw, 1.05rem); direction: ltr; }
.voltage-drops { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voltage-drops span { padding: 7px 10px; color: #44576b; background: #fff; border: 1px solid #dce4ea; border-radius: 9px; font-size: 0.74rem; font-weight: 850; direction: ltr; }

.projectile-lab {
  --projectile-violet: #7558c7;
  --projectile-teal: #15989b;
  --projectile-coral: #f27972;
  --projectile-ink: #102b46;
}

.projectile-lab-head { align-items: center; }
.projectile-law-badge { display: grid; gap: 3px; min-width: 175px; padding: 11px 15px; color: #59459a; text-align: center; background: #eeeafd; border: 1px solid #d4c9f4; border-radius: 14px; direction: ltr; }
.projectile-law-badge b { font-size: 0.88rem; }
.projectile-law-badge small { color: #786d96; font-size: 0.62rem; direction: rtl; }

.projectile-workspace { display: grid; grid-template-columns: minmax(280px, 0.67fr) minmax(0, 1.75fr); direction: rtl; }
.projectile-controls { display: grid; align-content: start; gap: 22px; padding: clamp(24px, 3vw, 38px); background: #f7f8fb; border-inline-end: 1px solid #dfe5eb; }
.projectile-controls fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.projectile-controls legend { margin-bottom: 9px; color: var(--projectile-ink); font-size: 0.78rem; font-weight: 900; }
.projectile-mode > div,
.projectile-gravity > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding: 5px; background: #e8ecf1; border-radius: 13px; }
.projectile-mode button,
.projectile-gravity button { min-height: 42px; color: #657487; background: transparent; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 900; }
.projectile-gravity button { font-size: 0.72rem; direction: ltr; }
.projectile-mode button.active,
.projectile-gravity button.active { color: var(--projectile-ink); background: #fff; box-shadow: 0 4px 13px rgba(16, 43, 70, 0.09); }

.projectile-timeline { display: grid; gap: 10px; }
.projectile-timeline > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--projectile-ink); font-size: 0.78rem; }
.projectile-timeline output { min-width: 70px; padding: 5px 8px; color: #604aa9; text-align: center; background: #eeeafd; border-radius: 8px; font-weight: 900; direction: ltr; }
.projectile-timeline input { width: 100%; accent-color: var(--projectile-violet); cursor: pointer; direction: ltr; }

.projectile-number { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 0.72fr); align-items: center; gap: 12px; }
.projectile-number > span:first-child { display: grid; gap: 3px; color: var(--projectile-ink); font-size: 0.78rem; }
.projectile-number > span:first-child small { color: #7b8a97; font-size: 0.61rem; font-weight: 750; }
.projectile-number-shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; overflow: hidden; background: #fff; border: 2px solid #d4dce5; border-radius: 11px; box-shadow: 0 5px 14px rgba(16, 43, 70, 0.05); direction: ltr; }
.projectile-number-shell:focus-within { border-color: var(--projectile-violet); box-shadow: 0 0 0 4px rgba(117, 88, 199, 0.12); }
.projectile-number-shell input { width: 100%; min-width: 0; padding: 10px 9px; color: var(--projectile-ink); background: transparent; border: 0; outline: 0; font: 900 1rem/1.2 Arial, sans-serif; direction: ltr; }
.projectile-number-shell i { align-self: stretch; display: grid; min-width: 42px; place-items: center; padding: 0 8px; color: #604aa9; background: #eeeafd; font-style: normal; font-size: 0.72rem; font-weight: 900; }
.projectile-number.disabled { opacity: 0.5; }
.projectile-number.disabled .projectile-number-shell { box-shadow: none; }
.projectile-number.disabled input { cursor: not-allowed; }
.projectile-entry-hint { margin: -10px 0 0; color: #6e7f8e; font-size: 0.64rem; font-weight: 750; line-height: 1.5; }

.projectile-playback { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; }
.projectile-play,
.projectile-reset { min-height: 46px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 900; }
.projectile-play { display: flex; align-items: center; justify-content: center; gap: 9px; color: #fff; background: linear-gradient(135deg, #7558c7, #4e84c4); border: 0; box-shadow: 0 10px 24px rgba(92, 76, 180, 0.2); }
.projectile-play.active { background: linear-gradient(135deg, #f27972, #d65e79); }
.projectile-play span { font-size: 0.9rem; }
.projectile-play b { font-size: 0.78rem; }
.projectile-reset { color: #5f7182; background: #fff; border: 1px solid #d5dfe6; font-size: 1.25rem; }
.projectile-reset:hover { color: var(--projectile-violet); border-color: var(--projectile-violet); }

.projectile-assumptions { display: grid; gap: 7px; padding: 13px 14px; color: #687a89; background: #fff; border: 1px dashed #ccd8e0; border-radius: 12px; font-size: 0.69rem; line-height: 1.5; }
.projectile-assumptions strong { color: var(--projectile-ink); }
.projectile-assumptions p { margin: 0; }
.projectile-assumptions > div { display: grid; gap: 5px; margin-top: 2px; }
.projectile-assumptions span { display: flex; align-items: center; gap: 7px; }
.projectile-assumptions i { width: 20px; height: 3px; border-radius: 4px; }
.projectile-assumptions .x-component { background: var(--projectile-teal); }
.projectile-assumptions .y-component { background: var(--projectile-coral); }
.projectile-assumptions .velocity-vector { background: var(--projectile-violet); }

.projectile-stage { min-width: 0; padding: clamp(20px, 3vw, 38px); background: #fff; }
.projectile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.projectile-metrics article { display: grid; gap: 4px; min-width: 0; min-height: 76px; align-content: center; padding: 11px 14px; background: #f5f7f9; border: 1px solid #dce4ea; border-radius: 14px; }
.projectile-metrics article.primary { color: #fff; background: linear-gradient(135deg, #7558c7, #4e84c4); border-color: transparent; }
.projectile-metrics small { color: #718092; font-size: 0.65rem; font-weight: 900; }
.projectile-metrics .primary small { color: rgba(255, 255, 255, 0.76); }
.projectile-metrics strong { overflow-wrap: anywhere; color: var(--projectile-ink); font-size: clamp(0.92rem, 1.65vw, 1.3rem); direction: ltr; }
.projectile-metrics .primary strong { color: #fff; }

.projectile-canvas-wrap { position: relative; min-height: 430px; overflow: hidden; background: #f7fbfe; border: 1px solid #d6e3e9; border-radius: 21px; box-shadow: inset 0 0 42px rgba(78, 132, 196, 0.05); }
.projectile-canvas-wrap canvas { display: block; width: 100%; height: 430px; }
.projectile-canvas-legend { position: absolute; inset: 12px 13px auto 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; color: #506778; background: rgba(255, 255, 255, 0.9); border: 1px solid #dce6eb; border-radius: 10px; font-size: 0.66rem; font-weight: 850; pointer-events: none; }
.projectile-canvas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.projectile-canvas-legend i { width: 22px; border-top: 3px dashed var(--projectile-violet); }
.projectile-canvas-legend b { font-weight: 850; direction: ltr; }
.projectile-equation { position: absolute; inset: auto auto 12px 13px; max-width: calc(100% - 26px); padding: 7px 10px; color: #425a6c; background: rgba(255, 255, 255, 0.9); border: 1px solid #dce6eb; border-radius: 9px; font: 800 0.72rem/1.3 Georgia, serif; direction: ltr; }

.projectile-vector-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.projectile-vector-panel article { min-width: 0; padding: 14px 16px; background: #f6f8fa; border: 1px solid #dce4ea; border-top: 4px solid var(--vector-color); border-radius: 14px; }
.projectile-vector-panel .vector-x { --vector-color: var(--projectile-teal); }
.projectile-vector-panel .vector-y { --vector-color: var(--projectile-coral); }
.projectile-vector-panel .vector-total { --vector-color: var(--projectile-violet); }
.projectile-vector-panel small { display: block; margin-bottom: 6px; color: #718092; font-size: 0.64rem; font-weight: 900; }
.projectile-vector-panel strong { display: block; color: var(--projectile-ink); font-size: clamp(0.86rem, 1.5vw, 1.05rem); direction: ltr; }
.projectile-vector-panel p { margin: 6px 0 0; color: #6c7d8c; font: 700 0.69rem/1.4 Georgia, serif; direction: ltr; }

@media (max-width: 1050px) {
  .simulations-hero,
  .fraction-workspace,
  .equivalence-workspace,
  .fraction-lesson-workspace,
  .simulations-next {
    grid-template-columns: 1fr;
  }

  .simulations-hero-card { width: min(520px, 100%); }
  .fraction-controls { border-inline-end: 0; border-bottom: 1px solid #dfe9e8; }
  .equivalence-controls { border-inline-end: 0; border-bottom: 1px solid #dfe9e8; }
  .lesson-controls { border-inline-end: 0; border-bottom: 1px solid #dfe9e8; }
  .projectile-workspace { grid-template-columns: 1fr; }
  .projectile-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); border-inline-end: 0; border-bottom: 1px solid #dfe5eb; }
  .projectile-entry-hint { grid-column: 1 / -1; }
  .projectile-assumptions { grid-column: 1 / -1; }
  .simulation-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .simulations-shell { width: min(100% - 24px, 1380px); padding-top: 34px; }
  .simulations-hero { min-height: 0; padding-bottom: 48px; }
  .simulations-hero h1 { font-size: clamp(2.75rem, 14vw, 4.7rem); }
  .simulations-hero-card { min-height: 250px; padding-inline: 22px; }
  .simulation-catalog { padding: 22px 14px; border-radius: 22px; }
  .simulation-catalog-head { align-items: start; flex-direction: column; gap: 12px; }
  .catalog-subject-tabs { grid-template-columns: 1fr; }
  .catalog-subject-tabs button { min-height: 62px; }
  .simulation-card-grid { grid-template-columns: 1fr; }
  .simulation-card { min-height: 260px; }
  .simulation-app-body .simulations-shell { gap: 7px; padding: 7px; }
  .simulation-app-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 56px;
    padding: 5px 7px;
    border-radius: 14px;
  }
  .simulation-app-brand > span { display: none; }
  .simulation-app-brand > a { width: 36px; height: 36px; }
  .simulation-app-brand img { width: 34px; height: 34px; }
  .simulation-subject-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .simulation-subject-switch button { min-height: 40px; justify-content: center; padding: 4px 7px; }
  .simulation-subject-switch button > b { display: none; }
  .simulation-subject-switch button > span { font-size: 0.72rem; }
  .simulation-subject-switch button small { font-size: 0.56rem; }
  .simulation-exit { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 0; }
  .simulation-exit span { font-size: 1.1rem; }
  .simulation-switcher {
    top: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
  }
  .simulation-switcher-title { display: none; }
  .simulation-switcher-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .simulation-switcher-tabs::-webkit-scrollbar { display: none; }
  .simulation-switcher-tabs button { min-width: 230px; min-height: 60px; }
  .simulation-app-body .simulation-switcher { top: auto; }
  .simulation-panel { scroll-margin-top: 88px; }
  .fraction-lab { border-radius: 22px; }
  .fraction-lab-head { align-items: start; flex-direction: column; }
  .derivative-workspace { grid-template-columns: 1fr; }
  .derivative-controls { border-inline-end: 0; border-bottom: 1px solid #dfe8ec; }
  .derivative-stage { padding: 14px; }
  .derivative-metrics { grid-template-columns: 1fr; }
  .derivative-metrics article { min-height: 62px; }
  .derivative-canvas-wrap { min-height: 330px; border-radius: 15px; }
  .derivative-canvas-wrap canvas { height: 330px; }
  .derivative-equations { grid-template-columns: 1fr; }
  .circuit-lab-head { align-items: start; }
  .circuit-power { min-width: 0; }
  .circuit-workspace { grid-template-columns: 1fr; }
  .circuit-controls { border-inline-end: 0; border-bottom: 1px solid #dfe5eb; }
  .circuit-stage { padding: 14px; }
  .circuit-metrics { grid-template-columns: 1fr; }
  .circuit-metrics article { min-height: 68px; }
  .circuit-canvas { min-height: 300px; border-radius: 16px; }
  .circuit-canvas svg { min-width: 590px; min-height: 300px; transform-origin: right center; }
  .circuit-canvas { overflow-x: auto; }
  .circuit-explanation { grid-template-columns: 1fr; }
  .projectile-lab-head { align-items: start; }
  .projectile-law-badge { min-width: 0; }
  .projectile-controls { grid-template-columns: 1fr; }
  .projectile-entry-hint { grid-column: auto; }
  .projectile-assumptions { grid-column: auto; }
  .projectile-stage { padding: 14px; }
  .projectile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projectile-metrics article { min-height: 65px; }
  .projectile-canvas-wrap { min-height: 350px; border-radius: 16px; }
  .projectile-canvas-wrap canvas { height: 350px; }
  .projectile-canvas-legend { align-items: start; flex-direction: column; }
  .projectile-vector-panel { grid-template-columns: 1fr; }
  .fraction-result-summary { grid-template-columns: 1fr; }
  .fraction-result-summary > p { grid-row: auto; min-height: 48px; }
  .fraction-conversions { grid-template-columns: 1fr; }
  .fraction-conversions article { min-height: 90px; }
  .fraction-units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fraction-circle-card svg { width: min(128px, 100%); }
  .fraction-number-line { overflow-x: auto; }
  .equivalence-result-head { grid-template-columns: 1fr; }
  .equivalence-result-head > span { grid-row: auto; min-height: 48px; }
  .equivalence-visual { grid-template-columns: 1fr; }
  .equivalence-arrow { transform: rotate(-90deg); }
  .equivalence-circles svg { width: min(120px, calc(50% - 6px)); }
  .lesson-visual-grid,
  .lesson-visual-grid.three-up { grid-template-columns: 1fr; }
  .lesson-visual-grid article { min-height: 210px; }
  .simulations-next { padding-inline: 4px; }
}

@media (prefers-reduced-motion: no-preference) {
  .fraction-slice.filled { animation: fraction-fill 360ms ease both; }
  @keyframes latex-caret { 50% { opacity: 0; } }
  @keyframes fraction-fill {
    from { opacity: 0.25; transform: scaleY(0.4); transform-origin: bottom; }
    to { opacity: 1; transform: scaleY(1); }
  }
}
