:root {
  --canvas: #f4f6fb;
  --paper: #fffdf7;
  --warm: #faf6ec;
  --sea: #1d3a35;
  --sea-2: #2e5d52;
  --ink: #26312e;
  --muted: #5d6a66;
  --faint: #7b8582;
  --line: rgba(29, 58, 53, 0.15);
  --field: #315c94;
  --field-soft: #e6edf7;
  --coil: #99501d;
  --coil-soft: #f4e5d8;
  --induced: #6b3e8e;
  --induced-soft: #eee5f4;
  --gold: #b8860b;
  --gold-soft: #f3e3b8;
  --ok: #13795b;
  --ok-soft: #e8f5ef;
  --bad: #b4233d;
  --bad-soft: #fbecef;
  --physics: #5e5ce6;
  --physics-soft: #eeeefd;
  --focus: #0f6bdc;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(900px 480px at 50% -180px, rgba(94, 92, 230, 0.10), transparent 68%),
    var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.formula,
.value,
.latin {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.formula {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

.value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.skip-link {
  position: fixed;
  inset-inline-start: 14px;
  top: -80px;
  z-index: 100;
  border-radius: 12px;
  background: var(--sea);
  color: white;
  padding: 11px 16px;
  font-weight: 800;
  text-decoration: none;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 251, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.site-header__inner {
  width: min(1120px, calc(100% - 28px));
  min-height: 62px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand,
.return-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sea);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #3c95ee, #2464d9);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(36, 100, 217, 0.85);
  direction: ltr;
  font-size: 12px;
  letter-spacing: -0.04em;
}

.return-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  padding-inline: 14px;
}

.intro {
  width: min(1120px, calc(100% - 28px));
  min-height: calc(100dvh - 62px);
  margin-inline: auto;
  padding-block: 28px calc(42px + var(--safe-bottom));
  display: grid;
  align-items: center;
  gap: 28px;
}

.intro__copy {
  min-width: 0;
}

.eyebrow {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--physics-soft);
  color: #4543b1;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
}

.intro h1 {
  max-width: 680px;
  margin: 14px 0 0;
  color: #232751;
  font-size: clamp(31px, 8vw, 58px);
  line-height: 1.25;
  letter-spacing: 0;
}

.intro__lead {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 3.7vw, 17px);
  line-height: 1.85;
}

.intro__meta {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intro__meta span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 5px 13px;
  color: var(--muted);
  font-size: 11.5px;
}

.source-note {
  max-width: 660px;
  margin-top: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid rgba(19, 121, 91, 0.18);
  border-radius: 18px;
  background: var(--ok-soft);
  padding: 13px 14px;
}

.source-note__icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.source-note b,
.source-note small {
  display: block;
}

.source-note b {
  color: #0d6048;
  font-size: 12px;
}

.source-note small {
  margin-top: 2px;
  color: #376b5c;
  font-size: 10.5px;
  line-height: 1.75;
}

.intro__actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.choice,
.control-button,
.case-button,
.angle-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 14px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 850;
}

.primary-button {
  border: 2px solid #3432a9;
  background: var(--physics);
  color: #fff;
  box-shadow: 0 4px 0 #3432a9, 0 12px 28px -16px rgba(49, 49, 127, 0.95);
}

.primary-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 #3432a9;
}

.primary-button:disabled {
  border-color: #a8a9b6;
  background: #c4c5cf;
  color: #565866;
  box-shadow: 0 3px 0 #9b9da8;
  cursor: not-allowed;
}

.secondary-button {
  border: 2px solid var(--sea);
  background: var(--paper);
  color: var(--sea);
  box-shadow: 0 3px 0 var(--sea);
}

.secondary-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: none;
}

.secondary-button:disabled {
  border-color: #b8bcba;
  color: #777e7b;
  box-shadow: 0 3px 0 #b8bcba;
  cursor: not-allowed;
}

.text-button {
  min-height: 48px;
  background: transparent;
  color: var(--sea-2);
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 12px;
  font-weight: 750;
}

.intro__scene {
  min-width: 0;
  border-radius: 30px;
  box-shadow: 0 30px 70px -36px rgba(17, 22, 47, 0.65);
}

.intro__scene svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
}

