/* MATHGPTAI.NET canonical visual system.
   Structural component rules live in site.css; this file is the only brand
   layer and intentionally owns colour, radius, elevation and page rhythm. */

:root {
  --paper: #ffffff;
  --paper-2: #f7f9fc;
  --white: #ffffff;
  --ink: #111827;
  --muted: #657184;
  --line: #e3e8ef;
  --red: #176fac;
  --red-dark: #125f96;
  --blue: #176fac;
  --yellow: #eaf5ff;
  --green: #25a66f;
  --shadow: 0 18px 48px rgba(15, 23, 42, .08);
  --ai-blue: #176fac;
  --ai-blue-dark: #125f96;
  --ai-ink: #111827;
  --ai-muted: #657184;
  --ai-line: #e3e8ef;
  --ai-soft: #f7f9fc;
  --ai-surface: #ffffff;
  --ai-surface-blue: #f1f8fe;
  --ai-border-blue: #cfe7fa;
  --upgrade-blue: #176fac;
  --upgrade-blue-dark: #125f96;
  --ai-sidebar: 288px;
  --ai-sidebar-collapsed: 76px;
  --ai-radius-sm: 12px;
  --ai-radius: 18px;
  --ai-radius-lg: 26px;
}

html { scrollbar-color: #c1c7cf transparent; }
body { background: var(--white); color: var(--ink); }
main#main { background: var(--white); }
::selection { background: #cfeaff; color: #111827; }

h1, h2, h3 { color: var(--ink); letter-spacing: -.045em; }
h1 { font-size: clamp(2.65rem, 5vw, 5.1rem); }
h2 { font-size: clamp(1.9rem, 3.5vw, 3.5rem); }

/* Controls */
.button,
.mg-primary-action,
.mg-secondary-action,
.mg-outline-link,
.upgrade-submit,
.pay-button {
  min-height: 48px;
  padding-inline: 22px;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  background: #fff;
  color: #111827;
  box-shadow: none !important;
  font-weight: 750;
}
.button:hover,
.mg-secondary-action:hover,
.mg-outline-link:hover {
  border-color: #9cccf0 !important;
  background: #f1f8fe !important;
  color: #176fac !important;
  transform: translateY(-1px);
}
.button-red,
.button-upgrade,
.mg-primary-action,
.upgrade-submit,
.pay-button,
.assessment-actions .button {
  border-color: #176fac !important;
  background: #176fac !important;
  color: #fff !important;
}
.button-red:hover,
.button-upgrade:hover,
.mg-primary-action:hover,
.upgrade-submit:hover,
.pay-button:hover { background: #125f96 !important; color: #fff !important; }
.button-dark { border-color: #111827 !important; background: #111827 !important; color: #fff !important; }
.button-light { border-color: #fff !important; background: #fff !important; color: #176fac !important; }

/* Application shell */
.ai-sidebar {
  width: var(--ai-sidebar);
  padding: 18px 14px 16px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}
.ai-sidebar-head { height: 68px; padding: 0 8px 14px; }
.ai-sidebar-head img,
.mobile-brand img,
.footer-brand img { border-radius: 14px !important; }
.mobile-brand .brand-mark {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.ai-sidebar-head img { width: 52px; height: 52px; }
.ai-sidebar-head button {
  position: fixed;
  top: 30px;
  left: 273px;
  width: 30px;
  height: 30px;
  border: 1px solid #dce4ec;
  border-radius: 999px;
  background: #fff;
  color: #6f7c8d;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .1);
}
.ai-sidebar-head button:hover { border-color: #9cccf0; color: #125f96; background: #f4faff; }
.ai-sidebar-nav { gap: 6px; scrollbar-width: none; }
.ai-sidebar-nav::-webkit-scrollbar { display: none; }
.ai-sidebar-nav > a {
  min-height: 58px;
  padding: 8px 10px;
  grid-template-columns: 42px 1fr auto;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #111827;
  font-size: .94rem;
  font-weight: 730;
}
.ai-sidebar-nav > a:hover,
.ai-sidebar-nav > a[aria-current="page"] {
  border-color: #e4e9ef;
  background: #f3f4f6;
  color: #111827;
}
.ai-sidebar-nav > a > b { color: #9aa5b2; font-size: 1.05rem; }
.ai-sidebar-nav .ai-new-chat {
  margin: 8px 0 16px;
  min-height: 64px;
  border-color: #eceef1;
  background: #f3f4f6;
  color: #4b5563;
}
.ai-sidebar-nav .ai-new-chat:hover { border-color: #dce4ec; background: #eaf5ff; color: #125f96; }
.nav-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  color: #111827 !important;
  background: #eaf4fe !important;
}
.nav-icon svg { width: 25px; height: 25px; }
.ai-sidebar-nav > a:nth-of-type(2) .nav-icon { background: #e8f4ff !important; color: #2588cf !important; }
.ai-sidebar-nav > a:nth-of-type(3) .nav-icon { background: #fff0f0 !important; color: #ef4d56 !important; }
.ai-sidebar-nav > a:nth-of-type(4) .nav-icon { background: #eafaf2 !important; color: #12a65a !important; }
.ai-sidebar-nav > a:nth-of-type(5) .nav-icon { background: #eaf4ff !important; color: #2a84c9 !important; }
.ai-sidebar-nav > a:nth-of-type(6) .nav-icon { background: #fbecff !important; color: #c42bd8 !important; }
.ai-sidebar-nav > a:nth-of-type(7) .nav-icon { background: #fff3e7 !important; color: #ef630f !important; }
.ai-sidebar-nav > a:nth-of-type(8) .nav-icon { background: #eef2f7 !important; color: #465a70 !important; }
.ai-sidebar-nav > a:hover .nav-icon { transform: none; }
.ai-recent { border-top: 1px solid var(--line); color: #8a929e; }
.ai-recent strong { color: #6b7280; }
.ai-premium-card {
  margin: auto 0 12px;
  padding: 18px;
  gap: 13px;
  overflow: hidden;
  border: 1px solid #cfe7fa;
  border-radius: 22px;
  background: linear-gradient(150deg, #f4faff 0%, #eaf6ff 100%);
  color: #111827;
  box-shadow: 0 12px 34px rgba(41, 139, 209, .09);
}
.ai-premium-card::after { border-color: rgba(52, 148, 220, .08); }
.ai-premium-card-head i { border: 0; border-radius: 12px; background: #fff; color: #2588cf; box-shadow: 0 7px 20px rgba(30, 104, 157, .09); }
.ai-premium-card > span { color: #66758a; }
.ai-premium-card > a { min-height: 48px; border: 0; border-radius: 14px; background: #111827; box-shadow: none; }
.ai-premium-card > a:hover { background: #125f96; transform: none; }
.ai-premium-card > a em {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 0;
}
.ai-premium-card > a em svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ai-sidebar-foot { border-top: 1px solid var(--line); color: #8a929e; }

.site-header.ai-topbar {
  left: var(--ai-sidebar);
  height: 78px;
  min-height: 78px;
  padding: 0 28px;
  border-bottom: 0;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
}
.ai-topbar .header-actions { gap: 10px; }
.ai-topbar .search-trigger {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 13px;
  background: #fff;
  color: #334155;
}
.ai-topbar .search-trigger:hover { background: #f3f7fb; color: #125f96; }
.ai-topbar .reward-chip {
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid #dce5ee;
  border-radius: 13px;
  background: #fff;
  color: #176fac;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.ai-topbar .reward-chip:hover,
.ai-topbar .reward-chip:focus-visible {
  border-color: #9bc7e5;
  background: #f3f9fd;
  color: #125f96;
  outline: 0;
}
.ai-topbar .reward-streak { color: #176fac; font-size: .88rem; }
.ai-topbar .reward-streak.at-risk { color: #c74444; }
.reward-gift {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}
.reward-gift-icon { width: 28px; height: 28px; overflow: visible; }
.reward-gift-box { fill: #e9f5fc; stroke: currentColor; stroke-width: 1.7; }
.reward-gift-lid { fill: #d8eefb; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.reward-gift-ribbon { fill: none; stroke: #176fac; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reward-gift-spark { fill: #f0a128; stroke: #f0a128; stroke-width: .7; stroke-linejoin: round; }
.ai-topbar .header-actions > .button {
  min-height: 48px;
  padding: 0 24px;
  border: 0 !important;
  border-radius: 999px !important;
  background: #176fac;
  color: #fff;
}
.ai-topbar .header-actions > .button:hover { background: #125f96 !important; color: #fff !important; transform: none; }
.account-trigger { border-color: #e2e8f0; border-radius: 14px !important; background: #fff; }
.account-avatar { border-radius: 12px; background: #176fac; }
.account-menu-panel {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15,23,42,.14);
}

main#main, body > footer { margin-left: var(--ai-sidebar); }
main#main { min-height: 100vh; padding-top: 78px; }

/* Search */
.site-search-dialog {
  width: min(900px, calc(100% - 36px));
  overflow: hidden;
  border: 1px solid #dfe6ee;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(15, 23, 42, .2);
}
.site-search-dialog-head { border-bottom: 1px solid #e6ebf1; background: #fff; }
.site-search-mark { border: 0; border-radius: 13px; background: #eaf5ff; color: #125f96; }
.site-search-dialog-head > button { border: 0; border-radius: 12px; background: #f3f5f8; }
.site-search-dialog input,
.search-page-form input { border: 1px solid #dfe6ee; border-radius: 14px !important; background: #fff; box-shadow: none; }
.site-search-dialog input:focus,
.search-page-form input:focus { border-color: #79b9e7; box-shadow: 0 0 0 4px rgba(52, 148, 220, .12); }
.site-search-quick a { border-color: #e2e8f0; border-radius: 12px !important; background: #fff; color: #334155; }

/* Home */
.ai-home-hero {
  min-height: 720px;
  padding: 120px clamp(24px, 6vw, 90px) 90px;
  background: #fff !important;
  background-image: none !important;
}
.grid-paper { background: #fff !important; background-image: none !important; }
.ai-home-heading { gap: 0; }
.ai-home-title { align-items: center; }
.ai-home-title img { width: 78px; height: 78px; border-radius: 20px; box-shadow: none; }
.ai-home-title h1 { max-width: 980px; color: #111827; font-size: clamp(2.8rem, 5.2vw, 5.25rem); font-weight: 720; }
.ai-home-title p { color: #566275; }
.ai-prompt-box {
  max-width: 940px;
  margin-top: 38px;
  padding: 23px 25px;
  border: 1px solid #dfe5ec;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15,23,42,.09);
}
.ai-prompt-box:focus-within { border-color: #72b8e8; box-shadow: 0 18px 52px rgba(37,136,207,.14), 0 0 0 4px rgba(52,148,220,.08); }
.ai-prompt-box .ai-input-tool,
.ai-prompt-box button[type="submit"] { border: 0; border-radius: 999px; background: #111827; color: #fff; }
.ai-prompt-box button.ai-input-tool { padding: 0; }
.ai-prompt-box button.ai-input-tool:focus-visible { outline: 3px solid rgba(37, 139, 210, .28); outline-offset: 3px; }
.ai-prompt-box button.ai-input-tool:disabled { opacity: .55; cursor: wait; }
.ai-prompt-box button[type="submit"] { background: #176fac; }
.ai-home-intro,
.ai-answer-preview { border: 0; border-radius: 28px; }
.ai-home-intro { background: #f7f9fc; }
.ai-home-visual { max-width: 580px; margin-top: 34px; }
.ai-home-visual picture { display: block; }
.ai-home-visual img {
  display: block;
  width: 100%;
  height: clamp(250px, 28vw, 340px);
  aspect-ratio: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 20px;
}
.ai-home-visual figcaption { margin-top: 12px; color: #667085; font-size: .82rem; line-height: 1.55; }
.ai-feature-grid article,
.ai-pathway-grid article {
  border: 1px solid #e3e8ef;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(15,23,42,.05);
}
.ai-feature-grid article:nth-child(n) { box-shadow: 0 12px 35px rgba(15,23,42,.05); }
.ai-pathway-grid article:hover { border-color: #b9daf2; box-shadow: 0 16px 42px rgba(32,126,195,.1); transform: translateY(-2px); }
.ai-pathway-grid article > span { border: 0; border-radius: 12px; background: #eaf5ff; color: #125f96; }
.ai-answer-preview { background: #111827; box-shadow: 0 20px 50px rgba(15,23,42,.17); }
.ai-answer-preview h2 { color: #fff; }
.ai-answer-preview > div p { color: #e5eaf1; font-size: 1.08rem; line-height: 1.75; }
.ai-answer-preview li { background: #202b3a; border-radius: 14px; }
.ai-answer-preview li b { color: #8ed0fb !important; font-size: 1.02rem; }
.ai-answer-preview li span { color: #f2f5f9; font-size: 1rem; line-height: 1.6; }
.ai-example-label {
  display: block;
  margin-bottom: 14px;
  color: #72bff0;
  font: 750 .72rem/1.2 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.ai-example-problem { margin: 22px 0 8px; color: #fff !important; font-size: 1.28rem !important; }
.ai-example-links { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 25px; }
.ai-example-links a { color: #a9dcff; font-size: .85rem; font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.home-tool-guide,
.home-photo-demo,
.home-subjects,
.home-calculators,
.home-reliability,
.home-reading,
.home-faq { max-width: 1340px; margin-inline: auto; }
.home-tool-guide .section-intro p,
.home-photo-demo .section-intro p,
.home-subjects .section-intro p,
.home-reading .section-intro p { max-width: 780px; margin-top: 15px; color: #637083; line-height: 1.7; }
.home-tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-photo-demo {
  max-width: 1340px;
  margin-inline: auto;
  border: 1px solid #e1e7ee;
  border-radius: 28px;
  background: #f7f9fc;
}
.photo-demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.photo-demo-grid > article { padding: 24px; border: 1px solid #e1e7ee; border-radius: 20px; background: #fff; }
.photo-demo-grid h3 { margin: 0 0 16px; }
.photo-demo-grid p { margin-bottom: 0; color: #5d697a; line-height: 1.65; }
.photo-demo-paper {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  border: 1px solid #d6dbe2;
  border-radius: 14px;
  background: repeating-linear-gradient(0deg, #fff 0, #fff 29px, #eaf0f5 30px);
  box-shadow: 0 14px 30px rgba(15,23,42,.08);
  transform: rotate(-1.5deg);
}
.photo-demo-paper span { color: #172033; font: 700 clamp(1.25rem, 2.2vw, 1.8rem)/1.3 var(--mono); }
.photo-demo-transcript { display: grid; min-height: 150px; align-content: center; gap: 15px; padding: 24px; border-radius: 14px; background: #111827; }
.photo-demo-transcript code { color: #fff; font-size: clamp(1.15rem, 2vw, 1.55rem); }
.photo-demo-transcript span { color: #b9dfff; line-height: 1.5; }
.photo-demo-grid ul { display: grid; gap: 12px; margin: 0; padding-left: 22px; color: #344054; line-height: 1.55; }
.home-photo-demo > details { margin-top: 20px; border: 1px solid #dce3eb; border-radius: 16px; background: #fff; }
.home-photo-demo > details summary { padding: 18px 20px; font-weight: 800; }
.home-photo-demo > details p { padding: 0 20px 20px; color: #526176; line-height: 1.7; }
.home-tool-grid article,
.home-topic-grid article,
.home-reading-grid article {
  padding: 26px;
  border: 1px solid #e3e8ef;
  border-radius: 20px;
  background: #fff;
}
.home-tool-grid article > span,
.home-reading-grid article > span { color: #2588cf; font: 750 .72rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.home-tool-grid h3,
.home-topic-grid h3,
.home-reading-grid h3 { margin: 17px 0 10px; font-size: 1.25rem; }
.home-tool-grid p,
.home-topic-grid p,
.home-reading-grid p { margin: 0; color: #637083; font-size: .9rem; line-height: 1.65; }
.home-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-topic-grid article { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 22px; }
.home-topic-grid article > .home-topic-icon { display: grid; width: 72px; height: 72px; place-items: center; border: 1px solid #cfe4f4; border-radius: 18px; background: #eaf5ff; color: #176fac; }
.subject-card-icon { width: 46px; height: 46px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.subject-card-icon .subject-icon-accent { fill: currentColor; stroke: none; opacity: .13; }
.subject-card-icon .subject-icon-dot { fill: currentColor; stroke: none; }
.home-topic-grid article:nth-child(2) > .home-topic-icon { border-color: #dcd7f9; background: #f0edff; color: #6b56c8; }
.home-topic-grid article:nth-child(3) > .home-topic-icon { border-color: #cfeadf; background: #eaf8f1; color: #22855e; }
.home-topic-grid article:nth-child(4) > .home-topic-icon { border-color: #f2ddc7; background: #fff3e8; color: #bd651d; }
.home-topic-grid article:nth-child(5) > .home-topic-icon { border-color: #e3d4ee; background: #f7edfb; color: #8a4da5; }
.home-topic-grid article:nth-child(6) > .home-topic-icon { border-color: #c9e8e7; background: #e9f8f7; color: #187b78; }
.home-topic-grid article:nth-child(7) > .home-topic-icon { border-color: #d2def5; background: #ebf1fc; color: #3c66ad; }
.home-topic-grid article:nth-child(8) > .home-topic-icon { border-color: #f0d5d5; background: #fff0f0; color: #b64b4b; }
.home-topic-grid h3 { margin-top: 0; }
.home-reliability {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: clamp(36px, 6vw, 80px);
  align-items: start;
  width: min(1180px, calc(100% - 48px));
  margin-block: 40px 72px;
  padding: clamp(38px, 5vw, 62px);
  border-radius: 28px;
  background: #f2f7fb;
}
.home-reliability .ai-example-label { color: #176fac; }
.home-reliability h2 { margin: 0 0 18px; font-size: clamp(2rem, 3vw, 3.15rem); }
.home-reliability p { color: #566275; line-height: 1.75; }
.home-reliability ul { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.home-reliability li { padding: 20px 22px; border: 1px solid #dbe7f0; border-radius: 16px; background: #fff; color: #566275; line-height: 1.65; }
.home-reliability li strong { display: block; margin-bottom: 4px; color: #111827; }
.home-reading-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.solver-information .subject-method-grid {
  gap: 16px;
  border: 0;
}
.solver-information .subject-method-grid article {
  min-height: 210px;
  padding: 26px;
  border: 1px solid #e1e7ee;
  border-radius: 18px;
  background: #fff;
}
.solver-information .subject-method-grid h3 { margin: 34px 0 12px; }
.solver-information .subject-method-grid p { font-size: .86rem; line-height: 1.65; }

/* Shared public page language */
.page-hero,
.solver-hero,
.calculus-hero,
.ap-hero,
.ap-course-hero,
.ap-resource-hero,
.detail-hero,
.editorial-head,
.sitemap-hero,
.formula-entry-hero {
  border-bottom: 1px solid #eef1f5 !important;
  border-radius: 0 !important;
  background: #fff !important;
  background-image: none !important;
  box-shadow: none !important;
}
.page-hero,
.solver-hero { padding-block: clamp(74px, 9vw, 132px); }
.page-hero h1,
.solver-hero h1,
.calculus-hero h1,
.ap-hero h1,
.ap-course-hero h1,
.ap-resource-hero h1,
.detail-hero h1 {
  max-width: 1040px;
  color: #111827 !important;
  font-size: clamp(2.7rem, 5.4vw, 5.25rem) !important;
}
.page-hero p,
.solver-hero p,
.detail-hero p { color: #637083; }

/* Let page titles and their lead copy use the full content column. The grids,
   tables, and workspaces below these heroes are substantially wider; the old
   700-1040px caps made the heading area look clipped by comparison. Keep the
   readable line-length limits inside long-form article bodies instead. */
.page-hero h1,
.page-hero > p,
.solver-hero h1,
.solver-hero > p,
.calculus-hero h1,
.calculus-hero p,
.ap-hero h1,
.ap-hero > div > p,
.ap-course-hero h1,
.ap-course-hero p,
.ap-resource-hero h1,
.ap-resource-hero p,
.detail-hero h1,
.detail-hero p,
.editorial-head h1,
.editorial-head > p,
.sitemap-hero h1,
.sitemap-hero p,
.formula-entry-hero h1,
.formula-entry-hero > p,
.learn-hub-copy h1,
.learn-hub-copy > p,
.mg-hub-hero h1,
.mg-hub-hero > div:last-child > p:last-child,
.mg-subjects-hero h1,
.mg-subjects-hero > div:last-child > p:last-child,
.mg-course-hero h1,
.mg-course-hero-copy > p:last-of-type,
.mg-level-hero h1,
.mg-level-hero > div:last-child > p:last-of-type,
.purpose-tool-hero h1,
.purpose-tool-hero > p:last-child {
  width: 100%;
  max-width: none;
}
.detail-hero > div:first-child,
.calculus-hero > div:first-child,
.ap-hero > div,
.ap-course-hero > div:first-child,
.learn-hub-copy {
  width: 100%;
  max-width: none;
}
.page-card,
.related-grid .cl,
.topic-grid .cl,
.calculator-link-grid .cl,
.compact-course-grid .cl,
.course-rail .cl,
.ap-track > div > .cl,
.ap-reference-grid article,
.ap-resource-grid .cl,
.subject-method-grid article,
.practice-skill-grid article,
.utility-guide-grid article {
  border: 1px solid #e3e8ef !important;
  border-radius: 20px !important;
  background: #fff !important;
  box-shadow: none !important;
}
.page-card:hover,
.related-grid .cl:hover,
.topic-grid .cl:hover,
.calculator-link-grid .cl:hover,
.course-rail .cl:hover,
.ap-track > div > .cl:hover {
  border-color: #b9daf2 !important;
  background: #fff !important;
  box-shadow: 0 14px 34px rgba(37,136,207,.09) !important;
  transform: translateY(-2px) !important;
}
.page-icon,
.ap-badge,
.pathway-symbol,
.detail-symbol {
  border: 0 !important;
  border-radius: 16px !important;
  background: #eaf5ff !important;
  color: #2588cf !important;
  box-shadow: none !important;
}
.focused-workbench-head,
.final-cta {
  width: min(1180px, calc(100% - 48px));
  margin: 72px auto;
  padding: clamp(38px, 5vw, 64px);
  align-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, #2588cf, #45a5e5) !important;
  color: #fff !important;
  box-shadow: 0 20px 50px rgba(37, 136, 207, .18);
}
.final-cta > div { max-width: 760px; }
.final-cta h2 { margin: 0; color: #fff; font-size: clamp(2.2rem, 4vw, 4rem); line-height: 1.04; }
.final-cta p { max-width: 680px; margin: 18px 0 0; color: rgba(255,255,255,.9); font-size: 1.03rem; line-height: 1.65; }
.final-cta .button-light { flex: none; min-width: 170px; }
.final-cta .button-light:hover { border-color: #fff !important; background: #fff !important; color: #125f95 !important; }
.focused-workbench-head { border-color: #176fac !important; border-radius: 22px 22px 0 0 !important; }
.subject-calculator-modes button.active,
.assessment-mode-switch a[aria-current="page"],
.assessment-mode-switch button[aria-pressed="true"] { border-color: #176fac !important; background: #176fac !important; color: #fff !important; }
.sitemap-hero dl,
.sitemap-group { border: 1px solid #e3e8ef !important; border-radius: 20px !important; }
.sitemap-group > header,
.sitemap-help { background: #f7f9fc !important; }
.sitemap-link-grid .cl:hover { background: #f1f8fe !important; }
.calculator-recommendation-icon { border: 0; border-radius: 14px; background: #eaf5ff; color: #2588cf; }

/* Course, hub and subject families */
.mg-hub,
.mg-subjects-hub,
.mg-course-page,
.mg-level-page { width: min(100% - 48px, 1240px); }
.mg-hub-mark,
.mg-solver-logo,
.mg-subjects-mark,
.mg-course-mark,
.mg-level-mark,
.mg-card-icon,
.mg-level-card-mark,
.mg-related-mark,
.mg-unit-number {
  border: 0 !important;
  border-radius: 18px !important;
  background: #eaf5ff !important;
  color: #2588cf !important;
  box-shadow: none !important;
}
.mg-hub-mark .accent,
.mg-solver-logo .accent,
.mg-subjects-mark .accent { stroke: #176fac !important; }
.mg-library,
.mg-subjects-hub .pathway-strip-wide,
.mg-level-support,
.mg-tools-feature,
.mg-subjects-cta,
.mg-solver-gate,
.ap-exam-snapshot {
  border: 1px solid #e3e8ef !important;
  border-radius: 24px !important;
  background: #f7f9fc !important;
  box-shadow: none !important;
}
.mg-destination-card,
.mg-route-grid article,
.mg-level-grid article,
.mg-unit-map a,
.mg-unit-list article,
.mg-study-loop-grid article,
.mg-support-grid a,
.mg-subjects-hub .pathway-strip > .cl,
.mg-subjects-hub .course-rail .cl,
.mg-subjects-hub .compact-course-grid .cl {
  border: 1px solid #e3e8ef !important;
  border-radius: 20px !important;
  background: #fff !important;
  box-shadow: none !important;
}
.mg-destination-card:hover,
.mg-route-grid article:hover,
.mg-level-grid article:hover,
.mg-unit-map a:hover,
.mg-support-grid a:hover,
.mg-subjects-hub .pathway-strip > .cl:hover {
  border-color: #b9daf2 !important;
  box-shadow: none !important;
  transform: none !important;
}
.mg-card-link,
.mg-level-card-meta a,
.mg-back-link,
.mg-card-arrow,
.mg-loop li > span,
.mg-tools-feature-copy > span,
.mg-unit-map span,
.mg-unit-list article > span,
.ap-unit-list article > span { color: #2588cf !important; }
.mg-route-grid article > span,
.mg-study-loop-grid article > span,
.mg-subjects-hub .course-rail .cl > span,
.mg-subjects-hub .compact-course-grid .cl > span {
  border: 0 !important;
  border-radius: 12px !important;
  background: #eaf5ff !important;
  color: #2588cf !important;
}
.mg-subjects-cta { background: #f1f8fe !important; color: #111827 !important; }
.mg-subjects-cta h2 { color: #111827; }
.mg-subjects-cta > a { border: 0 !important; border-radius: 14px !important; background: #176fac !important; color: #fff !important; }
.mg-unit-actions a { border-radius: 13px !important; }
.mg-unit-actions a:first-child { border-color: #176fac !important; background: #176fac !important; color: #fff !important; }

/* Solver, practice and calculator workspaces */
.mg-solver-intro .solver-route-switch { border: 1px solid #e3e8ef; border-radius: 14px !important; background: #f7f9fc; }
.mg-solver-intro .solver-route-switch a { border-radius: 10px !important; }
.mg-solver-intro .solver-route-switch a[aria-current="page"] { border-radius: 10px !important; background: #176fac; color: #fff; }
.solver-panel,
.solver-access-gate,
.solution,
.subject-calculator,
.calculus-lab,
.practice-app,
.ap-quiz,
.workspace,
.study-form,
.flashcard-form,
.planner-shell {
  border: 1px solid #e0e6ed !important;
  border-radius: 24px !important;
  background: #fff !important;
  box-shadow: 0 18px 46px rgba(15,23,42,.08) !important;
}
.solver-tabs button { border-radius: 0 !important; }
.solver-tabs button.active,
.practice-config fieldset button.active { background: #176fac !important; color: #fff !important; }
.mg-solver-gate aside,
.practice-config,
.practice-tools,
.practice-tip { background: #f7f9fc !important; }
.mg-gate-icon { border: 0; border-radius: 15px; background: #eaf5ff; color: #2588cf; }
.mg-input-guide article { border: 1px solid #e3e8ef; border-radius: 18px; background: #fff; }
.practice-top { background: #111827; border-radius: 23px 23px 0 0; }
.answer-options button,
.free-answer input { border: 1px solid #e0e6ed; border-radius: 14px !important; background: #fff; }
.answer-options button:hover { border-color: #7bbbe7; background: #f4faff; }
.assessment-icon,
.ap-course-mark {
  border: 0 !important;
  border-radius: 16px !important;
  background: #eaf5ff !important;
  color: #2588cf !important;
  box-shadow: none !important;
}
.assessment-config fieldset button.active { border-color: #176fac !important; background: #176fac !important; color: #fff !important; }
.assessment-rules,
.assessment-hint,
.assessment-feedback { border: 1px solid #e3e8ef !important; border-radius: 16px !important; background: #f7f9fc !important; }
.ap-subnav { border-radius: 14px !important; }
.ap-subnav a:hover,
.ap-subnav a[aria-current="page"] { border-radius: 11px !important; background: #eaf5ff !important; color: #125f96 !important; }
.workspace { overflow: hidden; }
.save-graph-button,
.workspace-footer a { background: #176fac !important; }

/* Conversion and account surfaces */
.growth-cta {
  width: min(1040px, calc(100% - 48px));
  max-width: 1040px !important;
  min-height: 0;
  margin: 72px auto;
  padding: 38px 42px;
  grid-template-columns: minmax(0,1fr) minmax(280px,.72fr);
  gap: 44px;
  align-items: center;
  border: 1px solid #cfe7fa;
  border-radius: 26px;
  background: linear-gradient(145deg, #f7fbff, #edf7ff);
  box-shadow: 0 18px 46px rgba(37,136,207,.09) !important;
}
.growth-title { max-width: 620px; margin: 0 0 18px; color: #111827; font-size: clamp(1.7rem,2.8vw,2.5rem); line-height: 1.1; letter-spacing: -.04em; }
.growth-cta ul { grid-template-columns: 1fr; gap: 6px; color: #66758a; font-size: .92rem; }
.growth-cta li:before { color: #176fac; }
.growth-actions { align-items: stretch; justify-items: stretch; }
.growth-actions .button { width: 100%; }
.growth-actions small { color: #66758a; line-height: 1.55; }
.growth-actions small a { text-decoration: underline; text-underline-offset: 3px; }

.upgrade-page-card,
.upgrade-panel,
.upgrade-dialog,
.pay-dialog,
.billing-card,
.profile-card,
.metric-card { border-radius: 22px !important; }
.upgrade-dialog,
.pay-dialog { border: 1px solid #dfe6ee; background: #fff; box-shadow: 0 28px 90px rgba(15,23,42,.2); }
.upgrade-dialog .upgrade-panel,
.upgrade-page-card .upgrade-panel { padding: 0; }
.pricing-page-direct {
  width: 100%;
  min-height: 0;
  padding: 18px 24px 34px;
  background: #f6faff;
}
.pricing-page-direct .upgrade-page-card {
  width: min(980px, 100%);
  margin: 0 auto;
}
.pricing-page-direct .upgrade-head { padding-top: 30px; }
.pricing-page-direct .upgrade-head .upgrade-title {
  margin-top: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
}
.pricing-page-direct .plan-card-hero {
  width: min(980px, 100%);
  margin: 0 auto;
}
.pricing-page-direct .plan-card-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
}
.upgrade-head {
  margin: 0 !important;
  padding: 36px 74px 30px;
  border-radius: 21px 21px 0 0;
  background: linear-gradient(145deg, #176fac, #125f96) !important;
  color: #fff;
}
.upgrade-head .upgrade-title {
  max-width: 720px;
  margin-bottom: 10px;
  color: #fff !important;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.05;
}
.upgrade-head > p:not(.upgrade-title) {
  max-width: 660px;
  color: rgba(255,255,255,.9) !important;
  font-size: 1rem;
  line-height: 1.55;
}
.upgrade-dialog .upgrade-body,
.upgrade-page-card .upgrade-body { padding: 34px 42px 0; }
.upgrade-dialog .upgrade-fine,
.upgrade-page-card .upgrade-fine { margin: 22px 0 0; padding: 0 42px 30px; }
.upgrade-dialog > .upgrade-close {
  top: 16px;
  right: 16px;
  z-index: 8;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #b9d7eb;
  border-radius: 50%;
  background: #fff;
  color: #125f96;
  font-size: 1.55rem;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(15, 74, 113, .2);
  transition: background .18s, border-color .18s, transform .18s;
}
.upgrade-dialog > .upgrade-close:hover,
.upgrade-dialog > .upgrade-close:focus-visible {
  border-color: #176fac;
  background: #eaf6ff;
  color: #0f5d92;
  transform: translateY(-1px);
}
.upgrade-dialog .upgrade-reason { min-height: 78px; padding: 20px 82px 20px 28px; display: flex; align-items: center; line-height: 1.45; }
.upgrade-dialog .upgrade-reason[hidden] { display: none; }
.upgrade-dialog:has(.upgrade-reason:not([hidden])) .upgrade-head { border-radius: 0; }
.pay-side { background: linear-gradient(155deg, #176fac, #125f96) !important; color: #fff; }
.upgrade-plan { border: 1px solid #e0e6ed !important; border-radius: 16px !important; background: #fff !important; }
.upgrade-plan:has(input:checked) { border-color: #72b8e8 !important; background: #f1f8fe !important; box-shadow: 0 0 0 3px rgba(52,148,220,.1); }
.upgrade-referral-option {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 14px 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid #cfe2f0;
  border-radius: 16px;
  background: #f3f9fd;
}
.upgrade-referral-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #e3f2fc;
  color: #176fac;
}
.upgrade-referral-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.upgrade-referral-copy b { display: block; color: #152238; font-size: .98rem; }
.upgrade-referral-copy small { display: block; margin-top: 3px; color: #66758a; font-size: .79rem; line-height: 1.45; }
.upgrade-referral-option > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #9ac7e3;
  border-radius: 12px;
  background: #fff;
  color: #176fac;
  font-size: .86rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.upgrade-referral-option > a:hover,
.upgrade-referral-option > a:focus-visible {
  border-color: #176fac;
  background: #eaf6ff;
  color: #125f96;
  text-decoration: none;
  box-shadow: none;
  transform: none;
}

@media (max-width: 760px) {
  .pricing-page-direct { padding: 12px 10px 26px; }
  .pricing-page-direct .upgrade-page-card { border-radius: 18px !important; }
  .upgrade-head { padding: 58px 22px 26px; }
  .pricing-page-direct .upgrade-head { padding: 28px 22px 24px; }
  .upgrade-head .upgrade-title { font-size: 2rem; }
  .upgrade-dialog .upgrade-body,
  .upgrade-page-card .upgrade-body { padding: 24px 18px 0; }
  .upgrade-dialog .upgrade-fine,
  .upgrade-page-card .upgrade-fine { padding: 0 18px 24px; }
  .upgrade-referral-option { grid-template-columns: auto minmax(0,1fr); }
  .upgrade-referral-option > a { grid-column: 1 / -1; width: 100%; }
}

footer { border-top: 1px solid #e7ebf0; background: #f8fafc !important; }
.footer-top h3,
.footer-heading { color: #435066; font-family: var(--font); text-transform: none; letter-spacing: 0; }

@media (min-width: 981px) {
  body.sidebar-collapsed .ai-sidebar { width: var(--ai-sidebar-collapsed); padding-inline: 10px; }
  body.sidebar-collapsed .site-header.ai-topbar { left: var(--ai-sidebar-collapsed); }
  body.sidebar-collapsed main#main,
  body.sidebar-collapsed > footer { margin-left: var(--ai-sidebar-collapsed); }
  body.sidebar-collapsed .ai-sidebar-head button { left: 62px; }
  body.sidebar-collapsed .ai-sidebar-nav > a { border-color: transparent; }
  body.sidebar-collapsed .ai-sidebar-nav > a[aria-current="page"] { border-color: #e3e8ef; }
}

@media (max-width: 980px) {
  :root { --ai-sidebar: 0px; }
  .site-header.ai-topbar { left: 0; height: 68px; min-height: 68px; padding: 0 14px; border-bottom: 1px solid #edf0f3; }
  .ai-topbar .mobile-brand { display: flex; align-items: center; gap: 9px; color: #111827; font-weight: 800; }
  .ai-topbar .mobile-brand img { width: 40px; height: 40px; }
  .ai-topbar .menu-button { display: flex; order: -1; border: 0; border-radius: 12px !important; background: #f2f6fa; }
  .ai-sidebar { width: min(310px,88vw); height: 100dvh; transform: translateX(-102%); box-shadow: 14px 0 42px rgba(15,23,42,.16); }
  body.menu-open .ai-sidebar { transform: translateX(0); }
  .ai-sidebar-head { height: 58px; padding: 0 8px 10px; align-items: center; }
  .ai-sidebar-head > a { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; }
  .ai-sidebar-head img { width: 42px; height: 42px; border: 0; box-shadow: none; }
  .ai-sidebar-head button { position: static; width: 38px; height: 38px; box-shadow: none; }
  .ai-sidebar-overlay { display: block; background: rgba(15,23,42,.45); }
  main#main,
  body > footer { margin-left: 0; }
  main#main { padding-top: 68px; }
  .ai-home-hero { min-height: auto; padding: 76px 18px 70px; }
  .ai-home-heading { flex-direction: column; }
  .ai-home-intro,
  .ai-pathways,
  .ai-answer-preview { width: calc(100% - 28px); }
  .home-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-demo-grid { grid-template-columns: 1fr; }
  .home-reliability { grid-template-columns: 1fr; }
  .home-reading-grid { grid-template-columns: 1fr; }
  .growth-cta { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  h1 { font-size: 2.55rem; }
  h2 { font-size: 2rem; }
  .ai-topbar .mobile-brand span,
  .ai-topbar .header-actions .button-upgrade { display: none; }
  .ai-topbar .header-actions > .button { min-height: 42px; padding: 0 17px; }
  .ai-home-hero { width: 100%; max-width: 100vw; overflow: hidden; }
  .ai-home-title,
  .ai-home-heading { width: calc(100vw - 36px) !important; max-width: calc(100vw - 36px) !important; min-width: 0; }
  .ai-home-title { flex-direction: column; gap: 16px; text-align: center; }
  .ai-home-title img { width: 64px; height: 64px; }
  .ai-home-title h1 { width: calc(100vw - 36px) !important; max-width: calc(100vw - 36px) !important; min-width: 0; font-size: 2.55rem; white-space: normal !important; text-wrap: wrap !important; overflow-wrap: break-word; }
  .ai-home-title p { width: calc(100vw - 36px) !important; max-width: calc(100vw - 36px) !important; }
  .ai-prompt-box { width: calc(100vw - 36px) !important; max-width: calc(100vw - 36px) !important; min-width: 0; padding: 18px; border-radius: 22px; }
  .ai-prompt-box > div { min-width: 0; }
  .home-tool-grid,
  .home-topic-grid { grid-template-columns: 1fr; }
  .home-photo-demo { width: calc(100% - 28px); padding: 28px 20px; }
  .home-photo-demo .section-intro { align-items: flex-start; }
  .home-reliability { width: calc(100% - 28px); padding: 28px 22px; }
  .home-topic-grid article { padding: 21px; }
  .home-topic-grid article { grid-template-columns: 64px minmax(0, 1fr); gap: 18px; }
  .home-topic-grid article > .home-topic-icon { width: 64px; height: 64px; border-radius: 16px; }
  .subject-card-icon { width: 40px; height: 40px; }
  .ai-input-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-hero,
  .solver-hero { padding: 62px 18px; }
  .page-hero h1,
  .solver-hero h1,
  .calculus-hero h1,
  .ap-hero h1,
  .ap-course-hero h1,
  .ap-resource-hero h1,
  .detail-hero h1 { font-size: 2.65rem !important; }
  .mg-hub,
  .mg-subjects-hub,
  .mg-course-page,
  .mg-level-page { width: min(100% - 28px, 1240px); }
  .growth-cta { width: calc(100% - 28px); margin-block: 44px; padding: 28px 22px; border-radius: 22px; }
}

/* Interaction polish: cards keep their position and elevation on hover.  The
   border/background change is enough feedback without making the catalog
   jump or acquire a second visual style. */
.ai-pathway-grid article:hover,
.home-discovery-grid article:hover,
.page-card:hover,
.cl:hover,
.related-grid .cl:hover,
.topic-grid .cl:hover,
.calculator-link-grid .cl:hover,
.course-rail .cl:hover,
.compact-course-grid .cl:hover,
.ap-track > div > .cl:hover,
.mg-destination-card:hover,
.mg-route-grid article:hover,
.mg-level-grid article:hover,
.mg-unit-map a:hover,
.mg-support-grid a:hover,
.mg-subjects-hub .pathway-strip > .cl:hover,
.mg-subjects-hub .course-rail .cl:hover,
.mg-subjects-hub .compact-course-grid .cl:hover,
.learn-subject-card:hover,
.learn-tool-card:hover,
.learn-pathway-grid article:hover,
.ap-course-card:hover,
.search-result:hover,
.graph-example-strip button:hover {
  box-shadow: none !important;
  transform: none !important;
}

/* The legacy desktop navigation drew an underline with ::after.  Sidebar
   selection is already communicated by the contained grey active state. */
.ai-sidebar-nav > a,
.ai-sidebar-nav > a:hover,
.ai-sidebar-nav > a:active,
.ai-sidebar-nav > a:focus,
.ai-sidebar-nav > a[aria-current="page"] {
  text-decoration: none !important;
  text-decoration-line: none !important;
}
.ai-sidebar-nav > a::after {
  content: none !important;
  display: none !important;
}

/* MathGPT AI learning library ------------------------------------------------
   Scoped to /learn so calculator and editorial families keep their own UI. */
.learn-hub-page,
.learn-subject-page,
.learn-guide-page {
  --learn-border: #dbe6ee;
  --learn-blue: #176fac;
  --learn-blue-bright: #258bd2;
  --learn-navy: #111827;
  --learn-muted: #607087;
  --learn-soft: #f3f8fc;
  --learn-soft-blue: #eaf6fe;
  color: var(--learn-navy);
}
.learn-hub-page .section,
.learn-subject-page .section,
.learn-guide-page .section {
  width: min(100% - 48px, 1460px);
  max-width: 1460px;
  margin-inline: auto;
  padding: 52px 0;
}
.learn-section-heading {
  width: 100%;
  max-width: none;
  margin: 0 0 26px;
}
.learn-section-heading h2 {
  max-width: none;
  margin: 0 0 10px;
  color: var(--learn-navy);
  font-size: clamp(1.65rem, 2.2vw, 2.2rem);
  line-height: 1.12;
  letter-spacing: -.035em;
}
.learn-section-heading p {
  max-width: 980px;
  margin: 0;
  color: var(--learn-muted);
  font-size: clamp(1rem, 1.25vw, 1.18rem);
  line-height: 1.65;
}
.learn-library-hero,
.learn-subject-hero,
.learn-guide-hero {
  width: min(100% - 48px, 1460px);
  max-width: 1460px;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  margin: 22px auto 0;
  padding: 52px;
  border: 1px solid #cfe2ef;
  border-radius: 28px;
  background: linear-gradient(135deg, #f7fbfe 0%, #edf7fd 100%);
  box-shadow: 0 18px 50px rgba(31, 83, 119, .08);
}
.learn-library-hero h1,
.learn-subject-hero h1,
.learn-guide-hero h1 {
  max-width: 1080px;
  margin: 0 0 16px;
  color: var(--learn-navy);
  font-size: clamp(2.4rem, 4.3vw, 4.6rem);
  line-height: .99;
  letter-spacing: -.06em;
}
.learn-library-hero p,
.learn-subject-hero p,
.learn-guide-hero p {
  max-width: 1050px;
  margin: 0;
  color: var(--learn-muted);
  font-size: clamp(1.06rem, 1.45vw, 1.32rem);
  line-height: 1.58;
}
.learn-hero-icon,
.learn-subject-hero .detail-symbol,
.learn-guide-icon {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid #c7e0f0;
  border-radius: 26px;
  background: #fff;
  color: var(--learn-blue);
  box-shadow: 0 12px 30px rgba(31, 83, 119, .09);
}
.learn-hero-icon .math-topic-icon,
.learn-subject-hero .detail-symbol .math-topic-icon,
.learn-guide-icon .math-topic-icon { width: 66px; height: 66px; }
.learn-hero-actions,
.learn-subject-hero .detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}
.learn-hero-actions .button,
.learn-subject-hero .button { min-height: 52px; border-radius: 14px; }
.learn-overview-grid,
.learn-loop-grid,
.learn-pathway-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.learn-overview-grid article,
.learn-loop-grid article,
.learn-pathway-grid article,
.learn-evidence-grid article {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--learn-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 61, 84, .055);
}
.learn-overview-grid article > span,
.learn-loop-grid article > span,
.learn-pathway-grid article > span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 17px;
  background: var(--learn-soft-blue);
  color: var(--learn-blue);
}
.learn-overview-grid .math-topic-icon,
.learn-loop-grid .math-topic-icon,
.learn-pathway-grid .math-topic-icon { width: 42px; height: 42px; }
.learn-overview-grid h3,
.learn-loop-grid h3,
.learn-pathway-grid h3,
.learn-evidence-grid h3 {
  margin: 0 0 8px;
  color: var(--learn-navy);
  font-size: 1.25rem;
  line-height: 1.22;
}
.learn-overview-grid p,
.learn-loop-grid p,
.learn-pathway-grid p,
.learn-evidence-grid p {
  margin: 0;
  color: var(--learn-muted);
  font-size: 1rem;
  line-height: 1.6;
}
.learn-route-links {
  max-width: 1180px;
  margin: 26px 0 0;
  color: var(--learn-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.learn-route-links a,
.learn-start-answer a,
.learn-text-link { color: var(--learn-blue); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.learn-question-heading h2 { margin: 32px 0 12px; font-size: 1.45rem; }
.learn-start-answer {
  max-width: 920px;
  margin-top: 20px;
  padding: 0;
  border: 1px solid var(--learn-border);
  border-radius: 15px;
  background: #fff;
}
.learn-start-answer summary { padding: 18px 20px; color: var(--learn-navy); font-weight: 750; cursor: pointer; }
.learn-start-answer p { margin: 0; padding: 0 20px 20px; color: var(--learn-muted); line-height: 1.65; }
.learn-loop,
.learn-model {
  margin-block: 12px;
  padding: 42px !important;
  border: 1px solid #cfe3f1;
  border-radius: 26px;
  background: var(--learn-soft);
}
.learn-loop-grid article { box-shadow: none; }
.learn-subjects .filter-row {
  gap: 14px;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  background: transparent;
}
.learn-subjects .filter-row span { color: var(--learn-muted); font-weight: 700; }
.learn-subjects .filter-row input {
  min-height: 48px;
  border: 1px solid var(--learn-border);
  border-radius: 13px;
  background: #fff;
}
.learn-subject-grid,
.learn-tool-grid,
.learn-lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.learn-subject-card,
.learn-tool-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 28px;
  border: 1px solid var(--learn-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 61, 84, .055);
}
.learn-card-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  background: var(--learn-soft-blue);
  color: var(--learn-blue);
}
.learn-card-icon .math-topic-icon { width: 50px; height: 50px; }
.learn-subject-card h3,
.learn-tool-card h3,
.learn-lesson-grid h3 { margin: 1px 0 8px; font-size: 1.28rem; line-height: 1.2; }
.learn-subject-card h3 a,
.learn-tool-card h3 a,
.learn-lesson-grid h3 a,
.learn-pathway-grid h3 a { color: var(--learn-navy); text-decoration: none; }
.learn-subject-card h3 a:hover,
.learn-tool-card h3 a:hover,
.learn-lesson-grid h3 a:hover,
.learn-pathway-grid h3 a:hover { color: var(--learn-blue); }
.learn-subject-card p,
.learn-tool-card p,
.learn-lesson-grid p {
  margin: 0 0 16px;
  color: var(--learn-muted);
  font-size: .98rem;
  line-height: 1.58;
}
.learn-text-link { display: inline-block; font-weight: 750; }
.learn-evidence { border-top: 1px solid #edf1f5; }
.learn-evidence-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.learn-evidence-grid article { box-shadow: none; }
.learn-pathways { padding-top: 20px !important; }
.learn-pathway-grid article { min-height: 230px; }
.learn-final-cta {
  width: min(100% - 48px, 1460px);
  max-width: 1460px;
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  margin: 20px auto 52px;
  padding: 38px 42px;
  border-radius: 24px;
  background: var(--learn-navy);
  color: #fff;
}
.learn-final-cta h2 { max-width: none; margin: 0 0 7px; color: #fff; font-size: clamp(1.55rem, 2vw, 2rem); }
.learn-final-cta p { margin: 0; color: #cbd5e1; line-height: 1.5; }
.learn-final-cta .button { flex: 0 0 auto; border-radius: 14px; }

/* Subject hubs */
.learn-subject-hero { grid-template-columns: minmax(0, 1fr) 104px; }
.learn-subject-hero .detail-symbol { grid-column: 2; grid-row: 1; }
.learn-subject-hero > div:first-child { grid-column: 1; grid-row: 1; }
.learn-subject-page .subject-guide {
  max-width: 1180px;
  padding: 46px 52px;
  border: 1px solid var(--learn-border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(31, 61, 84, .05);
}
.learn-subject-page .subject-guide > h2 { max-width: none; margin-top: 46px; font-size: 1.75rem; }
.learn-subject-page .subject-guide > h2:first-of-type { margin-top: 34px; }
.learn-subject-page .subject-guide p,
.learn-subject-page .subject-guide li,
.learn-subject-page .subject-guide dd { color: var(--learn-muted); line-height: 1.72; }
.learn-subject-page .subject-guide .tldr {
  padding: 26px 30px;
  border: 1px solid #cfe3f1;
  border-radius: 18px;
  background: var(--learn-soft);
}
.learn-subject-page .subject-method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border: 0;
}
.learn-subject-page .subject-method-grid article {
  padding: 24px;
  border: 1px solid var(--learn-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: none;
}
.learn-lesson-grid article {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--learn-border);
  border-radius: 18px;
  background: #fff;
}
.learn-subject-page > .related.section {
  border: 0;
  background: var(--learn-soft);
  border-radius: 24px;
  padding: 38px !important;
  margin-bottom: 52px;
}
.learn-subject-page > .related .related-grid { border: 0; gap: 14px; }
.learn-subject-page > .related .cl {
  border: 1px solid var(--learn-border);
  border-radius: 16px;
  background: #fff;
}

/* Individual lessons */
.learn-guide-page .editorial { max-width: none; margin: 0; }
.learn-guide-hero { grid-template-columns: 104px minmax(0, 1fr); }
.learn-guide-hero .byline { margin-top: 22px; }
.learn-guide-hero .byline span { display: grid; gap: 3px; }
.learn-guide-hero .byline b { color: var(--learn-navy); }
.learn-guide-hero .byline small { color: var(--learn-muted); }
.learn-guide-page .editorial-body {
  width: min(100% - 48px, 1080px);
  max-width: 1080px;
  margin: 34px auto 46px;
  padding: 0;
}
.learn-guide-page .guide-deep-section,
.learn-guide-page .tldr {
  margin: 0 0 20px;
  padding: 34px 38px;
  border: 1px solid var(--learn-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 61, 84, .045);
}
.learn-guide-page .guide-deep-section h2,
.learn-guide-page .tldr h2 { max-width: none; margin: 0 0 14px; font-size: 1.62rem; }
.learn-guide-page .guide-deep-section h3 { margin-top: 28px; font-size: 1.18rem; }
.learn-guide-page .guide-deep-section p,
.learn-guide-page .guide-deep-section li,
.learn-guide-page .guide-deep-section dd,
.learn-guide-page .tldr li { color: var(--learn-muted); line-height: 1.72; }
.learn-guide-page .guide-transfer,
.learn-guide-page .callout {
  margin-top: 26px;
  padding: 24px;
  border: 1px solid #cfe3f1;
  border-radius: 16px;
  background: var(--learn-soft);
}
.learn-guide-page .lesson-table { border-color: var(--learn-border); }
.learn-guide-page .lesson-table th,
.learn-guide-page .lesson-table td { border-color: var(--learn-border); }
.learn-subject-page .table-scroll,
.learn-guide-page .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.learn-subject-page .lesson-table,
.learn-guide-page .lesson-table { min-width: 720px; }
.learn-subject-page .subject-guide dl,
.learn-guide-page .guide-deep-section dl {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 10px 22px;
}
.learn-subject-page .subject-guide dt,
.learn-subject-page .subject-guide dd,
.learn-guide-page .guide-deep-section dt,
.learn-guide-page .guide-deep-section dd { margin: 0; }

@media (max-width: 1050px) {
  .learn-evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .learn-subject-grid,
  .learn-tool-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .learn-hub-page .section,
  .learn-subject-page .section,
  .learn-guide-page .section,
  .learn-library-hero,
  .learn-subject-hero,
  .learn-guide-hero,
  .learn-final-cta { width: calc(100% - 28px); }
  .learn-library-hero,
  .learn-subject-hero,
  .learn-guide-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    margin-top: 14px;
    padding: 28px 24px;
    border-radius: 22px;
  }
  .learn-library-hero h1,
  .learn-subject-hero h1,
  .learn-guide-hero h1 { font-size: clamp(2.1rem, 10vw, 3.2rem); }
  .learn-hero-icon,
  .learn-subject-hero .detail-symbol,
  .learn-guide-icon { width: 78px; height: 78px; border-radius: 20px; }
  .learn-hero-icon .math-topic-icon,
  .learn-subject-hero .detail-symbol .math-topic-icon,
  .learn-guide-icon .math-topic-icon { width: 50px; height: 50px; }
  .learn-subject-hero .detail-symbol,
  .learn-subject-hero > div:first-child { grid-column: 1; }
  .learn-subject-hero .detail-symbol { grid-row: 1; }
  .learn-subject-hero > div:first-child { grid-row: 2; }
  .learn-overview-grid,
  .learn-loop-grid,
  .learn-pathway-grid,
  .learn-evidence-grid,
  .learn-lesson-grid,
  .learn-subject-page .subject-method-grid { grid-template-columns: minmax(0, 1fr); }
  .learn-loop,
  .learn-model { padding: 28px 20px !important; border-radius: 20px; }
  .learn-subject-card,
  .learn-tool-card { grid-template-columns: 62px minmax(0, 1fr); gap: 16px; padding: 20px; }
  .learn-card-icon { width: 62px; height: 62px; border-radius: 16px; }
  .learn-card-icon .math-topic-icon { width: 40px; height: 40px; }
  .learn-subject-page .subject-guide { padding: 28px 22px; }
  .learn-subject-page .subject-guide dl,
  .learn-guide-page .guide-deep-section dl { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .learn-subject-page .subject-guide dd,
  .learn-guide-page .guide-deep-section dd { margin-bottom: 10px; }
  .learn-guide-page .editorial-body { width: calc(100% - 28px); margin-top: 22px; }
  .learn-guide-page .guide-deep-section,
  .learn-guide-page .tldr { padding: 26px 22px; border-radius: 17px; }
  .learn-final-cta { align-items: flex-start; flex-direction: column; padding: 30px 24px; }
  .learn-final-cta .button { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Fluid hero system -------------------------------------------------------
   Hero sections should use the same horizontal measure as the wide content
   below them. Earlier rules removed max-width from headings but left their
   parent grid tracks capped at 720-900px, so the text still wrapped inside a
   narrow column while the right side of the section remained empty. */
:where(
  .page-hero,
  .solver-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .detail-hero,
  .calculus-hero,
  .sitemap-hero
) {
  --hero-inline: clamp(28px, 5vw, 80px);
  padding-inline: var(--hero-inline);
}

:where(
  .page-hero,
  .solver-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .ap-resource-hero
) > :where(h1, p),
.detail-hero > div:first-child,
.calculus-hero > div:first-child,
.ap-course-hero > div:first-child,
.mg-hub-hero > div:last-child,
.mg-subjects-hero > div:last-child,
.mg-course-hero-copy,
.mg-level-hero > div:last-child {
  width: 100%;
  min-width: 0;
  max-width: none;
}

:where(
  .page-hero,
  .solver-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .ap-resource-hero,
  .detail-hero,
  .calculus-hero,
  .ap-course-hero,
  .mg-hub-hero,
  .mg-subjects-hero,
  .mg-course-hero,
  .mg-level-hero,
  .sitemap-hero
) h1 {
  max-width: none;
  text-wrap: wrap;
}

:where(
  .page-hero,
  .solver-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .ap-resource-hero,
  .detail-hero,
  .calculus-hero,
  .ap-course-hero,
  .mg-hub-hero,
  .mg-subjects-hero,
  .mg-course-hero,
  .mg-level-hero,
  .sitemap-hero
) p {
  max-width: none;
  text-wrap: pretty;
}

.mg-hub,
.mg-subjects-hub,
.mg-course-page,
.mg-level-page {
  width: min(calc(100% - 48px), 1440px);
}
.ai-home-title,
.ai-home-heading { width: 100%; max-width: none; }
.ai-home-heading { padding-inline: clamp(0px, 2vw, 28px); }
.ai-home-title h1 { flex: 1 1 auto; width: auto; max-width: none; text-wrap: wrap; }
.ai-home-title > p { width: 100%; max-width: none; text-wrap: pretty; }
.mg-hub-hero,
.mg-subjects-hero { grid-template-columns: 86px minmax(0, 1fr); }
.mg-course-hero,
.mg-level-hero { grid-template-columns: 104px minmax(0, 1fr); }
.mg-hub-hero h1,
.mg-subjects-hero h1,
.mg-course-hero h1,
.mg-level-hero h1,
.mg-hub-hero > div:last-child > p:last-child,
.mg-subjects-hero > div:last-child > p:last-child,
.mg-course-hero-copy > p:last-of-type,
.mg-level-hero > div:last-child > p:last-of-type {
  width: 100%;
  max-width: none;
}

.detail-hero { grid-template-columns: minmax(0, 1fr) auto; }
.detail-hero > div:first-child { max-width: none; }
.calculus-hero > div:first-child { flex: 1 1 auto; max-width: none; }
.ap-course-hero {
  width: min(calc(100% - 48px), 1440px);
  grid-template-columns: minmax(0, 1fr) auto;
}
.ap-resource-hero { width: min(calc(100% - 48px), 1440px); }
.ap-resource-hero h1,
.ap-resource-hero p,
.purpose-tool-hero h1,
.purpose-tool-hero > p:last-child,
.formula-entry-hero h1,
.formula-entry-hero > p,
.sitemap-hero h1,
.sitemap-hero p { width: 100%; max-width: none; }

@media (max-width: 1100px) {
  :where(
    .page-hero,
    .solver-hero,
    .editorial-head,
    .formula-entry-hero,
    .purpose-tool-hero,
    .detail-hero,
    .calculus-hero,
    .sitemap-hero
  ) { --hero-inline: clamp(24px, 4vw, 44px); }

  .mg-hub,
  .mg-subjects-hub,
  .mg-course-page,
  .mg-level-page,
  .ap-course-hero,
  .ap-resource-hero { width: calc(100% - 36px); }

  .mg-hub-hero,
  .mg-subjects-hero { grid-template-columns: 72px minmax(0, 1fr); gap: 22px; }
  .mg-course-hero,
  .mg-level-hero { grid-template-columns: 82px minmax(0, 1fr); gap: 22px; }
  .mg-hub-mark,
  .mg-subjects-mark { width: 72px; height: 72px; border-radius: 20px; }
  .mg-course-mark,
  .mg-level-mark { width: 82px; height: 82px; border-radius: 22px; }
}

@media (max-width: 800px) {
  .mg-hub-hero,
  .mg-subjects-hero,
  .mg-course-hero,
  .mg-level-hero,
  .detail-hero,
  .ap-course-hero,
  .sitemap-hero { grid-template-columns: 1fr; }

  .calculus-hero { align-items: flex-start; flex-direction: column; }
  .calculus-hero-actions { flex-flow: row wrap; }
  .detail-symbol,
  .ap-course-mark { display: none; }
}

@media (max-width: 680px) {
  :where(
    .page-hero,
    .solver-hero,
    .editorial-head,
    .formula-entry-hero,
    .purpose-tool-hero,
    .detail-hero,
    .calculus-hero,
    .sitemap-hero
  ) {
    --hero-inline: 18px;
    padding-block: 48px;
  }

  .mg-hub,
  .mg-subjects-hub,
  .mg-course-page,
  .mg-level-page,
  .ap-course-hero,
  .ap-resource-hero { width: calc(100% - 28px); }

  .mg-hub-hero,
  .mg-subjects-hero,
  .mg-course-hero,
  .mg-level-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-block: 24px 40px;
  }
  .mg-hub-mark,
  .mg-subjects-mark,
  .mg-course-mark,
  .mg-level-mark { width: 58px; height: 58px; border-radius: 17px; }

  :where(
    .page-hero,
    .solver-hero,
    .editorial-head,
    .formula-entry-hero,
    .purpose-tool-hero,
    .ap-resource-hero,
    .detail-hero,
    .calculus-hero,
    .ap-course-hero,
    .mg-hub-hero,
    .mg-subjects-hero,
    .mg-course-hero,
    .mg-level-hero,
    .sitemap-hero
  ) h1 {
    font-size: clamp(2.2rem, 10vw, 3rem) !important;
    line-height: 1.05;
  }
  :where(
    .page-hero,
    .solver-hero,
    .editorial-head,
    .formula-entry-hero,
    .purpose-tool-hero,
    .ap-resource-hero,
    .detail-hero,
    .calculus-hero,
    .ap-course-hero,
    .mg-hub-hero,
    .mg-subjects-hero,
    .mg-course-hero,
    .mg-level-hero,
    .sitemap-hero
  ) p { font-size: 1rem; line-height: 1.65; }

  .calculus-hero-actions { width: 100%; flex-direction: column; }
  .calculus-hero-actions .button { width: 100%; }
}

/* Focused learning guides use a wider reading column and fewer, deeper
   sections. The rules below keep worked mathematics, reference tables, and
   explanations visually connected instead of presenting every paragraph as a
   separate article fragment. */
.editorial[data-content-structure^="guide-"] .editorial-body {
  width: min(920px, calc(100% - 40px));
  max-width: 920px;
  padding-inline: 0;
}
.guide-deep-section {
  padding: 12px 0 54px;
  border-bottom: 1px solid #e3e8ef;
}
.guide-deep-section + .guide-deep-section { padding-top: 34px; }
.guide-deep-section > h2 { margin-top: 0; }
.guide-deep-section > h3 { margin-top: 34px; }
.guide-decision-list,
.guide-worked-list {
  display: grid;
  gap: 12px;
  margin: 26px 0 0;
  padding-left: 28px;
}
.guide-decision-list li,
.guide-worked-list li {
  padding: 16px 20px;
  border: 1px solid #e1e7ee;
  border-radius: 14px;
  background: #fff;
}
.guide-transfer {
  margin-top: 36px;
  padding: 28px;
  border-radius: 18px;
  background: #f2f8fd;
}
.guide-transfer h3 { margin-top: 0; }
.guide-transfer details { margin-top: 22px; border-bottom: 1px solid #d7e3ed; }
.guide-verification > p:first-of-type { color: #526176; font-size: 1rem; }
.guide-verification .callout {
  margin: 32px 0 0;
  border: 1px solid #cfe6f8;
  border-radius: 18px;
  background: #eef8ff;
  color: #143d5a;
}
.guide-verification .callout h3 { margin: 0; }
.guide-reference dl { margin: 24px 0 0; }
.guide-reference dt { margin-top: 20px; }
.guide-reference dd { margin: 5px 0 0; color: #5f6d80; }
.guide-context > ul { display: grid; gap: 12px; padding-left: 22px; }
.guide-faq details:last-child { border-bottom: 1px solid #e1e7ee; }

@media (max-width: 680px) {
  .editorial[data-content-structure^="guide-"] .editorial-body { width: calc(100% - 36px); }
  .guide-deep-section { padding-bottom: 42px; }
  .guide-decision-list,
  .guide-worked-list { padding-left: 22px; }
  .guide-decision-list li,
  .guide-worked-list li { padding: 14px; }
  .guide-transfer { padding: 22px 18px; }
}

/* Keep the typography and card hierarchy direct: no editorial eyebrows,
   decorative sequence columns, or italic emphasis. */
:where(em, i, cite, dfn, var) { font-style: normal !important; }
.upgrade-ribbon { font-style: normal; }
.kicker,
.eyebrow,
.page-category,
.ai-example-label,
.mg-card-category,
.purpose-tool-category,
.pay-side-lead { display: none !important; }

.account-menu-panel > a,
.account-menu-panel form button { grid-template-columns: 1fr; }
.mg-loop li { grid-template-columns: 1fr; }
.mg-unit-list > article { grid-template-columns: minmax(0, 1fr) auto; }
.mg-unit-map strong { margin-top: 0; }
.mg-study-loop-grid h3,
.utility-guide-grid h3,
.practice-skill-grid h3 { margin-top: 0; }
.ap-track .cl h3,
.search-result h3,
.formula-coverage-grid h3,
.solution-next-grid strong { margin-top: 0; }
.solution-next-grid > a > span { display: none; }
.ap-unit-list article { grid-template-columns: minmax(0, 1fr) 100px auto; }

@media (max-width: 1050px) {
  .ap-unit-list article { grid-template-columns: minmax(0, 1fr) 90px; }
  .unit-actions { grid-column: 1; }
}

@media (max-width: 680px) {
  .mg-unit-list > article,
  .ap-unit-list article { grid-template-columns: 1fr; }
  .ap-unit-list article > b,
  .unit-actions { grid-column: 1; }
}

/* One predictable keyboard indicator across links, controls, dialogs and
   calculator inputs. Component-specific focus rings may add to this rule. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid #0b74c4;
  outline-offset: 3px;
}

/* The requested fixed heading scale keeps page hierarchy consistent across
   long editorial pages, compact tools, and the responsive layouts. */
h1 { font-size: 36px !important; }
h2 { font-size: 26px !important; }

/* Section headings and their explanatory copy always share one vertical flow.
   Actions may follow them, but supporting text never occupies a side column. */
.section-intro,
.mg-course-section-head,
.search-results-head,
.lesson-videos-intro,
.solution-next-intro,
.calculator-information-head {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

.section-intro > div,
.mg-course-section-head > div,
.lesson-videos-intro > div,
.calculator-information-head > div,
.section-intro > p,
.section-intro > div > p,
.mg-course-section-head > p,
.mg-course-section-head > div > p,
.search-results-head > p,
.lesson-videos-intro > p,
.solution-next-intro > p,
.calculator-information-head > p {
  width: 100% !important;
  max-width: none !important;
}

.section-intro > p,
.mg-course-section-head > p,
.search-results-head > p,
.lesson-videos-intro > p,
.solution-next-intro > p,
.calculator-information-head > p {
  margin-top: 0 !important;
}

/* Breadcrumbs no longer occupy the page start. Keep the fixed-header clearance,
   but remove the second band of vertical space that the hub and hero wrappers
   previously added below it. */
.mg-hub,
.mg-subjects-hub,
.mg-course-page,
.mg-level-page {
  padding-top: 16px;
}

.mg-solver-intro {
  padding-top: 20px;
}

.mg-hub-hero,
.mg-subjects-hero,
.mg-course-hero,
.mg-level-hero {
  padding-top: 16px;
}

.page-hero,
.solver-hero,
.ap-hero,
.ap-course-hero,
.ap-resource-hero,
.detail-hero,
.calculus-hero,
.editorial-head,
.formula-entry-hero,
.purpose-tool-hero,
.sitemap-hero {
  margin-top: 0 !important;
  padding-top: clamp(28px, 3.5vw, 48px) !important;
}

@media (max-width: 680px) {
  .mg-hub,
  .mg-subjects-hub,
  .mg-course-page,
  .mg-level-page {
    padding-top: 8px;
  }

  .mg-solver-intro {
    padding-top: 14px;
  }

  .mg-hub-hero,
  .mg-subjects-hero,
  .mg-course-hero,
  .mg-level-hero {
    padding-top: 12px;
  }

  .page-hero,
  .solver-hero,
  .ap-hero,
  .ap-course-hero,
  .ap-resource-hero,
  .detail-hero,
  .calculus-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .sitemap-hero {
    padding-top: 24px !important;
  }
}

/* MathGPTAI application polish. The interactive tools predate the current
   product shell, so this layer replaces their hardware-calculator styling and
   supplies missing navigation styles with the same clear blue system used by
   the solver, libraries, and sidebar. */
main#main { overflow-x: clip; }
:where(p, li, dd, td, th, summary, label, a, button) { overflow-wrap: break-word; }

/* Dark information panels must opt back into light text after the global
   heading colour is applied. */
:where(
  .inline-solver,
  .subject-practice-cta,
  .final-cta,
  .formula-coverage,
  .calculator-relationship,
  .calculator-next-intro,
  .calculator-learning-intro,
  .learn-cycle,
  .solver-cta-inner,
  .ai-answer-preview
) :where(h1, h2, h3, h4, strong, b) {
  color: #fff;
}
:where(
  .subject-practice-cta,
  .final-cta,
  .formula-coverage,
  .calculator-relationship,
  .calculator-next-intro,
  .calculator-learning-intro,
  .learn-cycle,
  .solver-cta-inner,
  .ai-answer-preview
) :where(p, li, dd, small) {
  color: #d5deea;
}

/* Practice shortcuts live at the start of the session header. Keeping this
   control in normal flow prevents it from covering the timer or score. */
.practice-quick-nav {
  position: relative;
  z-index: 12;
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  font-size: .9rem;
}
.practice-quick-nav > button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #dbe3ec;
  border-radius: 999px;
  background: #f5f9fc;
  color: #31536d;
  box-shadow: none;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.practice-quick-nav > button::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 0 3px 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.practice-quick-nav.open > button::after { margin-bottom: -1px; transform: rotate(225deg); }
.practice-quick-nav > div {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(330px, calc(100vw - 32px));
  display: none;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dbe3ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, .16);
}
.practice-quick-nav.open > div { display: grid; }
.practice-quick-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 10px;
  color: #334155;
  font-weight: 700;
}
.practice-quick-nav a:hover,
.practice-quick-nav a:focus-visible { background: #eef7ff; color: #125f96; }

/* Shared suite heading and route switcher. */
.utility-tool {
  background: #f7f9fc;
  color: #111827;
}
.utility-tool-header {
  padding: 26px clamp(18px, 4vw, 54px) 0;
  border-bottom: 1px solid #e1e7ee;
  background: #fff;
}
.utility-tool-header > div {
  max-width: 1320px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.utility-tool-header h1 { margin: 0; color: #0b1220; }
.utility-tool-header p {
  width: 100%;
  max-width: 900px;
  margin: 0;
  color: #59687c;
  font-size: 1rem;
  line-height: 1.65;
  text-align: left;
}
.tool-suite-nav {
  max-width: 1320px;
  gap: 7px;
  margin-top: 22px;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
.tool-suite-nav a {
  min-width: 0;
  padding: 10px 15px;
  border: 1px solid #dce4ec !important;
  border-radius: 11px;
  background: #fff;
  color: #425168;
  font-size: .875rem;
  text-align: center;
}
.tool-suite-nav a:hover { border-color: #9cccf0 !important; background: #f1f8fe; color: #125f96; }
.tool-suite-nav a[aria-current="page"] {
  border-color: #176fac !important;
  background: #176fac;
  color: #fff;
}

/* Graphing calculator: give its title room, make every control legible, and
   replace the beige dock with the product's blue-white surface treatment. */
.workspace {
  width: min(calc(100% - 28px), 1500px);
  grid-template-columns: minmax(420px, 36%) minmax(0, 1fr);
  border-color: #dfe6ed !important;
  border-radius: 24px !important;
  background: #fff !important;
}
.workspace-title {
  min-height: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: 12px 14px;
  padding: 20px;
  border-bottom: 1px solid #e3e8ef;
}
.workspace-title .page-icon { width: 52px; height: 52px; border-radius: 16px; }
.workspace-title h1 { margin: 0 0 7px; font-size: 36px !important; line-height: 1.04; letter-spacing: -.045em; }
.workspace-title p { margin: 0; color: #5f6f83; font-size: .875rem; line-height: 1.5; }
.history-controls {
  grid-column: 2;
  width: 100%;
  gap: 6px;
  margin: 0 !important;
}
.history-controls button {
  min-width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid #dfe6ed;
  border-radius: 11px;
  background: #fff;
  color: #445267;
  font-size: 1rem;
}
.history-controls .save-graph-button { min-width: 76px; margin: 0; border-radius: 11px !important; }
.graph-toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  padding: 9px;
  background: #f8fafc;
}
.graph-toolbar button {
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid #e1e7ee;
  border-radius: 10px;
  background: #fff;
  color: #243244;
  font-size: .82rem;
}
.graph-toolbar button:hover { border-color: #a8d0ed; background: #eef8ff; color: #125f96; }
.graph-settings { font-size: .875rem; }
.bounds-fields label { font: 700 .78rem var(--font); }
.add-row { min-height: 48px; padding-inline: 18px; color: #536176; font-size: .875rem; }
.expression-result,
.slider-suggestions { color: #526176; font-size: .75rem; }
.workspace-footer {
  min-height: 46px;
  height: auto;
  color: #637083;
  font: 600 .75rem var(--font);
}
.workspace-footer button,
.workspace-footer a { min-height: 46px; padding-inline: 14px; }
.dock-keypad {
  padding: 12px clamp(14px, 2vw, 30px) 16px;
  border-top: 1px solid #dfe7ef;
  background: #f3f8fc;
  box-shadow: 0 -10px 30px rgba(15, 23, 42, .06);
}
.dock-keypad .keypad-tabs button {
  min-height: 38px;
  border-radius: 9px;
  color: #536176;
  font-family: var(--font);
  font-size: .8rem;
}
.dock-keypad .keypad-tabs button.active { background: #fff; color: #125f96; box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.dock-keypad .keypad-tabs > span { color: #617086; font: 750 .72rem var(--font); }
.key-group button,
.dock-alt button {
  height: 46px;
  border-color: #dbe4ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .06);
  font-family: var(--font);
  font-size: 1rem;
}
.number-keys button { background: #eaf5ff; color: #123f61; font-family: var(--font); font-size: 1.05rem; }
.enter-key { border-color: #176fac !important; background: #176fac !important; }
.graph-label,
.graph-readout { color: #435166; font-size: .75rem; }

/* Four-function calculator: an approachable web tool, not a simulated piece
   of vintage hardware. */
.four-workspace {
  width: min(calc(100% - 36px), 1280px);
  grid-template-columns: minmax(400px, .9fr) minmax(360px, 1.1fr);
  gap: 20px;
  margin: 32px auto;
}
.four-workspace > .four-calculator,
.four-side-panel {
  margin: 0;
  overflow: hidden;
  border: 1px solid #dce5ed !important;
  border-radius: 22px !important;
  background: #fff !important;
  color: #111827;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .07) !important;
}
.four-workspace > .four-calculator { width: 100%; padding: 22px; }
.four-device-head {
  padding: 3px 2px 14px;
  color: #405066;
  font: 800 .82rem var(--font);
  letter-spacing: 0;
  text-transform: none;
}
.four-device-head span { border-color: #cdd9e4; border-radius: 7px; background: #f5f8fb; }
.four-workspace .four-screen {
  height: 180px;
  padding: 18px;
  border: 1px solid #cfe3f2;
  border-radius: 18px;
  background: linear-gradient(145deg, #f4faff, #eaf5ff);
  color: #0f2d45;
}
.four-screen-meta { border-color: #c9deed; color: #526b7f; font: 750 .72rem var(--font); }
.four-screen input { color: #23445c; font: 500 1.1rem var(--font); }
.four-screen strong { color: #0b2940; font-family: var(--font); font-size: 2.35rem; }
.four-workspace .four-keypad { gap: 8px; padding-top: 16px; }
.four-workspace .four-keypad button {
  height: 52px;
  border: 1px solid #dce4ec;
  border-radius: 12px;
  background: #f7f9fc;
  color: #172033;
  box-shadow: none;
  font-family: var(--font);
  font-size: .95rem;
}
.four-workspace .four-keypad button:hover { border-color: #9dc9e8; background: #eef8ff; }
.four-workspace .four-keypad button[data-tone="number"] { background: #fff; color: #111827; }
.four-workspace .four-keypad button[data-tone="operator"],
.four-workspace .four-keypad button[data-tone="enter"] { border-color: #176fac; background: #176fac; color: #fff; }
.four-workspace .four-keypad button[data-tone="clear"] { border-color: #f5c9cd; background: #fff1f2; color: #b42332; }
.four-workspace .four-calculator > footer {
  min-height: 44px;
  height: auto;
  color: #637083;
  font: 650 .78rem var(--font);
  opacity: 1;
}
.four-workspace .four-calculator > footer select {
  min-height: 34px;
  padding: 4px 28px 4px 9px;
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  background: #fff;
  color: #243244;
}
.four-tabs { gap: 6px; padding: 8px; background: #f4f7fa; }
.four-tabs button {
  min-height: 46px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #425168;
  font-size: .9rem;
}
.four-tabs button.active { background: #176fac; color: #fff; }
.four-side-panel > .calculation-work { margin: 8px 22px 4px; padding-block: 16px; }
.four-side-panel > section { padding: 22px; }
.four-side-panel h2 { color: #111827; }
.four-panel-head button { min-height: 36px; padding: 6px 10px; border-color: #dbe3ec; background: #fff; font-size: .75rem; }
.four-empty-tape { margin-top: 70px; color: #607086; font-size: .875rem; }
.four-side-panel > section > label,
.four-utility-fields label { color: #334155; font-size: .875rem; }
.four-side-panel select,
.four-utility-fields input,
.four-utility-fields select { min-height: 44px; border-color: #dbe3ec; border-radius: 10px; background: #f8fafc; font-size: .95rem; }
.four-side-panel output { border-radius: 14px; background: #eef8ff; color: #123f61; font: 700 .9rem/1.6 var(--font); }
.calculation-work summary { font-size: .875rem; }
.calculation-work summary span { color: #657184; font: 700 .72rem var(--font); }
.calculation-work ol { color: #526176; font-size: .875rem; }

/* Remaining visual workspaces share readable controls and soft application
   chrome instead of black rails and undersized monospace labels. */
.utility-tool :where(input, select, textarea, button) { font-family: var(--font); }
.utility-tool :where(label) { color: #334155; }
.notebook-toolbar,
.visual-tool-bar {
  gap: 6px;
  padding: 8px;
  border: 1px solid #dce5ed;
  background: #fff;
  color: #243244;
}
.notebook-toolbar button,
.visual-tool-bar button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #dce4ec;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
  font-size: .82rem;
}
.notebook-toolbar button:hover,
.visual-tool-bar button:hover,
.visual-tool-bar button.active { border-color: #176fac; background: #176fac; color: #fff; }
.notebook-toolbar span { color: #5f6f83; font: 650 .75rem var(--font); }
.matrix-card,
.matrix-output,
.geometry-workspace,
.surface-workspace,
.notebook-paper { border-color: #dce5ed !important; }
.matrix-card label,
.matrix-parameter,
.geometry-inspector :where(label, dt, dd, small),
.surface-panel :where(label, p),
.notebook-filebar label { font-size: .82rem; }
.matrix-operations button,
.geometry-transform-actions button,
.geometry-export-actions button,
.surface-presets button,
.surface-stage-actions button,
.notebook-filebar button {
  min-height: 40px;
  border-color: #dce4ec;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-size: .8rem;
}
.matrix-operations button:hover,
.matrix-operations button.active,
.surface-panel-heading button { border-color: #176fac; background: #176fac; color: #fff; }
.matrix-output { background: #111827; }
.geometry-stage,
.geometry-inspector,
.surface-panel,
.surface-stage { border-color: #dce5ed; }

/* Explanatory cards below every utility tool. */
.utility-tool-guide { width: min(calc(100% - 40px), 1280px); }
.utility-tool-guide .section-intro { margin-bottom: 28px; }
.utility-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  border: 0;
}
.utility-guide-grid article {
  min-height: 0;
  padding: 26px;
  border: 1px solid #e0e7ee;
  border-radius: 18px;
  background: #fff;
}
.utility-guide-grid h3 { margin: 0 0 12px; color: #111827; font-size: 1.15rem; line-height: 1.25; }
.utility-guide-grid p { margin: 0; color: #5f6f83; font-size: .95rem; line-height: 1.7; }
.subject-practice-cta {
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: #111827;
}
.subject-practice-cta h3 { margin: 0 0 10px; font-size: 1.35rem; }
.subject-practice-cta p { color: #d4deea; }
.subject-practice-cta .text-link { color: #8bc8f2; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(370px, 44%) minmax(0, 1fr); }
  .workspace-title h1 { font-size: 32px !important; }
  .four-workspace { grid-template-columns: 1fr; }
  .four-workspace > .four-calculator { max-width: 720px; margin-inline: auto; }
}

@media (max-width: 760px) {
  .practice-quick-nav > button { min-height: 36px; padding-inline: 11px; font-size: .78rem; }
  .utility-tool-header { padding-inline: 14px; }
  .tool-suite-nav { margin-top: 18px; }
  .workspace {
    width: calc(100% - 20px);
    grid-template-columns: 1fr;
  }
  .workspace-title { grid-template-columns: 48px minmax(0, 1fr); padding: 16px; }
  .workspace-title .page-icon { width: 48px; height: 48px; }
  .workspace-title h1 { font-size: 30px !important; }
  .history-controls { grid-column: 1 / -1; }
  .graph-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graph-toolbar button { font-size: .82rem !important; }
  .dock-main { gap: 9px; }
  .utility-guide-grid { grid-template-columns: 1fr; }
  .subject-practice-cta { align-items: flex-start; flex-direction: column; }
  .subject-practice-cta .button { width: 100%; }
}

@media (max-width: 560px) {
  .four-workspace { width: calc(100% - 20px); }
  .four-workspace > .four-calculator { padding: 14px; }
  .four-workspace .four-keypad { gap: 6px; }
  .four-workspace .four-keypad button { height: 48px; font-size: .85rem; }
  .four-tabs { gap: 4px; padding: 6px; }
  .four-tabs button { font-size: .82rem; }
  .four-panel-head { align-items: flex-start; flex-direction: column; }
  .utility-tool-guide { width: calc(100% - 24px); padding-inline: 0; }
}

/* The legacy hero selectors carry more specificity than a bare h1/h2 rule.
   Anchor the requested scale to the application root so every page family,
   including formula and AP heroes, actually receives it. */
body main#main h1 { font-size: 36px !important; }
body main#main h2 { font-size: 26px !important; }

/* Practice sessions are information-dense, but their controls still need to
   remain readable without zooming. */
.practice-top { font-family: var(--font); font-size: .875rem; }
.practice-top :where(a, button, span) { font-size: inherit; }
.practice-config > p,
.practice-tools,
.practice-tip p { color: #526176; font-size: .875rem; line-height: 1.6; }
.practice-config legend,
.question-meta,
.session-score span { color: #526176; font: 750 .75rem var(--font); }
.practice-config fieldset button,
.practice-tools :where(a, button),
.answer-options button,
.question-actions .button { font-size: .95rem; }
.practice-config fieldset button { min-height: 46px; padding: 10px 12px; }
.practice-tools :where(a, button) { min-height: 46px; display: flex; align-items: center; }
.question-meta { letter-spacing: .03em; }
.question-card > h2 { color: #111827; line-height: 1.2; }
.answer-options button { min-height: 58px; color: #111827; }
.exam-switch { color: #243244; font-size: .9rem; }
.exam-switch small { color: #637083; font-size: .78rem; }

@media (max-width: 680px) {
  body main#main h1 { font-size: 36px !important; }
  body main#main h2 { font-size: 26px !important; }
  .practice-app { width: calc(100% - 20px); }
  .practice-top { font-size: .8rem; }
}

/* Readability floor for the shared shell and discovery cards. These elements
   repeat on almost every route, so correcting them here removes hundreds of
   inherited small/low-contrast instances without page-specific patches. */
.ai-sidebar-nav > a > b { display: none; }
.ai-recent a,
.ai-recent span,
.ai-sidebar-foot,
.ai-sidebar-foot a {
  color: #59687c !important;
  font-size: .875rem !important;
}
.ai-premium-card > span,
.ai-premium-card > a b {
  color: #59687c;
  font-size: .875rem;
}
.ai-premium-card > a b { color: #fff; }
.footer-top a:not(.brand) {
  color: #59687c;
  font-size: .875rem;
}
.footer-bottom {
  color: #59687c;
  font: 500 .875rem/1.55 var(--font);
}
.mg-library-head p { color: #657184; }
.mg-card-icon { color: #125f96 !important; }
.mg-destination-card:nth-child(3n+2) .mg-card-icon { color: #147a4f !important; }
.mg-destination-card:nth-child(3n) .mg-card-icon { color: #7432a6 !important; }
.mg-input-guide p,
.mg-input-guide li { font-size: .9rem; }
.mg-solver-gate aside li,
.solver-information .subject-method-grid p { font-size: 1rem; }
.ai-example-links a { font-size: .875rem; }
.home-reliability .text-link { color: #125f96; }
.final-cta a:not(.button) {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Site-wide legibility floor. Older workspace and library components used
   9-13px labels inherited from the previous visual system. Preserve the
   hierarchy while ensuring that every visible instruction and control is
   readable without zooming. */
main#main :where(
  p, li, a, button, input, select, textarea, label, summary,
  th, td, caption, output, dt, dd, b, strong, span
) { font-size: max(.875rem, 1em) !important; }
main#main :where(small, time) { font-size: .875rem !important; }
main#main legend { font-size: .875rem !important; }
main#main h4 { font-size: 1rem !important; line-height: 1.35; }

/* Canonical MathGPTAI blue-on-white treatments for legacy utility surfaces. */
.page-icon,
.ap-badge,
.pathway-symbol,
.detail-symbol,
.assessment-icon { color: #125f96 !important; }
.mg-card-link,
.mg-back-link,
.mg-outline-link,
.contextual-link { color: #125f96 !important; }
.purpose-tool-fields :where(input, select, textarea),
.purpose-tool-examples button,
.key-group button,
.dock-alt button,
.calculus-graph,
.calculus-graph-actions button,
.calculus-graph > output,
.subject-visual,
.subject-visual p,
.surface-stage-actions button,
.surface-hud,
.geometry-hud {
  border-color: #dce5ed;
  background: #fff !important;
}

.mg-unit-list li { color: #526176; }
.mg-subjects-hub :where(.course-rail, .compact-course-grid) .cl > small { color: #526176 !important; }
.mg-subjects-hub .pathway-strip .cl > p,
.mg-subjects-hero > div:last-child > p:last-child { color: #526176 !important; }
.mg-subjects-cta p:last-child { color: #526176; }
.course-rail a,
.compact-course-grid a,
.formula-subject-nav a { color: #125f96; }

.formula-coverage {
  background: #f1f8fe !important;
  color: #111827 !important;
}
.formula-coverage :where(h2, h3, h4, strong, b) { color: #111827 !important; }
.formula-coverage :where(p, li, small),
.formula-coverage-grid p { color: #526176 !important; }
.formula-coverage-grid {
  gap: 14px;
  border: 0;
}
.formula-coverage-grid article {
  border: 1px solid #dbe6ef;
  border-radius: 18px;
  background: #fff;
}
.formula-coverage-grid a { color: #125f96; }

.calculator-next-intro {
  background: #f1f8fe;
  color: #111827;
}
.calculator-next-intro :where(h2, h3, h4, strong, b) { color: #111827; }
.calculator-next-intro :where(p, li, small),
.calculator-next-intro > p { color: #526176 !important; }
.calculator-next-intro > span { color: #125f96; }

.expression-result,
.slider-suggestions,
.graph-readout { font-size: .875rem; }
.key-group button.enter-key,
.dock-alt button.enter-key {
  border-color: #176fac !important;
  background: #176fac !important;
  color: #fff !important;
}
.notebook-toolbar button:first-child { color: #fff; }
.calculator-keypad button[data-tone="clear"] { background: #b83b34; }
.calculator-keypad button[data-tone="enter"],
.calculator-keypad button[data-tone="nav"],
.calculator-keypad button[data-tone="soft"] {
  border-color: #125f96;
  background: #125f96;
  color: #fff;
}
.surface-axis-key .x { background: #b83b34; }
.surface-axis-key .y { background: #147a4f; }
.surface-axis-key .z { background: #125f96; }
.upgrade-ribbon { background: #147a4f; color: #fff; }

.subject-practice-cta h3 { color: #fff !important; }
.mg-subjects-hub :where(.pathway-strip, .course-rail, .compact-course-grid) .cl > span {
  color: #125f96 !important;
}
a.cl-a { color: #125f96; }
.mg-level-page a.cl-a,
.mg-hub a.cl-a { color: #125f96 !important; }
.mg-unit-map small { color: #526176 !important; }
.ap-course-mark { color: #125f96; }
.ap-course-mark small { color: #526176 !important; }
.mg-level-card-mark,
.mg-related-mark,
.mg-course-mark,
.mg-level-mark { color: #125f96 !important; }
.mg-subjects-hub .course-rail .cl > span,
.mg-subjects-hub .compact-course-grid .cl > span,
.mg-subjects-hub .pathway-strip .cl > span { color: #125f96 !important; }
.mg-level-card-meta :where(span, a),
.mg-support-grid span { color: #526176 !important; }
.mg-level-card-meta a { color: #125f96 !important; }
.mg-section-heading > p { color: #526176 !important; }
.auth-google { font-size: .875rem !important; }

/* Formula relationship cards ------------------------------------------------
   Formula pages need substantially more horizontal room than ordinary link
   cards. A four-column grid clipped long MathJax expressions and stranded the
   fifth relationship on a row by itself. The four-track layout below renders
   two readable cards per row and centres an odd final card. */
.formula-related-section {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(42px, 5vw, 72px) 0;
  border: 0 !important;
}

.formula-related-section > h2 {
  margin: 0 0 28px;
  color: #111827;
  font-size: clamp(1.65rem, 2.2vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.formula-related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  border: 0 !important;
}

.formula-related-grid > .formula-related-card {
  grid-column: span 2;
  min-width: 0;
  min-height: 0;
  padding: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #dce5ed !important;
  border-radius: 20px !important;
  background: #fff !important;
}

.formula-related-grid > .formula-related-card:last-child:nth-child(odd) {
  grid-column: 2 / span 2;
}

.formula-related-card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.3;
}

.formula-related-card h3 a {
  color: #111827;
  text-decoration: none;
}

/* Keep the anchor text accurate: only the title and explicit action are links,
   rather than turning every word in the card into one oversized anchor. */
.formula-related-card .cl-a::after { content: none; }

.formula-related-expression {
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  min-height: 96px;
  margin: 20px 0 16px;
  padding: 19px 20px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #d8e7f3;
  border-radius: 15px;
  background: #f2f8fd;
  color: #111827;
  scrollbar-width: thin;
  scrollbar-color: #9db7ca transparent;
  overscroll-behavior-inline: contain;
}

.formula-related-expression:focus-visible {
  outline: 3px solid rgba(37, 136, 207, .24);
  outline-offset: 2px;
}

.formula-related-expression mjx-container {
  min-width: max-content;
  max-width: none;
  margin: 0 !important;
  font-size: 1.02rem !important;
}

.formula-related-card > p {
  margin: 0;
  color: #5d6b7f;
  font-size: .9rem;
  line-height: 1.6;
}

.formula-related-link {
  position: relative;
  z-index: 2;
  width: fit-content;
  margin-top: auto;
  padding-top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #1269a3;
  font-size: .86rem;
  font-weight: 750;
  text-decoration: none;
}

.formula-related-link > span { font-size: 1.1rem; }
.formula-related-link:hover { color: #0c527f; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 840px) {
  .formula-related-section { width: min(100% - 32px, 720px); }
  .formula-related-grid { grid-template-columns: 1fr; }
  .formula-related-grid > .formula-related-card,
  .formula-related-grid > .formula-related-card:last-child:nth-child(odd) {
    grid-column: 1;
  }
}

@media (max-width: 520px) {
  .formula-related-section { width: calc(100% - 24px); padding-block: 34px; }
  .formula-related-section > h2 { margin-bottom: 20px; }
  .formula-related-grid { gap: 12px; }
  .formula-related-grid > .formula-related-card { padding: 20px; border-radius: 17px !important; }
  .formula-related-expression { min-height: 82px; margin-block: 16px 13px; padding: 16px; }
  .formula-related-expression mjx-container { font-size: .95rem !important; }
}

/* Compact page starts. The fixed top bar already reserves its own clearance
   through main#main, so page heroes must not reserve a second 470-720px band
   and push their title or primary action toward the fold. */
.ai-home-hero {
  min-height: 0;
  justify-content: flex-start;
  padding: 34px clamp(24px, 6vw, 90px) 64px;
}

:where(
  .page-hero,
  .solver-hero,
  .ap-hero,
  .ap-course-hero,
  .ap-resource-hero,
  .detail-hero,
  .calculus-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .sitemap-hero
) {
  min-height: 0 !important;
  align-content: start;
  padding-top: 28px !important;
  padding-bottom: 44px !important;
}

:where(
  .page-hero,
  .solver-hero,
  .ap-hero,
  .ap-course-hero,
  .ap-resource-hero,
  .detail-hero,
  .calculus-hero,
  .editorial-head,
  .formula-entry-hero,
  .purpose-tool-hero,
  .sitemap-hero
) h1 { margin-top: 0 !important; }

.calculus-hero,
.detail-hero,
.ap-course-hero { align-items: start; }

@media (max-width: 680px) {
  .ai-home-hero { padding: 24px 18px 48px; }

  .mg-course-hero,
  .mg-level-hero {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    padding-top: 8px;
  }

  :where(
    .page-hero,
    .solver-hero,
    .ap-hero,
    .ap-course-hero,
    .ap-resource-hero,
    .detail-hero,
    .calculus-hero,
    .editorial-head,
    .formula-entry-hero,
    .purpose-tool-hero,
    .sitemap-hero
  ) {
    padding-top: 20px !important;
    padding-bottom: 34px !important;
  }
}
.growth-actions small,
.growth-actions small a { font-size: .875rem; }
.ai-home-visual figcaption,
.editorial-image figcaption { color: #59687c; font: 500 .875rem/1.55 var(--font); }

/* Calculator results use the same calm, light workspace language as the
   MathGPTAI solver. Older calculator families rendered their answers as dark
   terminal panels with tiny monospace copy; these shared rules keep the
   mathematical hierarchy while making every label, step, and check readable. */
.subject-result,
.calculus-result,
.matrix-output,
.focused-result {
  border-top: 1px solid #dce5ed;
  background: #fff;
  color: #111827;
  box-shadow: none;
  font-family: var(--font);
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  :where(h2, h3, h4, strong, b) {
  color: #111827 !important;
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  :where(p, li, small, dd) {
  color: #526176 !important;
}

.subject-result,
.calculus-result {
  grid-template-columns: minmax(220px, .72fr) minmax(300px, 1.28fr);
  gap: 20px;
  padding: 24px;
}

.subject-answer,
.calculus-result > div:first-child {
  align-self: start;
  padding: 20px;
  border: 1px solid #cfe3f2;
  border-radius: 16px;
  background: #f1f8fe;
}

.subject-answer > span,
.calculus-result > div:first-child > span,
.focused-result > span {
  color: #125f96 !important;
  font: 750 .875rem/1.35 var(--font);
  letter-spacing: 0;
  text-transform: none;
}

.subject-answer > strong,
.calculus-result > div:first-child > strong,
.focused-result > strong {
  margin: 8px 0;
  color: #111827 !important;
  font-family: var(--font);
  font-size: clamp(1.55rem, 2.3vw, 2rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.subject-answer > strong.error,
.calculus-result strong.error,
.focused-result > strong.error {
  color: #b42332 !important;
  font-size: 1rem;
}

.subject-answer > small,
.calculus-result > div:first-child > small {
  color: #526176 !important;
  font: 500 .9rem/1.55 var(--font);
}

.subject-metrics {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  background: transparent;
}

.subject-metrics > div {
  padding: 16px;
  border: 1px solid #dce5ed;
  border-radius: 14px;
  background: #f8fafc;
}

.subject-metrics span {
  color: #526176;
  font: 650 .82rem/1.4 var(--font);
}

.subject-metrics b {
  margin-top: 5px;
  color: #111827 !important;
  font: 750 1rem/1.45 var(--font);
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work {
  border-top: 1px solid #dce5ed;
  color: #111827;
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work summary {
  color: #111827;
  font: 750 .95rem/1.4 var(--font);
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work summary span {
  color: #526176 !important;
  font: 650 .8rem/1.4 var(--font) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work summary::after {
  width: 34px;
  height: 34px;
  border: 1px solid #cfe3f2;
  border-radius: 10px;
  background: #f1f8fe;
  color: #125f96;
  font-family: var(--font);
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work ol {
  margin-top: 18px;
  padding: 0 0 0 24px;
  border: 0;
  color: #334155 !important;
  font: 500 .95rem/1.7 var(--font);
}

:where(.subject-result, .calculus-result, .matrix-output, .focused-result)
  .calculation-work li + li {
  margin-top: 8px;
}

.subject-result > .calculation-work,
.calculus-result > .calculation-work {
  grid-column: 1 / -1;
  padding-top: 20px;
}

.subject-result > a,
.calculus-result > a {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid #176fac;
  border-radius: 12px;
  background: #176fac;
  color: #fff;
  font: 750 .9rem/1.3 var(--font);
  text-decoration: none;
}

.subject-result > a:hover,
.calculus-result > a:hover {
  border-color: #125f96;
  background: #125f96;
  color: #fff;
  text-decoration: none;
}

.share-slot { min-height: 58px; }
.share-slot .share-result { margin-top: 14px; }
.share-result-button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #b9d6ea;
  border-radius: 11px;
  background: #fff;
  color: #125f96;
  font: 750 .875rem var(--font);
}
.share-result-button:hover { border-color: #176fac; background: #eaf5fd; }
.share-result-status { color: #147a4f; font: 650 .82rem/1.45 var(--font); }

.matrix-output {
  align-items: start;
  padding: 26px;
  border: 1px solid #dce5ed;
  border-top: 0;
  border-radius: 0 0 18px 18px;
}
.matrix-output h2 { margin: 0 0 8px; color: #111827 !important; }
.matrix-output > div:first-child p,
.matrix-output > p { color: #526176 !important; font: 500 .9rem/1.55 var(--font); }
.matrix-output [data-matrix-result] > strong,
.matrix-result-item > strong { color: #125f96 !important; font-family: var(--font); }
.matrix-result-grid {
  border-color: #176fac;
}
.matrix-result-grid span {
  border: 1px solid #dce5ed;
  border-radius: 8px;
  background: #f1f8fe;
  color: #111827;
}
.matrix-output > .calculation-work { grid-column: 1 / -1; }

.focused-result {
  padding: 30px;
  border-left: 1px solid #dce5ed;
}
.focused-result > p { color: #526176 !important; font: 500 .95rem/1.65 var(--font); }
.focused-history { border-top-color: #dce5ed; }
.focused-history h3 { color: #111827 !important; }
.focused-history button {
  border-bottom-color: #e3e9ef;
  color: #334155;
  font: 600 .875rem/1.45 var(--font);
}
.focused-history button b { color: #125f96 !important; }
.focused-history p { color: #526176 !important; font-size: .875rem; }

@media (max-width: 850px) {
  .subject-result,
  .calculus-result,
  .matrix-output { grid-template-columns: 1fr; }
  .subject-result > .calculation-work,
  .calculus-result > .calculation-work,
  .matrix-output > .calculation-work { grid-column: 1; }
}

@media (max-width: 680px) {
  .subject-result,
  .calculus-result,
  .matrix-output,
  .focused-result { padding: 18px; }
  .subject-metrics { grid-template-columns: 1fr; }
  .calculation-work summary { align-items: flex-start; flex-wrap: wrap; }
  .calculation-work summary::after { margin-left: auto; }
  .focused-result { border-left: 0; }
}

/* Canonical MathGPTAI surfaces for the last legacy tool and reference families. */
.scientific-page,
.planner-shell,
.formula-library,
.formula-subject-topics,
.simple-page,
.notebook-app {
  color: #111827;
  font-family: var(--font);
}

/* Scientific calculator: one branded workspace, with layouts instead of device skins. */
.calculator-model-picker {
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
}
.calculator-model-picker button {
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid #dce5ed;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font-family: var(--font);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.calculator-model-picker button:last-child { border-right: 1px solid #dce5ed; }
.calculator-model-picker button:hover {
  border-color: #9fc7e2;
  background: #f5faff;
  transform: translateY(-1px);
}
.calculator-model-picker button.active,
.calculator-model-picker button[aria-selected="true"] {
  border-color: #176fac;
  background: #eaf5fd;
  color: #125f96;
}
.calculator-model-picker b { font: 750 .84rem/1.35 var(--font); }
.calculator-model-picker span,
.calculator-model-picker button.active span {
  color: #607087;
  font: 500 .72rem/1.35 var(--font);
}
.calculator-device,
.calculator-device[data-model] {
  --calc-shell: #f7f9fc;
  --calc-edge: #dce5ed;
  --calc-screen: #fff;
  --calc-screen-ink: #111827;
  --calc-key: #fff;
  --calc-key-ink: #111827;
  --calc-key-border: #dce5ed;
  --calc-function: #edf6fc;
  --calc-accent: #176fac;
  --calc-enter: #176fac;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce5ed;
  border-radius: 22px;
  background: #f7f9fc;
  color: #111827;
  box-shadow: 0 18px 50px rgba(28, 52, 75, .09);
}
.calculator-device-head {
  min-height: 68px;
  padding: 13px 18px;
  border-color: #dce5ed;
  background: #fff;
  color: #111827 !important;
}
.calculator-device-head strong { font: 780 .95rem/1.3 var(--font); }
.calculator-device-head small { color: #607087; font: 500 .72rem/1.35 var(--font); opacity: 1; }
.calculator-status { color: #526176; font: 650 .72rem var(--font); }
.calculator-status button {
  min-width: 46px;
  min-height: 34px;
  border: 1px solid #b9d6ea;
  border-radius: 9px;
  background: #eef7fd;
  color: #125f96;
  font: 750 .72rem var(--font);
}
.calculator-device[data-model] .scientific-screen {
  height: 300px;
  margin: 14px;
  border: 1px solid #cbd9e5;
  border-radius: 16px;
  background: #fff;
  color: #111827;
}
.screen-toolbar { border-color: #e3e9ef; color: #607087; font-family: var(--font); }
.screen-toolbar button { color: #125f96; font-family: var(--font); }
.calculator-keypad { gap: 7px; padding: 12px 14px 14px; }
.calculator-device[data-model] .calculator-keypad button {
  height: 48px;
  border: 1px solid #d7e1ea;
  border-radius: 11px;
  background: #fff;
  color: #111827;
  font-family: var(--font);
  box-shadow: 0 2px 6px rgba(28, 52, 75, .05);
}
.calculator-device .calculator-keypad button:hover { border-color: #8fbddd; background: #f5faff; }
.calculator-device .calculator-keypad button[data-tone="function"],
.calculator-device .calculator-keypad button[data-tone="shift"],
.calculator-device .calculator-keypad button[data-tone="alpha"] {
  border-color: #c5deef;
  background: #eaf5fd;
  color: #125f96;
}
.calculator-device .calculator-keypad button[data-tone="enter"],
.calculator-device .calculator-keypad button[data-tone="equals"] {
  border-color: #176fac;
  background: #176fac;
  color: #fff;
}
.calculator-device .calculator-keypad button[data-tone="clear"],
.calculator-device .calculator-keypad button[data-tone="delete"] {
  border-color: #f1caca;
  background: #fff4f4;
  color: #9b2c2c;
}
.calculator-device-foot {
  min-height: 42px;
  padding: 0 18px;
  border-color: #dce5ed;
  background: #fff;
  color: #607087 !important;
  font: 500 .7rem var(--font);
  opacity: 1;
}
.calculator-guide {
  padding: 28px;
  border: 1px solid #dce5ed;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(28, 52, 75, .07);
}
.calculator-guide h2 { margin-top: 0; color: #111827; font: 780 1.65rem/1.18 var(--font); }
.calculator-guide > div > p,
.calculator-guide dd { color: #526176; font-family: var(--font); line-height: 1.62; }
.calculator-guide dt { color: #111827; font: 750 .84rem var(--font); }
.calculator-guide dl > div { border-color: #e3e9ef; }
.calculator-trademark-note { color: #607087; font: 500 .72rem/1.55 var(--font); }

/* Planner: a quiet two-panel workspace rather than an outlined legacy form. */
.planner-shell {
  max-width: 1250px;
  margin: 34px auto 110px;
  padding: 0 25px;
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
  gap: 0;
}
.planner-form,
.planner-result {
  border: 1px solid #dce5ed;
  background: #fff;
}
.planner-form {
  padding: 30px;
  border-radius: 22px 0 0 22px;
  border-right: 0;
}
.planner-form > label,
.planner-form legend { color: #334155; font: 700 .82rem/1.4 var(--font); }
.planner-form input:not([type="checkbox"]),
.planner-form select {
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #d7e1ea;
  border-radius: 11px;
  background: #f8fafc;
  color: #111827;
  font: 550 .9rem var(--font);
}
.planner-form input:focus,
.planner-form select:focus { border-color: #176fac; outline: 3px solid rgba(23, 111, 172, .12); }
.planner-form fieldset label {
  gap: 7px;
  margin: 4px 3px 4px 0;
  padding: 8px 10px;
  border: 1px solid #dce5ed;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font: 600 .75rem var(--font);
}
.planner-result {
  min-width: 0;
  padding: 36px;
  border-radius: 0 22px 22px 0;
  background: #f6faff;
}
.planner-result h2 { margin-top: 0; color: #111827; font: 780 clamp(1.8rem, 3vw, 2.5rem)/1.12 var(--font); }
.planner-result > p { color: #526176; font: 500 1rem/1.65 var(--font); }
.plan-list { border-color: #cbd9e5; }
.plan-list li { border-color: #dce5ed; }
.plan-list li > span { color: #125f96; font: 750 .72rem var(--font); }
.plan-list small,
.plan-list label { color: #526176; font-family: var(--font); }

/* Formula library: reference cards use the same soft, readable system as lessons. */
.page-hero.formula-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.page-hero.formula-hero > h1,
.page-hero.formula-hero > p { width: 100%; max-width: 1080px; }
.formula-subject-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.formula-subject-nav { margin-top: 48px; padding-top: 34px; border-color: #dce5ed; }
.formula-subject-nav ul { gap: 9px; }
.formula-subject-nav a {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #d3e0ea;
  border-radius: 12px;
  background: #fff;
  color: #125f96;
  font: 700 .84rem var(--font);
  text-decoration: none;
}
.formula-subject-nav a:hover { border-color: #176fac; background: #eaf5fd; color: #125f96; }
.formula-subject-nav small,
.formula-subject-nav a:hover small { color: #607087; font: 650 .72rem var(--font); }
.formula-use { margin-top: 64px; }
.formula-use > div { gap: 14px; border: 0; }
.formula-use article {
  min-height: 250px;
  padding: 26px;
  border: 1px solid #dce5ed;
  border-radius: 19px;
  background: #fff;
}
.formula-use article:last-child { border-right: 1px solid #dce5ed; }
.formula-use article > span { border-radius: 12px; background: #eaf5fd; color: #176fac; font-family: var(--font); }
.formula-search { border-color: #dce5ed; box-shadow: 0 10px 20px rgba(255,255,255,.92); }
.formula-search-main label,
.formula-filter-row > label { color: #526176; font: 700 .76rem/1.3 var(--font); letter-spacing: 0; text-transform: none; }
.formula-search-main input,
.formula-filter-row select {
  border-color: #cbd9e5;
  border-radius: 11px;
  background: #fff;
  font-family: var(--font);
}
.formula-search-main button { border-color: #176fac; border-radius: 11px; background: #176fac; font-family: var(--font); }
.formula-grid { gap: 16px; }
.formula-grid article {
  min-height: 540px;
  border: 1px solid #dce5ed;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(28, 52, 75, .05);
}
.formula-grid article > header span { color: #125f96; font: 750 .86rem/1.2 var(--font); letter-spacing: 0; text-transform: none; }
.formula-grid article > header small { color: #607087; font-family: var(--font); }
.formula-grid .formula-equation,
.formula-topic-list .formula-equation,
.formula-detail-statement .formula-equation { border-radius: 13px; background: #f1f8fe; }
.formula-details h4 { color: #334155; font: 750 .75rem var(--font); letter-spacing: 0; text-transform: none; }
.formula-card-actions button,
.formula-card-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid #c8dbe9;
  border-radius: 10px;
  background: #fff;
  color: #125f96;
  font: 700 .75rem var(--font);
  text-decoration: none;
}
.formula-topic-count { color: #607087; font: 600 .84rem var(--font); letter-spacing: 0; text-transform: none; }
.formula-topic-list { gap: 16px; }
.formula-topic-list article {
  padding: 26px;
  border: 1px solid #dce5ed;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(28, 52, 75, .045);
}
.formula-topic-list h3 a { color: #125f96; text-decoration: none; }
.formula-topic-list h3 a:hover { color: #0d4d7c; }
.formula-topic-list p { color: #526176; line-height: 1.65; }
.formula-topic-list small { color: #607087; font: 600 .76rem var(--font); }
.formula-detail-tags li {
  padding: 7px 12px;
  border: 1px solid #d3e0ea;
  border-radius: 999px;
  background: #f8fafc;
  color: #526176;
  font: 650 .75rem var(--font);
  letter-spacing: 0;
  text-transform: none;
}
.formula-detail-tags a { color: #125f96; text-decoration: none; }
.formula-detail-statement {
  padding: 26px;
  border: 1px solid #dce5ed;
  border-radius: 20px;
  background: #fff;
}
.formula-detail-statement small { color: #526176; font: 700 .78rem var(--font); letter-spacing: 0; text-transform: none; }

/* Trust and editorial pages: prose-led, with calm supporting panels. */
.simple-page > .prose { max-width: 1080px; }
.tldr,
.simple-checklist {
  margin: 0 0 34px;
  padding: 26px 28px;
  border: 1px solid #dce5ed;
  border-radius: 18px;
  background: #f7f9fc;
}
.tldr h2 {
  margin: 0 0 13px !important;
  color: #111827;
  font: 760 1.22rem/1.3 var(--font) !important;
  letter-spacing: -.01em;
  text-transform: none;
}
.tldr li { padding: 4px 0; color: #334155; font: 550 .95rem/1.6 var(--font); }
.calculator-authored mjx-container { color: #111827; }
.calculator-authored .callout h3 mjx-container { font-size: 1.18em !important; }
.simple-checklist h2 { color: #111827; }
.simple-related > div { gap: 14px; border: 0; }
.simple-related .cl {
  padding: 22px;
  border: 1px solid #dce5ed;
  border-radius: 16px;
  background: #fff;
}
.simple-related span { color: #607087; font: 500 .86rem/1.5 var(--font); }

/* Notebook: preserve the paper metaphor without the old black frame. */
.notebook-filebar {
  gap: 9px;
  padding: 13px;
  border: 1px solid #dce5ed;
  border-top: 0;
  background: #f7f9fc;
}
.notebook-filebar label { color: #526176; font: 700 .72rem var(--font); }
.notebook-filebar input,
.notebook-filebar button {
  min-height: 38px;
  border: 1px solid #d3e0ea;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-family: var(--font);
}
.notebook-filebar button:hover { border-color: #176fac; background: #eaf5fd; color: #125f96; }
.notebook-document-head {
  padding: 32px clamp(18px, 5vw, 56px) 24px;
  border: 1px solid #dce5ed;
  border-top: 0;
  border-bottom-color: #e3e9ef;
  background: #fff;
}
.notebook-document-head > input { color: #111827; font-family: var(--font); }
.notebook-document-head p { color: #607087; font: 600 .72rem var(--font); }
.notebook-paper {
  border: 1px solid #dce5ed !important;
  border-top: 0 !important;
  border-radius: 0 0 22px 22px;
  background-color: #fff;
  box-shadow: 0 18px 48px rgba(28, 52, 75, .07);
}

@media (max-width: 1000px) {
  .planner-shell { grid-template-columns: 1fr; gap: 0; }
  .planner-form { border-right: 1px solid #dce5ed; border-bottom: 0; border-radius: 20px 20px 0 0; }
  .planner-result { border-radius: 0 0 20px 20px; }
  .formula-use > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .calculator-model-picker { grid-template-columns: repeat(5, minmax(175px, 1fr)); }
  .calculator-device[data-model] { padding: 0; border-radius: 18px; }
  .calculator-device[data-model] .scientific-screen { height: 245px; margin: 9px; }
  .calculator-guide { padding: 22px; border-radius: 18px; }
  .planner-shell { margin-top: 22px; padding-inline: 14px; }
  .planner-form,
  .planner-result { padding: 22px; }
  .formula-use > div { grid-template-columns: 1fr; }
  .formula-grid article,
  .formula-topic-list article { padding: 20px; }
  .tldr,
  .simple-checklist { padding: 20px; }
}

/* Search uses the same soft surfaces, blue icon tiles, and compact information
   hierarchy as the current MathGPTAI hubs. Only the descriptive title is a
   link; cards are deliberately not stretched anchors. */
.search-page {
  width: min(1240px, calc(100% - 40px));
  min-height: 70vh;
  margin: 0 auto;
  padding: 34px 0 90px;
}
.search-page-head { max-width: none; margin: 0; }
.search-page-title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
}
.search-page-title > span,
.search-result-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #eaf5ff;
  color: #176fac;
}
.search-page-title > span { width: 62px; height: 62px; }
.search-page-title svg,
.search-result-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.search-page-title h1 { margin: 0; color: #111827; letter-spacing: -.035em; }
.search-page-title p { margin: 7px 0 0; color: #647184; font-size: 1rem; }
.search-page-form { max-width: none; }
.search-page-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.search-page-form input[type="search"] {
  min-height: 58px;
  padding: 0 20px;
  font-size: 1rem;
}
.search-page-form .button {
  min-width: 128px;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: #176fac;
}
.search-suggestions {
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  font-size: .78rem;
}
.search-suggestions span { margin-right: 2px; color: #647184; font-weight: 700; }
.search-suggestions a {
  padding: 8px 12px;
  border: 1px solid #e1e7ee;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 700;
}
.search-suggestions a:hover { border-color: #b9d9ee; background: #f2f9fe; color: #125f96; }
.search-results-head {
  max-width: none;
  margin: 54px 0 22px;
  padding: 0;
  border: 0;
}
.search-results-head h2 { margin: 0; color: #111827; }
.search-results-head p { color: #647184; font-size: .9rem; }
.search-results {
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 0;
}
.search-result {
  min-height: 172px;
  padding: 23px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  border: 1px solid #dfe6ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: none;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.search-result:hover,
.search-result:focus-within {
  border-color: #afd4ec;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .07);
  transform: translateY(-2px);
}
.search-result-icon { width: 58px; height: 58px; }
.search-result:nth-child(3n + 2) .search-result-icon { background: #eafaf3; color: #169b68; }
.search-result:nth-child(3n) .search-result-icon { background: #f5efff; color: #7659d7; }
.search-result h3 { margin: 2px 0 9px; font-size: 1.18rem; line-height: 1.3; letter-spacing: -.02em; }
.search-result h3 a { color: #111827; text-decoration: none; }
.search-result h3 a:hover { color: #125f96; text-decoration: underline; text-underline-offset: 4px; }
.search-result p { margin: 0 0 16px; color: #647184; font-size: .86rem; line-height: 1.62; }
.search-result > div:last-child { display: flex; min-width: 0; flex-direction: column; }
.search-result > div:last-child > span { margin-top: auto; color: #607087; font-size: .74rem; font-weight: 750; }
.search-empty,
.search-start {
  max-width: none;
  margin: 46px 0 0;
  padding: 32px;
  border: 1px solid #dfe6ee;
  border-radius: 18px;
  background: #f7fafe;
}
.search-empty h2,
.search-start h2 { margin-top: 0; color: #111827; }
.search-start > div { border-top-color: #dfe6ee; }

@media (max-width: 800px) {
  .search-page { width: min(100% - 28px, 1240px); padding-top: 24px; }
  .search-results { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .search-page-title { align-items: flex-start; }
  .search-page-title > span { width: 52px; height: 52px; border-radius: 14px; }
  .search-page-form > div { grid-template-columns: 1fr; }
  .search-page-form .button { width: 100%; }
  .search-result { grid-template-columns: 48px minmax(0, 1fr); padding: 18px; }
  .search-result-icon { width: 48px; height: 48px; border-radius: 14px; }
  .search-result-icon svg { width: 25px; height: 25px; }
}

/* Custom mathematical icon language. Data records retain compact semantic
   keys, while every visible card receives a substantial line illustration
   matching the weight and rounded containers of the left navigation. */
.math-topic-icon {
  width: 72%;
  height: 72%;
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}
.math-topic-icon .icon-accent { stroke-width: 3.25; }
.math-topic-icon .icon-faint { stroke-width: 1.5; opacity: .22; }
.math-topic-icon .icon-dot { fill: currentColor; stroke: none; }
.math-topic-icon .icon-fill { fill: currentColor; stroke: none; opacity: .12; }
.math-topic-icon .icon-glyph {
  fill: currentColor;
  stroke: none;
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif;
  font-size: 66px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: central;
}

.mg-card-icon {
  width: 64px !important;
  height: 64px !important;
  border-radius: 18px !important;
}
.mg-card-icon .math-topic-icon { width: 42px !important; height: 42px !important; }
.page-icon,
.assessment-icon,
.calculator-recommendation-icon,
.mg-level-card-mark,
.mg-related-mark {
  width: 58px !important;
  height: 58px !important;
  display: grid;
  place-items: center;
}
.page-icon .math-topic-icon,
.assessment-icon .math-topic-icon,
.calculator-recommendation-icon .math-topic-icon,
.mg-level-card-mark .math-topic-icon,
.mg-related-mark .math-topic-icon { width: 38px; height: 38px; }
.calculator-link-grid i {
  width: 52px !important;
  height: 52px !important;
  border: 0 !important;
  border-radius: 15px !important;
  background: #eaf5ff !important;
  color: #125f96 !important;
}
.calculator-link-grid i .math-topic-icon { width: 35px; height: 35px; }
.related-grid .cl > span,
.course-rail .cl > span,
.compact-course-grid .cl > span {
  width: 52px !important;
  height: 52px !important;
  display: grid !important;
  place-items: center;
  border-radius: 15px !important;
  background: #eaf5ff !important;
  color: #125f96 !important;
}
.related-grid .cl > span .math-topic-icon,
.course-rail .cl > span .math-topic-icon,
.compact-course-grid .cl > span .math-topic-icon { width: 35px; height: 35px; }
.pathway-symbol .math-topic-icon { width: 38px; height: 38px; }
.detail-symbol .math-topic-icon { width: 68%; height: 68%; }
.card-chevron-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mg-card-arrow { display: grid; place-items: center; }
.formula-use article > span {
  width: 58px !important;
  height: 58px !important;
  border: 0 !important;
  border-radius: 16px;
  background: #eaf5ff !important;
  color: #125f96 !important;
}
.formula-use article > span .math-topic-icon { width: 39px; height: 39px; }
.cam-icon .math-topic-icon { width: 20px; height: 20px; }
.mg-gate-actions > span .math-topic-icon,
.mg-gate-icon .math-topic-icon { width: 28px; height: 28px; }
.ap-course-mark .math-topic-icon { width: 58px; height: 58px; }
.cancel-done-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 680px) {
  .mg-card-icon { width: 58px !important; height: 58px !important; }
  .mg-card-icon .math-topic-icon { width: 38px !important; height: 38px !important; }
}

/* Signed-in student dashboard. The information density follows the account
   workspace pattern used by ShareIt, while the palette, icon language, and
   learning actions remain specific to MathGPT AI. */
.student-dashboard.profile-shell {
  width: min(1240px, calc(100% - 40px));
  max-width: 1240px;
  margin: 28px auto 84px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.student-dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  padding: 30px 32px;
  border: 1px solid #dfe6ee;
  border-radius: 20px 20px 0 0;
  background: #fff;
}
.student-dashboard-identity {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.student-dashboard-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cde5f7;
  border-radius: 19px;
  background: linear-gradient(145deg, #eaf5ff, #d9edfc);
  color: #125f96;
  font-size: 1.55rem;
  font-weight: 800;
}
.student-dashboard-avatar img { width: 100%; height: 100%; object-fit: cover; }
.student-dashboard-head h1 {
  margin: 0;
  color: #111827;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -.04em;
}
.student-dashboard-head p {
  max-width: none;
  margin: 8px 0 2px;
  color: #5f6f84;
  font-size: .94rem;
  line-height: 1.5;
}
.student-dashboard-email { color: #8190a3; font-size: .78rem; }
.student-dashboard-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.student-dashboard-head-actions .button { min-height: 46px; border-radius: 12px; white-space: nowrap; }
.student-dashboard-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid #dfe6ee;
  border-top: 0;
  border-radius: 0 0 20px 20px;
  background: #f7f9fc;
  scrollbar-width: thin;
}
.student-dashboard-tabs a {
  flex: 0 0 auto;
  padding: 9px 15px;
  border-radius: 10px;
  color: #607086;
  font-size: .78rem;
  font-weight: 750;
}
.student-dashboard-tabs a:hover,
.student-dashboard-tabs a:focus-visible { background: #edf5fb; color: #125f96; }
.student-dashboard-tabs a[aria-current="page"] {
  background: #fff;
  color: #125f96;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
}
.student-dashboard-section { margin-top: 26px; }
.student-dashboard-section-head,
.student-dashboard-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
}
.student-dashboard-section-head { margin-bottom: 13px; padding: 0 3px; align-items: flex-end; }
.student-dashboard-section-head h2,
.student-dashboard-card h2 {
  margin: 0;
  color: #111827;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.student-dashboard-section-head p,
.student-dashboard-card-head p {
  margin: 6px 0 0;
  color: #718096;
  font-size: .82rem;
  line-height: 1.5;
}
.student-dashboard-section-head > a,
.student-text-link,
.student-dashboard-link-card a,
.student-dashboard-saved .profile-empty > a {
  color: #176fac;
  font-size: .78rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #a8d2ef;
  text-underline-offset: 4px;
}
.student-dashboard-metrics.profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: transparent;
  color: #111827;
}
.student-dashboard-metrics.profile-metrics article {
  min-width: 0;
  padding: 20px 22px;
  border: 1px solid #dfe6ee;
  border-radius: 16px;
  background: #fff;
}
.student-dashboard-metrics.profile-metrics span {
  display: block;
  overflow: hidden;
  color: #617086;
  font-size: .74rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.student-dashboard-metrics.profile-metrics b {
  display: block;
  margin: 7px 0 3px;
  color: #111827;
  font-family: var(--font);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}
.student-dashboard-metrics.profile-metrics article:nth-child(1) b { color: #176fac; }
.student-dashboard-metrics.profile-metrics article:nth-child(2) b { color: #07865c; }
.student-dashboard-metrics.profile-metrics article:nth-child(3) b { color: #7a3cc2; }
.student-dashboard-metrics.profile-metrics article:nth-child(4) b { color: #c56a14; }
.student-dashboard-metrics.profile-metrics small { color: #8b97a8; font-size: .68rem; }
.student-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, .85fr);
  gap: 18px;
  margin-top: 18px;
}
.student-dashboard-card {
  min-width: 0;
  padding: 26px;
  border: 1px solid #dfe6ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .035);
}
.student-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.student-tool-grid > a {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #e2e8ef;
  border-radius: 14px;
  background: #fbfcfe;
  transition: border-color .18s, background .18s, transform .18s;
}
.student-tool-grid > a:hover,
.student-tool-grid > a:focus-visible {
  border-color: #acd4ef;
  background: #f4faff;
  transform: translateY(-1px);
}
.student-tool-icon,
.student-feature-icon,
.student-empty-icon {
  display: grid;
  place-items: center;
  font-style: normal;
}
.student-tool-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}
.student-tool-icon .math-topic-icon { width: 34px; height: 34px; }
.student-tool-icon.blue,
.student-feature-icon.blue { background: #e7f3fc; color: #176fac; }
.student-tool-icon.purple,
.student-feature-icon.purple { background: #f4eafe; color: #7a3cc2; }
.student-tool-icon.green { background: #e8f8f1; color: #07865c; }
.student-tool-icon.orange { background: #fff2e5; color: #c56a14; }
.student-tool-grid b { display: block; color: #172033; font-size: .83rem; line-height: 1.35; }
.student-tool-grid small {
  display: block;
  margin-top: 3px;
  color: #77869a;
  font-size: .68rem;
  line-height: 1.45;
}
.student-plan-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf1f5;
  color: #526176;
  font-size: .68rem;
  font-weight: 800;
}
.student-plan-badge.is-pro { background: #e6f5ff; color: #125f96; }
.student-dashboard-account .student-dashboard-card-head { margin-bottom: 17px; }
.student-account-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #e7ebf0;
  font-size: .75rem;
}
.student-account-row span { color: #6b798d; }
.student-account-row b { color: #172033; text-align: right; }
.student-referral-copy {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 15px;
  color: #6b798d;
  font-size: .72rem;
}
.student-referral-copy b { color: #172033; }
.student-dashboard-account .referral-meter {
  height: 8px;
  margin: 9px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf3;
}
.student-dashboard-account .referral-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #176fac, #45a2df);
}
.student-dashboard-account > p { margin: 0 0 10px; color: #738196; font-size: .72rem; line-height: 1.55; }
.student-dashboard-practice { margin-top: 18px; }
.student-dashboard-practice .student-dashboard-card-head { align-items: center; }
.student-dashboard-practice .student-dashboard-card-head .button { min-height: 42px; border-radius: 11px; white-space: nowrap; }
.practice-result-summary { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 9px; }
.practice-result-summary span { padding: 9px 13px; border: 1px solid #d7e4ee; border-radius: 999px; background: #f5f9fc; color: #637287; font-size: .73rem; }
.practice-result-summary b { color: #172033; }
.practice-result-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.practice-result-grid article { padding: 17px; border: 1px solid #dce6ed; border-radius: 14px; background: #fbfdff; }
.practice-result-grid article > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.practice-result-grid article span { color: #526176; font-size: .76rem; font-weight: 800; }
.practice-result-grid article > div b { color: #176fac; font-size: 1.28rem; }
.practice-result-grid article p { margin: 9px 0 4px; color: #334155; font-size: .73rem; }
.practice-result-grid article time { display: block; color: #8491a2; font-size: .67rem; }
.practice-result-grid article a { display: inline-block; margin-top: 11px; color: #176fac; font-size: .72rem; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.practice-results-empty { min-height: 205px; margin-top: 18px; padding: 20px; border: 1px solid #e1e7ee; border-radius: 15px; background: #f9fbfd; }
.practice-results-empty h3 { color: #172033; font-size: 1.05rem; }
.practice-results-empty p { margin-bottom: 10px; color: #6f7e92; font-size: .76rem; }
.practice-results-empty > a { color: #176fac; font-weight: 800; }
.student-dashboard-saved { margin-top: 18px; }
.student-dashboard-saved .student-dashboard-card-head { align-items: center; }
.student-dashboard-saved .student-dashboard-card-head .button { min-height: 42px; border-radius: 11px; white-space: nowrap; }
.student-dashboard-saved .saved-graph-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
  border: 0;
}
.student-dashboard-saved .saved-graph-card,
.student-dashboard-saved .profile-empty {
  min-height: 230px;
  padding: 20px;
  border: 1px solid #e1e7ee;
  border-radius: 15px;
  background: #f9fbfd;
}
.student-dashboard-saved .profile-empty { min-height: 210px; }
.student-empty-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 15px;
  background: #e7f3fc;
  color: #176fac;
}
.student-empty-icon .math-topic-icon { width: 36px; height: 36px; }
.student-dashboard-saved .profile-empty h3 { color: #172033; font-size: 1.05rem; }
.student-dashboard-saved .profile-empty p { margin-bottom: 10px; font-size: .76rem; }
.student-dashboard-saved .saved-graph-card h3 { color: #172033; font-size: 1rem; }
.student-dashboard-saved .saved-graph-preview { border-radius: 10px; background: #eef4f8; }
.student-dashboard-saved .saved-graph-card .button { min-height: 38px; padding-inline: 14px; border-radius: 10px; font-size: .72rem; }
.student-dashboard-lower-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-dashboard-link-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 17px;
}
.student-feature-icon { width: 58px; height: 58px; border-radius: 16px; }
.student-feature-icon .math-topic-icon { width: 38px; height: 38px; }
.student-dashboard-link-card h2 { font-size: 1.18rem; }
.student-dashboard-link-card p { margin: 7px 0 10px; color: #6f7e92; font-size: .76rem; line-height: 1.55; }
.student-inline-links { display: flex; flex-wrap: wrap; gap: 8px 15px; }
.student-dashboard-note.profile-storage-note {
  margin: 18px 4px 0;
  color: #78869a;
  font-size: .69rem;
  line-height: 1.55;
}
.student-dashboard-note a { color: #176fac; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 980px) {
  .student-dashboard-head { align-items: flex-start; }
  .student-dashboard-head-actions { max-width: 230px; }
  .student-dashboard-grid { grid-template-columns: 1fr; }
  .practice-result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-dashboard-account { order: -1; }
}
@media (max-width: 760px) {
  .student-dashboard.profile-shell { width: min(100% - 24px, 1240px); margin-top: 14px; }
  .student-dashboard-head { flex-direction: column; padding: 23px 20px; }
  .student-dashboard-head h1 { font-size: 32px; }
  .student-dashboard-head-actions { width: 100%; max-width: none; justify-content: stretch; }
  .student-dashboard-head-actions .button { flex: 1 1 160px; }
  .student-dashboard-metrics.profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-tool-grid { grid-template-columns: 1fr; }
  .student-dashboard-lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .student-dashboard-identity { align-items: flex-start; gap: 14px; }
  .student-dashboard-avatar { width: 54px; height: 54px; flex-basis: 54px; border-radius: 15px; }
  .student-dashboard-head h1 { font-size: 29px; }
  .student-dashboard-head p { font-size: .82rem; }
  .student-dashboard-section-head,
  .student-dashboard-card-head { flex-direction: column; align-items: flex-start; }
  .student-dashboard-metrics.profile-metrics { gap: 9px; }
  .student-dashboard-metrics.profile-metrics article { padding: 17px 15px; }
  .student-dashboard-metrics.profile-metrics span { white-space: normal; line-height: 1.35; }
  .student-dashboard-metrics.profile-metrics b { font-size: 1.65rem; }
  .student-dashboard-card { padding: 20px; }
  .student-dashboard-practice .student-dashboard-card-head .button { width: 100%; }
  .practice-result-grid { grid-template-columns: 1fr; }
  .student-dashboard-saved .student-dashboard-card-head .button { width: 100%; }
  .student-dashboard-saved .saved-graph-grid { grid-template-columns: 1fr; }
  .student-dashboard-link-card { grid-template-columns: 48px minmax(0, 1fr); }
  .student-feature-icon { width: 48px; height: 48px; border-radius: 13px; }
  .student-feature-icon .math-topic-icon { width: 31px; height: 31px; }
}

/* MathGPT AI 3D surface workspace. This replaces the inherited ruled-panel
   treatment with the same rounded, quiet application chrome as the navigation
   and calculator cards. */
.surface-workspace[data-surface-tool] {
  width: min(1420px, calc(100% - 48px));
  max-width: 1420px;
  height: clamp(690px, 76vh, 860px);
  min-height: 690px;
  margin: 28px auto 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(330px, 380px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.surface-workspace[data-surface-tool] .surface-panel {
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
  border: 1px solid #dfe6ee;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .055);
  scrollbar-color: #bac6d3 transparent;
  scrollbar-width: thin;
}
.surface-workspace[data-surface-tool] .surface-panel-heading {
  align-items: flex-start;
  gap: 16px;
}
.surface-workspace[data-surface-tool] .surface-panel-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 26px;
  line-height: 1.15;
}
.surface-workspace[data-surface-tool] .surface-panel-heading p {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  color: #59697e;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
.surface-workspace[data-surface-tool] .surface-panel-heading button {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #176fac;
  border-radius: 12px;
  background: #176fac;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}
.surface-workspace[data-surface-tool] .surface-panel-heading button:hover { background: #125f96; }
.surface-workspace[data-surface-tool] .surface-expression-list { gap: 10px; margin: 22px 0 18px; }
.surface-workspace[data-surface-tool] .surface-expression-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 38px 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #dce4ec;
  border-radius: 15px;
  background: #f8fafc;
  box-shadow: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.surface-workspace[data-surface-tool] .surface-expression-row.active {
  border-color: #79bce9;
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(37, 136, 207, .1);
}
.surface-visibility-toggle {
  min-height: 66px;
  display: grid !important;
  place-items: center !important;
  align-self: stretch;
  padding: 0 !important;
  cursor: pointer;
}
.surface-visibility-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.surface-visibility-toggle span {
  width: 30px;
  height: 30px;
  display: grid !important;
  place-items: center;
  margin: 0 !important;
  border-radius: 9px;
  background: #e7f3fc;
  color: #176fac !important;
  font-family: var(--font) !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}
.surface-visibility-toggle input:not(:checked) + span { opacity: .42; text-decoration: line-through; }
.surface-expression-editor { min-width: 0; padding: 7px 4px; }
.surface-math-preview {
  width: 100%;
  min-height: 50px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #172033;
  text-align: left;
}
.surface-math-preview:hover,
.surface-math-preview:focus-visible { background: #edf6fd; outline: 0; }
.surface-math-preview output {
  min-width: 0;
  overflow: hidden;
  color: #172033;
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
}
.surface-math-preview output mjx-container { margin: 0 !important; }
.surface-math-preview > span {
  flex: 0 0 auto;
  color: #176fac;
  font-size: 14px;
  font-weight: 750;
}
.surface-expression-input {
  display: none;
  width: 100%;
  min-height: 46px;
  padding: 9px 10px !important;
  border: 1px solid #79bce9 !important;
  border-radius: 10px;
  background: #fff !important;
  color: #172033 !important;
  font-family: var(--mono) !important;
  font-size: 15px !important;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(37, 136, 207, .1);
}
.surface-expression-row.editing .surface-math-preview { display: none; }
.surface-expression-row.editing .surface-expression-input { display: block; }
.surface-color-control {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
}
.surface-workspace[data-surface-tool] .surface-color-control input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 3px;
  border: 1px solid #cdd7e2;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.surface-workspace[data-surface-tool] .surface-delete {
  align-self: stretch;
  border: 0;
  border-left: 1px solid #e4e9ef;
  background: transparent;
  color: #59697e;
  font-size: 20px;
}
.surface-workspace[data-surface-tool] .surface-delete:hover:not(:disabled) { background: #fff0f1; color: #d94a58; }
.surface-workspace[data-surface-tool] .surface-delete:disabled { background: #f1f4f7; color: #45556a; opacity: 1; }
.surface-control-group {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid #e2e8ef;
  border-radius: 15px;
  background: #f8fafc;
}
.surface-control-group > span {
  display: block;
  margin-bottom: 10px;
  color: #4f5f73;
  font-size: 14px;
  font-weight: 750;
}
.surface-workspace[data-surface-tool] .surface-presets {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}
.surface-workspace[data-surface-tool] .surface-presets button {
  min-height: 38px;
  padding: 7px 5px;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  background: #fff;
  color: #405066;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
}
.surface-workspace[data-surface-tool] .surface-presets button:hover,
.surface-workspace[data-surface-tool] .surface-presets button:focus-visible { border-color: #8bc4eb; background: #edf7fe; color: #125f96; }
.surface-workspace[data-surface-tool] .surface-range-control {
  display: block;
  margin: 20px 0;
  color: #263449;
  font-size: 14px;
  font-weight: 700;
}
.surface-range-control > span { display: flex !important; justify-content: space-between; align-items: center; margin: 0 0 9px !important; }
.surface-range-control output { color: #68788c; font-family: var(--mono); font-size: 14px; font-weight: 500; }
.surface-workspace[data-surface-tool] input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #2588cf;
}
.surface-workspace[data-surface-tool] .surface-selects { gap: 10px; }
.surface-workspace[data-surface-tool] .surface-selects label {
  color: #263449;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
}
.surface-workspace[data-surface-tool] .surface-selects select {
  min-height: 44px;
  margin-top: 7px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #dce4ec;
  border-radius: 11px;
  background-color: #f8fafc;
  color: #263449;
  font-size: 15px;
}
.surface-workspace[data-surface-tool] .surface-options { gap: 9px; margin-top: 20px; }
.surface-workspace[data-surface-tool] .surface-options label {
  min-height: 38px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e1e7ee;
  border-radius: 10px;
  background: #f8fafc;
  color: #405066;
  font-size: 14px;
  font-weight: 650;
}
.surface-workspace[data-surface-tool] .surface-options input { width: 17px; height: 17px; accent-color: #2588cf; }
.surface-workspace[data-surface-tool] .surface-panel > p {
  margin: 20px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid #e4e9ef;
  color: #59697e;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}
.surface-workspace[data-surface-tool] .surface-stage {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dbe4ec;
  border-radius: 22px;
  background: #edf6fc;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .055);
}
.surface-workspace[data-surface-tool] .surface-stage canvas:focus-visible { box-shadow: inset 0 0 0 3px rgba(37, 136, 207, .5); }
.surface-workspace[data-surface-tool] .surface-stage-actions {
  top: 16px;
  right: 16px;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.surface-workspace[data-surface-tool] .surface-stage-actions > div {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(205, 220, 232, .95);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 5px 16px rgba(15, 23, 42, .06);
  backdrop-filter: blur(10px);
}
.surface-workspace[data-surface-tool] .surface-stage-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #34445a;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}
.surface-workspace[data-surface-tool] .surface-stage-actions button:hover,
.surface-workspace[data-surface-tool] .surface-stage-actions button:focus-visible { background: #eaf5fd; color: #125f96; outline: 0; }
.surface-workspace[data-surface-tool] .surface-stage-actions .surface-export-button { background-color: #176fac !important; color: #fff !important; }
.surface-workspace[data-surface-tool] .surface-stage-actions .surface-export-button:hover { background-color: #125f96 !important; color: #fff !important; }
.surface-workspace[data-surface-tool] .surface-axis-key { left: 16px; bottom: 16px; gap: 6px; }
.surface-workspace[data-surface-tool] .surface-axis-key span {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .1);
}
.surface-workspace[data-surface-tool] .surface-axis-key .x { background: #b83242; }
.surface-workspace[data-surface-tool] .surface-axis-key .y { background: #087a51; }
.surface-workspace[data-surface-tool] .surface-axis-key .z { background: #176fac; }
.surface-workspace[data-surface-tool] .surface-hud {
  right: 16px;
  bottom: 16px;
  padding: 8px 11px;
  border: 1px solid rgba(205, 220, 232, .95);
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  color: #637288;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
  backdrop-filter: blur(10px);
}
.surface-workspace[data-surface-tool] > .share-slot {
  grid-column: 1 / -1;
  min-height: 54px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.surface-workspace[data-surface-tool] > .share-slot .share-result { margin: 0; }

@media (max-width: 1000px) {
  .surface-workspace[data-surface-tool] {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto 620px auto;
  }
  .surface-workspace[data-surface-tool] .surface-panel { max-height: none; }
  .surface-workspace[data-surface-tool] .surface-stage { height: 620px; }
}
@media (max-width: 680px) {
  .surface-workspace[data-surface-tool] {
    width: calc(100% - 20px);
    grid-template-rows: auto 520px auto;
    gap: 12px;
    margin-top: 18px;
  }
  .surface-workspace[data-surface-tool] .surface-panel { padding: 18px; border-radius: 18px; }
  .surface-workspace[data-surface-tool] .surface-panel-heading { flex-direction: column; }
  .surface-workspace[data-surface-tool] .surface-panel-heading button { width: 100%; justify-content: center; }
  .surface-workspace[data-surface-tool] .surface-expression-row { grid-template-columns: 40px minmax(0, 1fr) 36px 34px; }
  .surface-workspace[data-surface-tool] .surface-math-preview output { font-size: 16px; }
  .surface-workspace[data-surface-tool] .surface-math-preview > span { display: none; }
  .surface-workspace[data-surface-tool] .surface-stage { height: 520px; border-radius: 18px; }
  .surface-workspace[data-surface-tool] .surface-stage-actions {
    left: 10px;
    right: 10px;
    top: 10px;
    max-width: none;
    align-items: stretch;
    flex-direction: column;
  }
  .surface-workspace[data-surface-tool] .surface-stage-actions > div { width: 100%; }
  .surface-workspace[data-surface-tool] .surface-stage-actions > div:first-child { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .surface-workspace[data-surface-tool] .surface-stage-actions button { flex: 1; min-width: 0; padding-inline: 5px; }
  .surface-workspace[data-surface-tool] .surface-hud { left: 14px; right: auto; max-width: calc(100% - 28px); }
}

/* Shared utility cleanup: keep every calculator workspace in the same quiet,
   rounded MathGPT AI system and remove the remaining ruled legacy surfaces. */
.utility-tool-header {
  border-bottom-color: #e3e9ef;
}
.utility-tool-header h1 { font-size: 36px; line-height: 1.12; }

.notebook-app {
  overflow: hidden;
  border: 1px solid #dce5ed;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .055);
}
.notebook-toolbar { border: 0; border-bottom: 1px solid #e2e8ef; }
.notebook-document-head {
  padding: 30px clamp(20px, 4vw, 48px) 22px;
  border: 0;
  border-bottom: 1px solid #e6ebf0;
  background: #fbfdff;
}
.notebook-document-head > input { font-size: 26px; line-height: 1.2; }
.notebook-paper { border: 0 !important; background: #fff; }
.notebook-block {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid #dfe6ed !important;
  border-left: 1px solid #dfe6ed !important;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
}
.notebook-block-rail {
  gap: 3px;
  padding: 10px 7px;
  border-right: 1px solid #e3e9ef;
  background: #f5f9fc;
}
.notebook-block-rail .notebook-block-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #e4f2fc;
  color: #176fac;
}
.notebook-block-rail .notebook-block-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notebook-block-rail small {
  padding: 3px 0 6px;
  writing-mode: initial;
  color: #617086;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 750;
  text-transform: capitalize;
}
.notebook-block-rail button {
  width: 36px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  color: #536176;
  font-family: var(--font);
  font-size: 14px;
}
.notebook-block-rail button:hover { background: #e7f3fc; color: #176fac; }
.notebook-block > div:last-child { padding: 18px; }
.notebook-block input,
.notebook-block textarea { font-family: var(--font); }
.notebook-block output { border-top-color: #e3e9ef; font-family: var(--font); }

.matrix-card {
  padding: 24px;
  border: 1px solid #dce5ed !important;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .045);
}
.matrix-grid {
  gap: 8px;
  padding: 10px;
  border: 1px solid #dfe6ed !important;
  border-inline-width: 1px !important;
  border-radius: 14px;
  background: #f7fafc;
}
.matrix-grid input { border-radius: 10px; background: #fff; font-family: var(--font); }
.matrix-operations {
  margin: 16px 0;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid #dfe6ed;
  border-radius: 16px;
  background: #fff;
}
.matrix-primary-operations,
.matrix-advanced-operations > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.matrix-operations button {
  min-height: 42px;
  padding: 8px 13px;
  border-color: #dce4ec;
  border-radius: 10px;
}
.matrix-parameter {
  min-width: 190px;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 9px;
  color: #425168;
  font-size: 13px;
}
.matrix-parameter span { color: #176fac; font-family: Georgia, serif; font-size: 18px; font-style: normal; }
.matrix-parameter input {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 42px;
  border: 1px solid #dce4ec;
  border-radius: 10px;
  background: #f8fafc;
  font-family: var(--font);
}
.matrix-advanced-operations {
  grid-column: 1 / -1;
  padding-top: 11px;
  border-top: 1px solid #e3e9ef;
}
.matrix-advanced-operations summary {
  width: max-content;
  min-height: 40px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dce4ec;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  list-style: none;
}
.matrix-advanced-operations summary::-webkit-details-marker { display: none; }
.matrix-advanced-operations summary::after { content: '+'; color: #176fac; font-size: 17px; line-height: 1; }
.matrix-advanced-operations[open] summary::after { content: '−'; }
.matrix-advanced-operations > div { padding-top: 10px; }
.matrix-output {
  min-height: 220px;
  padding: 26px;
  grid-template-columns: 240px minmax(0, 1fr);
  border: 1px solid #dce5ed !important;
  border-radius: 20px;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .045);
}
.matrix-output > div:first-child p,
.matrix-output > p { color: #617086; }
.matrix-output [data-matrix-result] > strong {
  min-width: 86px;
  min-height: 64px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfe3f2;
  border-radius: 15px;
  background: #eef8ff;
  color: #176fac;
  font-family: var(--font);
  font-size: 28px;
}
.matrix-result-item > strong { color: #425168; font-family: var(--font); }
.matrix-result-math {
  min-width: max-content;
  padding: 18px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfe3f2;
  border-radius: 15px;
  background: #eef8ff;
  color: #123f61;
  font-size: 20px;
}
.matrix-result-math mjx-container { margin: 0 !important; }
.matrix-output .calculation-work { border-top-color: #dfe6ed; }

.geometry-workspace {
  gap: 12px;
  padding: 0;
  overflow: hidden;
  border: 0 !important;
  border-radius: 22px;
  background: transparent;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .055);
}
.geometry-workspace .visual-tool-bar {
  grid-column: 1 / -1;
  border: 1px solid #dce5ed;
  border-radius: 18px;
}
.geometry-stage,
.geometry-inspector {
  border: 1px solid #dce5ed !important;
  border-radius: 18px;
  background-color: #fff;
}
.geometry-stage { overflow: hidden; }
.geometry-inspector { padding: 24px; }
.geometry-properties,
.geometry-object-list { border-top-color: #e3e9ef; }
.geometry-object-list > div { border-top-color: #e3e9ef; }

/* Reusable explanatory sections no longer fall back to black spreadsheet-like
   rules on calculator, subject, and guide pages. */
.subject-method-grid {
  gap: 12px;
  border: 0;
  background: transparent;
}
.subject-method-grid article,
.subject-method-grid > li {
  min-height: 0;
  padding: 24px;
  border: 1px solid #e0e7ee;
  border-radius: 16px;
  background: #fff;
}
.subject-method-grid h3 { margin: 0 0 10px; }
.subject-method-grid p { font-size: .92rem; line-height: 1.65; }
.calculator-information-lead,
.calculator-input-table,
.calculator-check-grid aside {
  overflow: hidden;
  border: 1px solid #e0e7ee;
  border-radius: 16px;
  background: #fff;
}
.calculator-information-lead article + article { border-left-color: #e0e7ee; }
.calculator-input-table > div + div,
.calculator-input-table strong { border-color: #e0e7ee; }
.calculator-check-grid aside { padding: 26px; }

@media (max-width: 680px) {
  .utility-tool-header h1 { font-size: 36px; }
  .notebook-app { border-radius: 16px; }
  .notebook-block { grid-template-columns: 50px minmax(0, 1fr); }
  .notebook-block-rail { padding-inline: 5px; }
  .notebook-block-rail .notebook-block-icon { width: 34px; height: 34px; }
  .matrix-card,
  .matrix-output { padding: 18px 14px; border-radius: 16px; }
  .matrix-operations { grid-template-columns: 1fr; padding: 10px; }
  .matrix-primary-operations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix-parameter { min-width: 0; }
  .matrix-advanced-operations { grid-column: 1; }
  .matrix-advanced-operations summary { width: 100%; justify-content: space-between; }
  .matrix-advanced-operations > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix-output { grid-template-columns: 1fr; }
  .geometry-workspace { padding-inline: 0; border-radius: 16px; }
  .geometry-workspace .visual-tool-bar,
  .geometry-stage,
  .geometry-inspector { border-radius: 14px; }
}

/* Keep consecutive content sections connected. The shared section wrapper used
   to contribute as much as 88px on both sides of every boundary; these values
   are exactly half of the previous desktop and mobile spacing. */
.section {
  padding-block: clamp(24px, 2.75vw, 44px);
}

.section.prose > h2:first-child { margin-top: 1.1em; }
.section.prose > p:last-child { margin-bottom: .5em; }

/* Preserve the same 50% reduction where page-specific rules previously
   overrode the shared section padding. */
.calculator-information { padding-bottom: clamp(17px, 2vw, 30px); }
.calculator-information + .section,
.calculator-information + .article-layout { padding-top: clamp(17px, 2vw, 30px); }
.ap-course-hero ~ .section,
.ap-resource-hero ~ .section { padding-block: 36px; }

@media (max-width: 680px) {
  .section { padding-block: 26px; }
  .calculator-information { padding-bottom: 17px; }
  .ap-course-hero ~ .section,
  .ap-resource-hero ~ .section { padding-block: 27px; }
}

/* Calculus has one primary answer, followed by a full-width explanation. Do not
   leave a vacant second result column or let a long MathJax expression escape
   the answer card. */
.calculus-result { grid-template-columns: minmax(0, 1fr); }
.calculus-result > div:first-child {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.calculus-result > div:first-child > strong {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}
.calculus-result > div:first-child > strong mjx-container {
  min-width: max-content;
  margin-inline: 0 !important;
}

/* Purpose-built calculators share the MathGPT AI workspace language: compact
   white panels, blue answer surfaces, quiet borders, and no legacy eyebrow or
   spreadsheet treatments. The grid items size to their content instead of
   stretching both columns to the height of the longer panel. */
.purpose-tool {
  grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 16px;
  padding: clamp(24px, 3vw, 40px) clamp(16px, 3vw, 40px);
  background: #f7f9fc;
}
.purpose-tool > form,
.purpose-tool-result {
  min-width: 0;
  padding: clamp(22px, 2.5vw, 30px);
  border: 1px solid #dfe6ed;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .055);
}
.purpose-tool form header > span,
.purpose-tool-result > header > span { display: none; }
.purpose-tool form h2 { margin: 0 0 10px; }
.purpose-tool form header p,
.purpose-tool-result > header p {
  margin: 0;
  color: #526176;
  line-height: 1.65;
}
.purpose-tool-fields { gap: 14px; margin: 22px 0; }
.purpose-tool-fields label { gap: 8px; color: #111827; }
.purpose-tool-fields input,
.purpose-tool-fields select,
.purpose-tool-fields textarea {
  min-height: 50px;
  border-color: #d7e0e8;
  border-radius: 12px;
  background: #f8fafc !important;
}
.purpose-tool-fields :where(input, select, textarea):focus {
  outline: 3px solid rgba(37, 139, 210, .2);
  outline-offset: 1px;
  border-color: #258bd2;
}
.purpose-tool-examples { margin-bottom: 18px; }
.purpose-tool-examples button {
  border-color: #cfe3f2;
  background: #f1f8fe !important;
  color: #125f96;
}
.purpose-tool-actions { gap: 10px; }
.purpose-tool-actions .button { min-height: 48px; }

.purpose-tool-result > header {
  min-width: 0;
  padding: 22px;
  overflow: hidden;
  border: 1px solid #cfe3f2;
  border-radius: 16px;
  background: #f1f8fe;
}
.purpose-tool-result > header strong {
  display: block;
  max-width: 100%;
  margin: 0 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  color: #111827;
  font-family: var(--font);
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -.025em;
}
.purpose-tool-result > header strong mjx-container {
  min-width: max-content;
  margin-inline: 0 !important;
}
.purpose-tool-result > header p { margin-top: 4px; }
.purpose-tool-metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  margin: 14px 0 0;
}
.purpose-tool-metrics > div {
  min-width: 0;
  padding: 16px;
  border-color: #dfe6ed;
  border-radius: 14px;
  background: #fff;
}
.purpose-tool-metrics b {
  color: #111827;
  font-family: var(--font);
  font-size: 1rem;
}
.purpose-tool-work {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 12px;
  margin-top: 16px;
}
.purpose-tool-work section,
.purpose-tool-work section:last-child {
  min-width: 0;
  padding: 20px;
  border: 1px solid #dfe6ed;
  border-radius: 15px;
  background: #f8fafc;
}
.purpose-tool-work h2 { margin: 0 0 12px; color: #111827; }
.purpose-tool-work ol { padding-left: 22px; color: #425168; line-height: 1.65; }
.purpose-tool-work li + li { margin-top: 8px; }
.purpose-tool-result .share-slot { margin-top: 16px; }

@media (max-width: 820px) {
  .purpose-tool {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 14px;
  }
}

@media (max-width: 480px) {
  .purpose-tool > form,
  .purpose-tool-result { padding: 18px; border-radius: 16px; }
  .purpose-tool-result > header { padding: 18px; }
  .purpose-tool-actions { display: grid; }
  .purpose-tool-actions .button { width: 100%; }
}

/* Remove the remaining spaced-uppercase/serif remnants found by the full
   rendered-route audit. These are functional labels, not editorial eyebrows. */
.upgrade-plan-copy small,
.dock-keypad .keypad-tabs > span {
  text-transform: none;
  letter-spacing: 0;
}
.matrix-parameter span { font-family: var(--font); }

/* Canonical MathGPT AI treatment for the remaining legacy exam and
   assessment surfaces. Keep these as independent, quiet cards rather than
   the old spreadsheet rules and dark utility bars. */
.exam-method {
  gap: 12px;
  border: 0;
  background: transparent;
}
.exam-method article,
.exam-method article:last-child {
  min-width: 0;
  padding: 24px;
  border: 1px solid #dfe6ed;
  border-radius: 16px;
  background: #fff;
}
.exam-method article > span { display: none; }
.exam-method h3 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 1.3rem;
  letter-spacing: -.025em;
}
.exam-method p {
  margin: 0;
  color: #526176;
  font-size: .95rem;
  line-height: 1.65;
}

.assessment-page { background: #f7f9fc; }
.assessment-header {
  height: 64px;
  padding-inline: clamp(16px, 3vw, 32px);
  border: 0;
  border-bottom: 1px solid #dfe6ed;
  background: rgba(255, 255, 255, .97);
  color: #111827;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .04);
  font-family: var(--font);
  font-size: .85rem;
}
.assessment-header > span {
  color: #526176;
  font-family: var(--font);
  font-weight: 700;
}
.assessment-mode-switch { gap: 8px; }
.assessment-mode-switch a,
.assessment-mode-switch button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid #dce5ed;
  border-radius: 999px;
  background: #fff;
  color: #526176;
  font-family: var(--font);
}
.assessment-mode-switch a[aria-current="page"],
.assessment-mode-switch button[aria-pressed="true"] {
  border-color: #176fac !important;
  background: #176fac !important;
  color: #fff !important;
}
.assessment-layout {
  gap: 18px;
  padding: 18px;
}
.assessment-config,
.assessment-workspace {
  border: 1px solid #dfe6ed;
  border-radius: 18px;
  background: #fff;
}
.assessment-config { padding: 30px 24px 36px; }
.assessment-workspace { padding: clamp(32px, 5vw, 72px); }
.assessment-icon {
  border: 0;
  border-radius: 15px;
  background: #eaf5fd;
  color: #176fac;
  font-family: var(--font);
}
.assessment-config > p:first-of-type,
.assessment-config legend,
.assessment-select,
.assessment-welcome > span,
.assessment-results > span {
  color: #526176;
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.assessment-config > p:first-of-type { margin: 8px 0 20px; }
.assessment-config fieldset button {
  min-height: 44px;
  border-color: #dfe6ed;
  background: #fff;
  color: #334155;
  font-family: var(--font);
  font-size: .85rem;
}
.assessment-config fieldset button.active {
  border-color: #176fac !important;
  background: #eef7fd !important;
  color: #125f96 !important;
}
.assessment-rules {
  border: 1px solid #cfe3f2;
  border-radius: 14px;
  background: #f1f8fe;
  color: #334155;
}
.assessment-results > strong {
  color: #176fac;
  font-family: var(--font);
}
.assessment-results [data-result-units] { gap: 10px; }
.assessment-results [data-result-units] > div {
  border-color: #dfe6ed;
  background: #f8fafc;
}
.assessment-review { border-top: 1px solid #dfe6ed; }

@media (max-width: 1050px) {
  .exam-method { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .assessment-layout { padding: 10px; }
  .assessment-config,
  .assessment-workspace { border-radius: 15px; }
}
@media (max-width: 680px) {
  .exam-method { grid-template-columns: minmax(0, 1fr); }
  .exam-method article { border-bottom: 1px solid #dfe6ed; }
}

/* Final eyebrow cleanup from the exhaustive rendered-route scan. These are
   ordinary interface labels, so keep natural casing and normal tracking. */
.practice-config legend,
.question-meta,
.question-meta > span,
.session-score,
.session-score > span,
.session-score b,
.ap-course-mark small,
.calculation-work summary span,
.four-screen-meta,
.four-screen-meta > span,
.slider-limit,
.slider-limit > span,
.calculator-example-list > b,
.filter-row,
.filter-row > span,
.screen-toolbar,
.screen-toolbar > span {
  font-family: var(--font);
  letter-spacing: 0;
  text-transform: none;
}

/* Practice sessions use the same light MathGPT AI workspace chrome as the
   calculators and assessments. */
.practice-top {
  border-bottom: 1px solid #dfe6ed;
  border-radius: 23px 23px 0 0;
  background: #fff;
  color: #111827;
}
.practice-top > button {
  min-height: 40px;
  border: 1px solid #dce5ed;
  border-radius: 999px;
  background: #fff;
  color: #334155;
}
.practice-top > button span { color: #176fac; }
.progress-track { background: #e8edf3; }
.progress-track i { background: #258bd2; }
.practice-config,
.practice-tools {
  border-top: 0;
  background: #f8fafc;
}
.practice-config { padding: 26px 22px; }
.practice-config fieldset button { border-color: #dfe6ed; }
.practice-config fieldset button.active {
  border-color: #176fac !important;
  background: #eef7fd !important;
  color: #125f96 !important;
}
.session-score {
  gap: 8px;
  border: 0;
}
.session-score span {
  border: 1px solid #dfe6ed !important;
  border-radius: 12px;
  background: #fff;
}
.question-card { padding: clamp(25px, 4vw, 48px); }
.question-meta > span {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef7fd;
  color: #125f96;
}
.practice-tools { padding: 24px 18px; }
.practice-tools > a,
.practice-tools > button { border-color: #dfe6ed; }
.practice-tip {
  border: 1px solid #cfe3f2;
  border-radius: 14px;
  background: #f1f8fe;
  color: #334155;
}

/* Purpose-specific calculator heroes need the same recognizable visual mark
   used by the calculator library and left navigation. */
.purpose-tool-hero {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}
.purpose-tool-hero-icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid #cfe3f2;
  border-radius: 22px;
  background: #eaf5fd;
  color: #176fac;
}
.purpose-tool-hero-icon .math-topic-icon {
  width: 52px;
  height: 52px;
}

/* Original MathGPT AI practice workspace. The active question is the visual
   center; session controls stay compact and resources remain close at hand. */
.practice-workspace {
  width: min(calc(100% - 40px), 1240px);
  margin: 24px auto 64px;
  overflow: hidden;
  border: 1px solid #d8e3ec;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(30, 64, 90, .08);
}
.practice-workspace .practice-top {
  min-height: 58px;
  padding: 0 22px;
  display: grid;
  grid-template-columns: 1fr minmax(180px, 340px) 1fr;
  gap: 20px;
  border-bottom: 1px solid #dfe8ef;
  border-radius: 0;
  background: #fff;
  color: #172033;
}
.practice-start-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.practice-back { display: inline-flex; align-items: center; gap: 8px; width: max-content; color: #334155; font-weight: 700; }
.practice-back svg, .practice-timer svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.practice-session-progress { min-width: 0; text-align: center; font-weight: 750; }
.practice-workspace .progress-track { width: 100%; height: 5px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e6edf3; }
.practice-workspace .progress-track i { display: block; height: 100%; border-radius: inherit; background: #258bd2; }
.practice-workspace .practice-timer {
  justify-self: end;
  min-height: 40px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d6e2ec;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font: inherit;
}
.practice-timer span { color: #176fac; font-weight: 800; font-variant-numeric: tabular-nums; }
.practice-timer small { font-size: .75rem; }
.practice-track-intro {
  padding: 22px 28px;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  background: linear-gradient(120deg, #f6fbff, #fff 70%);
  border-bottom: 1px solid #dfe8ef;
}
.practice-track-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid #cce2f1;
  border-radius: 18px;
  background: #eaf5fd;
  color: #176fac;
}
.practice-track-icon .math-topic-icon { width: 44px; height: 44px; }
.practice-track-intro h1 { margin: 0 0 5px; font-size: clamp(1.9rem, 3vw, 2.55rem); line-height: 1.05; letter-spacing: -.045em; }
.practice-track-intro p { max-width: none; margin: 0; color: #5c6b82; font-size: 1rem; line-height: 1.55; }
.practice-score { display: flex; gap: 8px; }
.practice-score span { min-width: 88px; padding: 9px 12px; border: 1px solid #dbe5ed; border-radius: 12px; background: #fff; color: #627089; font-size: .74rem; text-align: center; }
.practice-score b { display: block; color: #172033; font-size: 1.2rem; line-height: 1.1; }
.practice-level-bar {
  padding: 14px 28px;
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(420px, 1.6fr) minmax(160px, .7fr);
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #dfe8ef;
  background: #fff;
}
.practice-level-copy { display: grid; gap: 2px; }
.practice-level-copy strong { color: #172033; }
.practice-level-copy span { color: #68778d; font-size: .78rem; }
.practice-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.practice-levels button { min-width: 0; padding: 8px 10px; display: grid; gap: 1px; border: 1px solid #d8e3ec; border-radius: 12px; background: #f8fafc; color: #415169; font: inherit; text-align: left; cursor: pointer; }
.practice-levels button b { font-size: .85rem; }
.practice-levels button small { overflow: hidden; font-size: .68rem; white-space: nowrap; text-overflow: ellipsis; }
.practice-levels button.active {
  border-color: #b9d8ed;
  background: #eaf5fd;
  color: #125f96;
  box-shadow: none;
}
.practice-quiet { display: flex; align-items: center; gap: 9px; color: #334155; cursor: pointer; }
.practice-quiet input { width: 18px; height: 18px; accent-color: #176fac; }
.practice-quiet span { display: grid; }
.practice-quiet b { font-size: .82rem; }
.practice-quiet small { color: #68778d; font-size: .68rem; }
.practice-workspace .practice-body {
  max-width: none;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: start;
  background: #f5f9fc;
}
.practice-workspace .question-card {
  min-height: 430px;
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid #d9e4ec;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(30, 64, 90, .06);
}
.practice-workspace .question-meta { justify-content: flex-start; gap: 8px; }
.practice-workspace .question-meta > span { padding: 6px 11px; border: 1px solid #cce2f1; border-radius: 999px; background: #eef8ff; color: #176fac; font-size: .76rem; font-weight: 750; }
.practice-workspace .question-card > h2 { max-width: none; margin: clamp(28px, 5vw, 50px) 0 32px; font-size: clamp(1.65rem, 3vw, 2.6rem); line-height: 1.3; letter-spacing: -.035em; }
.practice-workspace .answer-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.practice-workspace .answer-options button { min-height: 72px; padding: 13px 16px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; border: 1px solid #d8e3ec; border-radius: 15px; background: #fbfdff; color: #172033; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.practice-workspace .answer-options button:hover { border-color: #7bb9e2; background: #f3faff; }
.practice-workspace .answer-options button.selected {
  border-color: #b9d8ed;
  background: #eaf5fd;
  box-shadow: none;
}
.practice-workspace .answer-options button.correct { border-color: #2d9b68; background: #eaf7f0; }
.practice-workspace .answer-options button.incorrect { border-color: #e45858; background: #fff0f0; }
.answer-letter { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #cddbe6; border-radius: 10px; background: #fff; color: #52627a; font-size: .78rem; }
.answer-copy { min-width: 0; overflow-wrap: anywhere; }
.practice-workspace .answer-options .practice-level-complete {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid #cfe2ef;
  border-radius: 16px;
  background: #f3f9fe;
  color: #334155;
}
.practice-level-complete > b { display: block; color: #172033; font-size: 1.05rem; }
.practice-level-complete > p { margin: 7px 0 0; color: #5c6b82; line-height: 1.55; }
.practice-level-complete > div { margin-top: 17px; display: flex; flex-wrap: wrap; gap: 9px; }
.practice-level-complete button {
  min-height: 46px !important;
  width: auto !important;
  padding: 10px 16px !important;
  display: inline-flex !important;
  grid-template-columns: none !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
}
.practice-level-complete .practice-advance-level { border-color: #176fac !important; background: #1f7ab5 !important; color: #fff !important; }
.practice-level-complete .practice-restart-level { background: #fff !important; color: #31536d !important; }
.practice-workspace .question-actions { margin-top: 26px; align-items: stretch; }
.practice-clue-button, .practice-check-button { min-height: 50px; padding: 11px 18px; border-radius: 13px; font: inherit; font-weight: 800; cursor: pointer; }
.practice-clue-button { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #d3dfe8; background: #fff; color: #334155; }
.practice-clue-button svg { width: 22px; height: 22px; fill: none; stroke: #176fac; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.practice-check-button { min-width: 190px; border: 1px solid #176fac; background: #1f7ab5; color: #fff; box-shadow: 0 8px 20px rgba(31, 122, 181, .2); }
.practice-check-button:hover { background: #17699f; }
.practice-workspace .hint-box, .practice-workspace .feedback-box { border: 1px solid #cfe2ef; border-radius: 13px; background: #f4faff; }
.practice-workspace .feedback-box.correct { border-color: #a9dbc2; background: #effaf4; }
.practice-workspace .feedback-box.incorrect, .practice-workspace .feedback-box.error { border-color: #f0c5c5; background: #fff5f5; }
.practice-workspace .feedback-box ol { margin: 12px 0 0 20px; padding: 0; }
.practice-workspace .feedback-box li + li { margin-top: 7px; }
.practice-workspace .answer-options .practice-test-result {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid #cfe2ef;
  border-radius: 18px;
  background: #f4faff;
}
.practice-test-score { display: flex; align-items: center; gap: 18px; }
.practice-test-score strong { color: #176fac; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; }
.practice-test-score span { color: #526176; font-weight: 750; }
.practice-test-result > p { margin: 14px 0 0; color: #526176; line-height: 1.55; }
.practice-test-result-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.practice-test-result-actions button,
.practice-test-result-actions a {
  width: auto !important;
  min-height: 46px !important;
  padding: 10px 17px !important;
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: center;
  border: 1px solid #c8d9e6 !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: #31536d !important;
  font: inherit;
  font-weight: 800 !important;
  text-decoration: none;
  cursor: pointer;
}
.practice-test-result-actions .practice-save-result { border-color: #176fac !important; background: #1f7ab5 !important; color: #fff !important; }
.practice-test-result-actions .practice-advance-level { border-color: #d5e1ea !important; background: #edf4f8 !important; }
.practice-save-status { min-height: 1.4em; margin: 10px 0 0; color: #526176; font-size: .76rem; }
.practice-save-status a { color: #176fac; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.practice-workspace .practice-tools { padding: 20px; display: flex; flex-direction: column; border: 1px solid #d9e4ec; border-radius: 20px; background: #fff; }
.practice-tools h2 { margin: 0 0 4px; font-size: 1.15rem; }
.practice-tools > p { margin: 0 0 13px; color: #526176; font-size: .78rem; line-height: 1.45; }
.practice-workspace .practice-tools > a { padding: 11px 0; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; border: 0; border-top: 1px solid #e3eaf0; color: #26344a; }
.practice-workspace .practice-tools > a > span:last-child { display: grid; }
.practice-workspace .practice-tools a b { font-size: .84rem; }
.practice-workspace .practice-tools a small { color: #526176; font-size: .71rem; }
.practice-tool-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: #eaf5fd; color: #176fac; }
.practice-tool-icon .math-topic-icon { width: 28px; height: 28px; }
.practice-workspace .practice-tip { margin: 14px 0 0; padding: 14px; border: 1px solid #cfe3f2; border-radius: 14px; background: #f1f8fe; color: #334155; }
.practice-workspace .practice-tip p { margin: 5px 0 0; color: #5f6f85; font-size: .75rem; line-height: 1.55; }
.practice-report { margin-top: 12px; padding: 8px 0 0; border: 0; border-top: 1px solid #e3eaf0; background: transparent; color: #627089; font: inherit; font-size: .72rem; text-align: left; cursor: pointer; }

@media (max-width: 900px) {
  .practice-level-bar { grid-template-columns: 1fr; gap: 10px; }
  .practice-level-copy { display: none; }
  .practice-workspace .practice-body { grid-template-columns: 1fr; }
  .practice-workspace .practice-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .practice-tools h2, .practice-tools > p, .practice-workspace .practice-tip, .practice-report { grid-column: 1 / -1; }
  .practice-workspace .practice-tools > a { border: 1px solid #d9e4ec; border-radius: 13px; padding: 10px; }
}
@media (max-width: 680px) {
  .practice-workspace { width: calc(100% - 20px); margin-top: 10px; border-radius: 20px; }
  .practice-workspace .practice-top { padding: 0 12px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .practice-start-actions { gap: 5px; }
  .practice-back { font-size: 0; }.practice-back svg { width: 24px; height: 24px; }
  .practice-quick-nav > button { padding-inline: 9px; font-size: .72rem; }
  .practice-quick-nav > div { left: 0; width: min(300px, calc(100vw - 44px)); }
  .practice-timer small { display: none; }
  .practice-track-intro { padding: 18px; grid-template-columns: 50px 1fr; gap: 12px; }
  .practice-track-icon { width: 50px; height: 50px; border-radius: 14px; }.practice-track-icon .math-topic-icon { width: 34px; height: 34px; }
  .practice-track-intro h1 { font-size: 1.75rem; }.practice-track-intro p { font-size: .85rem; }
  .practice-score { grid-column: 1 / -1; }.practice-score span { flex: 1; }
  .practice-level-bar { padding: 12px 16px; }
  .practice-levels button small { display: none; }.practice-levels button { text-align: center; }
  .practice-workspace .practice-body { padding: 12px; gap: 12px; }
  .practice-workspace .question-card { min-height: 0; padding: 22px 16px; border-radius: 17px; }
  .practice-workspace .question-card > h2 { margin: 28px 0 24px; font-size: 1.55rem; }
  .practice-workspace .answer-options { grid-template-columns: 1fr; }
  .practice-workspace .question-actions { flex-direction: column-reverse; }
  .practice-check-button { width: 100%; }
  .practice-workspace .practice-tools { grid-template-columns: 1fr; }
  .practice-tools h2, .practice-tools > p, .practice-workspace .practice-tip, .practice-report { grid-column: auto; }
}
.calculator-hero-heading,
.utility-tool-header > .utility-tool-heading,
.scientific-intro-heading {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.calculator-hero-heading > div,
.utility-tool-heading > div,
.scientific-intro-heading > div { min-width: 0; }
.calculator-hero-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid #cfe3f2;
  border-radius: 20px;
  background: #eaf5fd;
  color: #176fac;
}
.calculator-hero-icon .math-topic-icon { width: 46px; height: 46px; }
.calculator-hero-heading h1,
.calculator-hero-heading p,
.utility-tool-heading h1,
.utility-tool-heading p,
.scientific-intro-heading h1,
.scientific-intro-heading p { width: 100%; max-width: none; }
.utility-tool-heading h1,
.scientific-intro-heading h1 { margin: 0 0 10px; }
.purpose-tool-hero-copy {
  min-width: 0;
  width: 100%;
}
.purpose-tool-hero-copy h1 {
  width: 100%;
  max-width: none;
  margin: 0 0 12px !important;
}
.purpose-tool-hero-copy p {
  width: 100%;
  max-width: none;
  margin: 0;
  color: #526176;
}

/* Retire the remaining heavy editorial rules in shared public surfaces. */
.ap-track > header {
  border-width: 0 0 1px !important;
  border-color: #e1e7ee;
}
.school-account-note {
  border-left-width: 1px !important;
  border-radius: 12px;
  background: #f1f8fe !important;
}

@media (max-width: 680px) {
  .purpose-tool-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .purpose-tool-hero-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }
  .purpose-tool-hero-icon .math-topic-icon {
    width: 38px;
    height: 38px;
  }
  .calculator-hero-heading,
  .utility-tool-header > .utility-tool-heading,
  .scientific-intro-heading {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
  }
  .calculator-hero-icon { width: 58px; height: 58px; border-radius: 16px; }
  .calculator-hero-icon .math-topic-icon { width: 38px; height: 38px; }
}

/* Graphing calculator rebuild: the graph and expression list are the primary
   workspace. The optional keypad expands below them instead of squeezing the
   list to zero height. */
.graph-calculator-intro {
  width: min(calc(100% - 32px), 1500px);
  margin: 22px auto 0;
  padding: 26px 28px;
  display: block;
  border: 1px solid #dfe6ed;
  border-radius: 22px;
  background: #fff;
}
.graph-calculator-intro .calculator-hero-heading { width: 100%; max-width: none; align-items: start; }
.graph-calculator-intro .calculator-hero-icon { margin-top: 3px; }
.graph-calculator-intro h1 { margin: 0 0 8px !important; }
.graph-calculator-intro p { margin: 0; color: #526176; font-size: 1rem; line-height: 1.55; }
.graph-intro-notes { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-top: 14px; }
.graph-intro-notes span {
  padding: 8px 11px;
  border: 1px solid #dbe7f0;
  border-radius: 999px;
  background: #f5faff;
  color: #31536d;
  font-size: .875rem;
  font-weight: 750;
  white-space: nowrap;
}
.workspace[data-tool="calculator"] {
  height: auto;
  min-height: 0;
  grid-template-columns: minmax(390px, 32%) minmax(0, 1fr);
  grid-template-rows: 680px auto;
  margin-top: 14px;
  overflow: hidden;
}
.workspace[data-tool="calculator"] > .expression-panel,
.workspace[data-tool="calculator"] > .canvas-wrap { min-height: 680px; }
.workspace[data-tool="calculator"] .workspace-title {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px;
}
.workspace[data-tool="calculator"] .workspace-title > div:first-child { min-width: 0; }
.workspace[data-tool="calculator"] .workspace-title h2 { margin: 0 0 4px; font-size: 1.2rem !important; }
.workspace[data-tool="calculator"] .workspace-title p { margin: 0; color: #64748b; font-size: .78rem; }
.workspace[data-tool="calculator"] .history-controls { grid-column: auto; width: auto; flex: none; }
.workspace[data-tool="calculator"] .history-controls button { min-width: 38px; min-height: 38px; }
.workspace[data-tool="calculator"] .history-controls .save-graph-button { min-width: 66px; }
.workspace[data-tool="calculator"] .graph-toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 8px;
}
.workspace[data-tool="calculator"] .graph-toolbar button { min-height: 40px; font-size: .76rem; }
.graph-example-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  overflow-x: auto;
  border-bottom: 1px solid #e5eaf0;
  background: #fbfcfe;
}
.graph-example-strip span { color: #64748b; font-size: .75rem; font-weight: 750; }
.graph-example-strip button {
  min-height: 32px;
  padding: 5px 9px;
  flex: none;
  border: 1px solid #dce5ed;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: .72rem;
  font-weight: 700;
}
.graph-example-strip button:hover { border-color: #89bde3; background: #eef8ff; color: #125f96; }
.workspace[data-tool="calculator"] .expression-list { min-height: 210px; margin: 0; }
.workspace[data-tool="calculator"] .expression-row { margin: 8px; overflow: hidden; border: 1px solid #e0e7ee !important; border-radius: 12px; }
.workspace[data-tool="calculator"] .expression-row.is-selected {
  background: #f4faff;
  box-shadow: inset 4px 0 0 #258bd2;
}
.workspace[data-tool="calculator"] .expression-row.is-selected .expression-number,
.workspace[data-tool="calculator"] .expression-row.is-selected .visibility-dot { color: #334155; }
.workspace[data-tool="calculator"] .expression-row.is-selected .slider-actions button { color: #176fac; }
.workspace[data-tool="calculator"] .expression-main { min-height: 64px; }
.workspace[data-tool="calculator"] .expression-input { height: 63px !important; font-size: 1.05rem !important; }
.workspace[data-tool="calculator"] .add-row { margin: 0 8px 8px; width: calc(100% - 16px); min-height: 42px; border: 1px dashed #cbd9e4; border-radius: 10px; background: #f8fbfd; }
.workspace[data-tool="calculator"] .workspace-footer { padding-left: 6px; border-top: 1px solid #e5eaf0; }
.workspace[data-tool="calculator"] .workspace-footer a { border-radius: 9px 0 0 0; }
.workspace[data-tool="calculator"] .canvas-wrap { border-left: 1px solid #e3e9ef; background: #fff; }
.graph-empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100% - 40px));
  padding: 24px;
  transform: translate(-50%, -50%);
  border: 1px solid #cfe3f2;
  border-radius: 18px;
  background: rgba(247, 251, 255, .96);
  text-align: center;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}
.graph-empty-state[hidden] { display: none !important; }
.graph-empty-state strong { display: block; margin-bottom: 7px; font-size: 1.1rem; }
.graph-empty-state span { display: block; color: #607086; font-size: .86rem; }
.graph-empty-state button { margin-top: 16px; padding: 10px 14px; border: 0; border-radius: 10px; background: #176fac; color: #fff; font-weight: 750; }
.graph-status {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 7px 10px;
  border: 1px solid #dce6ee;
  border-radius: 9px;
  background: rgba(255, 255, 255, .94);
  color: #526176;
  font-size: .75rem;
  font-weight: 700;
}
.workspace[data-tool="calculator"] .graph-readout { bottom: 16px; }
.workspace[data-tool="calculator"] .graph-label { bottom: 16px; }
.workspace[data-tool="calculator"] > .dock-keypad { grid-row: 2; }
.workspace[data-tool="calculator"].panel-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.workspace[data-tool="calculator"].panel-collapsed .workspace-title { padding: 10px; }

@media (max-width: 1050px) {
  .workspace[data-tool="calculator"] { grid-template-columns: minmax(350px, 42%) minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .graph-calculator-intro { width: calc(100% - 20px); margin-top: 10px; padding: 20px 16px; border-radius: 18px; }
  .graph-intro-notes { display: flex; gap: 6px; margin-top: 12px; }
  .graph-intro-notes span { padding: 7px 10px; font-size: .78rem; }
  .workspace[data-tool="calculator"] {
    width: calc(100% - 20px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 500px;
    border-radius: 18px !important;
  }
  .workspace[data-tool="calculator"] > .expression-panel { min-height: 440px; height: 440px; }
  .workspace[data-tool="calculator"] > .canvas-wrap { min-height: 500px; height: 500px; }
  .workspace[data-tool="calculator"] .workspace-title {
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .workspace[data-tool="calculator"] .history-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .workspace[data-tool="calculator"] .history-controls .save-graph-button { margin-right: auto; }
  .workspace[data-tool="calculator"] .workspace-title p { display: none; }
  .workspace[data-tool="calculator"] .graph-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graph-example-strip { padding-inline: 9px; }
  .workspace[data-tool="calculator"] .graph-label { display: none; }
  .workspace[data-tool="calculator"] .graph-readout { left: 10px; bottom: 10px; }
  .workspace[data-tool="calculator"] > .dock-keypad { grid-row: auto; }
}

/* Homepage account and engagement actions. Keep the action itself as the only
   link so its anchor text describes the destination precisely. */
.home-engagement {
  width: min(940px, 100%);
  margin: 28px auto 0;
  text-align: left;
}
.home-engagement-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}
.home-engagement-heading h2 {
  margin: 0;
  color: #111827;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.12;
  letter-spacing: -.035em;
}
.home-engagement-heading p {
  max-width: 660px;
  margin: 7px 0 0;
  color: #607087;
  font-size: .95rem;
  line-height: 1.55;
}
.home-engagement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.home-engagement-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 10px 14px;
  align-items: start;
  padding: 17px;
  border: 1px solid #dbe5ed;
  border-radius: 20px;
  background: #f8fbfe;
  box-shadow: none;
}
.home-engagement-card:hover { box-shadow: none; transform: none; }
.home-engagement-card-signup {
  grid-column: 1 / -1;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  align-items: center;
  border-color: #b9d9ef;
  background: #eef8ff;
}
.home-engagement-icon {
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #e8f4fd;
  color: #176fac;
}
.home-engagement-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-engagement-icon-referral { background: #edf8f2; color: #16815d; }
.home-engagement-icon-group { background: #f1effd; color: #6454b8; }
.home-engagement-icon-premium { background: #fff4e8; color: #c4641c; }
.home-engagement-icon-practice { background: #f8edfb; color: #9b35b8; }
.home-engagement-card h3 {
  margin: 1px 0 4px;
  color: #142033;
  font-size: 1.02rem;
  line-height: 1.25;
}
.home-engagement-card p {
  margin: 0;
  color: #607087;
  font-size: .86rem;
  line-height: 1.48;
}
.home-engagement-link {
  grid-column: 2;
  width: max-content;
  max-width: 100%;
  color: #126aa5;
  font-size: .86rem;
  font-weight: 760;
  line-height: 1.35;
  text-decoration: none !important;
}
.home-engagement-link:hover,
.home-engagement-link:focus,
.home-engagement-link:active { color: #0d5688; text-decoration: none !important; }
.home-engagement-card-signup .home-engagement-link {
  grid-column: 3;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid #176fac;
  border-radius: 12px;
  background: #176fac;
  color: #fff;
}
.home-engagement-card-signup .home-engagement-link:hover,
.home-engagement-card-signup .home-engagement-link:focus { background: #125f96; color: #fff; }

@media (max-width: 720px) {
  .home-engagement { margin-top: 22px; }
  .home-engagement-grid { grid-template-columns: minmax(0, 1fr); }
  .home-engagement-card,
  .home-engagement-card-signup {
    grid-column: 1;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    padding: 15px;
    border-radius: 17px;
  }
  .home-engagement-icon { width: 48px; height: 48px; border-radius: 14px; }
  .home-engagement-icon svg { width: 31px; height: 31px; }
  .home-engagement-card-signup .home-engagement-link,
  .home-engagement-link { grid-column: 2; min-height: auto; padding: 0; border: 0; border-radius: 0; background: transparent; color: #126aa5; }
  .home-engagement-card-signup .home-engagement-link:hover,
  .home-engagement-card-signup .home-engagement-link:focus { background: transparent; color: #0d5688; }
}

/* Study groups: shared roster, truthful organiser rewards, and private work. */
.group-hero {
  padding-block: clamp(42px, 6vw, 76px) !important;
}
.group-hero h1,
.group-hero p {
  max-width: 1180px !important;
}
.group-page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 70px;
}
.group-management.referral-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.group-management .plan-card,
.group-management .share-shell,
.group-reward-card {
  max-width: none;
  margin: 0;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid #d7e3ec;
  border-radius: 22px;
  background: #fff;
  box-shadow: none;
}
.group-management .plan-card h2,
.group-management .share-shell h2,
.group-reward-card h2 {
  margin: 5px 0 12px;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  letter-spacing: -.035em;
}
.group-card-label {
  margin: 0;
  color: #176fac;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.group-roster-card .group-members {
  margin: 18px 0 22px;
  gap: 9px;
}
.group-roster-card .group-members li {
  padding: 8px 13px;
  border-color: #d7e3ec;
  background: #f5f9fc;
}
.group-invite-card .share-link {
  margin-top: 18px;
}
.group-invite-card .share-link > span {
  color: #52647b;
  font-family: inherit;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}
.group-invite-card .share-link input,
.group-create-card .group-create input {
  min-height: 50px;
  border: 1px solid #d7e3ec;
  border-radius: 12px;
  background: #f8fbfd;
}
.group-invite-card .share-link .button,
.group-create-card .group-create .button {
  min-height: 50px;
  border-radius: 12px;
}
.group-invite-card .share-buttons .button {
  min-height: 42px;
  border-color: #bfd4e4;
  border-radius: 11px;
  background: #fff;
  color: #176fac;
}
.group-invite-card .share-buttons .button:hover {
  box-shadow: none;
  background: #eef7fd;
}
.group-management .form-note {
  margin-bottom: 0;
  color: #52647b;
  line-height: 1.65;
}
.group-management .form-note a,
.group-benefit-card a {
  color: #176fac;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.group-reward-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .75fr);
  gap: 12px 34px;
  align-items: center;
  background: #f1f8fd;
}
.group-reward-card .form-note {
  grid-column: 1 / -1;
}
.group-reward-progress {
  height: 13px;
  border-radius: 999px;
  background: #dceaf4;
  overflow: hidden;
}
.group-reward-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #258bd2;
}
.group-create-card .group-create {
  margin-top: 18px;
}
.group-create-card .group-create input {
  padding-inline: 15px;
}
.group-create-card .group-create .button {
  border-color: #1f7ab5;
  background: #1f7ab5;
  color: #fff;
}
.group-overview-card .group-steps {
  margin-top: 18px;
  padding-left: 24px;
  gap: 12px;
  color: #52647b;
}
.group-benefits,
.group-perks {
  margin-top: 28px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid #d7e3ec;
  border-radius: 24px;
  background: #f5f9fc;
}
.group-section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
  gap: 18px 40px;
  align-items: end;
  margin-bottom: 24px;
}
.group-section-heading h2 {
  margin: 0;
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  letter-spacing: -.045em;
}
.group-section-heading p {
  margin: 0;
  color: #52647b;
  line-height: 1.6;
}
.group-benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.group-benefit-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 5px 17px;
  align-items: start;
  padding: 22px;
  border: 1px solid #d7e3ec;
  border-radius: 18px;
  background: #fff;
}
.group-benefit-icon {
  grid-row: 1 / span 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #eaf5fc;
  color: #176fac;
}
.group-benefit-icon .math-topic-icon {
  width: 38px;
  height: 38px;
}
.group-benefit-card h3 {
  margin: 4px 0 5px;
  font-size: 1.2rem;
}
.group-benefit-card p {
  margin: 0;
  color: #52647b;
  line-height: 1.6;
}
.group-perks {
  background: #fff;
}
.group-perk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.group-perk-grid article {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid #c9dfef;
  border-radius: 18px;
  background: #f1f8fd;
}
.group-perk-grid strong {
  color: #145f93;
  font-size: 1.08rem;
}
.group-perk-grid span,
.group-perk-owner {
  color: #52647b;
  line-height: 1.6;
}
.group-perk-owner {
  margin: 18px 0 0;
}
@media (max-width: 800px) {
  .group-management.referral-shell,
  .group-benefit-grid,
  .group-perk-grid,
  .group-section-heading,
  .group-reward-card {
    grid-template-columns: 1fr;
  }
  .group-reward-card .form-note {
    grid-column: auto;
  }
}
@media (max-width: 560px) {
  .group-page { width: min(100% - 24px, 1180px); padding-top: 22px; }
  .group-management .plan-card,
  .group-management .share-shell,
  .group-reward-card,
  .group-benefits,
  .group-perks { border-radius: 18px; }
  .group-invite-card .share-link { grid-template-columns: 1fr; }
  .group-benefit-card { grid-template-columns: 48px minmax(0, 1fr); padding: 18px; }
  .group-benefit-icon { width: 48px; height: 48px; border-radius: 13px; }
  .group-benefit-icon .math-topic-icon { width: 32px; height: 32px; }
}

/* MathGPT AI tutor result — calm, readable and consistent with the current UI. */
.solution {
  width: min(calc(100% - 48px), 1320px);
  max-width: 1320px;
  margin: 24px auto 72px;
  padding: clamp(24px, 3vw, 42px);
  border: 1px solid #d7e4ee;
  border-radius: 28px;
  background: #fff;
  box-shadow: none;
}
.solution-head {
  gap: 22px;
  align-items: center;
  margin: 0 0 30px;
  padding: 0 0 26px;
  border: 0;
  border-bottom: 1px solid #e3edf4;
}
.solution-head h2 { margin: 0 0 7px; color: #101828; font-size: 26px; line-height: 1.2; }
.solution-head p { margin: 0; color: #66758b; font-size: .9rem; }
.solution-head-actions { align-items: center; }
.solution-head-actions .button {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid #d6e2eb;
  border-radius: 14px;
  box-shadow: none;
}
.solution-head-actions .button-outline { background: #f7fbfe; color: #176ca5; }
.solution-head-actions .button-dark { border-color: #176fac; background: #176fac; color: #fff; }
.solution-head-actions .button:hover { box-shadow: none; transform: none; }

.solution-body { width: 100%; max-width: none; color: #172033; font-size: 1rem; line-height: 1.72; }
.solution-body > h2 {
  margin: 34px 0 12px;
  padding: 0;
  border: 0;
  color: #101828;
  font-size: 26px;
  line-height: 1.25;
}
.solution-body > h2:first-child { margin-top: 0; }
.solution-body h3 { margin: 24px 0 9px; color: #172033; font-size: 21px; }
.solution-body p,
.solution-body li { color: #2f3b4e; }
.solution-body ol,
.solution-body ul { margin: 10px 0 20px; padding-left: 26px; }
.solution-body li { padding: 3px 0 3px 5px; }
.solution-body hr { height: 1px; margin: 32px 0; border: 0; background: #e3edf4; }
.solution-body blockquote {
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid #d5e5f0;
  border-radius: 16px;
  background: #f3f9fd;
  color: #172033;
  font-family: var(--font);
  font-size: 1rem;
}
.solution-equation,
.solution-final-content > .solution-equation {
  margin: 15px 0 22px;
  padding: 20px 22px;
  border: 1px solid #d5e5f0;
  border-radius: 16px;
  background: #f5f9fc;
  text-align: center;
  box-shadow: none;
}

.first-share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  margin: 0 0 28px;
  padding: 20px 22px;
  border: 1px solid #cde2f0;
  border-radius: 18px;
  background: #eef8fe;
}
.first-share p { color: #334155; }
.first-share .button { border: 0; border-radius: 13px; background: #1978b8; color: #fff; box-shadow: none; }
.first-share .button:hover { box-shadow: none; transform: none; }

.hint-controls {
  margin: 20px 0;
  padding: 17px 18px;
  border: 1px solid #d5e5f0;
  border-radius: 16px;
  background: #f7fbfe;
}
.hint-controls p { color: #334155; }
.hint-controls .button { min-height: 44px; border-radius: 12px; box-shadow: none; }
.hint-controls .button:hover { box-shadow: none; transform: none; }
.hint-turn { margin-top: 28px; padding-top: 0; border: 0; }

.solution-final-card {
  margin: 32px 0 20px;
  overflow: hidden;
  border: 1px solid #bcdcf0;
  border-radius: 20px;
  background: #eef8fe;
  box-shadow: none;
}
.solution-final-card > h2 {
  margin: 0;
  padding: 20px 24px 0;
  border: 0;
  background: transparent;
  color: #145f91;
  font-size: 26px;
}
.solution-final-content { padding: 18px 24px 24px; }
.solution-final-content > p { color: #233149; }
.solution-final-content > blockquote {
  margin: 0 0 18px;
  padding: 18px 20px;
  border: 1px solid #cfe1ed;
  border-radius: 14px;
  background: #fff;
  color: #172033;
}

.solution-next {
  margin: 36px 0 0;
  padding: 24px;
  border: 1px solid #d5e5f0;
  border-radius: 22px;
  background: #f3f9fd;
}
.solution-next-intro { margin-bottom: 18px; }
.solution-next-intro h3 { margin: 0; color: #101828; font-size: 1.35rem; }
.solution-next-intro p { color: #637188; font-size: .88rem; }
.solution-next-grid {
  gap: 12px;
  border: 0;
  background: transparent;
}
.solution-next-grid a {
  min-height: 140px;
  padding: 20px;
  border: 1px solid #d7e4ee;
  border-radius: 16px;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.solution-next-grid a:hover,
.solution-next-grid a:focus-visible { border-color: #85bfe4; background: #f9fcfe; box-shadow: none; transform: none; }
.solution-next-grid strong { margin: 0 0 20px; color: #172033; font-size: 1rem; }
.solution-next-grid b { color: #176fac; font-size: .78rem; }

.follow-up { margin-top: 28px; }
.follow-up-form {
  gap: 12px;
  padding: 20px;
  border: 1px solid #d5e5f0;
  border-radius: 20px;
  background: #f7fbfe;
}
.follow-up-form label {
  color: #334155;
  font: 750 .86rem var(--font);
  text-transform: none;
  letter-spacing: 0;
}
.follow-up-form textarea {
  min-height: 110px;
  padding: 14px 16px;
  border: 1px solid #d7e4ee;
  border-radius: 14px;
  background: #fff;
  font-family: var(--font);
}
.follow-up-form .button { min-height: 48px; border: 0; border-radius: 13px; background: #1978b8; color: #fff; box-shadow: none; }
.follow-up-form .button:hover { box-shadow: none; transform: none; }
.follow-up-question { padding: 14px 16px; border: 1px solid #d5e5f0; border-radius: 14px; background: #f3f9fd; }

@media (max-width: 680px) {
  .solution { width: calc(100% - 24px); margin: 16px 12px 56px; padding: 20px 16px; border-radius: 22px; }
  .solution-head { align-items: stretch; flex-direction: column; padding-bottom: 20px; }
  .solution-head-actions { width: 100%; }
  .solution-head-actions .button { flex: 1; }
  .solution-equation,
  .solution-final-content > .solution-equation { margin-inline: 0; padding-inline: 12px; }
  .first-share { grid-template-columns: 1fr; }
  .first-share .button { width: 100%; }
  .solution-final-card { margin-inline: 0; }
  .solution-final-card > h2 { padding: 18px 18px 0; }
  .solution-final-content { padding: 16px 18px 18px; }
  .solution-next { padding: 18px; }
  .solution-next-grid { grid-template-columns: 1fr; }
  .solution-next-grid a { min-height: 112px; }
  .hint-controls { align-items: stretch; flex-direction: column; }
  .hint-controls div,
  .hint-controls .button { width: 100%; }
}

/* Shared MathGPT AI data-table system.
   Every public table is kept inside .table-scroll so one light, accessible
   component replaces the inherited MathGPTNow dark headers and heavy rules. */
main .table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 20px 0 32px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  border: 1px solid #d7e4ee;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(31, 61, 84, .055);
  scrollbar-width: thin;
  scrollbar-color: #a9cce5 #edf6fc;
  -webkit-overflow-scrolling: touch;
}
main .table-scroll > table,
main .table-scroll > .lesson-table,
main .table-scroll > .plan-table,
main .table-scroll > .calculator-input-table {
  display: table;
  width: 100%;
  min-width: 640px;
  margin: 0;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  color: #111827;
  font: 520 15px/1.6 var(--font);
}
main .table-scroll > table caption {
  caption-side: top;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid #dce8f1;
  background: #f8fbfe;
  color: #31516c;
  font: 720 14px/1.4 var(--font);
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
}
main .table-scroll > table th,
main .table-scroll > table td {
  min-width: 0;
  padding: 17px 20px;
  border: 0;
  border-right: 1px solid #e1eaf1;
  border-bottom: 1px solid #e1eaf1;
  color: #4f6077;
  font-family: var(--font);
  font-style: normal;
  line-height: 1.6;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}
main .table-scroll > table thead th {
  background: #edf7fd;
  color: #244964;
  font: 750 14px/1.4 var(--font);
  letter-spacing: 0;
  text-transform: none;
}
main .table-scroll > table tbody th {
  background: #f8fbfe;
  color: #18283b;
  font-weight: 720;
}
main .table-scroll > table tbody td {
  background: #fff;
}
main .table-scroll > table tbody tr:nth-child(even) td {
  background: #fbfdff;
}
main .table-scroll > table tbody tr:hover > * {
  background: #f1f8fd;
}
main .table-scroll > table tr > :last-child {
  border-right: 0;
}
main .table-scroll > table tbody tr:last-child > * {
  border-bottom: 0;
}
main .table-scroll > table a {
  color: #146fae;
  font-weight: 700;
  text-decoration-color: #9bc7e5;
  text-underline-offset: 3px;
}
main .table-scroll > table mjx-container[display="true"] {
  max-width: 100%;
  margin-block: .15em;
  overflow-x: auto;
  overflow-y: hidden;
}

@media (max-width: 760px) {
  main .table-scroll {
    margin: 16px 0 26px;
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(31, 61, 84, .045);
  }
  main .table-scroll > table,
  main .table-scroll > .lesson-table,
  main .table-scroll > .plan-table,
  main .table-scroll > .calculator-input-table {
    display: table;
    min-width: 620px;
    font-size: 14px;
  }
  main .table-scroll > table th,
  main .table-scroll > table td {
    padding: 14px 16px;
  }
  main .table-scroll > table thead th {
    font-size: 13px;
  }
}

/* Authored calculator guidance: MathGPT AI cards, not the legacy MathGPTNow article skin. */
.calculator-information-mathgptai {
  width: min(1480px, calc(100% - 48px));
  margin-inline: auto;
  padding-top: clamp(24px, 3vw, 42px);
}
.calculator-information-mathgptai .calculator-authored-grid {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 18px;
}
.calculator-information-mathgptai .calculator-info-card,
.calculator-information-mathgptai .calculator-info-summary {
  min-width: 0;
  margin: 0;
  padding: clamp(24px, 2.5vw, 34px);
  border: 1px solid #d8e4ed;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 61, 84, .055);
}
.calculator-information-mathgptai .calculator-info-summary,
.calculator-information-mathgptai .calculator-info-reference,
.calculator-information-mathgptai .calculator-info-mistakes,
.calculator-information-mathgptai .calculator-info-faq,
.calculator-information-mathgptai .calculator-info-related {
  grid-column: 1 / -1;
}
.calculator-information-mathgptai .calculator-info-summary {
  border-color: #c8e2f4;
  background: #f1f8fd;
}
.calculator-information-mathgptai .calculator-authored h2 {
  max-width: none;
  margin: 0 0 18px !important;
  padding: 0 !important;
  border: 0 !important;
  color: #111827;
  font: 760 26px/1.18 var(--font) !important;
  letter-spacing: -.025em;
  text-transform: none;
}
.calculator-information-mathgptai .calculator-info-summary h2 {
  color: #125f96;
}
.calculator-information-mathgptai .calculator-authored h3 {
  margin: 0 0 10px;
  color: #111827;
  font: 740 19px/1.3 var(--font);
  letter-spacing: -.015em;
}
.calculator-information-mathgptai .calculator-authored p,
.calculator-information-mathgptai .calculator-authored li,
.calculator-information-mathgptai .calculator-authored td,
.calculator-information-mathgptai .calculator-authored th {
  color: #4f6077;
  font-family: var(--font);
  font-style: normal;
  line-height: 1.65;
}
.calculator-information-mathgptai .calculator-info-summary ul,
.calculator-information-mathgptai .calculator-info-card > ol,
.calculator-information-mathgptai .calculator-info-related ul {
  margin: 0;
}
.calculator-information-mathgptai .calculator-info-summary li {
  padding-block: 5px;
  font-size: 16px;
  font-weight: 560;
}
.calculator-information-mathgptai .calculator-info-card > ol {
  padding-left: 22px;
}
.calculator-information-mathgptai .calculator-info-card > ol li {
  padding: 7px 0;
  font-size: 16px;
}
.calculator-information-mathgptai .calculator-info-card > ol strong {
  color: #111827;
}
.calculator-information-mathgptai .calculator-info-relationship .math-display {
  min-width: 0;
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  border: 1px solid #c8e2f4;
  border-radius: 17px;
  background: #edf7fd;
  color: #111827;
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  line-height: 1.45;
}
.calculator-information-mathgptai .table-scroll {
  margin: 0;
  border: 1px solid #d8e4ed;
  border-radius: 17px;
  background: #fff;
}
.calculator-information-mathgptai .calculator-input-table,
.calculator-information-mathgptai .lesson-table {
  width: 100%;
  min-width: 640px;
  border: 0;
  border-collapse: collapse;
  background: #fff;
  font-size: 15px;
}
.calculator-information-mathgptai .calculator-input-table caption,
.calculator-information-mathgptai .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.calculator-information-mathgptai .calculator-input-table th,
.calculator-information-mathgptai .calculator-input-table td,
.calculator-information-mathgptai .lesson-table th,
.calculator-information-mathgptai .lesson-table td {
  padding: 15px 18px;
  border: 0;
  border-right: 1px solid #dfe8ef;
  border-bottom: 1px solid #dfe8ef;
  text-align: left;
  vertical-align: top;
}
.calculator-information-mathgptai .calculator-input-table tr > :last-child,
.calculator-information-mathgptai .lesson-table tr > :last-child {
  border-right: 0;
}
.calculator-information-mathgptai .calculator-input-table tbody tr:last-child > *,
.calculator-information-mathgptai .lesson-table tbody tr:last-child > * {
  border-bottom: 0;
}
.calculator-information-mathgptai .calculator-input-table thead th,
.calculator-information-mathgptai .lesson-table thead th {
  border-color: #d5e4ef;
  background: #edf7fd;
  color: #31516c;
  font: 720 13px/1.35 var(--font);
  letter-spacing: 0;
  text-transform: none;
}
.calculator-information-mathgptai .calculator-input-table tbody th,
.calculator-information-mathgptai .lesson-table tbody th {
  background: #f8fbfd;
  color: #1f2a3a;
  font-weight: 720;
  white-space: normal;
}
.calculator-information-mathgptai .lesson-table tbody tr:hover td {
  background: #f7fbfe;
}
.calculator-information-mathgptai .calculator-mistake-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.calculator-information-mathgptai .calculator-mistake-grid .callout {
  min-width: 0;
  margin: 0;
  padding: 22px;
  border: 1px solid #d8e4ed;
  border-radius: 17px;
  background: #f8fbfd;
}
.calculator-information-mathgptai .calculator-mistake-grid .callout p {
  margin: 8px 0 0;
  font-size: 15px;
}
.calculator-information-mathgptai .calculator-mistake-grid .callout strong {
  color: #125f96;
}
.calculator-information-mathgptai .calculator-faq-list {
  display: grid;
  gap: 10px;
}
.calculator-information-mathgptai .calculator-faq-list details {
  margin: 0;
  padding: 0;
  border: 1px solid #d8e4ed;
  border-radius: 15px;
  background: #f8fbfd;
}
.calculator-information-mathgptai .calculator-faq-list summary {
  position: relative;
  padding: 18px 54px 18px 20px;
  cursor: pointer;
  list-style: none;
  color: #1f2a3a;
  font: 700 16px/1.4 var(--font);
}
.calculator-information-mathgptai .calculator-faq-list summary::-webkit-details-marker { display: none; }
.calculator-information-mathgptai .calculator-faq-list summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 19px;
  translate: 0 -50%;
  color: #176fac;
  font: 500 24px/1 var(--font);
}
.calculator-information-mathgptai .calculator-faq-list details[open] summary::after { content: "−"; }
.calculator-information-mathgptai .calculator-faq-list details p {
  max-width: 980px;
  margin: 0;
  padding: 0 20px 20px;
  font-size: 15px;
}
.calculator-information-mathgptai .calculator-info-related ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  list-style: none;
}
.calculator-information-mathgptai .calculator-info-related li {
  padding: 18px 20px;
  border: 1px solid #d8e4ed;
  border-radius: 15px;
  background: #f8fbfd;
  font-size: 15px;
}
.calculator-information-mathgptai .calculator-info-related a {
  color: #125f96;
  font-weight: 720;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.calculator-information-mathgptai .calculator-information-actions {
  margin-top: 4px;
}

@media (max-width: 900px) {
  .calculator-information-mathgptai .calculator-authored-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .calculator-information-mathgptai .calculator-info-summary,
  .calculator-information-mathgptai .calculator-info-reference,
  .calculator-information-mathgptai .calculator-info-mistakes,
  .calculator-information-mathgptai .calculator-info-faq,
  .calculator-information-mathgptai .calculator-info-related {
    grid-column: auto;
  }
  .calculator-information-mathgptai .calculator-mistake-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 680px) {
  .calculator-information-mathgptai {
    width: calc(100% - 20px);
    padding-top: 18px;
  }
  .calculator-information-mathgptai .calculator-authored-grid { gap: 12px; }
  .calculator-information-mathgptai .calculator-info-card,
  .calculator-information-mathgptai .calculator-info-summary {
    padding: 20px 17px;
    border-radius: 18px;
  }
  .calculator-information-mathgptai .calculator-authored h2 {
    margin-bottom: 15px !important;
    font-size: 23px !important;
  }
  .calculator-information-mathgptai .calculator-info-relationship .math-display {
    padding: 19px 16px;
    border-radius: 14px;
  }
  .calculator-information-mathgptai .calculator-info-related ul {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep learning-page content close to the compact mobile navigation. */
@media (max-width: 760px) {
  .learn-library-hero,
  .learn-subject-hero,
  .learn-guide-hero {
    margin-top: 0 !important;
    padding-top: 20px !important;
  }
}

/* Solver guidance belongs directly below the submission workspace. */
.solver-shell { padding-bottom: 24px; }
.solver-panel {
  grid-column: 1;
  grid-row: 1;
}
.solver-streak-note {
  grid-column: 1;
  grid-row: 2;
  margin: -12px 0 0;
  padding: 18px 22px;
  border: 1px solid #d7e4ee;
  border-radius: 16px;
  background: #f5f9fd;
}
.solver-streak-note p { margin: 0 0 4px; }
.solver-streak-note a {
  color: #176fac;
  font-weight: 700;
  text-decoration-thickness: 1px;
}
.solver-aside {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.solver-input-nudge {
  width: min(calc(100% - 60px), 1320px);
  max-width: 1320px;
  margin: 0 auto 42px;
  padding: 20px 24px;
  border: 1px solid #dce6ee;
  border-radius: 16px;
  background: #f7fbfe;
}
.solver-input-nudge p { margin: 0; }
.solver-input-nudge p + p { margin-top: 8px; }

@media (max-width: 1050px) {
  .solver-panel,
  .solver-streak-note,
  .solver-aside {
    grid-column: auto;
    grid-row: auto;
  }
}

/* MathGPT AI uses a one-pixel rule system. Retire every legacy heavy accent. */
:where(
  .prose blockquote,
  .upload-zone label,
  .solver-aside,
  .expression-list input,
  .solver-access-gate .solver-saved-question,
  .program-layout > aside,
  .practice-config,
  .hint-box,
  .feedback-box,
  .practice-tools,
  .planner-result,
  .progress-dashboard > aside,
  .solution-final-content > .solution-equation,
  .solution-final-content > blockquote,
  .solution-equation,
  .ap-track > header,
  .ap-quiz-feedback,
  .ap-after-practice,
  .assessment-review,
  .ap-answer-review,
  .scientific-screen,
  .calculator-guide,
  .calculator-device[data-model] .scientific-screen,
  .four-screen,
  .notebook-block.math,
  .notebook-block.note,
  .notebook-block.heading,
  .notebook-block.checklist,
  .notebook-block.graph,
  .notebook-block.data,
  .matrix-grid,
  .matrix-result-grid,
  .formula-checklist,
  .simple-checklist,
  .calculator-check-grid aside,
  .tldr,
  .transfer-answer,
  .paired-lesson,
  .share-result-note,
  .formula-mistake,
  .history-user,
  .quick-form,
  .upgrade-plan,
  .billing-flash,
  .cancel-warning,
  .study-error,
  .pay-plans label,
  .history-share-note,
  .follow-up-question,
  .assessment-personal,
  .streak-nudge,
  .school-account-note,
  .purpose-tool-work section
) { border-width: 1px !important; }

.expression-row.is-selected,
.surface-expression-row.active,
.workspace[data-tool="calculator"] .expression-row.is-selected {
  box-shadow: none !important;
}

.ai-premium-card::after { border-width: 1px; }

@media (max-width: 680px) {
  .solver-shell { padding-bottom: 16px; }
  .solver-panel,
  .solver-streak-note,
  .solver-aside {
    grid-column: auto;
    grid-row: auto;
  }
  .solver-streak-note {
    margin: -4px 0 0;
    padding: 16px 18px;
  }
  .solver-input-nudge {
    width: calc(100% - 28px);
    margin-bottom: 30px;
    padding: 18px;
  }
}

/* AP and learning library refresh -----------------------------------------
   These selectors deliberately reset the ruled legacy grids in site.css.
   The hubs use the same light, rounded component language as the current
   MathGPT AI navigation and calculator cards. */
.ap-hub-page,
.learn-hub-page,
.learn-subject-page {
  --library-ink: #101828;
  --library-muted: #607089;
  --library-blue: #1978b8;
  --library-soft: #f3f9fd;
  --library-line: #d7e4ee;
}
.ap-hub-page .section,
.learn-hub-page .section,
.learn-subject-page .section {
  width: min(calc(100% - 48px), 1460px);
  max-width: 1460px;
  margin-inline: auto;
}
.ap-library-hero {
  width: min(calc(100% - 48px), 1460px);
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
  margin: 22px auto 0;
  padding: 46px 50px;
  border: 1px solid #cfe2ef;
  border-radius: 28px;
  background: linear-gradient(135deg, #f8fcff 0%, #edf7fd 100%);
  box-shadow: 0 18px 50px rgba(31, 83, 119, .07);
}
.ap-library-hero h1 {
  max-width: none;
  margin: 0 0 13px;
  color: var(--library-ink);
  line-height: 1.08;
  letter-spacing: -.045em;
}
.ap-library-hero p {
  max-width: 980px;
  margin: 0;
  color: var(--library-muted);
  font-size: 1.16rem;
  line-height: 1.62;
}
.ap-library-icon,
.ap-course-icon {
  display: grid;
  place-items: center;
  background: #e8f4fc;
  color: var(--library-blue);
}
.ap-library-icon {
  width: 104px;
  height: 104px;
  border: 1px solid #c7e0f0;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 83, 119, .08);
}
.ap-library-icon .math-topic-icon { width: 66px; height: 66px; }
.ap-library-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.ap-library-actions .button { min-height: 52px; border-radius: 14px; }
.ap-hub-summary { padding-top: 42px !important; padding-bottom: 20px !important; }
.ap-method-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.ap-method-cards article {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--library-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 61, 84, .045);
}
.ap-method-cards article > span {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 17px;
  background: #e8f4fc;
  color: var(--library-blue);
}
.ap-method-cards .math-topic-icon { width: 40px; height: 40px; }
.ap-method-cards h3 { margin: 0 0 8px; color: var(--library-ink); font-size: 1.2rem; }
.ap-method-cards p { margin: 0; color: var(--library-muted); line-height: 1.6; }
.ap-course-library { padding-top: 28px !important; }
.ap-course-search {
  display: grid !important;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
  gap: 18px !important;
  align-items: center !important;
  margin: 0 0 34px !important;
  padding: 14px 18px !important;
  border: 1px solid var(--library-line) !important;
  border-radius: 16px;
  background: #fff !important;
  color: var(--library-ink);
  font-size: .9rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.ap-course-search span { font-weight: 750; }
.ap-course-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px;
  background: #f8fafc !important;
  font: inherit;
}
.ap-track { margin: 0 0 42px !important; }
.ap-track > header {
  display: block !important;
  margin: 0 0 16px;
  padding: 0 !important;
  border: 0 !important;
}
.ap-track > header h3 { margin: 0 0 4px; color: var(--library-ink); font-size: 1.45rem; }
.ap-track > header p { margin: 0; color: var(--library-muted); font-size: .94rem; }
.ap-track > .ap-course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px !important;
  border: 0 !important;
}
.ap-track .ap-course-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 18px 22px;
  padding: 26px;
  border: 1px solid var(--library-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 61, 84, .045);
}
.ap-track .ap-course-card[hidden] { display: none; }
.ap-course-icon {
  width: 76px;
  height: 76px;
  border-radius: 19px;
  grid-row: 1 / span 3;
}
.ap-course-icon .math-topic-icon { width: 48px; height: 48px; }
.ap-course-copy h3 { margin: 0 0 8px !important; font-size: 1.32rem; line-height: 1.22; }
.ap-course-copy h3 a { color: var(--library-ink); text-decoration: none; }
.ap-course-copy h3 a:hover { color: var(--library-blue); }
.ap-course-copy p { margin: 0; color: var(--library-muted); font-size: .98rem; line-height: 1.58; }
.ap-course-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-course-meta span {
  padding: 7px 10px;
  border: 1px solid #d9e7f1;
  border-radius: 999px;
  background: #f6fbfe;
  color: #35536c;
  font-size: .78rem;
  font-weight: 700;
}
.ap-course-link { color: var(--library-blue); font-weight: 750; text-underline-offset: 4px; }

/* The old subject grid supplied a black top and left rule. It must not leak
   into the current card layout. */
.learn-subjects .learn-subject-grid {
  border: 0 !important;
  background: transparent !important;
}
.learn-subjects .learn-subject-card {
  border: 1px solid var(--library-line) !important;
}

/* Subject formula references are readable cards rather than a dark legacy
   spreadsheet. MathJax renders the relationship and produces assistive MML. */
.learn-subject-page .subject-formula-reference {
  margin: 42px 0 0;
  padding: 34px;
  border: 1px solid var(--library-line);
  border-radius: 22px;
  background: #f7fbfe;
}
.learn-subject-page .subject-formula-heading h2 { margin: 0 0 8px !important; }
.learn-subject-page .subject-formula-heading p {
  max-width: 850px;
  margin: 0;
  color: var(--library-muted);
}
.subject-formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.subject-formula-grid article {
  min-width: 0;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--library-line);
  border-radius: 18px;
  background: #fff;
}
.subject-formula-grid h3 { margin: 0 0 14px; color: var(--library-ink); font-size: 1.16rem; }
.subject-formula-math {
  max-width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 13px;
  background: #eef7fd;
  color: var(--library-ink);
  scrollbar-width: thin;
}
.subject-formula-math mjx-container { margin: 0 !important; font-size: 1.16rem !important; }
.subject-formula-grid article > p { margin: 16px 0 0; color: var(--library-muted); line-height: 1.58; }
.subject-formula-example {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5edf3;
  color: var(--library-muted);
  line-height: 1.55;
}
.subject-formula-example strong { color: var(--library-ink); font-size: .86rem; }
.learn-subject-page .subject-formula-note { margin: 24px 0 0; color: var(--library-muted); }

@media (max-width: 900px) {
  .ap-method-cards,
  .ap-track > .ap-course-grid,
  .subject-formula-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .ap-hub-page .section { width: calc(100% - 28px); }
  .ap-library-hero {
    width: calc(100% - 28px);
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 0;
    padding: 26px 22px;
    border-radius: 22px;
  }
  .ap-library-icon { width: 76px; height: 76px; border-radius: 20px; }
  .ap-library-icon .math-topic-icon { width: 48px; height: 48px; }
  .ap-library-actions { display: grid; }
  .ap-library-actions .button { width: 100%; justify-content: center; }
  .ap-hub-summary { padding-top: 28px !important; }
  .ap-course-search { grid-template-columns: minmax(0, 1fr); gap: 8px !important; }
  .ap-track .ap-course-card { grid-template-columns: 60px minmax(0, 1fr); padding: 20px; gap: 14px 16px; }
  .ap-course-icon { width: 60px; height: 60px; border-radius: 16px; }
  .ap-course-icon .math-topic-icon { width: 38px; height: 38px; }
  .learn-subject-page .subject-formula-reference { padding: 24px 18px; border-radius: 18px; }
  .subject-formula-grid article { padding: 20px 17px; }
}

/* Graphing calculator interface refinement. The expression editor is a calm,
   card-based control surface with generous hit targets and a single thin
   divider to the canvas. */
.graph-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.graph-ui-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.graph-calculator-intro {
  border-color: #d7e4ee;
  background: linear-gradient(135deg, #fff 0%, #f8fcff 100%);
  box-shadow: 0 12px 34px rgba(20, 64, 96, .06);
}
.graph-calculator-intro .calculator-hero-icon {
  width: 82px;
  height: 82px;
  border-radius: 23px;
  background: linear-gradient(145deg, #eaf6ff, #dcefff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 8px 20px rgba(23, 111, 172, .1);
}
.graph-calculator-intro .calculator-hero-icon .math-topic-icon { width: 54px; height: 54px; }
.workspace[data-tool="calculator"] {
  grid-template-columns: clamp(420px, 31vw, 520px) minmax(0, 1fr);
  grid-template-rows: 820px auto;
  border: 1px solid #d8e3ec !important;
  border-bottom: 1px solid #d8e3ec !important;
  border-radius: 26px !important;
  background: #fff;
  box-shadow: 0 20px 55px rgba(27, 62, 88, .11);
}
.workspace[data-tool="calculator"] > .expression-panel,
.workspace[data-tool="calculator"] > .canvas-wrap { min-height: 820px; }
.workspace[data-tool="calculator"] > .expression-panel {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) 54px auto auto auto;
  border: 0 !important;
  border-right: 0 !important;
  background: #f6f9fc !important;
}
.workspace[data-tool="calculator"] > .expression-panel > .workspace-title { grid-row: 1; }
.workspace[data-tool="calculator"] > .expression-panel > .graph-example-strip { grid-row: 2; }
.workspace[data-tool="calculator"] > .expression-panel > .expression-list { grid-row: 3; }
.workspace[data-tool="calculator"] > .expression-panel > .add-row { grid-row: 4; }
.workspace[data-tool="calculator"] > .expression-panel > .graph-toolbar { grid-row: 5; }
.workspace[data-tool="calculator"] > .expression-panel > .graph-settings { grid-row: 6; }
.workspace[data-tool="calculator"] > .expression-panel > .workspace-footer { grid-row: 7; }
.workspace[data-tool="calculator"] > .canvas-wrap {
  border: 0;
  border-left: 1px solid #e3eaf0;
  background: #fff;
}
.workspace[data-tool="calculator"] .graph-plot-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .12));
}
.workspace[data-tool="calculator"] .graph-controls,
.workspace[data-tool="calculator"] .graph-status,
.workspace[data-tool="calculator"] .graph-readout,
.workspace[data-tool="calculator"] .graph-label,
.workspace[data-tool="calculator"] .graph-crosshair,
.workspace[data-tool="calculator"] .graph-empty-state { z-index: 2; }
.workspace[data-tool="calculator"] .workspace-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 16px 14px;
  border: 0;
  background: #fff;
}
.workspace[data-tool="calculator"] .graph-panel-copy h2 {
  margin: 0;
  color: #111827;
  font-size: 1.35rem !important;
  letter-spacing: -.025em;
}
.workspace[data-tool="calculator"] .graph-panel-title-line {
  gap: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.workspace[data-tool="calculator"] .graph-expression-count {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #d7e5ef;
  border-radius: 999px;
  background: #f3f8fc;
  color: #526176;
  font-size: .66rem;
  font-weight: 750;
  line-height: 1;
}
.workspace[data-tool="calculator"] .graph-panel-copy p {
  max-width: none;
  margin-top: 6px;
  color: #607087;
  font-size: .82rem;
  line-height: 1.48;
}
.workspace[data-tool="calculator"] .history-controls {
  width: auto;
  gap: 6px;
  align-items: center;
}
.workspace[data-tool="calculator"] .history-controls button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #d9e4ed;
  border-radius: 12px;
  background: #fff;
  color: #405168;
  box-shadow: 0 3px 9px rgba(31, 61, 84, .05);
}
.workspace[data-tool="calculator"] .history-controls button:hover:not(:disabled) {
  border-color: #91c3e4;
  background: #f2f9fe;
  color: #14679f;
}
.workspace[data-tool="calculator"] .history-controls button:disabled { opacity: .38; }
.workspace[data-tool="calculator"] .graph-toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px 10px;
  border: 0;
  border-top: 1px solid #e4ebf1;
  background: #fff;
}
.workspace[data-tool="calculator"] .graph-toolbar button {
  min-width: 0;
  min-height: 42px;
  gap: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 7px;
  border: 1px solid #dbe5ed;
  border-radius: 12px;
  background: #f9fbfd;
  color: #334155;
  font-size: .69rem;
  font-weight: 750;
  line-height: 1.2;
}
.workspace[data-tool="calculator"] .graph-toolbar button .graph-ui-icon { width: 21px; height: 21px; color: #176fac; }
.workspace[data-tool="calculator"] .graph-toolbar button:hover {
  border-color: #9ac8e7;
  background: #eef8ff;
  color: #125f96;
  transform: translateY(-1px);
}
.workspace[data-tool="calculator"] .graph-toolbar .graph-save-action {
  border-color: #176fac;
  background: #176fac;
  color: #fff;
}
.workspace[data-tool="calculator"] .graph-toolbar .graph-save-action .graph-ui-icon { color: #fff; }
.workspace[data-tool="calculator"] .graph-toolbar .graph-save-action:hover { border-color: #125f96; background: #125f96; color: #fff; }
.graph-example-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 11px 14px 12px;
  overflow: visible;
  border: 0;
  border-top: 1px solid #edf1f5;
  border-bottom: 1px solid #e2e9ef;
  background: #fff;
}
.graph-example-heading {
  margin-bottom: 3px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}
.graph-example-heading strong {
  color: #526176;
  font-size: .78rem;
  font-weight: 750;
}
.graph-example-heading span {
  color: #5f6d80;
  font-size: .67rem;
  line-height: 1.35;
}
.graph-example-strip button {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid #dce6ee;
  border-radius: 13px;
  background: #fff;
  color: #405168;
  text-align: left;
  box-shadow: 0 3px 10px rgba(31, 61, 84, .035);
}
.graph-example-strip button:hover,
.graph-example-strip button[aria-pressed="true"] {
  border-color: #79b9e2;
  background: #f1f9fe;
  box-shadow: 0 5px 16px rgba(31, 98, 143, .08);
}
.graph-example-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #e8f5fd;
  color: #258bd2;
}
.graph-example-icon .graph-ui-icon { width: 24px; height: 24px; }
.graph-example-copy { min-width: 0; display: grid; gap: 2px; }
.graph-example-copy b { color: #24344a; font-size: .75rem; line-height: 1.2; }
.graph-example-copy small {
  overflow: hidden;
  color: #53657a;
  font: 500 .64rem/1.35 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.graph-example-strip .graph-example-action {
  padding: 5px 7px;
  border-radius: 7px;
  background: #edf6fc;
  color: #125f96;
  font-size: .64rem;
  font-weight: 800;
}
.workspace[data-tool="calculator"] .graph-settings {
  margin: 10px 12px 0;
  padding: 14px;
  border: 1px solid #dce6ee;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31, 61, 84, .06);
}
.workspace[data-tool="calculator"] .graph-settings > label {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #e2e8ef;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
  font-size: .78rem;
}
.workspace[data-tool="calculator"] .bounds-fields { gap: 8px; }
.workspace[data-tool="calculator"] .bounds-fields label { color: #526176; font-size: .72rem; }
.workspace[data-tool="calculator"] .bounds-fields input {
  min-height: 38px;
  border: 1px solid #d7e2eb !important;
  border-radius: 9px;
  background: #fff !important;
  font-family: var(--font) !important;
}
.workspace[data-tool="calculator"] .expression-list {
  min-height: 230px;
  padding: 12px;
  margin: 0;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #b8c4d0 transparent;
  scrollbar-width: thin;
  background: #f6f9fc;
}
.workspace[data-tool="calculator"] .expression-list::-webkit-scrollbar { width: 8px; }
.workspace[data-tool="calculator"] .expression-list::-webkit-scrollbar-thumb { border-radius: 10px; background: #bcc8d3; }
.workspace[data-tool="calculator"] .expression-row {
  margin: 0 0 10px;
  overflow: hidden;
  border: 1px solid #dce6ee !important;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 13px rgba(31, 61, 84, .05);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.workspace[data-tool="calculator"] .expression-row:last-child { margin-bottom: 0; }
.workspace[data-tool="calculator"] .expression-row.is-selected {
  border-color: #78b9e3 !important;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 139, 210, .09), 0 9px 24px rgba(31, 80, 116, .1);
}
.workspace[data-tool="calculator"] .expression-row.has-error { border-color: #e7a7a7 !important; }
.workspace[data-tool="calculator"] .expression-row.is-dragging { opacity: .46; box-shadow: none; }
.workspace[data-tool="calculator"] .expression-row.drop-before { box-shadow: 0 -4px 0 #258bd2, 0 8px 22px rgba(31, 80, 116, .1); }
.workspace[data-tool="calculator"] .expression-row.drop-after { box-shadow: 0 4px 0 #258bd2, 0 8px 22px rgba(31, 80, 116, .1); }
.workspace[data-tool="calculator"] .expression-main {
  min-height: 82px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 36px 42px;
  gap: 7px;
  align-items: center;
  padding: 10px 10px 7px;
}
.workspace[data-tool="calculator"] .visibility-dot {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: var(--row-color);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--row-color) 34%, #dbe5ed), 0 5px 12px color-mix(in srgb, var(--row-color) 20%, transparent);
}
.workspace[data-tool="calculator"] .visibility-dot .graph-ui-icon { width: 22px; height: 22px; }
.workspace[data-tool="calculator"] .visibility-dot.is-hidden { background: #c6d0da; color: #66768a; box-shadow: 0 0 0 2px #dce4eb; }
.workspace[data-tool="calculator"] .expression-row.is-selected .visibility-dot { color: #fff; }
.workspace[data-tool="calculator"] .expression-field {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 1px;
  min-height: 0 !important;
  border: 0 !important;
}
.workspace[data-tool="calculator"] .expression-number {
  color: #68778a !important;
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 700;
  text-align: left;
}
.workspace[data-tool="calculator"] .expression-input {
  width: 100%;
  height: 44px !important;
  min-height: 44px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #111827;
  font: 600 1.1rem/1.3 var(--mono) !important;
  letter-spacing: -.02em;
}
.workspace[data-tool="calculator"] .expression-input::placeholder { color: #8a97a8; font-family: var(--font); font-weight: 500; }
.workspace[data-tool="calculator"] .expression-input:focus { outline: 0; }
.workspace[data-tool="calculator"] .expression-drag-handle {
  width: 36px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #7a899b;
  cursor: grab;
}
.workspace[data-tool="calculator"] .expression-drag-handle:hover,
.workspace[data-tool="calculator"] .expression-drag-handle:focus-visible { border-color: #c9dbe8; background: #edf7fd; color: #176fac; }
.workspace[data-tool="calculator"] .expression-drag-handle:active { cursor: grabbing; }
.workspace[data-tool="calculator"] .expression-drag-handle .graph-ui-icon { width: 23px; height: 23px; }
.workspace[data-tool="calculator"] .row-menu {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #526176;
}
.workspace[data-tool="calculator"] .row-menu:hover,
.workspace[data-tool="calculator"] .row-menu[aria-expanded="true"] {
  border-color: #d9e4ed;
  background: #f1f7fb;
  color: #176fac;
}
.workspace[data-tool="calculator"] .row-menu .graph-ui-icon { width: 24px; height: 24px; }
.workspace[data-tool="calculator"] .row-delete { display: none !important; }
.workspace[data-tool="calculator"] .expression-result {
  min-height: 32px;
  padding: 0 12px 10px 64px;
  color: #53657a;
  font-family: var(--font);
  font-size: .78rem;
}
.workspace[data-tool="calculator"] .expression-result span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 8px;
  background: #f1f6fa;
}
.workspace[data-tool="calculator"] .expression-row.has-error .expression-result span { background: #fff1f1; color: #a23c3c; }
.workspace[data-tool="calculator"] .expression-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 12px 12px;
  border: 0;
  border-top: 1px solid #e8edf2;
  background: #f8fbfd;
}
.workspace[data-tool="calculator"] .expression-options:not([hidden]) { display: grid; }
.workspace[data-tool="calculator"] .expression-options button,
.workspace[data-tool="calculator"] .graph-color-control {
  min-width: 0;
  min-height: 42px !important;
  gap: 8px !important;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 10px !important;
  border: 1px solid #dce5ed !important;
  border-radius: 10px;
  background: #fff !important;
  color: #334155;
  font-family: var(--font);
  font-size: .76rem;
  font-weight: 700;
}
.workspace[data-tool="calculator"] .expression-options .graph-ui-icon,
.workspace[data-tool="calculator"] .graph-color-control .graph-ui-icon { width: 20px; height: 20px; color: #176fac; }
.workspace[data-tool="calculator"] .graph-color-control input[type="color"] {
  width: 30px !important;
  height: 30px !important;
  margin-left: auto;
  padding: 2px !important;
  border: 1px solid #ccd8e2 !important;
  border-radius: 8px;
  background: #fff !important;
}
.workspace[data-tool="calculator"] .expression-options button:disabled { opacity: .42; }
.workspace[data-tool="calculator"] .expression-options .graph-row-danger {
  grid-column: 1 / -1;
  color: #a23c3c;
}
.workspace[data-tool="calculator"] .expression-options .graph-row-danger .graph-ui-icon { color: #c24747; }
.workspace[data-tool="calculator"] .slider-suggestions {
  gap: 6px;
  display: flex;
  align-items: center;
  padding: 0 12px 11px 64px;
  color: #53657a;
  font-family: var(--font);
  font-size: .76rem;
}
.workspace[data-tool="calculator"] .slider-suggestions button {
  min-width: 36px;
  min-height: 32px;
  margin: 0;
  border: 1px solid #8ec3e5;
  border-radius: 9px;
  background: #edf8ff;
  color: #125f96;
  font-weight: 750;
}
.workspace[data-tool="calculator"] .slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  padding: 2px 12px 14px 64px;
}
.workspace[data-tool="calculator"] .slider-track-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 9px;
  align-items: center;
}
.workspace[data-tool="calculator"] .slider-track-line button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #d7e3ec;
  border-radius: 10px;
  background: #fff;
  color: #176fac;
}
.workspace[data-tool="calculator"] .slider-track-line button .graph-ui-icon { width: 21px; height: 21px; }
.workspace[data-tool="calculator"] .slider-track-line input[type="range"] { width: 100%; accent-color: #258bd2; cursor: ew-resize; }
.workspace[data-tool="calculator"] .slider-range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.workspace[data-tool="calculator"] .slider-range-fields label {
  min-height: 0 !important;
  gap: 4px;
  display: grid !important;
  border: 0 !important;
  color: #68778a;
  font-family: var(--font);
  font-size: .7rem;
  font-weight: 700;
}
.workspace[data-tool="calculator"] .slider-range-fields input {
  width: 100%;
  min-height: 36px;
  padding: 6px 9px !important;
  border: 1px solid #d8e3ec !important;
  border-radius: 9px;
  background: #fff !important;
  color: #111827;
  font-family: var(--font) !important;
  font-size: .8rem !important;
}
.workspace[data-tool="calculator"] .add-row {
  width: calc(100% - 24px);
  min-height: 46px;
  gap: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 12px 12px;
  align-self: center;
  padding: 0 15px;
  border: 1px dashed #a9c6db;
  border-radius: 12px;
  background: #f2f8fc;
  color: #176fac;
  font-size: .82rem;
  font-weight: 750;
}
.workspace[data-tool="calculator"] .add-row .graph-ui-icon { width: 21px; height: 21px; }
.workspace[data-tool="calculator"] .add-row:hover { border-color: #258bd2; background: #eaf6fe; }
.workspace[data-tool="calculator"] .workspace-footer {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 0;
  border-top: 1px solid #e2e9ef;
  background: #fff;
  color: #607087;
  font-family: var(--font);
  font-size: .72rem;
}
.workspace[data-tool="calculator"] .workspace-footer button,
.workspace[data-tool="calculator"] .workspace-footer a {
  min-height: 40px;
  gap: 7px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #dce5ed;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-family: var(--font);
  font-size: .73rem;
  font-weight: 750;
}
.workspace[data-tool="calculator"] .workspace-footer button .graph-ui-icon,
.workspace[data-tool="calculator"] .workspace-footer a .graph-ui-icon { width: 20px; height: 20px; color: #176fac; }
.workspace[data-tool="calculator"] .workspace-footer a {
  margin: 0;
  border-color: #176fac;
  background: #176fac !important;
  color: #fff;
}
.workspace[data-tool="calculator"] .workspace-footer a .graph-ui-icon { color: #fff; }
.workspace[data-tool="calculator"] .graph-save-state {
  min-width: 0;
  gap: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.workspace[data-tool="calculator"] .graph-save-state .graph-ui-icon { width: 17px; height: 17px; color: #2f8b68; }
.workspace[data-tool="calculator"] .graph-controls { top: 18px; right: 18px; gap: 8px; }
.workspace[data-tool="calculator"] .graph-controls button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid #d7e3ec;
  border-radius: 15px;
  background: rgba(255, 255, 255, .96);
  color: #334155;
  box-shadow: 0 9px 24px rgba(31, 61, 84, .11);
}
.workspace[data-tool="calculator"] .graph-controls button:hover { border-color: #89bde3; background: #eef8ff; color: #176fac; }
.workspace[data-tool="calculator"] .graph-controls .graph-ui-icon { width: 25px; height: 25px; }
.workspace[data-tool="calculator"] .graph-status,
.workspace[data-tool="calculator"] .graph-readout,
.workspace[data-tool="calculator"] .graph-label {
  border-color: #d8e3ec;
  border-radius: 11px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 6px 18px rgba(31, 61, 84, .06);
}
.workspace[data-tool="calculator"] .graph-status { min-height: 40px; display: flex; align-items: center; padding: 8px 12px; font-size: .78rem; }
.graph-empty-state { padding: 28px; border-color: #bedcf0; background: rgba(248, 252, 255, .97); }
.graph-empty-state .graph-empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; color: #258bd2; }
.graph-empty-state strong { font-size: 1.2rem; }
.graph-empty-state button {
  gap: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 11px;
}
.graph-empty-state button span { color: inherit; }
.graph-empty-state button .graph-ui-icon { width: 21px; height: 21px; }
.workspace[data-tool="calculator"].panel-collapsed { grid-template-columns: 66px minmax(0, 1fr); }
.workspace[data-tool="calculator"].panel-collapsed .workspace-title { padding: 12px; }
.workspace[data-tool="calculator"] [data-panel-toggle].is-panel-collapsed .graph-ui-icon { transform: scaleX(-1); }
.workspace[data-tool="calculator"] .dock-keypad { border-top: 1px solid #dce6ee; background: #f3f8fc; }

@media (max-width: 1050px) {
  .workspace[data-tool="calculator"] { grid-template-columns: minmax(390px, 42%) minmax(0, 1fr); }
  .workspace[data-tool="calculator"] .graph-panel-copy p { display: none; }
  .workspace[data-tool="calculator"] .workspace-title { grid-template-columns: 1fr; }
  .workspace[data-tool="calculator"] .history-controls { width: 100%; }
  .workspace[data-tool="calculator"] .history-controls .save-graph-button { margin-right: auto; }
}
@media (max-width: 680px) {
  .graph-calculator-intro .calculator-hero-icon { width: 64px; height: 64px; border-radius: 18px; }
  .graph-calculator-intro .calculator-hero-icon .math-topic-icon { width: 43px; height: 43px; }
  .workspace[data-tool="calculator"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 470px;
    border-radius: 20px !important;
  }
  .workspace[data-tool="calculator"] > .expression-panel { min-height: 850px; height: 850px; }
  .workspace[data-tool="calculator"] > .canvas-wrap { min-height: 470px; height: 470px; border-left: 0; border-top: 1px solid #e3eaf0; }
  .workspace[data-tool="calculator"] .workspace-title { padding: 17px 14px 12px; }
  .workspace[data-tool="calculator"] .graph-panel-copy p { display: block; max-width: none; }
  .workspace[data-tool="calculator"] .history-controls { margin-top: 3px; }
  .workspace[data-tool="calculator"] .history-controls button { width: 44px; height: 44px; }
  .workspace[data-tool="calculator"] .history-controls .save-graph-button { min-width: 104px; }
  .workspace[data-tool="calculator"] .graph-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 10px 10px; }
  .workspace[data-tool="calculator"] .graph-toolbar button { justify-content: center; padding-inline: 8px; font-size: .75rem; }
  .graph-example-strip { padding: 10px 12px 12px; }
  .workspace[data-tool="calculator"] .expression-list { min-height: 220px; padding: 10px; }
  .workspace[data-tool="calculator"] .expression-main { grid-template-columns: 40px minmax(0, 1fr) 34px 40px; gap: 6px; padding-inline: 9px; }
  .workspace[data-tool="calculator"] .expression-input { font-size: 1rem !important; }
  .workspace[data-tool="calculator"] .expression-result,
  .workspace[data-tool="calculator"] .slider-suggestions,
  .workspace[data-tool="calculator"] .slider-row { padding-left: 59px; }
  .workspace[data-tool="calculator"] .workspace-footer { grid-template-columns: 1fr 1fr; padding: 8px; }
  .workspace[data-tool="calculator"] .graph-save-state { min-height: 40px; }
  .workspace[data-tool="calculator"] .workspace-footer a { grid-column: 1 / -1; justify-content: center; }
  .workspace[data-tool="calculator"] .graph-controls { right: 12px; top: 12px; }
  .workspace[data-tool="calculator"] .graph-controls button { width: 44px; height: 44px; border-radius: 13px; }
  .workspace[data-tool="calculator"] .graph-status { left: 10px; top: 10px; max-width: calc(100% - 76px); }
  .workspace[data-tool="calculator"] .graph-readout { left: 10px; bottom: 10px; }
  .workspace[data-tool="calculator"] > .dock-keypad { grid-row: auto; }
}
