
/* МатКлуб · общий цвет, навигация, обложка и учебная среда. */
:root {
  --mc-font: 'Golos Text', 'Segoe UI', sans-serif;
  --mc-mono: 'Cascadia Mono', Consolas, monospace;
  --mc-width: 1440px;
  --mc-gutter: clamp(20px, 5.2vw, 82px);
  --mc-ease: cubic-bezier(.2,.72,.24,1);
  --mc-cover: #090c0d;
  --mc-white: #f3f5ef;
  --mc-silver: #adb7b2;
  --mc-lime: #d7fa9a;
  --mc-hairline: #ffffff29;
  --mc-accent-ink: #142011;
}
:root[data-theme=light] {
  --paper: #f4f6f2;
  --ink: #181f1c;
  --line: #cdd6ce;
  --ui-surface: #fff;
  --ui-soft: #e8eee8;
  --ui-field: #fcfdfb;
  --ui-text: #47574e;
  --ui-faint: #526358;
  --sci-blue: #203d31;
  --sci-accent: #35654a;
  --sci-night: #172a22;
}
:root[data-theme=dark], :root:not([data-theme]) {
  --paper: #0c100f;
  --ink: #eff2ed;
  --line: #2a3430;
  --ui-surface: #141a18;
  --ui-soft: #1c2520;
  --ui-field: #101714;
  --ui-text: #b7c1ba;
  --ui-faint: #a4b0a8;
  --sci-blue: #e2eae3;
  --sci-accent: #cbeca2;
  --sci-night: #141c19;
}
:root[data-accent=forest] {
  --ui-accent: #365341;
  --ui-accent-hover: #40674d;
  --ui-accent-text: var(--sci-accent);
  --ui-accent-edge: #65846b;
}
:root[data-theme=dark][data-accent=forest] {
  --ui-accent: #304733;
  --ui-accent-hover: #3e5a3e;
  --ui-accent-soft: #223025;
  --ui-accent-edge: #5b745a;
  --ui-accent-text: #cbeca2;
  --desk-blue: #cbeca2;
}
[data-theme=dark][data-domain=physics] { --sci-accent: #a7dae8; }
[data-theme=light][data-domain=physics] { --sci-accent: #296479; }
[data-contrast=high] {
  --line: #6a7b71;
  --ui-text: var(--ink);
  --ui-faint: var(--ink);
}
html { scroll-padding-top: 85px; }
.workbench-shell { --night: #151a18; --mint: var(--mc-lime); --rule: var(--line); --gutter: var(--mc-gutter); --measure: var(--mc-width); --grotesk: var(--mc-font); }
html[data-theme] .workbench-shell .main { margin: 0 !important; }
.mc-wrap { width: 100%; max-width: var(--mc-width); margin-inline: auto; padding-inline: var(--mc-gutter); }

.workbench-shell .main > .mc-header {
  position: sticky; top: 0; z-index: 20; display: block; width: 100%; max-width: none;
  padding: 0; margin: 0; height: auto; min-height: 0; background: var(--paper); border: 0;
}
.mc-header-inner {
  position: relative; display: grid; align-items: center; grid-template-columns: 1fr auto 1fr; min-height: 74px; gap: 20px;
}
.mc-header-inner::after {
  content: ''; position: absolute; inset: auto var(--mc-gutter) 0; border-top: 1px solid var(--line); pointer-events: none;
}
[data-screen=home] .workbench-shell .main > .mc-header { background: var(--mc-cover); color: var(--mc-white); }
[data-screen=home] .mc-header-inner::after { border-color: var(--mc-hairline); }
.workbench-shell .mc-header .mc-brand {
  display: inline-flex; align-items: center; justify-self: start; gap: 10px; padding: 0; color: var(--ink);
  font: 500 21px/1 var(--mc-font); letter-spacing: -.055em; border: 0; text-decoration: none; white-space: nowrap;
}
[data-screen=home] .workbench-shell .mc-header .mc-brand { color: var(--mc-white); }
.mc-brand svg { width: 34px; height: 32px; color: var(--sci-accent); }
[data-screen=home] .mc-brand svg, .mc-brand-dot { color: var(--mc-lime); }
.mc-header-nav, .mc-header-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mc-header-nav { gap: clamp(14px, 2.4vw, 34px); }
.mc-header-actions { justify-self: end; }
.mc-header-nav button {
  position: relative; padding: 10px 0; min-height: 44px; border: 0; border-radius: 0; background: transparent;
  color: var(--ui-text); font-size: 14px; white-space: nowrap;
}
[data-screen=home] .mc-header-nav button { color: var(--mc-silver); }
.mc-header-nav button:hover, .mc-header-nav button[aria-pressed=true] { color: var(--ink); }
[data-screen=home] .mc-header-nav button:hover { color: var(--mc-white); }
.mc-header-nav button[aria-pressed=true]::after {
  content: ''; position: absolute; bottom: 1px; inset-inline: 0; height: 1px; background: var(--sci-accent);
}
.workbench-shell .main > .mc-header :is(.mc-icon,.account-button,.sidebar-toggle) {
  display: inline-flex; gap: 7px; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; width: auto; padding: 0 9px;
  background: transparent !important; border: 1px solid transparent !important; color: var(--ui-text);
  border-radius: 3px !important; margin: 0; box-shadow: none; font-size: 13px;
}
[data-screen=home] .workbench-shell .main > .mc-header :is(.mc-icon,.account-button) { color: var(--mc-silver); }
.workbench-shell .main > .mc-header :is(.mc-icon,.account-button,.sidebar-toggle):hover,
.workbench-shell .main > .mc-header .mc-icon[aria-expanded=true] { border-color: var(--line) !important; color: var(--ink); }
[data-screen=home] .workbench-shell .main > .mc-header :is(.mc-icon,.account-button):hover,
[data-screen=home] .workbench-shell .main > .mc-header .mc-icon[aria-expanded=true] { color: var(--mc-white); }
.mc-header-actions svg { display: block; width: 20px; height: 20px; }
.mc-header-actions .account-button > span:first-child { display: grid; place-items: center; }
.workbench-shell .main > .mc-header .crumb { display: none; }
[data-screen=home] .workbench-shell .mc-header #sidebarToggle { display: none; }
.workbench-shell .main > .mc-header #mcSearchPanel {
  display: none; position: absolute; z-index: 3; right: var(--mc-gutter); top: calc(100% + 9px);
  width: min(460px, calc(100% - 2 * var(--mc-gutter))) !important; height: 52px; margin: 0;
  background: var(--ui-surface) !important; box-shadow: 0 12px 30px #0005;
}
.workbench-shell .main > .mc-header[data-search-open] #mcSearchPanel { display: flex; }
.workbench-shell #mcSearchPanel #search {
  flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0 5px;
  color: var(--ink); font-size: 16px !important;
}

.workbench-shell #siteSidebar {
  position: relative; inset: auto; width: 100%; height: auto; min-height: 0; max-width: var(--mc-width); margin-inline: auto;
  padding: 8px var(--mc-gutter); display: flex; flex-direction: row; align-items: center; gap: 16px;
  background: var(--paper); border: 0; box-shadow: none; overflow: visible;
}
.workbench-shell #siteSidebar nav { display: flex; flex-direction: row; align-items: center; gap: 3px; flex: 1; margin: 0; }
.workbench-shell #siteSidebar .nav { min-height: 44px; padding: 8px 11px; justify-content: center; gap: 7px; color: var(--ui-text); border: 0; }
.workbench-shell #siteSidebar .nav:is(:hover,.active) { background: var(--ui-soft); color: var(--sci-accent); }
.workbench-shell #siteSidebar .nav .nav-label { display: inline !important; font: 400 13px var(--mc-font); }
.workbench-shell #siteSidebar .nav i, .workbench-shell #siteSidebar .lab-mobile-label { display: none; }
.workbench-shell #siteSidebar .nav svg { width: 17px; height: 17px; }
.workbench-shell #siteSidebar .releases-nav { order: 2; background: transparent; padding: 9px 5px; font-size: 13px; color: var(--ui-text); white-space: nowrap; border: 0; }
.workbench-shell #siteSidebar .top-credit { display: none; }
[data-screen=home] .workbench-shell #siteSidebar { display: none; }
[data-screen=home] .workbench-shell main { max-width: none; padding: 0 !important; }
[data-screen=home] .workbench-shell main > :is(.domain-switch,.hero,.study-ribbon,#catalog,.discovery) { display: none !important; }
[data-screen=home] .workbench-shell #aiLaunch { bottom: max(20px,env(safe-area-inset-bottom)) !important; }
.workbench-shell .mc-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
  margin: 70px auto 0; padding-block: 25px 35px; border-top: 1px solid var(--line); color: var(--ui-text);
}
[data-screen=home] .workbench-shell .mc-footer { max-width: var(--mc-width); padding-inline: var(--mc-gutter); }
.workbench-shell .mc-footer :is(a,button) { font: 400 13px/1.35 var(--mc-font); color: var(--ui-text); }
.workbench-shell .mc-footer :is(a,button):hover { color: var(--sci-accent); }
.workbench-shell .mc-footer .footer-support { display: inline-flex; max-width: 100%; gap: 6px; background: transparent !important; border: 0 !important; padding: 0; }
.workbench-shell .mc-footer .footer-support .support-label { font: inherit; line-height: inherit; text-align: start; }
.workbench-shell .mc-footer .header-help { min-width: 36px; width: 36px; min-height: 36px; padding: 0; }
.workbench-shell .mc-footer .footer-credit { margin-left: auto; }

