/* Reserve loading space so the footer stays below the initial viewport while
   the validated catalog and selected workspace mount. */
#toolsApp { min-height: 100vh; min-height: 100svh; }
/* Keep help and workspace navigation below the deferred calculator controls. */
#toolRuntime { min-height: min(100vh, 48rem); min-height: min(100svh, 48rem); }

/* Tools workspaces share type and color tokens from site.css. */
.tools-page { font-size: 15px; }
.tools-page [hidden] { display: none !important; }
.tools-page :is(a,button,input,textarea,summary,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.tools-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.tools-page button { border-radius: 4px; }
.tools-page button:disabled { cursor: default; }
.tools-shell { max-width: 1376px; padding: 0 48px 72px; margin: auto; }
.tools-masthead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.tools-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 18px; letter-spacing: -.04em; }
.tools-brand strong { font-weight: 400; color: var(--muted); }
.tools-mark { width: 25px; height: 25px; border: 1px solid var(--accent); color: var(--accent); display: grid; place-items: center; margin-right: 5px; font: 22px/1 monospace; }
.preview-tag { color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 3px 9px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.micro-label { font: 11px/1.5 var(--font); letter-spacing: .11em; color: var(--muted); margin: 0 0 10px; }
.tools-intro { display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: 28px 0 20px; }
.tools-intro h1 { font-size: clamp(32px,4vw,52px); line-height: 1.08; letter-spacing: -.055em; margin: 0 0 16px; font-weight: 500; }
.tools-intro h1 span { color: var(--accent); }
.tools-lede { max-width: 640px; color: var(--muted); margin: 0; font-size: 15px; line-height: 1.65; }
.intro-note { flex: 0 0 245px; border-left: 1px solid var(--line); padding-left: 32px; color: var(--muted); }
.intro-note p { font-size: 18px; color: var(--text); line-height: 1.5; margin: 8px 0 12px; }
.intro-note > span:last-child { font-size: 11px; }
.index-symbol { color: var(--accent); font: 28px/1 monospace; letter-spacing: .12em; }
.tool-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.tool-search { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--control-border); border-radius: 5px; padding: 0 18px; max-width: 760px; height: 58px; }
.tool-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tool-search > svg { color: var(--muted); }
.tools-page .tool-search input[type="search"] { background: transparent; color: var(--text); border: 0; padding: 12px 0; width: 100%; min-width: 0; outline: none; box-shadow: none; }
.tool-search input::placeholder { color: var(--muted); opacity: 1; }
.tool-search input::-webkit-search-cancel-button { display: none; }
.tool-search button { background: var(--surface-raised); border: 1px solid var(--control-border); padding: 3px 10px; font-size: 12px; min-height: 32px; }
.search-hint { color: var(--muted); font-size: 11px; margin: 7px 0 0; }
.preview-explainer { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 28px; font-size: 12px; color: var(--text); }
.preview-explainer p { margin: 0; }
.preview-explainer p span { color: var(--muted); }
.preview-dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; flex: 0 0 5px; }
.tools-page .section-heading { display: flex; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-heading > :is(span,p) { color: var(--muted); font-size: 11px; margin: 0; }
.featured-section { padding-bottom: 34px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.featured-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.featured-card { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); position: relative; min-width: 0; }
.featured-card:hover, .featured-card:focus-within { border-color: var(--accent); }
.featured-copy { padding: 17px 20px 18px; border-top: 1px solid var(--line); }
.featured-copy .micro-label { font-size: 10px; margin-bottom: 8px; }
.featured-copy h3 { font-size: 19px; margin: 0 0 8px; letter-spacing: -.035em; }
.featured-copy a { text-decoration: none; color: var(--text); display: flex; justify-content: space-between; gap: 8px; }
.featured-copy a::after, .tool-card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: 5px; }
.featured-copy a svg { width: 17px; height: 17px; color: var(--accent); }
.featured-copy p { font-size: 12px; color: var(--muted); margin: 0; max-width: 280px; }
.feature-equation, .feature-graph, .feature-code { height: 120px; overflow: hidden; }
.feature-equation { padding: 15px 24px 10px; font-family: monospace; display: flex; flex-direction: column; align-items: flex-end; background: #141c23; }
.feature-equation > span { color: var(--muted); font-size: 14px; }
.feature-equation strong { font: 34px/1.3 var(--font); font-weight: 400; color: var(--text); }
.feature-equation strong span { color: var(--accent); }
.feature-equation small { font-size: 9px; color: var(--muted); align-self: flex-start; margin-top: 7px; letter-spacing: .05em; }
.feature-equation i { font-style: normal; padding: 0 8px; }
.feature-graph { background: #10181d; display: flex; align-items: center; }
.feature-graph .graph-plot { width: 100%; min-width: 0; height: auto; }
.feature-code { padding: 15px 18px; background: #13191f; font: 12px/1.9 monospace; white-space: nowrap; }
.feature-code > span { display: block; }
.feature-code i { color: var(--muted); padding-right: 16px; font-style: normal; }
.feature-code b { color: var(--accent); font-weight: 400; }
.feature-code em { color: var(--success); font-style: normal; }
.catalog-layout { display: grid; grid-template-columns: 218px minmax(0,1fr); gap: 32px; align-items: start; }
.category-sidebar h2 { font-size: 13px; letter-spacing: 0; margin: 0 0 18px; color: var(--muted); font-weight: 400; }
.category-controls { display: flex; flex-direction: column; gap: 4px; }
.category-controls button { display: flex; align-items: center; gap: 9px; background: transparent; color: var(--muted); padding: 11px 9px; border: 1px solid transparent; text-align: left; width: 100%; font-size: 12px; line-height: 1.5; min-height: 44px; }
.category-controls button .tool-icon { width: 17px; height: 17px; }
.category-controls button small { margin-left: auto; font-size: 10px; }
.category-controls button[aria-pressed="true"] { background: #172732; color: #b3d9ef; border-color: #435f72; }
.category-controls button:hover { background: var(--surface-raised); color: var(--text); }
.sidebar-note { border-top: 1px solid var(--line); margin: 26px 8px 0; padding-top: 22px; }
.sidebar-note .micro-label { font-size: 9px; }
.sidebar-note p { font-size: 18px; line-height: 1.5; margin: 10px 0; }
.sidebar-note small { color: var(--muted); font-size: 11px; display: block; line-height: 1.7; }
.catalog-heading { min-height: 24px; }
.tool-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.tool-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px 16px 14px; position: relative; min-width: 0; }
.tool-card:hover, .tool-card:focus-within { border-color: var(--control-border); background: #161e25; }
.tool-card.has-preview:hover, .tool-card.has-preview:focus-within { border-color: var(--accent); }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tool-card-top .tool-icon { color: var(--muted); width: 23px; height: 23px; }
.has-preview .tool-card-top .tool-icon { color: var(--accent); }
.availability { font-size: 10px; line-height: 1.4; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; }
.availability.is-preview { color: #b3d9ef; background: #172732; border-color: #435f72; }
.tool-card h3 { font-size: 16px; line-height: 1.3; letter-spacing: -.025em; margin: 0 0 9px; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.tool-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; margin-bottom: 18px; flex: 1; }
.tool-card-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 9px; color: var(--muted); }
.card-action { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.has-preview .card-action { color: var(--accent); }
.card-action svg { width: 12px; height: 12px; }
.empty-results { grid-column: 1/-1; padding: 48px 24px; border: 1px dashed var(--control-border); text-align: center; }
.empty-results h3 { font-size: 25px; }
.empty-results p { color: var(--muted); overflow-wrap: anywhere; }
.empty-results button { padding: 10px 16px; border: 1px solid var(--control-border); background: var(--surface-raised); }
/* Shared workspace framework; each tool keeps its own input and output layout. */
.workspace-breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; padding: 24px 0 30px; }
.workspace-breadcrumb a { color: var(--muted); }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 24px; }
.workspace-title { display: flex; align-items: flex-start; gap: 20px; }
.workspace-title > svg { width: 36px; height: 36px; padding: 7px; box-sizing: content-box; border: 1px solid var(--line); border-radius: 4px; color: var(--accent); background: var(--surface); }
.workspace-title h1 { font-size: clamp(27px,3.3vw,40px); margin-bottom: 10px; }
.workspace-title p:last-child { color: var(--muted); margin: 0; font-size: 14px; }
.back-link { white-space: nowrap; font-size: 12px; }
.workspace-notice { padding: 12px 16px; border: 1px solid #435f72; border-left: 3px solid var(--accent); background: #131f28; color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.workspace-notice strong { color: #b3d9ef; font-weight: 500; }
.work-panel { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: hidden; }
.panel-header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-header h2 { font-size: 13px; letter-spacing: 0; margin: 0; }
.panel-header > span { font: 10px/1.5 var(--font); color: var(--muted); text-align: right; }
.panel-footnote { margin: 0; padding: 18px; color: var(--muted); font-size: 11px; }
.calculator-layout { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 20px; }
.calculator-display { margin: 22px 22px 18px; padding: 20px; background: var(--bg); border: 1px solid var(--line); display: flex; align-items: flex-end; flex-direction: column; font: 18px/1.5 monospace; }
.calculator-display > span { color: var(--muted); }
.calculator-display strong { font: 54px/1.3 var(--font); }
.calculator-display small { font: 10px/1.5 var(--font); color: var(--muted); }
.calculator-keys { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; padding: 0 22px; }
.calculator-keys button { padding: 9px 2px; min-height: 42px; background: var(--surface-raised); border: 1px solid var(--line); color: var(--muted); font-size: 15px; opacity: 1; }
.calculator-keys .equals { background: #284355; color: #d0e6f3; border-color: #55778d; }
.sample-block { padding: 24px; }
.calc-notes .sample-block + .sample-block { border-top: 1px solid var(--line); }
.sample-block p:not(.micro-label) { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.math-line { font: 23px/1.6 monospace; }
.math-line span { color: var(--accent); }
.graph-layout { display: grid; grid-template-columns: minmax(220px, .38fr) minmax(0,1fr); gap: 20px; }
.sample-input-label { display: block; color: var(--muted); font-size: 10px; margin: 12px 0 6px; }
.tools-page .expression-panel input { width: 100%; background: var(--bg); border: 1px solid var(--control-border); color: var(--text); font: 18px/1.5 monospace; padding: 12px; border-radius: 4px; }
.legend { display: flex; align-items: center; gap: 8px; }
.legend span { width: 18px; height: 2px; background: var(--accent); }
.graph-settings { margin: 0 24px 24px; border-top: 1px solid var(--line); padding-top: 12px; }
.graph-settings > div, .writing-settings > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 12px; padding: 8px 0; }
.graph-settings dt, .writing-settings dt { color: var(--muted); }
.graph-settings dd, .writing-settings dd { margin: 0; }
.plot-scroll { overflow-x: auto; background: #0e1419; }
.graph-plot { display: block; width: 100%; }
.graph-panel .graph-plot { min-height: 300px; }
.graph-caption { border-top: 1px solid var(--line); padding: 14px 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); }
.graph-caption span:first-child { color: var(--accent); }
.code-layout { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 20px; }
.editor-scroll { overflow-x: auto; padding: 24px; min-height: 365px; background: #0e1419; }
.editor-scroll pre { width: max-content; min-width: 100%; margin: 0; font: 14px/1.9 monospace; color: #d8e0e7; tab-size: 2; }
.editor-scroll code { font: inherit; }
.code-comment { color: var(--muted); }
.code-keyword { color: var(--accent); }
.code-string { color: var(--success); }
.code-number { color: var(--warning); }
.editor-status { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 18px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.console-lines { padding: 24px; font: 13px/1.8 monospace; }
.console-lines p { margin: 0 0 12px; }
.console-panel .panel-footnote { border-top: 1px solid var(--line); }
.palette-swatches { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
.swatch { background: var(--swatch); min-height: 290px; padding: 22px 18px; display: flex; justify-content: flex-end; flex-direction: column; }
.swatch span { font-size: 12px; margin-bottom: 6px; }
.swatch strong { font: 16px/1.5 monospace; }
.swatch-dark { color: #f3f1ec; }
.swatch-light { color: #0b0e11; }
.palette-bottom { padding: 26px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; }
.palette-bottom > p { color: var(--muted); font-size: 13px; align-self: center; margin: 0; }
.palette-specimen { display: flex; align-items: center; gap: 24px; }
.specimen-type { font-size: 60px; letter-spacing: -.06em; line-height: 1.3; color: var(--accent); }
.palette-specimen h3 { font-size: 22px; margin: 0 0 8px; }
.palette-specimen p { font-size: 12px; color: var(--muted); margin: 0; }
.writing-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); gap: 20px; }
.writing-input label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.tools-page .writing-input textarea { background: var(--bg); border: 1px solid var(--control-border); border-radius: 4px; color: var(--text); width: 100%; padding: 16px; font-size: 14px; line-height: 1.7; resize: vertical; }
.writing-settings { margin: 18px 0 0; }
.writing-input .panel-footnote { padding: 18px 0 0; }
.sample-draft { padding: 36px; max-width: 640px; }
.sample-draft h3 { font-size: 30px; line-height: 1.2; margin: 20px 0; }
.sample-draft p:not(.micro-label) { font-size: 15px; line-height: 1.8; color: #c3cbd2; }
.workspace-help { margin: 24px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.workspace-help summary { font-size: 13px; color: var(--text); padding: 4px 0; }
.workspace-help p { max-width: 820px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.workspace-pagination { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 24px; }
.workspace-pagination a { color: var(--text); text-decoration: none; font-size: 14px; }
.workspace-pagination a:last-child { text-align: right; }
.workspace-pagination a span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.workspace-pagination a:hover { color: var(--accent); }
.preview-position { color: var(--muted); font: 11px/1.5 monospace; white-space: nowrap; }
.planned-panel { border: 1px solid var(--line); background: var(--surface); padding: 48px; }
.planned-panel > svg { color: var(--accent); width: 40px; height: 40px; margin-bottom: 24px; }
.planned-panel h2 { font-size: 30px; }
.planned-panel p { max-width: 640px; color: var(--muted); }
.planned-panel a { display: inline-flex; align-items: center; gap: 12px; }
.unknown-tool { padding: 60px 0; }
.unknown-tool h1 { font-size: 32px; }
.unknown-tool p { color: var(--muted); }
@media (min-width: 1500px) { .tools-shell { max-width: 1440px; } }
@media (max-width: 1150px) {
  .tools-shell { padding-inline: 32px; }
  .catalog-layout { grid-template-columns: 198px minmax(0,1fr); gap: 24px; }
  .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .intro-note { flex-basis: 220px; padding-left: 24px; }
  .feature-code { font-size: 11px; }
  .featured-copy { padding-inline: 16px; }
  .featured-copy h3 { font-size: 17px; }
}
@media (max-width: 800px) {
  .tools-shell { padding-inline: 24px; }
  .intro-note { display: none; }
  .tools-intro h1 { font-size: 42px; }
  .catalog-layout { display: block; }
  .category-controls { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
  .category-controls button { border-color: var(--line); font-size: 11px; padding: 10px 8px; }
  .category-controls button small { display: none; }
  .category-controls button svg { width: 15px; height: 15px; }
  .category-sidebar { margin-bottom: 26px; }
  .category-sidebar h2 { margin-bottom: 12px; }
  .sidebar-note { display: none; }
  .featured-grid { gap: 10px; }
  .featured-copy { padding: 14px 12px; }
  .featured-copy h3 { font-size: 16px; }
  .feature-code { padding-inline: 10px; font-size: 9px; }
  .feature-code i { padding-right: 5px; }
  .feature-equation { padding-inline: 16px; }
  .workspace-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  .graph-layout { grid-template-columns: minmax(180px,.5fr) minmax(0,1fr); gap: 12px; }
  .code-layout { grid-template-columns: 1fr; }
  .swatch { padding: 16px 10px; min-height: 240px; }
  .swatch strong { font-size: 13px; }
  .palette-bottom { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 580px) {
  .tools-shell { padding: 0 20px 48px; }
  .tools-masthead { padding: 20px 0; }
  .tools-brand { font-size: 16px; }
  .preview-tag { font-size: 9px; padding: 3px 6px; }
  .tools-intro { padding: 28px 0 22px; }
  .tools-intro h1 { font-size: clamp(30px,8.6vw,42px); }
  .tools-lede { font-size: 13px; }
  .micro-label { font-size: 10px; }
  .tool-search { padding: 0 12px; height: 54px; gap: 10px; }
  .preview-explainer { margin: 18px 0 24px; font-size: 11px; }
  .section-heading { gap: 12px; }
  .section-heading > span { max-width: 100px; text-align: right; font-size: 10px; }
  .section-heading h2 { font-size: 17px; }
  .featured-grid { grid-template-columns: 1fr; gap: 10px; }
  .featured-card { display: grid; grid-template-columns: 96px minmax(0,1fr); }
  .feature-equation, .feature-graph, .feature-code { height: 100%; min-height: 130px; }
  .featured-copy { border-top: 0; border-left: 1px solid var(--line); padding: 16px 12px; }
  .featured-copy h3 { font-size: 16px; }
  .featured-copy p { font-size: 11px; }
  .featured-copy .micro-label { font-size: 8px; }
  .feature-equation { align-items: center; justify-content: center; padding: 10px 8px; }
  .feature-equation > span { font-size: 7px; white-space: nowrap; }
  .feature-equation strong { font-size: 25px; }
  .feature-equation small { display: none; }
  .feature-graph .graph-plot { width: 240px; max-width: none; flex-shrink: 0; transform: translateX(-55px); }
  .feature-code { display: flex; flex-direction: column; justify-content: center; padding: 10px 8px; font-size: 8px; }
  .feature-code i { display: none; }
  .category-controls { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .category-controls button { font-size: 11px; gap: 7px; }
  .category-controls button svg { width: 14px; height: 14px; }
  .tool-grid { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { padding: 18px; }
  .tool-card-top { margin-bottom: 14px; }
  .tool-card h3 { font-size: 17px; }
  .tool-card > p { font-size: 13px; }
  .tool-card-bottom { font-size: 10px; }
  .workspace-breadcrumb { font-size: 10px; padding: 20px 0 26px; }
  .workspace-title { gap: 12px; }
  .workspace-title > svg { width: 22px; height: 22px; padding: 6px; }
  .workspace-title h1 { font-size: 27px; }
  .workspace-title p:last-child { font-size: 12px; }
  .workspace-notice { font-size: 11px; }
  .calculator-layout,.graph-layout,.writing-layout { grid-template-columns: 1fr; gap: 16px; }
  .calculator-display { margin: 16px; padding: 16px; }
  .calculator-display > span { font-size: 16px; }
  .calculator-keys { padding: 0 16px; gap: 6px; }
  .sample-block { padding: 20px; }
  .graph-panel .graph-plot { min-height: 0; }
  .editor-scroll { padding: 20px 16px; min-height: 0; }
  .editor-scroll pre { font-size: 12px; }
  .palette-swatches { grid-template-columns: 1fr; }
  .swatch { min-height: 80px; padding: 20px; flex-direction: row; align-items: center; justify-content: space-between; }
  .swatch span { margin: 0; }
  .palette-bottom { padding: 20px; }
  .palette-specimen { gap: 16px; }
  .sample-draft { padding: 24px; }
  .sample-draft h3 { font-size: 27px; }
  .sample-draft p:not(.micro-label) { font-size: 14px; }
  .workspace-pagination { gap: 14px; align-items: flex-start; }
  .workspace-pagination a { font-size: 12px; flex: 1; }
  .workspace-pagination a span { font-size: 10px; }
  .preview-position { display: none; }
  .planned-panel { padding: 28px 20px; }
  .planned-panel h2 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .tools-page *, .tools-page *::before, .tools-page *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Functional mathematics workspaces: existing shell and visual rhythm retained. */
.math-live { font-size: 14px; }
.math-live button, .math-help button { min-height: 40px; padding: 7px 12px; background: var(--surface-raised); border: 1px solid var(--control-border); color: var(--text); }
.math-live button:hover:not(:disabled) { border-color: var(--accent); background: #243442; }
.math-live button:disabled { opacity: .55; }
.math-live .math-primary { background: #284355; border-color: #638ca5; color: #eef7fc; }
.math-input-form { padding: 22px; }
.math-input-form > label { display: block; margin-bottom: 7px; }
.math-mode { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.math-mode select { width: 150px; }
.math-hint { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 8px 0 14px; }
.math-result { padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.math-result > span { color: var(--muted); font-size: 11px; }
.math-result output { font-size: clamp(24px,3vw,40px); line-height: 1.3; overflow-wrap: anywhere; max-width: 100%; }
.math-message { font-size: 12px; line-height: 1.6; min-height: 2em; margin: 14px 0; color: var(--muted); overflow-wrap: anywhere; }
.math-error { color: var(--danger); }
.math-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.live-keypad { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; padding: 0 22px; }
.live-keypad button { min-width: 0; padding: 8px 2px; font-size: 13px; }
.math-history { padding: 0; margin: 0; list-style: none; }
.math-history li { border-bottom: 1px solid var(--line); }
.math-history button { display: flex; width: 100%; justify-content: space-between; text-align: left; align-items: baseline; gap: 20px; padding: 18px; border: 0; border-radius: 0; background: transparent; }
.math-history button span { overflow-wrap: anywhere; min-width: 0; }
.math-history small { color: var(--muted); font-size: 10px; }
.math-history strong { color: var(--accent); overflow-wrap: anywhere; min-width: 0; }
.math-reference h3 { font-size: 17px; margin-bottom: 18px; }
.math-reference dl { margin: 0; }
.math-reference dt { color: var(--text); font-size: 12px; margin: 14px 0 4px; }
.math-reference dd { margin: 0; color: var(--muted); font-size: 12px; }
.math-help { border-top: 1px solid var(--line); padding: 20px 0; margin-top: 24px; }
.math-help summary { font-size: 13px; }
.math-help p { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.math-return { padding: 12px 0; font-size: 13px; }
.graph-live .graph-layout { grid-template-columns: minmax(250px,.38fr) minmax(0,1fr); }
.graph-expression-form { padding: 18px; }
.graph-expression-row { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.graph-expression-row > label { display: block; margin-bottom: 6px; font-size: 12px; }
.graph-row-options { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.graph-row-options label { font-size: 11px; display: flex; align-items: center; gap: 6px; }
.graph-row-options input[type=checkbox] { margin: 0; }
.graph-row-options select { padding: 7px; min-height: 38px; font-size: 11px; width: 142px; }
.graph-row-options button { font-size: 11px; }
.graph-function-error { font-size: 11px; color: var(--danger); margin: 6px 0 0; overflow-wrap: anywhere; }
.graph-toolbar { padding: 10px 14px; display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.graph-toolbar button { padding: 6px 11px; }
.graph-axis-settings { margin: 0 18px 18px; font-size: 12px; }
.axes-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.axes-inputs label { font-size: 11px; min-width: 0; }
.axes-inputs input { font-size: 12px; }
.graph-grid-toggle { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
#graphCanvas { width: 100%; height: 440px; display: block; touch-action: none; cursor: crosshair; }
.graph-readout { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding: 12px 18px; font: 10px/1.6 monospace; color: var(--muted); border-top: 1px solid var(--line); }
.graph-visual > .math-message { padding: 0 18px; }
.graph-table-panel { margin-top: 20px; }
.graph-trace { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px; }
.graph-trace input { max-width: 160px; }
.graph-table-panel > .math-message { padding: 0 18px; }
.math-table-scroll { overflow-x: auto; padding: 0 18px 18px; }
.math-table-scroll table { border-collapse: collapse; width: 100%; font-size: 12px; }
.math-table-scroll caption { color: var(--muted); font-size: 11px; text-align: left; padding: 10px 0; }
.math-table-scroll :is(th,td) { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; min-width: 100px; overflow-wrap: anywhere; max-width: 300px; }
.math-table-scroll th { font-weight: 500; color: var(--text); }
.math-table-scroll td { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .graph-live .graph-layout { grid-template-columns: 1fr; } #graphExpressions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; } }
@media (max-width: 580px) {
  .math-input-form { padding: 16px; }
  .live-keypad { padding: 0 16px; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .math-mode { gap: 8px; }
  .math-mode select { max-width: 136px; }
  .math-history button { gap: 12px; font-size: 12px; }
  #graphExpressions { grid-template-columns: 1fr; gap: 0; }
  #graphCanvas { height: 320px; }
  .graph-trace { padding: 16px; }
  .graph-trace input { max-width: 100%; }
}

.graph-readout > * { min-width: 0; overflow-wrap: anywhere; }
.math-live.calculator-layout { align-items: start; }
.graph-live { display: grid; grid-template-columns: minmax(250px,.38fr) minmax(0,1fr); gap: 20px; align-items: start; }
.graph-live > .graph-layout { display: contents; }
.graph-controls-panel { grid-column: 1; grid-row: 1 / span 2; }
.graph-visual, .graph-table-panel { grid-column: 2; }
.graph-live > .graph-table-panel { margin-top: 0; }
.graph-live > .math-help { grid-column: 1 / -1; margin-top: 0; }
.graph-share-fallback { padding: 0 18px 18px; }
.graph-share-fallback label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
@media (max-width: 900px) {
  .graph-live { display: block; }
  .graph-live > .graph-layout { display: block; }
  .graph-controls-panel { margin-bottom: 20px; }
  .graph-live > .graph-table-panel { margin-top: 20px; }
  .graph-live > .math-help { margin-top: 20px; }
}
.live-keypad { display: block; }
.live-keypad-functions { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
.live-keypad-numbers { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-top: 12px; }
.live-keypad .keypad-calculate { width: 100%; margin-top: 8px; }
.math-message:empty { min-height: 0; margin: 0; padding: 0; }
@media(max-width:580px) { .live-keypad-functions { grid-template-columns: repeat(4,minmax(0,1fr)); } }
/* Expanded mathematics: exact fractions, coefficient forms, matrices, statistics. */
.arithmetic-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; align-items:start; }
.math-live :is(section,form,fieldset,div) { min-width:0; }
.math-input-form > select { margin-bottom:18px; }
.math-input-form :is(input,textarea,select) { max-width:100%; }
.math-input-form textarea { resize:vertical; min-height:120px; }
#fractionBField { margin-top:16px; }
#fractionBField label, .coefficient-grid label { display:block; margin-bottom:7px; font-size:12px; }
.math-output { padding:22px; overflow-wrap:anywhere; }
.math-output > :first-child { margin-top:0; }
.math-output h3 { font-size:17px; font-weight:500; }
.large-number { display:block; font-size:clamp(24px,3vw,38px); font-variant-numeric:tabular-nums; line-height:1.4; overflow-wrap:anywhere; }
.math-result-list { margin:20px 0; }
.math-result-list > div { padding:12px 0; border-bottom:1px solid var(--line); }
.math-result-list dt, .statistics-metrics dt { color:var(--muted); font-size:11px; }
.math-result-list dd { margin:6px 0 0; font-variant-numeric:tabular-nums; }
.math-output-actions { padding:0 22px 18px; }
.math-secondary-panel { margin-top:20px; }
.coefficient-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.equation-formula { font-size:20px; padding:16px 0; border-block:1px solid var(--line); }
.equation-answers { list-style:none; margin:18px 0; padding:0; font-size:24px; font-variant-numeric:tabular-nums; }
.equation-answers li { margin:8px 0; }
.equation-steps { padding-left:20px; font-size:12px; color:var(--muted); }
.equation-steps li { padding:4px 0; }
.math-output .math-subheading { margin-top:28px; font-size:14px; }
.math-output .math-table-scroll { padding:0 0 16px; }
.matrix-editors { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px; }
.matrix-dimensions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; border:0; margin:0 0 16px; padding:0; }
.matrix-dimensions legend { padding:0 0 12px; font-size:13px; }
.matrix-dimensions label { font-size:11px; color:var(--muted); }
.matrix-dimensions select { width:64px; padding:8px; }
.matrix-input-scroll { overflow-x:auto; padding:2px 2px 12px; }
.matrix-input-grid { display:grid; gap:7px; }
.matrix-input-grid input { width:100%; min-width:0; padding:9px; font:13px/1.5 monospace; }
.statistics-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:0 22px; margin:0; }
.statistics-metrics > div { padding:16px 0; border-bottom:1px solid var(--line); }
.statistics-metrics dd { margin:8px 0 0; font-size:20px; font-variant-numeric:tabular-nums; }
.statistics-variance { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; margin-top:28px; }
.statistics-variance .math-result-list { margin-top:8px; }
.statistics-boxplot { display:block; width:100%; max-height:170px; margin:10px 0; }
.sorted-data { margin-top:20px; font-size:12px; }
.sorted-data textarea { margin-top:14px; width:100%; resize:vertical; font:12px/1.7 monospace; }
@media(max-width:1000px) { .statistics-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:800px) { .arithmetic-layout, .matrix-editors { grid-template-columns:1fr; } }
@media(max-width:580px) {
 .math-output { padding:16px; }
 .math-output-actions { padding:0 16px 16px; }
 .coefficient-grid, .statistics-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .statistics-variance { grid-template-columns:1fr; gap:6px; }
 .statistics-metrics dd { font-size:17px; }
}
.unit-selectors { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:18px 0; }
.unit-selectors label { display:block; margin-bottom:7px; font-size:12px; }
.unit-selectors select { width:100%; }
@media(max-width:580px) { .unit-selectors { grid-template-columns:1fr; } }

.games-category-link{display:block;margin:16px 0;padding:12px;border:1px solid var(--line,#d7d8ce);border-radius:4px;font-size:13px}
