
:root {
  color-scheme: light;
  --ink: #18382f;
  --muted: #71827b;
  --paper: #f4f5f0;
  --surface: #ffffff;
  --line: #e5eae5;
  --green: #24775e;
  --green-dark: #164d3d;
  --green-pale: #eaf4ef;
  --accent: #24775e;
  --accent-rgb: 36, 119, 94;
  --gold: #e3b04b;
  --radius: 20px;
  font-family: "Noto Sans Arabic", "Geeza Pro", Tahoma, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
bdi { font-family: "Inter", "Noto Sans Arabic", Arial, sans-serif; }
.topbar { height: 76px; padding: 0 max(28px, calc((100vw - 1320px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(27,64,51,.08); background: rgba(255,255,255,.58); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand img { display: block; border-radius: 12px; box-shadow: 0 4px 10px rgba(24,56,47,.08); }
.brand-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.brand-copy strong { font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.brand-copy small { font-size: 10px; color: #85918b; font-weight: 600; letter-spacing: .02em; }
.topbar-note { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #71827b; font-weight: 650; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ca17e; box-shadow: 0 0 0 4px #e5f2eb; }
.page-shell { width: min(1320px, calc(100% - 56px)); margin: 0 auto; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 44px 5px 27px; }
.eyebrow, .section-kicker { margin: 0; color: #83928b; font-weight: 750; font-size: 10px; letter-spacing: .075em; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.eyebrow-line { width: 19px; height: 2px; border-radius: 2px; background: var(--gold); }
h1 { margin: 0; font-size: clamp(30px, 3.2vw, 43px); line-height: 1.3; letter-spacing: -.055em; font-weight: 850; }
h1 span { color: #688077; font-size: .76em; font-weight: 700; letter-spacing: -.04em; }
.intro-copy { max-width: 620px; margin: 11px 0 0; color: #73837c; font-size: 13px; line-height: 1.9; }
.reset-button { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #dce5df; border-radius: 12px; background: rgba(255,255,255,.66); color: #426457; padding: 10px 14px; font-size: 11px; font-weight: 750; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.reset-button:hover { border-color: #a6c9b5; background: #fff; transform: translateY(-1px); }
.reset-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(335px, .88fr); align-items: start; gap: 20px; direction: rtl; }
.surface-card { border: 1px solid rgba(25,67,52,.07); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 34px rgba(35,65,51,.045), 0 2px 5px rgba(35,65,51,.025); }
.plot-card { padding: 22px 24px 16px; min-width: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.plot-heading h2, .compact-heading h2 { margin: 3px 0 0; font-size: 16px; font-weight: 800; letter-spacing: -.025em; }
.section-kicker { font-size: 9px; letter-spacing: .08em; }
.mode-pill { border: 1px solid #d9e9e0; color: var(--accent); background: rgba(var(--accent-rgb),.065); border-radius: 999px; padding: 6px 10px; font-size: 10px; font-weight: 750; white-space: nowrap; transition: .2s; }
.graph-wrap { margin: 13px -4px 0; border: 1px solid #edf1ed; border-radius: 15px; overflow: hidden; background: linear-gradient(180deg,#fcfdfb,#fafbf8); }
#graph { display: block; width: 100%; height: auto; overflow: visible; touch-action: none; }
.plot-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 2px 0; }
.drag-hint { display: inline-flex; align-items: center; gap: 6px; color: #87948e; font-size: 10px; font-weight: 600; white-space: nowrap; }
.drag-glyph { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; color: var(--accent); background: rgba(var(--accent-rgb),.09); font-size: 13px; font-weight: 800; }
.legend { display: flex; align-items: center; gap: 13px; color: #84918b; font-size: 9px; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-open { border: 1.5px solid var(--accent); background: white; }
.legend-solid { background: var(--accent); }
.legend-dash { width: 13px !important; height: 0 !important; border-top: 1.5px dashed #87958d; border-radius: 0 !important; }
.control-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.controls-card { padding: 21px 20px 16px; }
.compact-heading h2 { font-size: 15px; }
.step-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; color: #678376; background: #f0f5f1; font: 800 10px/1 "Inter", Arial, sans-serif; }
.mode-picker { display: flex; flex-direction: column; gap: 7px; margin-top: 17px; }
.mode-button { position: relative; width: 100%; display: grid; grid-template-columns: 41px 1fr 19px; align-items: center; gap: 11px; text-align: right; padding: 9px 10px; border: 1px solid #edf0ed; border-radius: 13px; background: #fff; cursor: pointer; transition: border .18s, background .18s, box-shadow .18s; }
.mode-button:hover { background: #fafcfb; border-color: #dbe7df; }
.mode-button.is-active { border-color: rgba(var(--accent-rgb),.4); background: rgba(var(--accent-rgb),.045); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),.04); }
.mode-button strong, .mode-button small { display: block; }
.mode-button strong { font-size: 11px; font-weight: 800; }
.mode-button small { margin-top: 2px; color: #909b95; font-size: 9px; font-weight: 550; }
.mode-check { opacity: 0; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: white; background: var(--accent); font: 800 10px/1 Arial, sans-serif; transition: opacity .15s; }
.mode-button.is-active .mode-check { opacity: 1; }
.mini-graph { position: relative; display: block; width: 39px; height: 26px; overflow: hidden; border-radius: 7px; background-color: #f4f7f4; background-image: linear-gradient(#e6ece7 1px,transparent 1px),linear-gradient(90deg,#e6ece7 1px,transparent 1px); background-size: 9px 9px; }
.mini-graph::before, .mini-graph::after { content: ""; position: absolute; background: #aebbb3; }
.mini-graph::before { width: 1px; height: 100%; left: 20px; top: 0; }
.mini-graph::after { height: 1px; width: 100%; top: 13px; left: 0; }
.mini-graph i { position: absolute; z-index: 1; display: block; width: 20px; height: 2px; background: var(--accent); }
.mini-jump i { top: 8px; left: 2px; box-shadow: 17px 8px 0 var(--accent); }
.mini-hole i { top: 12px; left: 2px; width: 34px; }
.mini-hole i::after { content: ""; position: absolute; width: 5px; height: 5px; top: -2px; left: 16px; background: #fff; border: 1px solid var(--accent); border-radius: 50%; }
.mini-infinite i { top: 6px; left: 23px; width: 2px; height: 16px; transform: skew(-5deg); box-shadow: -2px 14px 0 0 var(--accent); }
.divider { height: 1px; background: #edf0ed; margin: 16px 0 13px; }
.slider-block { margin-bottom: 15px; }
.slider-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: #5f746a; font-size: 10px; font-weight: 700; }
.slider-title output { min-width: 47px; padding: 4px 7px; border-radius: 7px; color: var(--accent); background: rgba(var(--accent-rgb),.08); text-align: center; font: 750 10px/1.1 "Inter", Arial, sans-serif; }
input[type="range"] { display: block; width: 100%; height: 5px; margin: 0; border-radius: 99px; accent-color: var(--accent); direction: ltr; cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; margin-top: 4px; color: #a1aaa5; font: 9px/1 "Inter", Arial, sans-serif; direction: ltr; }
.mode-fields { border-top: 1px solid #f0f2f0; padding-top: 12px; }
.field-group-title { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; color: #78877f; font-size: 9px; font-weight: 750; }
.field-group-title::before { content: ""; width: 4px; height: 13px; border-radius: 3px; background: var(--accent); }
.field-stack { display: flex; flex-direction: column; gap: 11px; }
.field-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; color: #5d7067; font-size: 9px; font-weight: 650; }
.field-label output { color: var(--accent); font: 700 9px/1 "Inter", Arial, sans-serif; }
.number-line { display: flex; align-items: center; gap: 9px; }
.number-line input[type="number"] { width: 91px; height: 34px; border: 1px solid #e5ebe6; border-radius: 9px; outline: none; padding: 0 9px; background: #fcfdfc; color: var(--ink); direction: ltr; text-align: center; font: 700 11px "Inter", Arial, sans-serif; }
.number-line input[type="number"]:focus, select:focus-visible { border-color: #82ae96; box-shadow: 0 0 0 3px rgba(36,119,94,.11); }
.input-suffix { color: #939f98; font-size: 9px; }
.field-check { display: inline-flex; align-items: center; gap: 6px; color: #85928a; font-size: 9px; cursor: pointer; }
.field-check input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
select { width: 100%; min-height: 35px; border: 1px solid #e5ebe6; border-radius: 9px; padding: 5px 9px; outline: none; color: #52675d; background-color: #fcfdfc; font-size: 10px; }
.controls-footnote { display: flex; align-items: center; gap: 6px; margin: 13px 0 0; color: #909b95; font-size: 9px; }
.controls-footnote span { color: var(--accent); font-size: 13px; }
.results-card { padding: 19px 19px 16px; }
.results-heading { margin-bottom: 13px; }
.result-symbol { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 10px; color: #698177; background: #f0f5f1; font: 700 17px/1 Georgia, serif; }
.result-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid #edf1ed; border-radius: 12px; overflow: hidden; }
.result-cell { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 5px 9px; background: #fcfdfc; text-align: center; }
.result-cell + .result-cell { border-right: 1px solid #edf1ed; }
.result-cell > span { color: #8b9991; font-size: 9px; font-weight: 650; }
.result-cell strong { color: var(--accent); font: 800 16px/1.2 "Inter", "Noto Sans Arabic", Arial, sans-serif; letter-spacing: -.03em; }
.result-cell small { color: #88958e; font-size: 8px; direction: ltr; white-space: nowrap; }
.result-function strong { color: #1b4438; }
.continuity-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 10px 11px; border: 1px solid #f0dfbe; border-radius: 11px; background: #fffaf0; }
.continuity-note.is-continuous { border-color: #dcebe1; background: #f3faf5; }
.continuity-icon { flex: 0 0 auto; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; color: #b5822b; background: #f9edcf; font: 800 11px/1 Arial,sans-serif; }
.is-continuous .continuity-icon { color: #327657; background: #e1f0e6; }
.continuity-note strong { display: block; color: #806329; font-size: 10px; font-weight: 800; }
.is-continuous strong { color: #317351; }
.continuity-note p { margin: 3px 0 0; color: #93866d; font-size: 9px; line-height: 1.7; }
.is-continuous p { color: #728d7d; }
.page-footer { display: flex; justify-content: space-between; gap: 16px; padding: 17px 5px 25px; color: #94a099; font-size: 9px; }
.footer-separator { padding: 0 6px; color: #c0c8c2; }

/* SVG plot */
.grid-line { stroke: #e9eeea; stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis-line { stroke: #708179; stroke-width: 1.35; vector-effect: non-scaling-stroke; }
.axis-tick { stroke: #9ba8a0; stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis-label { fill: #7e8e85; font: 11px "Inter", Arial, sans-serif; }
.axis-name { fill: #415b4f; font: 700 14px "Inter", Arial, sans-serif; }
.curve-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 2px 1px rgba(var(--accent-rgb),.09)); }
.a-guide { stroke: var(--accent); stroke-opacity: .32; stroke-width: 1.4; stroke-dasharray: 5 6; vector-effect: non-scaling-stroke; }
.a-label-bg { fill: #fff; stroke: #e8eeea; stroke-width: 1; }
.a-label { fill: #416455; font: 700 12px "Inter", Arial, sans-serif; }
.open-point { fill: #fff; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.solid-point { fill: var(--accent); stroke: #fff; stroke-width: 2.2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 2px rgba(22,77,61,.2)); }
.curve-handle { fill: var(--accent); stroke: #fff; stroke-width: 2.4; vector-effect: non-scaling-stroke; cursor: ns-resize; filter: drop-shadow(0 1px 3px rgba(22,77,61,.25)); transition: r .12s; }
.curve-handle:hover { r: 9; }
.curve-handle.limit-handle { fill: #fff; stroke: var(--accent); stroke-width: 2.4; cursor: ns-resize; }
.drag-x-handle { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: ew-resize; }
.handle-halo { fill: var(--accent); fill-opacity: .1; }
.asymptote-label { fill: #829188; font: 10px "Inter", Arial, sans-serif; }

:focus-visible { outline: 3px solid rgba(36,119,94,.35); outline-offset: 2px; }
@media (min-width: 1450px) { .page-shell { width: min(1370px, calc(100% - 80px)); } }
@media (max-width: 1100px) {
  .page-shell { width: min(980px, calc(100% - 36px)); }
  .workspace { grid-template-columns: minmax(0,1fr); }
  .control-column { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; }
  .plot-card { padding: 19px 18px 14px; }
  .controls-card, .results-card { padding: 18px; }
}
@media (max-width: 620px) {
  .topbar { height: 65px; padding: 0 18px; }
  .topbar-note { font-size: 9px; }
  .page-shell { width: calc(100% - 28px); }
  .intro { align-items: flex-start; padding: 29px 2px 19px; }
  h1 { font-size: clamp(28px, 8vw, 37px); }
  .intro-copy { font-size: 11px; line-height: 1.8; }
  .reset-button { padding: 8px 10px; margin-top: 2px; font-size: 9px; white-space: nowrap; }
  .reset-button svg { width: 14px; height: 14px; }
  .workspace { gap: 12px; }
  .plot-card { padding: 16px 12px 12px; border-radius: 16px; }
  .plot-heading h2 { font-size: 14px; }
  .mode-pill { padding: 5px 8px; font-size: 9px; }
  .graph-wrap { margin: 12px -3px 0; border-radius: 11px; }
  .plot-footer { align-items: flex-start; flex-direction: column; gap: 8px; padding-top: 9px; }
  .legend { width: 100%; justify-content: space-between; gap: 5px; font-size: 8px; }
  .control-column { display: flex; gap: 12px; }
  .controls-card, .results-card { padding: 16px 14px 13px; border-radius: 16px; }
  .page-footer { flex-direction: column; gap: 5px; padding: 14px 2px 22px; font-size: 8px; }
}
@media (max-width: 390px) {
  .topbar-note { font-size: 0; gap: 0; }
  .live-dot { margin-left: 2px; }
  .intro { gap: 10px; }
  .reset-button { gap: 5px; padding-inline: 8px; }
  .legend { font-size: 7.5px; }
  .legend span { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }


/* Mathematical example selector and live formula */
.example-picker { margin-top: 16px; }
.example-label, .formula-overline { display: block; margin-bottom: 6px; color: #71847a; font-size: 9px; font-weight: 750; }
.example-picker select { min-height: 38px; border-color: #dde7df; background: #fbfdfb; color: #34594b; font-weight: 650; }
.formula-card { margin-top: 9px; padding: 11px 12px 9px; border: 1px solid #e4ece6; border-radius: 12px; background: linear-gradient(135deg,#f7faf7,#f2f7f3); }
.formula-card[hidden] { display: none; }
.formula-overline { margin-bottom: 8px; color: #8b9990; font-size: 8px; letter-spacing: .04em; }
.formula-equation { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; min-height: 38px; color: #183c31; font-family: "STIX Two Math", "Cambria Math", Georgia, serif; font-size: 17px; font-weight: 600; text-align: center; }
.math-leading, .math-expression { white-space: nowrap; }
.math-brace { align-self: stretch; color: #688576; font: 38px/.8 Georgia, serif; }
.math-cases { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 14px; }
.math-cases > span { display: grid; grid-template-columns: minmax(27px,auto) auto; align-items: baseline; gap: 8px; }
.math-cases i { color: #788a80; font: italic 10px/1.3 "Inter", Arial, sans-serif; white-space: nowrap; }
.math-fraction { display: inline-flex; min-width: 36px; flex-direction: column; align-items: stretch; text-align: center; line-height: 1.25; }
.math-fraction > span:first-child { padding: 0 4px 2px; border-bottom: 1.2px solid #426b58; }
.math-fraction > span:last-child { padding: 2px 4px 0; }
.math-tail { align-self: center; color: #5c7568; font: 11px/1.5 "Inter", "Noto Sans Arabic", Arial, sans-serif; }
.math-tail small { color: #788b80; font-size: 9px; }
.formula-description { margin: 8px 0 0; color: #839188; font-size: 8.5px; line-height: 1.7; }
.manual-label { margin: 14px 0 -7px; color: #89958e; font-size: 9px; font-weight: 700; }

@media (max-width: 620px) {
  .example-picker { margin-top: 13px; }
  .formula-card { padding: 10px; }
  .formula-equation { font-size: 15px; }
  .math-cases { font-size: 12px; }
  .math-tail { font-size: 10px; }
  .manual-label { margin-top: 12px; }
}


/* Piecewise functions learning section */
.piecewise-section { margin: 18px 0 8px; padding: 28px; border: 1px solid rgba(25,67,52,.07); border-radius: var(--radius); background: rgba(255,255,255,.68); box-shadow: 0 12px 34px rgba(35,65,51,.035); }
.piecewise-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.piecewise-section-heading h2 { margin: 4px 0 0; font-size: 20px; font-weight: 850; letter-spacing: -.035em; }
.piecewise-section-heading p:last-child { max-width: 660px; margin: 7px 0 0; color: #77877f; font-size: 11px; line-height: 1.8; }
.piecewise-tag { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #e1eae3; border-radius: 999px; color: #527363; background: #f4f8f4; font-size: 9px; font-weight: 750; }
.piecewise-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.piecewise-card { min-width: 0; display: flex; flex-direction: column; padding: 17px 16px 14px; border: 1px solid #e9eee9; border-radius: 15px; background: #fff; }
.piecewise-index { color: #8d9a92; font: 750 9px/1.3 "Inter", Arial, sans-serif; letter-spacing: .045em; }
.piecewise-index i { padding: 0 3px; color: #c2cec5; font-style: normal; }
.piecewise-card h3 { margin: 9px 0 0; color: #254638; font-size: 13px; font-weight: 800; }
.piecewise-card > p { min-height: 54px; margin: 6px 0 11px; color: #78877f; font-size: 9px; line-height: 1.8; }
.piecewise-math { min-width: 0; min-height: 74px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 0 0 13px; padding: 10px 7px; border: 1px solid #edf1ed; border-radius: 11px; background: #fafcf9; color: #244638; font: 600 14px/1.4 "STIX Two Math", "Cambria Math", Georgia, serif; }
.piecewise-math .math-leading { font-size: 13px; }
.piecewise-math .math-brace { font-size: 35px; }
.piecewise-math .math-cases { min-width: 0; max-width: 100%; gap: 5px; font-size: 13px; }
.piecewise-math .math-cases > span { min-width: 0; grid-template-columns: minmax(35px,auto) minmax(0,1fr); gap: 6px; }
.piecewise-math .math-cases i { font-size: 9px; white-space: normal; overflow-wrap: anywhere; }
.piecewise-apply { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 9px 11px; border: 1px solid #deebe2; border-radius: 9px; color: #28684f; background: #f5faf6; font-size: 9px; font-weight: 800; text-align: right; cursor: pointer; transition: background .16s,border-color .16s,transform .16s; }
.piecewise-apply:hover { transform: translateY(-1px); border-color: #b9d4c2; background: #edf7f0; }
.piecewise-apply span { font: 700 14px/1 Arial,sans-serif; }

@media (max-width: 1100px) { .piecewise-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .piecewise-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 620px) {
  .piecewise-section { margin-top: 12px; padding: 17px 14px; border-radius: 16px; }
  .piecewise-section-heading { margin-bottom: 14px; }
  .piecewise-section-heading h2 { font-size: 17px; }
  .piecewise-section-heading p:last-child { font-size: 10px; }
  .piecewise-tag { padding: 6px 8px; font-size: 8px; }
  .piecewise-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .piecewise-card { padding: 14px; }
  .piecewise-card > p { min-height: 0; }
  .piecewise-math { min-height: 68px; }
}


/* Language switch and direction-aware layout */
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.language-toggle { min-height: 34px; padding: 0 12px; border: 1px solid #dce5df; border-radius: 10px; color: #426457; background: rgba(255,255,255,.78); font-size: 10px; font-weight: 800; cursor: pointer; transition: border-color .18s,background .18s,transform .18s; }
.language-toggle:hover { transform: translateY(-1px); border-color: #a6c9b5; background: #fff; }
html[dir="ltr"] .workspace { direction: ltr; }
html[dir="ltr"] .mode-button { direction: ltr; text-align: left; }
html[dir="ltr"] .piecewise-apply { direction: ltr; text-align: left; }
html[dir="ltr"] .result-cell + .result-cell { border-right: 0; border-left: 1px solid #edf1ed; }
html[dir="ltr"] .field-group-title { direction: ltr; }
html[dir="ltr"] .controls-footnote { direction: ltr; }
html[dir="ltr"] .legend { direction: ltr; }
@media (max-width: 620px) {
  .topbar-actions { gap: 10px; }
  .language-toggle { min-height: 31px; padding: 0 9px; font-size: 9px; }
}


/* Piecewise limit practice cards */
.practice-section { margin: 18px 0 8px; padding: 28px; border: 1px solid rgba(25,67,52,.07); border-radius: var(--radius); background: rgba(255,255,255,.68); box-shadow: 0 12px 34px rgba(35,65,51,.035); }
.practice-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.practice-heading h2 { margin: 4px 0 0; font-size: 20px; font-weight: 850; letter-spacing: -.035em; }
.practice-heading p:last-child { max-width: 680px; margin: 7px 0 0; color: #77877f; font-size: 11px; line-height: 1.8; }
.practice-mark { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #e1eae3; border-radius: 11px; color: #527363; background: #f4f8f4; font: 800 10px/1 "Inter", Arial, sans-serif; }
.practice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.practice-card { min-width: 0; display: flex; flex-direction: column; padding: 17px 16px 14px; border: 1px solid #e9eee9; border-radius: 15px; background: #fff; }
.practice-card-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.practice-index { flex: 0 0 auto; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: var(--accent); background: rgba(var(--accent-rgb),.08); font: 800 9px/1 "Inter", Arial, sans-serif; }
.practice-card h3 { margin: 0; color: #254638; font-size: 13px; font-weight: 800; }
.practice-formula { min-width: 0; width: 100%; min-height: 94px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin: 0 0 11px; padding: 12px 8px; overflow-wrap: anywhere; border: 1px solid #edf1ed; border-radius: 11px; background: #fafcf9; color: #244638; font: 600 15px/1.45 "STIX Two Math", "Cambria Math", Georgia, serif; }
.practice-formula .math-leading { font-size: 14px; }
.practice-formula .math-brace { font-size: 39px; }
.practice-formula .math-cases { min-width: 0; max-width: 100%; gap: 5px; font-size: 14px; }
.practice-formula .math-cases > span { min-width: 0; grid-template-columns: minmax(76px,auto) max-content; gap: 9px; }
.practice-formula .math-cases i { color: #788a80; font: italic 11px/1.4 "Inter", Arial, sans-serif; white-space: nowrap; }
.practice-prompt { margin: 0 0 6px; color: #536d60; font-size: 10px; font-weight: 750; }
.practice-questions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 16px; margin: 0 0 14px; padding-inline-start: 21px; color: #697b72; }
.practice-questions li { min-width: 0; padding-inline-start: 2px; font-size: 9px; line-height: 1.75; }
.practice-questions li::marker { color: #8aa292; font: 700 9px "Inter", Arial, sans-serif; }
.practice-questions bdi { color: #284b3d; font: 650 10px "Inter", "Noto Sans Arabic", Arial, sans-serif; }
.practice-answer { border: 1px solid #e3ece5; border-radius: 10px; background: #f8fbf8; }
.practice-answer summary { padding: 10px 12px; color: #28684f; font-size: 10px; font-weight: 800; cursor: pointer; }
.practice-answer[open] summary { border-bottom: 1px solid #e3ece5; }
.practice-solution { padding: 10px 12px; color: #62756a; font-size: 9px; line-height: 1.8; }
.practice-solution p { margin: 0; }
.practice-solution p + p { margin-top: 6px; }
.practice-solution bdi { color: #244638; font: 650 10px "Inter", "Noto Sans Arabic", Arial, sans-serif; }
@media (max-width: 760px) { .practice-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 620px) {
  .practice-section { margin-top: 12px; padding: 17px 14px; border-radius: 16px; }
  .practice-heading { margin-bottom: 14px; }
  .practice-heading h2 { font-size: 17px; }
  .practice-heading p:last-child { font-size: 10px; }
  .practice-card { padding: 14px; }
  .practice-questions { gap: 5px 10px; }
}