.mc-hero {
  isolation: isolate; position: relative; overflow: hidden; background: var(--mc-cover); color: var(--mc-white);
}
.mc-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse at 74% 44%, #162925 0%, #0c1211 38%, transparent 67%);
}
.mc-hero-inner { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: clamp(660px, calc(100svh - 74px), 890px); }
.mc-hero-stage {
  position: absolute; z-index: -1; pointer-events: none; inset: 0 max(0px, calc((100% - 1550px)/2)) 0 38%;
}
.mc-grid {
  position: absolute; inset: 8% 4% 12% 9%; opacity: .46;
  background-image: linear-gradient(#98c5aa1e 1px, transparent 1px), linear-gradient(90deg, #98c5aa1e 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 60% 48%, #000 8%, transparent 70%);
}
.mc-orbits { position: absolute; width: 106%; height: 96%; inset: -2% -2% auto; stroke: #b7edc74e; stroke-width: .8; }
.mc-orbit-point { fill: #d7fa9a; stroke: none; opacity: .74; }
.mc-knot {
  display: block; position: absolute; top: 48%; left: 52%; width: min(110%, 980px); max-width: none; height: auto;
  transform: translate3d(calc(-50% + var(--shift-x, 0px)), calc(-50% + var(--shift-y, 0px)), 0);
  transition: transform 620ms var(--mc-ease); filter: drop-shadow(0 15px 34px #02241490);
}
.mc-model-label {
  position: absolute; bottom: 17%; right: clamp(22px,6.6vw,102px); display: grid; gap: 4px; padding-left: 30px;
  font: 12px/1.45 var(--mc-mono); color: #b8c5bd;
}
.mc-model-label::before { content: ''; position: absolute; top: 8px; left: 0; width: 20px; height: 1px; background: #d7fa9a8c; }
.mc-model-label b { color: #d7e2d9; font-weight: 400; }
.mc-hero-copy { align-self: center; padding: 52px 0 78px; position: relative; max-width: 690px; }
.mc-kicker {
  margin: 0 0 28px; display: flex; align-items: center; gap: 12px; color: #c7d5cb;
  font: 400 12px/1.4 var(--mc-mono); letter-spacing: .14em; text-transform: uppercase;
}
.mc-kicker::before { content: ''; width: 22px; height: 1px; background: var(--mc-lime); }
#matclubWelcome #welcomeTitle {
  font: 500 clamp(62px, 7.55vw, 115px)/.93 var(--mc-font); letter-spacing: -.085em;
  margin: 0; color: var(--mc-white); text-wrap: initial; position: relative;
}
#welcomeTitle em { color: var(--mc-lime); font-style: normal; }
.mc-lead { color: #c0c9c3; margin: 28px 0 0; max-width: 420px; font: 400 clamp(16px,1.35vw,19px)/1.62 var(--mc-font); }
.mc-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 30px; }
.mc-button {
  display: inline-flex; gap: 18px; align-items: center; justify-content: space-between;
  min-height: 51px; padding: 12px 16px; border: 1px solid transparent; border-radius: 3px; white-space: nowrap;
  font: 500 14px/1.2 var(--mc-font); text-decoration: none;
  transition: background-color 200ms var(--mc-ease), border-color 200ms var(--mc-ease), transform 200ms var(--mc-ease);
}
.mc-button span, .mc-link span { font-size: 17px; font-weight: 400; }
.mc-button-solid { background: var(--mc-lime); color: var(--mc-accent-ink); }
.mc-button-solid:hover { color: var(--mc-accent-ink); background: #e7ffbd; }
.mc-button-outline { background: #0e14137d; color: var(--mc-white); border-color: #b2c2b16b; }
.mc-button-outline:hover { background: #222b26; border-color: #b2c2b1; color: var(--mc-white); }
.mc-button:active { transform: translateY(2px); }
.mc-hero-links {
  position: relative; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(22px,5vw,76px); padding: 0 0 37px;
}
.mc-hero-links button {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px;
  padding: 16px 0 12px; border: 0; border-top: 1px solid #99ae9e61; border-radius: 0;
  background: transparent; color: var(--mc-white); text-align: left;
}
.mc-hero-links button:hover { border-color: var(--mc-lime); color: var(--mc-lime); }
.mc-hero-links span { font: italic 19px/1 Georgia,serif; color: #a6c58e; }
.mc-hero-links b { font-size: 15px; font-weight: 500; }
.mc-hero-links i, .mc-tools i { font-style: normal; color: #b0c2b4; }
@keyframes mc-copy-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes mc-image-in { from { opacity: .15; } to { opacity: 1; } }
[data-motion=on] .mc-hero-copy > * { animation: mc-copy-in 640ms var(--mc-ease) backwards; }
[data-motion=on] .mc-hero-copy h1 { animation-delay: 50ms; }
[data-motion=on] .mc-hero-copy .mc-lead { animation-delay: 95ms; }
[data-motion=on] .mc-hero-copy .mc-hero-actions { animation-delay: 145ms; }
[data-motion=on] .mc-hero-stage { animation: mc-image-in 880ms var(--mc-ease) backwards; }

.mc-disciplines { padding-top: clamp(55px,8vw,112px); }
.mc-section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 7px 30px; margin-bottom: 26px;
}
.mc-section-head h2 { margin: 0; font: 500 clamp(34px,4.35vw,66px)/1.05 var(--mc-font); letter-spacing: -.065em; }
.mc-section-head p { color: var(--ui-text); margin: 0; font-size: 16px; }
.mc-subjects { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.mc-subject { --scheme: #b6e492; --scene: #132019; background: var(--ui-surface); border: 1px solid var(--line); min-width: 0; }
.mc-subject.mc-physics { --scheme: #a3d8e9; --scene: #12222a; }
.mc-subject figure { margin: 0; overflow: hidden; display: grid; place-items: center; height: clamp(147px,17vw,248px); background: var(--scene); color: var(--scheme); }
.mc-subject figure svg { display: block; width: 100%; height: 100%; }
.mc-scheme-grid { opacity: .12; }
.mc-scheme-trace { stroke: var(--scheme); }
.mc-scheme-pin, .mc-scheme-text { fill: var(--scheme); }
.mc-scheme-text { font: 12px var(--mc-mono); }
.mc-scheme-lens { fill: #a3d8e926; }
.mc-subject-copy { padding: clamp(18px,2.4vw,36px); }
.mc-subject-heading { display: flex; flex-wrap: wrap; gap: 4px 15px; justify-content: space-between; align-items: baseline; }
.mc-subject-heading h3 { margin: 0; font-size: clamp(28px,3vw,44px); letter-spacing: -.055em; line-height: 1.15; }
.mc-subject-heading span { font: 13px var(--mc-mono); color: var(--ui-text); }
.mc-subject-copy p { margin: 14px 0 16px; color: var(--ui-text); font-size: 16px; max-width: 46ch; }
.mc-subject-links { display: flex; flex-wrap: wrap; column-gap: 13px; align-items: center; padding: 0 0 15px; }
.mc-subject-links :is(a,button) {
  display: inline-flex; align-items: center; justify-content: start; min-height: 44px; padding: 0;
  background: transparent; border: 0; border-radius: 0; color: var(--ui-text);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px;
  font: 400 14px/1.35 var(--mc-font);
}
.mc-subject-links :is(a,button):hover { color: var(--sci-accent); text-decoration-color: currentColor; }

@media (max-width: 767px) {
  .workbench-shell #subjectTabs:has([data-subject="probability"]:not([hidden])) {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 4px;
  }
  .workbench-shell #subjectTabs:has([data-subject="probability"]:not([hidden])) button {
    flex: 0 0 auto;
    max-width: 100%;
    min-height: 44px;
    padding-inline: 8px;
    white-space: normal;
  }
  .workbench-shell #subjectTabs [data-subject="probability"] {
    font-size: 11px;
    line-height: 1.2;
  }
  #subjectTabs [data-subject="probability"] > span {
    display: none;
  }
  .mc-subject-links [data-curriculum-subject="probability"] {
    max-width: 100%;
    font-size: 11px;
    white-space: normal;
  }
}
.mc-link {
  display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 0 1px;
  border: 0; border-radius: 0; border-top: 1px solid var(--line); color: var(--ink); background: transparent; font: 500 15px var(--mc-font);
}
.mc-link:hover { color: var(--sci-accent); }
.mc-tools {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: clamp(35px,5vw,70px);
}
.mc-tools button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 0; color: var(--ui-text);
  min-height: 52px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left;
}
.mc-tools button:hover { color: var(--sci-accent); border-color: var(--sci-accent); }

.workbench-shell .domain-switch { border-bottom: 1px solid var(--line); }
.workbench-shell .domain-switch > button { border-radius: 0; color: var(--ui-text); }
.workbench-shell .domain-switch > button.selected { color: var(--sci-accent); }
[data-screen=workspace] .workbench-shell .hero:not([hidden]) { --mint: var(--sci-accent); }
[data-screen=workspace] .workbench-shell .hero .phase-plate { border-color: #809d8a56; }
[data-catalog=tasks] .workbench-shell :is(.hero,.study-ribbon,.discovery,.challenge-banner,.syllabus-note) { display: none !important; }
.workbench-shell #catalog .section-head { margin: clamp(30px,5vw,72px) 0 20px; }
.workbench-shell #sectionTitle { font: 500 clamp(34px,5vw,74px)/1.01 var(--mc-font); letter-spacing: -.07em; text-wrap: balance; }
.mc-catalog-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; }
[data-page]:not([data-page=catalog]) .mc-catalog-tabs { display: none; }
.mc-catalog-tabs button {
  padding: 8px 17px; min-height: 43px; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ui-text); background: transparent; font: 500 14px var(--mc-font);
}
.mc-catalog-tabs button:hover, .mc-catalog-tabs button[aria-pressed=true] {
  color: var(--sci-accent); background: var(--ui-soft); border-color: var(--ui-accent-edge);
}
.workbench-shell .course-filters { border: 1px solid var(--line); border-radius: 3px; padding: 15px; }
.mc-topic-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mc-topic-filter label { color: var(--ui-text); font-size: 14px; }
.mc-topic-filter select {
  max-width: 100%; min-width: min(13ch, 100%); min-height: 42px; padding: 5px 10px; font-size: 16px;
  color: var(--ink); background: var(--ui-field); border-color: var(--line);
}
.workbench-shell .level-header { scroll-margin-top: 8px; display: flex; flex-wrap: wrap; gap: 10px 16px; }
.workbench-shell .level-header h3 { margin-right: auto; font-size: clamp(19px,2vw,26px); }
.workbench-shell .level-header :is(#mcResultsSearch,#random) { min-height: 44px; color: var(--sci-accent); font-size: 13px; }
.workbench-shell #topics .topic-index, .workbench-shell .task-num { display: none; }
.workbench-shell #topics .topic:nth-child(n) { grid-template-columns: 46px minmax(0,1fr) minmax(0,1.45fr) minmax(165px,auto); }
.workbench-shell #topics { border-top: 1px solid var(--line); }
.workbench-shell #topics .topic p { font-size: 14px; }
.workbench-shell #topics .topic-actions :is(a,button) { font-size: 13px; min-height: 44px; }
.workbench-shell #tasks { border-top: 1px solid var(--line); }
.workbench-shell #tasks .task-card {
  grid-template-columns: minmax(0,1fr) minmax(100px,auto) 44px minmax(88px,auto);
  gap: 11px; padding: 20px clamp(13px,2vw,26px); border-bottom: 1px solid var(--line);
}
.workbench-shell #tasks .task-card h3 { font: 500 clamp(17px,1.7vw,22px)/1.22 var(--mc-font); margin: 0 0 6px; }
.workbench-shell #tasks .task-card p { color: var(--ui-text); font-size: 15px; line-height: 1.5; }
.workbench-shell #tasks .task-caption { color: var(--ui-text); font-size: 13px; }
.workbench-shell #tasks .task-meta { color: var(--ui-text); font-size: 13px; }
.workbench-shell .task-card .solve { min-height: 44px; border-radius: 3px; border: 1px solid var(--line); }
.workbench-shell .task-card .solve:hover { border-color: var(--ui-accent-edge); }
.workbench-shell .task-card .bookmark { min-height: 44px; min-width: 44px; }
.workbench-shell .task-card .bookmark svg { display: inline-block; vertical-align: middle; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.workbench-shell .task-card .bookmark.saved svg { fill: currentColor; }
.workbench-shell #taskDialog .workspace-top { background: var(--sci-night); border-color: var(--line); }
.workbench-shell #taskDialog .workspace-top > div > :is(span,.eyebrow) { color: #dbe8df; }
.workbench-shell #taskDialog .modal-title { font: 500 clamp(28px,3.8vw,48px)/1.08 var(--mc-font); letter-spacing: -.053em; }
.workbench-shell #taskDialog .question, .workbench-shell #taskDialog .solution-step p {
  font-size: calc(1.075rem * var(--font-scale, 1));
  line-height: var(--reading-line, 1.76); overflow-wrap: anywhere;
}
.workbench-shell :is(#taskDialog,#lessonDialog) :is(sub,sup) { line-height: 0; }
.workbench-shell #taskDialog .solution-details { border-color: var(--line); }
.workbench-shell #taskDialog .work-tabs button[aria-selected=true] { color: var(--sci-accent); }
.workbench-shell dialog[open] { animation: mc-copy-in 220ms var(--mc-ease) backwards; }
.workbench-shell dialog::backdrop { background: #050807b8; }
.math-fraction { margin-inline: .20em; padding-block: .07em; font-variant-numeric: lining-nums tabular-nums; }
.math-fraction-top, .math-fraction-bottom { min-width: 1.15em; padding-inline: .19em; }
[data-reading=relaxed] { --reading-line: 1.95; }
[data-density=compact] .workbench-shell #tasks .task-card { padding-block: 10px; }

.search-page > :is(header,main,footer) { max-width: 1010px; }
.search-page > header { min-height: 67px; border-top: 0; border-bottom: 1px solid var(--line); }
.search-page .search-brand { font: 500 21px var(--mc-font); letter-spacing: -.065em; text-decoration: none; }
.search-page h1, .releases-page h1 {
  font: 500 clamp(33px,5vw,72px)/1.03 var(--mc-font); letter-spacing: -.062em; text-wrap: balance;
}
.search-page h2 { font: 500 clamp(22px,3vw,36px)/1.15 var(--mc-font); letter-spacing: -.043em; }
.search-page p, .search-page li { font-size: calc(1rem * var(--font-scale, 1)); line-height: var(--reading-line, 1.76); }
.search-page .lead { font-size: calc(1.2rem * var(--font-scale, 1)); color: var(--ui-text); }
.search-page section { border-top: 1px solid var(--line); padding-block: 8px; }
.search-page article { padding: 22px 0; }
.search-page details > summary { cursor: pointer; min-height: 44px; }
.search-page .primary { color: #fff; }
.search-page a:hover, .releases-page a:hover { color: var(--sci-accent); }
.search-page .primary:hover { color: #fff; background: var(--ui-accent-hover); }
.releases-page > .releases-header { color: var(--ink); border-bottom: 1px solid var(--line); }
.releases-page > .releases-content { background: var(--paper); color: var(--ink); }

@media (max-width: 1050px) {
  .workbench-shell .mc-header .account-button > span:last-child { display: none; }
  .mc-hero-stage { left: 35%; }
  .mc-hero-inner { min-height: max(650px, min(780px, calc(100svh - 74px))); }
  .workbench-shell #siteSidebar .nav { padding-inline: 8px; }
  .workbench-shell #siteSidebar .releases-nav { display: none; }
}
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px) {
  html { scroll-padding-top: 68px; }
  .workbench-shell .main > .mc-header .mc-header-inner { grid-template-columns: 1fr auto; gap: 4px; min-height: 61px; }
  .mc-header-nav, .workbench-shell .main > .mc-header #sidebarToggle { display: none; }
  .workbench-shell .main > .mc-header .mc-header-actions { gap: 0; }
  .workbench-shell .mc-header .mc-brand { font-size: 19px; gap: 7px; }
  .mc-brand svg { width: 28px; height: 28px; }
  .workbench-shell #siteSidebar { position: fixed; inset: auto 0 0; z-index: 19; padding: 0; display: block; border-top: 1px solid var(--line); }
  .workbench-shell #siteSidebar nav {
    position: static; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 0;
    background: var(--paper); padding: 4px 2px max(4px, env(safe-area-inset-bottom));
  }
  .workbench-shell #siteSidebar .nav { display: flex; flex-direction: column; min-width: 0; gap: 3px; padding: 3px 1px; }
  .workbench-shell #siteSidebar .nav :is(.nav-label,.lab-mobile-label) { font-size: clamp(8px,2.5vw,11px); }
  .workbench-shell #siteSidebar .nav .lab-desktop-label { display: none !important; }
  .workbench-shell #siteSidebar .nav .lab-mobile-label { display: block; }
  .workbench-shell #siteSidebar .nav b { display: none; }
  .workbench-shell .mc-footer .footer-credit { margin-left: 0; }
  .workbench-shell #topics .topic:nth-child(n) { grid-template-columns: minmax(29px, auto) minmax(0,1fr); }
  .workbench-shell #tasks .task-card { grid-template-columns: minmax(0,1fr) 44px auto; }
}
@media (max-width: 700px) {
  .mc-hero-inner { min-height: 0; }
  .mc-hero-copy { padding: 48px 0 0; }
  .mc-hero-stage { inset: 3% -25% 7% 13%; }
  .mc-grid { inset: 4% 24% 14% 0; background-size: 26px 26px; }
  .mc-knot { top: 51%; left: 52%; width: 105%; opacity: .57; }
  .mc-orbits { width: 108%; height: 90%; top: 1%; opacity: .64; }
  .mc-hero::before { z-index: 0; background: linear-gradient(90deg,#090c0dc9 0%,#090c0d76 49%,transparent 100%); }
  .mc-model-label { display: none; }
  #matclubWelcome #welcomeTitle { font-size: clamp(49px,11.3vw,76px); }
  .mc-kicker { margin-bottom: 20px; font-size: 11px; letter-spacing: .11em; }
  .mc-lead { margin-top: 22px; max-width: 31ch; font-size: 16px; color: #e0e7e1; }
  .mc-hero-actions { gap: 8px; margin-top: 21px; }
  .mc-button { padding: 10px 11px; min-height: 48px; gap: 10px; font-size: 13px; }
  .mc-hero-links { padding-bottom: 18px; margin-top: 50px; gap: 0; grid-template-columns: 1fr; }
  .mc-hero-links button { grid-template-columns: 30px 1fr auto; min-height: 44px; padding: 8px 0; }
  .mc-hero-links b { font-size: 14px; }
  .mc-hero-links span { font-size: 17px; }
  .mc-subjects, .mc-tools { grid-template-columns: minmax(0,1fr); }
  .mc-subject figure { height: clamp(140px,40vw,225px); }
  .mc-tools { gap: 0; }
  .workbench-shell .course-filters { padding: 11px; }
  .workbench-shell #tasks .task-card p { font-size: 14px; }
}
@media (max-width: 360px) {
  #matclubWelcome #welcomeTitle { font-size: clamp(40px,12.5vw,49px); }
  .mc-button { gap: 7px; padding-inline: 9px; font-size: 12px; }
  .mc-header-actions .mc-icon, .mc-header-actions .account-button { padding-inline: 6px; }
}
@media (min-width: 768px) and (min-height: 501px), (min-width: 1024px) {
  [data-sidebar=hidden] .workbench-shell #siteSidebar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mc-knot { transform: translate(-50%,-50%); }
}
[data-motion=off] :is(.mc-knot,.mc-button,.mc-header button,.mc-hero-links button) { transition: none; }
[data-motion=off] .mc-knot { transform: translate(-50%,-50%); }


/* Compact catalogue controls and the phone workspace. */
.mc-hero-links span { white-space: nowrap; }
[data-catalog=tasks] .workbench-shell #catalog .section-head { margin-top: clamp(20px,3vw,40px); }
.workbench-shell #catalog .level-header { border-top: 1px solid var(--line); }
.workbench-shell #catalog .level-header h3 {
  font: 500 clamp(20px,2.1vw,30px)/1.16 var(--mc-font); letter-spacing: -.042em;
}
.workbench-shell #catalog .level-tabs button { font-size: 13px; min-height: 44px; }
.workbench-shell #catalog .level-tabs button.selected {
  color: var(--sci-accent); border-color: var(--ui-accent-edge); background: var(--ui-soft);
}
.workbench-shell #catalog .task-card .solve { font-size: 13px; padding-inline: 12px; }
.workbench-shell #catalog .task-card .bookmark:hover { color: var(--sci-accent); }
.workbench-shell #taskDialog .workspace-top { border-bottom-width: 1px; }
[data-screen=home] .workbench-shell #aiLaunch:not(.ai-positioned):not([popover]) { right: 12px !important; }
@media (min-width: 701px) {
  [data-screen=home] .workbench-shell #aiLaunch:not(.ai-positioned):not([popover]) { bottom: 11px !important; }
}
@media (max-width: 767px) {
  .workbench-shell #catalog .course-filters { gap: 8px; }
  .workbench-shell #catalog .course-filters .grade-row button { min-height: 40px; }
  .workbench-shell #catalog #physicsFilter {
    width: 100%; padding: 8px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center;
  }
  .workbench-shell #catalog #physicsFilter label { grid-column: 1 / -1; color: var(--ui-text); font-size: 13px; }
  .workbench-shell #catalog #physicsSection { width: 100%; max-width: 100%; font-size: 16px; }
  .workbench-shell #catalog #physicsReference { font-size: 12px; text-align: left; }
  .workbench-shell #catalog #physicsFilter > span { display: none; }
  .workbench-shell .mc-topic-filter { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; }
  .workbench-shell #catalog .level-tabs { display: flex; gap: 6px; justify-content: flex-start; }
  .workbench-shell #catalog .level-tabs button { width: auto; flex: 0 1 auto; padding: 8px 11px; }
  .workbench-shell #catalog .level-header { padding-top: 10px; }
  .workbench-shell #catalog .level-header :is(#mcResultsSearch,#random) { font-size: 12px; }
  .workbench-shell #taskDialog .solution-step { padding-inline: 0; }
}

.workbench-shell #taskDialog #workspaceSave {
  display: inline-flex; gap: 7px; align-items: center; justify-content: center;
}
.workbench-shell #taskDialog #workspaceSave svg {
  display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5;
}
.workbench-shell #taskDialog #workspaceSave[aria-pressed=true] svg { fill: currentColor; }
.workbench-shell .study-ribbon > div > span { display: none; }
@media (max-width: 767px) {
  .workbench-shell #taskDialog #workspaceSave::before { content: none; }
  .workbench-shell #taskDialog #workspaceSave > span { display: none; }
}

@media (max-width: 360px) {
  .workbench-shell #catalog #physicsSection { grid-column: 1 / -1; }
  .workbench-shell #catalog #physicsReference { justify-self: start; min-height: 36px; }
}
.mc-mobile-releases { display: none; }
@media (max-width: 1050px) {
  .mc-header-actions .mc-mobile-releases {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding-inline: 5px;
    color: var(--ink);
    font-size: 13px;
    text-decoration: none;
  }
  [data-screen=home] .mc-header-actions .mc-mobile-releases { color: var(--mc-silver); }
  .mc-header-actions .mc-mobile-releases:is(:hover, :focus-visible) { color: var(--sci-accent); }
}
@media (min-width: 768px) and (max-width: 1050px) and (min-height: 501px) {
  .workbench-shell .mc-header-inner {
    grid-template-columns: minmax(max-content, 1fr) max-content minmax(max-content, 1fr);
    gap: clamp(8px, 1.4vw, 18px);
  }
  .workbench-shell #siteSidebar nav { min-width: 0; flex-wrap: wrap; }
  html[data-screen=workspace] .workbench-shell #siteSidebar .nav { gap: 5px; padding-inline: 8px; }
}
@media (max-width: 350px) {
  .workbench-shell .main > .mc-header .mc-header-inner { padding-inline: 10px; }
  .workbench-shell .mc-header .mc-brand { font-size: 16px; gap: 5px; }
  .mc-header .mc-brand svg { width: 22px; height: 22px; }
}
@media (max-width: 305px) {
  .workbench-shell .main > .mc-header .mc-header-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .mc-header-actions { justify-self: stretch; justify-content: space-between; }
}

.workbench-shell .hero .phase-controls { pointer-events: auto; }
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px), (pointer: coarse) {
  .workbench-shell .hero .optics-chart .phase-labels { font-size: 19px; }
  .workbench-shell .hero .phase-controls {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0 8px;
  }
  .workbench-shell .hero .phase-controls button { min-height: 44px; }
  .workbench-shell .hero .phase-controls output { grid-column: 3; grid-row: 1; }
  .workbench-shell .hero #wbAngle {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    margin: 0;
    height: 44px;
    padding-inline: 0;
    touch-action: pan-y;
  }
}

/* The task toolbar stays outside the scrolling content, including on touch devices. */
.workbench-shell #taskDialog[open] {
  display: flex;
  flex-direction: column;
}
.workbench-shell #taskDialog #modalBody {
  flex: 1 1 auto;
  height: auto;
}
.workbench-shell #taskDialog .workspace-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-inline: 20px;
}
.workbench-shell #workspaceContext { overflow-wrap: anywhere; }
.workbench-shell .workspace-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.workbench-shell #taskDialog .workspace-actions > .close {
  position: static;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 24px;
}
.workbench-shell #workspaceAssistantSlot:empty { display: none; }
.workbench-shell #aiLaunch[hidden] { display: none; }

@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px) and (orientation: landscape) {
  html:has(#taskDialog[open]) { overflow: hidden; }
  .workbench-shell #taskDialog[open] {
    inset: var(--workspace-viewport-top, 0px) 0 auto;
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: min(100dvh, var(--workspace-viewport-height, 100dvh));
    max-height: 100dvh;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0 !important;
    animation: none !important;
  }
  .workbench-shell #taskDialog .workspace-top {
    padding: calc(7px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
      7px max(12px, env(safe-area-inset-left));
  }
  .workbench-shell #taskDialog #workspaceContext {
    font-size: calc(12px * var(--font-scale, 1));
    line-height: 1.28;
  }
  .workbench-shell #taskDialog .workspace-grid {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 10px 20px;
  }
  .workbench-shell #taskDialog :is(.problem-pane,.work-pane,.work-panel) {
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .workbench-shell #taskDialog .problem-pane,
  .workbench-shell #taskDialog .work-panel {
    padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
  }
  .workbench-shell #taskDialog .work-pane {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .workbench-shell #taskDialog .workspace-actions :is(button,#aiLaunch) {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
  }
  .workbench-shell #taskDialog #workspaceSave > span { display: none; }
  .workbench-shell #taskDialog #workspaceSave::before { content: none; }
  .workbench-shell #workspaceAssistantSlot #aiLaunch {
    position: static !important;
    inset: auto !important;
    margin: 0;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 2px !important;
    box-shadow: none !important;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }
  .workbench-shell #workspaceAssistantSlot #aiLaunch .assistant-label { display: none; }
  .workbench-shell #taskDialog .modal-title {
    font-size: calc(clamp(19px, 5.2vw, 25px) * var(--font-scale, 1));
    margin-block: 6px 8px;
    line-height: 1.2;
    letter-spacing: -.025em;
  }
  .workbench-shell #taskDialog :is(.question,.lesson-intro,.guided-steps p) {
    font-size: calc(14px * var(--font-scale, 1));
    overflow-wrap: anywhere;
  }
  .workbench-shell #taskDialog :is(.problem-pane,.work-panel) { padding-block: 12px; }
  .workbench-shell #taskDialog .question { margin-block-end: 10px; }
  .workbench-shell #taskDialog .hint-section,
  .workbench-shell #taskDialog .solution-details { margin-block: 8px; }
  .workbench-shell #taskDialog .solution-details { padding-block: 4px; }
  .workbench-shell #taskDialog :is(.work-tabs button,.solution-controls button,.draft-tools button) {
    white-space: normal;
    overflow-wrap: anywhere;
    min-height: 44px;
  }
  .workbench-shell #taskDialog .answer-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .workbench-shell #taskDialog .answer-row:has(select) .primary { grid-column: 1 / -1; }
  .workbench-shell #taskDialog .answer-row .primary { white-space: normal; }
  .workbench-shell #taskDialog .desktop-shortcut { display: none; }
  .workbench-shell #catalog .level-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workbench-shell #catalog .level-tabs button {
    min-width: 0;
    max-width: 100%;
    font-size: calc(13px * var(--font-scale, 1));
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .workbench-shell #tasks .task-card h3 {
    font-size: calc(15px * var(--font-scale, 1));
    overflow-wrap: anywhere;
  }
  .workbench-shell #tasks .task-card p {
    font-size: calc(13px * var(--font-scale, 1));
    -webkit-line-clamp: 3;
  }
  .workbench-shell #lessonDialog .lesson-content :is(p,li),
  .workbench-shell .py-theory > p,
  .workbench-shell .lab-theory :is(p,li) {
    font-size: calc(14px * var(--font-scale, 1));
    overflow-wrap: anywhere;
  }
  .workbench-shell :is(#lessonDialog,#settingsDialog,#accountDialog,#aiAccessDialog) {
    padding-inline: clamp(14px, 4.5vw, 24px);
    overflow-wrap: anywhere;
  }
  .workbench-shell #lessonBody > h2,
  .workbench-shell #settingsDialog > h2 {
    padding-inline-end: 52px;
  }
  .workbench-shell #accountClose {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }
}
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px) and (orientation: landscape) {
  #matclubWelcome #welcomeTitle {
    font-size: clamp(32px, 9.4vw, 49px);
    line-height: 1.01;
  }
  .mc-hero-copy { padding-block: 26px 10px; }
  .mc-kicker { margin-bottom: 12px; }
  .mc-lead { margin-top: 14px; font-size: 14px; line-height: 1.5; }
  .mc-hero-actions { margin-top: 15px; }
  .mc-button { min-height: 44px; }
  .mc-hero-links { margin-top: 16px; padding-bottom: 12px; }
  .mc-section-head { gap: 8px; margin-block: 22px 12px; }
  .mc-section-head h2 { font-size: clamp(24px, 6vw, 34px); letter-spacing: -.035em; }
  .mc-section-head p, .mc-subject-copy p { font-size: 14px; line-height: 1.5; }
  .mc-subject figure { height: clamp(105px, 34vw, 155px); }
  .mc-subject-copy { padding: 14px; }
  .mc-subject-heading h3 { font-size: 23px; }

  .workbench-shell .hero { padding: 15px; gap: 12px; }
  html[data-domain] .workbench-shell .hero h1 {
    font-size: clamp(27px, 10.5cqw, 43px) !important;
    letter-spacing: -.045em !important;
    line-height: 1.05;
  }
  .workbench-shell .hero-copy > p { font-size: 14px; line-height: 1.5; }
  .workbench-shell #catalog .section-head { margin-block: 18px 12px; }
  .workbench-shell #sectionTitle {
    font-size: clamp(24px, 6.2vw, 34px);
    line-height: 1.12;
    letter-spacing: -.035em;
  }
  .workbench-shell #catalog .level-header h3 { font-size: 19px; }
  .workbench-shell #topics .topic { padding-block: 9px; }
  .workbench-shell #topics h3 { font-size: calc(15px * var(--font-scale, 1)); }
  .workbench-shell :is(.graph-heading,.lab-heading,.computing-intro) h1 {
    font-size: clamp(23px, 5.8vw, 34px);
    line-height: 1.13;
  }
  .workbench-shell :is(.graph-heading,.lab-heading,.computing-hero) { padding: 12px 14px; }
  .workbench-shell #plotArea { height: clamp(225px, 47svh, 320px); }
  .workbench-shell .py-code-editor { min-height: clamp(190px, 42svh, 260px); }
  .workbench-shell :is(.graph-heading,.lab-heading,.computing-intro) p {
    font-size: calc(14px * var(--font-scale, 1));
    line-height: 1.5;
  }
  .workbench-shell :is(.py-lesson-heading h3,.lab-work-head h2) {
    font-size: calc(20px * var(--font-scale, 1));
    line-height: 1.2;
  }
  .workbench-shell #settingsDialog h2,
  .workbench-shell #lessonBody > h2 {
    font-size: calc(22px * var(--font-scale, 1));
    line-height: 1.2;
  }
  body.search-page > main { padding-block: 16px 20px; }
  body.search-page > main h1 { font-size: clamp(25px, 6vw, 34px); }
  body.search-page > main h2 { font-size: clamp(20px, 5vw, 26px); }
  body.search-page > main :is(p,li) { font-size: calc(14px * var(--font-scale, 1)); line-height: 1.55; }
  body.search-page > main .lead { font-size: calc(15px * var(--font-scale, 1)); }
  body.releases-page .releases-windows {
    padding: 13px;
    gap: 12px;
  }
  body.releases-page .releases-windows h2 { font-size: 21px; }
  body.releases-page .releases-windows p { font-size: 14px; line-height: 1.5; }
}
@media (max-width: 420px) {
  .workbench-shell #taskDialog .workspace-top { gap: 2px 8px; }
  .workbench-shell #taskDialog .workspace-top > div:first-child { display: contents; }
  .workbench-shell #taskDialog .workspace-top .eyebrow {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    line-height: 1.35;
  }
  .workbench-shell #taskDialog #workspaceContext {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .workbench-shell #taskDialog .workspace-actions {
    grid-column: 2;
    grid-row: 1;
  }
}