.lesson {
  width: min(1120px, 100%);
  min-height: calc(100dvh - 62px);
  height: calc(100dvh - 62px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lesson__header {
  flex: none;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 8px;
}

.lesson__heading {
  min-width: 0;
}

.lesson__heading > span {
  display: block;
  color: var(--physics);
  font-size: 10.5px;
  font-weight: 850;
}

.lesson__heading h2 {
  margin: 2px 0 0;
  color: #232751;
  font-size: clamp(19px, 5.2vw, 25px);
  line-height: 1.35;
}

.icon-button {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid rgba(94, 92, 230, 0.2);
  border-radius: 15px;
  background: var(--physics-soft);
  color: var(--physics);
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 900;
}

.mission-progress {
  flex: none;
  height: 12px;
  margin: 0;
  padding: 0 14px 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  list-style: none;
}

.mission-progress li {
  height: 6px;
  border-radius: 999px;
  background: #d9dbe7;
  overflow: hidden;
}

.mission-progress li::after {
  content: "";
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #5e5ce6, #4da4eb);
  transition: width 220ms ease;
}

.mission-progress li[data-state="complete"]::after,
.mission-progress li[aria-current="step"]::after {
  width: 100%;
}

.mission-progress li[aria-current="step"] {
  box-shadow: 0 0 0 2px rgba(94, 92, 230, 0.18);
}

.lesson__workspace {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 18px;
  padding: 10px 14px 18px;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
}

.scene-panel,
.mission-body {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 40px -34px rgba(29, 58, 53, 0.6);
}

.scene-panel {
  min-height: calc(clamp(224px, 34dvh, 310px) + 48px);
  align-self: start;
  overflow: hidden;
}

.scene {
  min-height: clamp(224px, 34dvh, 310px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(380px 190px at 50% 0%, rgba(94, 92, 230, 0.18), transparent 72%),
    linear-gradient(145deg, #151a38, #0c1127);
  color: white;
  direction: ltr;
}

.scene > svg {
  width: 100%;
  height: 100%;
  max-height: 310px;
  display: block;
}

.scene-summary {
  min-height: 48px;
  margin: 0;
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #151a38;
  color: #dce2ff;
  padding: 8px 14px;
  direction: rtl;
  font-size: 11.5px;
  line-height: 1.7;
}

.mission-body {
  padding: 15px;
}

.mission-kicker {
  margin: 0;
  color: var(--physics);
  font-size: 10.5px;
  font-weight: 850;
}

.mission-instruction {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.8;
}

.microcopy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.control-grid,
.choice-grid,
.case-grid,
.angle-grid {
  margin-top: 13px;
  display: grid;
  gap: 9px;
}

.control-grid {
  grid-template-columns: repeat(3, 1fr);
}

.control-button,
.case-button,
.angle-button {
  min-height: 52px;
  border: 2px solid var(--sea-2);
  border-radius: 14px;
  background: var(--paper);
  color: var(--sea);
  box-shadow: 0 3px 0 var(--sea-2);
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 800;
}

.control-button:active,
.case-button:active,
.angle-button:active {
  transform: translateY(3px);
  box-shadow: none;
}

.control-button[data-active="true"],
.case-button[aria-pressed="true"],
.angle-button[aria-pressed="true"] {
  border-color: #3432a9;
  background: var(--physics);
  color: white;
  box-shadow: 0 3px 0 #3432a9;
}

.control-button small,
.case-button small,
.angle-button small {
  display: block;
  margin-top: 1px;
  color: inherit;
  opacity: 0.72;
  font-size: 9px;
}

.observation-ledger,
.givens,
.equation-chain,
.feedback,
.question-card,
.skill-summary {
  margin-top: 13px;
  border-radius: 16px;
}

.observation-ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.observation-ledger > span {
  min-width: 0;
  border: 1px solid rgba(49, 92, 148, 0.18);
  border-radius: 13px;
  background: var(--field-soft);
  padding: 9px 10px;
}

.observation-ledger small,
.observation-ledger b {
  display: block;
}

.observation-ledger small {
  color: #506782;
  font-size: 9.5px;
}

.observation-ledger b {
  margin-top: 2px;
  color: #273e5b;
  font-size: 11px;
  line-height: 1.55;
}

.question-card {
  border: 1px solid rgba(184, 134, 11, 0.25);
  background: #fffaf0;
  padding: 12px;
}

.question-card legend,
.question-card h3 {
  margin: 0;
  color: #5e4808;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.7;
}

fieldset.question-card {
  min-width: 0;
}

.choice-grid {
  margin-top: 9px;
}

.choice {
  width: 100%;
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1.5px solid rgba(29, 58, 53, 0.18);
  border-radius: 13px;
  background: #fff;
  padding: 9px 11px;
  text-align: start;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.6;
}

.choice::after {
  content: "";
  width: 19px;
  height: 19px;
  flex: none;
  border: 2px solid #b8bfbc;
  border-radius: 50%;
}

.choice[aria-pressed="true"] {
  border-color: var(--physics);
  background: var(--physics-soft);
  color: #343278;
}

.choice[aria-pressed="true"]::after {
  border: 5px solid var(--physics);
  background: #fff;
}

.choice[data-result="correct"] {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: #0c6148;
}

.choice[data-result="correct"]::after {
  content: "✓";
  display: grid;
  place-items: center;
  border: 0;
  background: var(--ok);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.choice[data-result="wrong"] {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: #8e1a30;
}

.choice[data-result="wrong"]::after {
  content: "×";
  display: grid;
  place-items: center;
  border-color: var(--bad);
  color: var(--bad);
  font-size: 16px;
  font-weight: 900;
}

.feedback {
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  background: #f8faf9;
  padding: 10px 11px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.feedback::before {
  content: "i";
  width: 23px;
  height: 23px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e9eceb;
  color: var(--sea);
  font-family: Georgia, serif;
  font-weight: 900;
}

.feedback[data-tone="correct"] {
  border-color: rgba(19, 121, 91, 0.28);
  background: var(--ok-soft);
  color: #0d6048;
}

.feedback[data-tone="correct"]::before {
  content: "✓";
  background: var(--ok);
  color: white;
}

.feedback[data-tone="wrong"] {
  border-color: rgba(180, 35, 61, 0.26);
  background: var(--bad-soft);
  color: #8e1a30;
}

.feedback[data-tone="wrong"]::before {
  content: "!";
  background: var(--bad);
  color: white;
}

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

.case-button {
  text-align: start;
}

.two-part {
  margin-top: 12px;
  display: grid;
  gap: 11px;
}

.two-part fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.two-part legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
}

.two-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.angle-grid {
  grid-template-columns: repeat(3, 1fr);
  direction: ltr;
}

.angle-button {
  font-family: Georgia, serif;
  font-size: 15px;
}

.formula-card {
  margin-top: 12px;
  border: 1px solid rgba(49, 92, 148, 0.18);
  border-radius: 14px;
  background: var(--field-soft);
  padding: 10px 12px;
  color: #263e5b;
  text-align: center;
}

.formula-card .formula {
  font-size: 18px;
  font-weight: 700;
}

.formula-card small {
  margin-top: 4px;
  display: block;
  color: #536b87;
  font-size: 10px;
}

.givens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid rgba(49, 92, 148, 0.16);
  background: var(--field-soft);
  padding: 9px;
}

.givens span {
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px 7px;
  color: #2d4562;
  font-size: 10px;
  font-weight: 750;
}

.equation-chain {
  display: grid;
  gap: 8px;
}

.equation-step {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(74px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  padding: 8px;
}

.equation-step[data-state="locked"] {
  background: #f0f1f3;
  color: #6f747b;
}

.equation-step[data-state="done"] {
  border-color: rgba(19, 121, 91, 0.25);
  background: var(--ok-soft);
}

.equation-step label {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.equation-step input,
.number-field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1.5px solid #aeb6c8;
  border-radius: 10px;
  background: #fff;
  color: #1f2745;
  padding: 6px 9px;
  direction: ltr;
  text-align: left;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.equation-step input[disabled] {
  background: transparent;
  color: inherit;
}

.equation-step input[aria-invalid="true"],
.number-field input[aria-invalid="true"] {
  border-color: var(--bad);
  background: #fff7f8;
}

.equation-step .unit,
.number-field .unit {
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.number-fields {
  margin-top: 12px;
  display: grid;
  gap: 9px;
}

.number-field {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.number-field label {
  font-size: 10.5px;
  font-weight: 800;
}

.transfer-banner {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.transfer-banner b {
  font-size: 12px;
}

.transfer-banner span {
  color: var(--muted);
  font-size: 10px;
}

.skill-summary {
  border: 1px solid rgba(19, 121, 91, 0.22);
  background: linear-gradient(145deg, #f3fbf7, #e8f5ef);
  padding: 14px;
}

.skill-summary h3 {
  margin: 0;
  color: #0d6048;
  font-size: 16px;
}

.skill-summary ul {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.skill-summary li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  padding: 8px 10px;
  font-size: 11px;
}

.skill-summary li b {
  color: var(--ok);
}

.action-dock {
  flex: none;
  min-height: calc(76px + var(--safe-bottom));
  display: grid;
  grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  background: rgba(244, 246, 251, 0.96);
  padding: 10px 14px calc(10px + var(--safe-bottom));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.source-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: min(680px, calc(100dvh - 36px));
  border: 0;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 30px 90px -30px rgba(12, 17, 39, 0.85);
}

.source-dialog::backdrop {
  background: rgba(12, 17, 39, 0.62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.source-dialog form {
  position: relative;
  padding: 24px;
}

.source-dialog h2 {
  margin: 12px 0 0;
  color: #232751;
  font-size: 22px;
  line-height: 1.45;
}

.source-dialog p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}

.source-dialog__limit {
  border-radius: 13px;
  background: var(--physics-soft);
  padding: 10px;
  color: #45437f !important;
}

.source-dialog .secondary-button {
  width: 100%;
  margin-top: 18px;
}

.dialog-close {
  position: absolute;
  inset-inline-end: 14px;
  top: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #edf0f5;
  color: #414654;
  font-size: 23px;
  cursor: pointer;
}

.noscript {
  width: min(620px, calc(100% - 28px));
  margin: 32px auto;
  border: 1px solid rgba(180, 35, 61, 0.2);
  border-radius: 18px;
  background: var(--bad-soft);
  color: #8e1a30;
  padding: 18px;
  text-align: center;
}

/* Functional SVG classes. Coordinates are always physical LTR, never mirrored. */
.diagram-label {
  fill: #e8ecff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 750;
}

.diagram-muted {
  fill: #aeb7d7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
}

.diagram-value {
  fill: #fff;
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 700;
}

.scene-badge {
  fill: rgba(255, 255, 255, 0.10);
  stroke: rgba(255, 255, 255, 0.18);
}

.magnet-track {
  cursor: grab;
  touch-action: none;
}

.magnet-track:active {
  cursor: grabbing;
}

@media (min-width: 760px) {
  .intro {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.75fr);
    gap: 52px;
    padding-block: 44px 70px;
  }

  .lesson {
    width: min(1120px, calc(100% - 30px));
  }

  .lesson__header,
  .mission-progress,
  .action-dock {
    padding-inline: 20px;
  }

  .lesson__workspace {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.75fr);
    align-items: start;
    gap: 16px;
    padding: 14px 20px 20px;
  }

  .scene-panel {
    min-height: calc(min(52dvh, 430px) + 48px);
    position: sticky;
    top: 0;
  }

  .scene {
    min-height: min(52dvh, 430px);
  }

  .scene > svg {
    max-height: 430px;
  }

  .action-dock {
    grid-template-columns: 150px minmax(220px, 360px);
    justify-content: end;
  }

  .two-part {
    grid-template-columns: 1fr 1fr;
  }

  .number-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 374px) {
  .site-header__inner,
  .intro {
    width: min(100% - 20px, 1120px);
  }

  .brand > span:last-child {
    display: none;
  }

  .lesson__header,
  .mission-progress,
  .lesson__workspace,
  .action-dock {
    padding-inline: 10px;
  }

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

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

  .observation-ledger {
    grid-template-columns: 1fr;
  }

  .equation-step,
  .number-field {
    grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .site-header__inner {
    min-height: 52px;
  }

  .lesson {
    height: calc(100dvh - 52px);
    min-height: calc(100dvh - 52px);
  }

  .lesson__header {
    min-height: 58px;
  }

  .scene {
    min-height: 210px;
  }

  .action-dock {
    min-height: calc(66px + var(--safe-bottom));
    padding-block: 6px calc(6px + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  .choice[aria-pressed="true"],
  .control-button[data-active="true"],
  .case-button[aria-pressed="true"],
  .angle-button[aria-pressed="true"] {
    outline: 3px solid CanvasText;
  }
}
