/* ===== CALCULATOR ===== */
.gcalc-root {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.gcalc-root {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
  border: 1px solid #111;
  --sat-font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--sat-font-main);
}
.gcalc-root .sat-calc-header {
  position: relative; flex: none; display: flex; align-items: center; justify-content: space-between;
  height: 42px; padding: 0 10px 0 12px; gap: 8px;
  background: #111; color: #fff; user-select: none;
}
.gcalc-root .sat-calc-title { min-width: 0; max-width: calc(50% - 22px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 700; color: #fff; font-family: var(--sat-font-main); }
.gcalc-root .sat-calc-header-right { display: flex; align-items: center; gap: 8px; }
.gcalc-root .sat-calc-expand-btn { display: flex; align-items: center; gap: 8px; padding: 3px 5px; border: none; border-radius: 5px; background: none; color: #fff; font-size: 16px; font-weight: 700; font-family: var(--sat-font-main); cursor: pointer; }
.gcalc-root .sat-calc-expand-btn:hover { background: rgba(255,255,255,0.16); }
.gcalc-root .sat-calc-expand-icon { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 5px; background: #fff; color: #111; }
.gcalc-root .sat-calc-expand-icon svg { width: 17px; height: 17px; fill: currentColor; }

.gcalc-root .sat-calc-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.gcalc-root .sat-calc-graph-wrap { flex: 1 1 0; min-height: 110px; position: relative; background: #fff; }
/* Out of the flow, so the size of the drawing surface can never feed back into the layout. */
.gcalc-root .sat-calc-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.gcalc-root .sat-calc-coord-label { position: absolute; pointer-events: none; background: #fff; border: 1px solid #b3b3b3; border-radius: 4px; padding: 2px 7px; font-size: 13px; font-family: var(--sat-font-main); color: #000; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,0.18); z-index: 5; display: none; }

/* Graph tools, top right of the graph: settings (wrench), zoom in / out, default viewport (home) */
.gcalc-root .sat-calc-graph-tools { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
.gcalc-root .sat-calc-tool { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; border-radius: 4px; background: rgba(236,236,236,0.95); color: #4d4d4d; cursor: pointer; font-size: 22px; line-height: 1; font-family: var(--sat-font-main); }
.gcalc-root .sat-calc-tool:hover { background: #dcdcdc; }
.gcalc-root .sat-calc-tool svg { width: 20px; height: 20px; fill: currentColor; }
.gcalc-root .sat-calc-tool-3d { font-size: 13px; font-weight: 700; }
.gcalc-root .sat-calc-tool-on { background: #d5dcf7; color: #2f50d0; }
.gcalc-root .sat-calc-zoom-pair { display: flex; flex-direction: column; border-radius: 4px; }
.gcalc-root .sat-calc-zoom-pair .sat-calc-tool:first-child { border-radius: 4px 4px 0 0; border-bottom: 1px solid #cbcbcb; }
.gcalc-root .sat-calc-zoom-pair .sat-calc-tool:last-child { border-radius: 0 0 4px 4px; }

/* Graph settings panel */
.gcalc-root .sat-calc-settings { display: none; position: absolute; top: 6px; right: 46px; width: 236px; max-width: calc(100% - 20px); z-index: 7; background: #fff; border: 1px solid #b9b9b9; border-radius: 6px; box-shadow: 0 3px 14px rgba(0,0,0,0.25); font-family: var(--sat-font-main); font-size: 13px; color: #1a1a2e; }
.gcalc-root .sat-calc-settings.sat-calc-open { display: block; }
.gcalc-root .sat-calc-settings-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 700; border-bottom: 1px solid #e3e5e8; }
.gcalc-root .sat-calc-settings-head button { border: none; background: none; cursor: pointer; color: #777; font-size: 13px; padding: 2px 4px; }
.gcalc-root .sat-calc-settings-row { display: flex; align-items: center; gap: 6px; padding: 7px 10px; }
.gcalc-root .sat-calc-settings-row label { flex: none; width: 46px; font-weight: 600; color: #444; }
.gcalc-root .sat-calc-settings-row input { flex: 1; min-width: 0; width: 60px; padding: 4px 5px; border: 1px solid #c4c4c4; border-radius: 4px; font-size: 13px; font-family: inherit; }
.gcalc-root .sat-calc-settings-row input:focus { outline: 2px solid #2f50d0; outline-offset: -1px; }
.gcalc-root .sat-calc-seg { display: flex; flex: 1; }
.gcalc-root .sat-calc-seg button { flex: 1; padding: 5px 4px; border: 1px solid #c4c4c4; background: #fff; cursor: pointer; font-size: 12px; font-family: inherit; color: #333; }
.gcalc-root .sat-calc-seg button:first-child { border-radius: 4px 0 0 4px; }
.gcalc-root .sat-calc-seg button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.gcalc-root .sat-calc-seg button.sat-calc-on { background: #2f50d0; border-color: #2f50d0; color: #fff; }
.gcalc-root .sat-calc-settings-btn { width: 100%; padding: 6px; border: 1px solid #c4c4c4; background: #fff; border-radius: 4px; cursor: pointer; font-size: 12.5px; font-family: inherit; color: #333; }
.gcalc-root .sat-calc-settings-btn:hover { background: #f1f1f1; }

/* Toolbar and expression list, below the graph (beside it when the panel is expanded) */
.gcalc-root .sat-calc-side { flex: 0 1 auto; display: flex; flex-direction: column; min-height: 0; max-height: 68%; border-top: 1px solid #b5b5b5; background: #fff; }
.gcalc-root .sat-calc-toolbar { flex: none; display: flex; align-items: center; gap: 2px; height: 46px; padding: 0 8px 0 14px; background: #fff; }
.gcalc-root .sat-calc-toolbar-spacer { flex: 1; }
.gcalc-root .sat-calc-add, .gcalc-root .sat-calc-tbtn { width: 38px; height: 38px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; border-radius: 4px; background: none; color: #3b3b3b; cursor: pointer; }
.gcalc-root .sat-calc-add svg, .gcalc-root .sat-calc-tbtn svg { width: 27px; height: 27px; fill: currentColor; transition: transform 0.15s; }
.gcalc-root .sat-calc-add:hover, .gcalc-root .sat-calc-tbtn:hover:not(:disabled) { background: #ececec; }
.gcalc-root .sat-calc-tbtn:disabled { color: #bdbdbd; cursor: default; }
.gcalc-root .sat-calc-tbtn.sat-calc-tool-on { background: #dfe5fa; color: #2f50d0; }
/* "+" menu: expression / table / inference */
.gcalc-root .sat-calc-add-wrap { position: relative; flex: none; }
.gcalc-root .sat-calc-addmenu { position: absolute; top: 100%; left: 0; margin-top: 4px; display: none; flex-direction: column; min-width: 168px; padding: 4px; background: #fff; border: 1px solid #d4d4d4; border-radius: 7px; box-shadow: 0 6px 18px rgba(0,0,0,0.18); z-index: 60; }
.gcalc-root .sat-calc-addmenu.sat-calc-open { display: flex; }
.gcalc-root .sat-calc-addmenu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: none; border-radius: 5px; background: none; color: #333; font-size: 14.5px; font-family: var(--sat-font-main); text-align: left; cursor: pointer; }
.gcalc-root .sat-calc-addmenu-item:hover:not(:disabled) { background: #f0f2f5; }
.gcalc-root .sat-calc-addmenu-item:disabled { color: #bcbcbc; cursor: default; }
.gcalc-root .sat-calc-addmenu-icon { flex: none; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-style: italic; font-size: 15px; color: #6b6b6b; }
.gcalc-root .sat-calc-addmenu-item:disabled .sat-calc-addmenu-icon { color: #bcbcbc; }
.gcalc-root .sat-calc-addmenu-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.gcalc-root:not(.sat-expanded) .sat-calc-side.sat-calc-kp-hidden #satCalcCollapseBtn svg { transform: rotate(180deg); }
.gcalc-root.sat-expanded #satCalcCollapseBtn svg { transform: rotate(90deg); }
.gcalc-root.sat-expanded .sat-calc-side.sat-calc-collapsed #satCalcCollapseBtn svg { transform: rotate(-90deg); }
.gcalc-root .sat-calc-side.sat-calc-collapsed .sat-calc-listwrap, .gcalc-root .sat-calc-side.sat-calc-collapsed .sat-calc-keypad-wrap { display: none; }
.gcalc-root .sat-calc-listwrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.gcalc-root .sat-calc-expr-list { flex: 1 1 auto; min-height: 0; max-height: 262px; overflow-y: auto; background: #fff; border-top: 1px solid #d9d9d9; }
.gcalc-root .sat-calc-kbtoggle { position: absolute; left: 8px; bottom: 8px; z-index: 3; display: none; align-items: center; gap: 3px; height: 30px; padding: 0 7px; border: 1px solid #c2c2c2; border-radius: 4px; background: #fff; color: #4d4d4d; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.gcalc-root .sat-calc-kbtoggle svg { width: 22px; height: 22px; fill: currentColor; }
.gcalc-root .sat-calc-kbtoggle.sat-calc-kb-on { background: #eef1fd; border-color: #2f50d0; color: #2f50d0; }
.gcalc-root.sat-expanded .sat-calc-kbtoggle { display: flex; }
.gcalc-root .sat-calc-caret { border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.gcalc-root .sat-calc-kbtoggle:not(.sat-calc-kb-on) .sat-calc-caret { transform: rotate(180deg); }
/* "powered by" watermark logo, bottom-right of the expression list -- the
   same corner (and out-of-the-way, non-interactive treatment) Desmos uses
   for its own "powered by desmos" mark. Embedded as a data URI so the
   widget stays a drop-in with no extra image file to ship. */
.gcalc-root .sat-calc-watermark { position: absolute; right: 10px; bottom: 8px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; pointer-events: none; user-select: none; }
.gcalc-root .sat-calc-watermark-label { font-size: 10px; line-height: 1; color: #b3b3b3; font-family: var(--sat-font-main); white-space: nowrap; }
.gcalc-root .sat-calc-watermark-logo { display: block; height: 20px; width: auto; opacity: 0.82; }

/* Rows */
.gcalc-root .sat-calc-expr-row { position: relative; display: flex; align-items: stretch; min-height: 62px; border-bottom: 1px solid #d9d9d9; background: #fff; }
.gcalc-root .sat-calc-expr-row.sat-focus { box-shadow: inset 0 0 0 2px #2f50d0; z-index: 1; }
.gcalc-root .sat-calc-expr-gutter { position: relative; flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: #e6e6e6; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-gutter { background: #2f50d0; }
.gcalc-root .sat-calc-expr-num { position: absolute; top: 3px; left: 5px; font-size: 10.5px; line-height: 1; color: #7a7a7a; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-num { color: #fff; }
.gcalc-root .sat-calc-expr-vis { display: none; width: 34px; height: 34px; padding: 0; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--c); background: var(--c); cursor: pointer; }
.gcalc-root .sat-calc-expr-vis svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.gcalc-root .sat-calc-expr-row.sat-has-graph .sat-calc-expr-vis { display: flex; }
.gcalc-root .sat-calc-expr-row.sat-off .sat-calc-expr-vis { background: #fff; }
.gcalc-root .sat-calc-expr-row.sat-off .sat-calc-expr-vis svg { display: none; }
.gcalc-root .sat-calc-expr-play, .gcalc-root .sat-calc-expr-loop { display: none; padding: 0; align-items: center; justify-content: center; background: none; cursor: pointer; color: #444; }
.gcalc-root .sat-calc-expr-play { width: 32px; height: 32px; border: 2px solid #444; border-radius: 50%; }
.gcalc-root .sat-calc-expr-play svg { width: 20px; height: 20px; fill: currentColor; }
.gcalc-root .sat-calc-expr-loop { width: 26px; height: 22px; border: none; border-radius: 4px; }
.gcalc-root .sat-calc-expr-loop svg { width: 18px; height: 18px; fill: currentColor; }
.gcalc-root .sat-calc-expr-loop.sat-calc-on { color: #2f50d0; background: #dfe5fa; }
.gcalc-root .sat-calc-expr-row.sat-is-slider .sat-calc-expr-play, .gcalc-root .sat-calc-expr-row.sat-is-slider .sat-calc-expr-loop { display: flex; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-play, .gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-loop { color: #fff; border-color: #fff; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-loop.sat-calc-on { background: rgba(255,255,255,0.25); }
.gcalc-root .sat-calc-expr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 6px 12px 6px 14px; }
.gcalc-root .sat-calc-expr-input { flex: none; width: 100%; min-width: 0; border: none; outline: none; background: transparent; font-size: 18px; font-family: var(--sat-font-main); color: #111; padding: 6px 0; }
/* Rows show what you type already typeset (Desmos style). The <input> still
   does the editing, but sits invisibly behind the maths; the caret and the
   selection are drawn on the maths itself (see renderPreview). */
.gcalc-root .sat-calc-expr-main { position: relative; }
.gcalc-root .sat-calc-expr-input.sat-calc-has-math { position: absolute; left: 14px; top: 0; width: calc(100% - 26px); height: 100%; padding: 0; opacity: 0; pointer-events: none; font-size: 16px; }
.gcalc-root .sat-calc-expr-preview { display: none; padding: 6px 0; min-height: 30px; overflow-x: auto; overflow-y: hidden; color: #111; cursor: text; user-select: none; -webkit-user-select: none; }
.gcalc-root .sat-calc-expr-preview .katex { font-size: 1.3em; }
.gcalc-root .sat-calc-expr-preview .katex-html { white-space: nowrap; }
.gcalc-root .sat-calc-expr-preview [data-ph] { color: #b8bcc6; }
.gcalc-root .sat-calc-expr-preview .sat-sel { background: rgba(47, 80, 208, 0.22); border-radius: 2px; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-before,
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-after { position: relative; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-before::before,
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-after::after {
  content: ''; position: absolute; top: 0.05em; bottom: 0.05em; width: 0; border-left: 2px solid #2f50d0; pointer-events: none; animation: satCaretBlink 1.1s steps(1) infinite;
}
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-before::before { left: -1px; }
.gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-preview .sat-caret-after::after { right: -1px; }
@keyframes satCaretBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.gcalc-root .sat-calc-expr-note { display: none; padding: 0 0 4px; font-size: 11.5px; line-height: 1.3; color: #b3261e; }
.gcalc-root .sat-calc-expr-result { display: none; flex: none; align-self: center; margin-right: 34px; font-size: 17px; color: #222; white-space: nowrap; }
.gcalc-root .sat-calc-expr-del { position: absolute; top: 3px; right: 6px; width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: none; color: #a3a3a3; cursor: pointer; font-size: 17px; z-index: 2; }
.gcalc-root .sat-calc-expr-del:hover { background: #e6e6e6; color: #c74440; }
.gcalc-root .sat-calc-expr-row:last-child .sat-calc-expr-del { visibility: hidden; }

/* Tables */
.gcalc-root .sat-calc-table-row { position: relative; display: flex; align-items: stretch; border-bottom: 1px solid #d9d9d9; background: #fff; }
.gcalc-root .sat-calc-table-row.sat-focus { box-shadow: inset 0 0 0 2px #2f50d0; z-index: 1; }
.gcalc-root .sat-calc-table-row .sat-calc-expr-gutter { flex: 0 0 46px; }
.gcalc-root .sat-calc-table-row .sat-calc-expr-vis { display: flex; }
.gcalc-root .sat-calc-table-row.sat-off .sat-calc-expr-vis { background: #fff; }
.gcalc-root .sat-calc-table-row.sat-off .sat-calc-expr-vis svg { display: none; }
.gcalc-root .sat-calc-table-main { flex: 1; min-width: 0; padding: 8px 12px 10px 10px; }
.gcalc-root .sat-calc-table-head { display: flex; border-bottom: 2px solid #d4d4d4; }
.gcalc-root .sat-calc-table-head-cell { flex: 1 1 50%; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--sat-font-main); font-size: 14.5px; font-weight: 600; color: #555; padding: 4px 6px; text-align: center; }
.gcalc-root .sat-calc-table-head-y { color: var(--c); }
.gcalc-root .sat-calc-table-head-y:focus { background: #f5f6f9; border-radius: 3px; }
.gcalc-root .sat-calc-table-body { max-height: 180px; overflow-y: auto; }
.gcalc-root .sat-calc-table-rowline { display: flex; border-bottom: 1px solid #eee; }
.gcalc-root .sat-calc-table-rowline:last-child { border-bottom: none; }
.gcalc-root .sat-calc-table-cell { flex: 1 1 50%; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--sat-font-main); font-size: 15px; color: #111; padding: 5px 6px; text-align: center; }
.gcalc-root .sat-calc-table-cell:first-child { border-right: 1px solid #eee; }
.gcalc-root .sat-calc-table-cell:focus { background: #eef1fd; }
.gcalc-root .sat-calc-table-cell:disabled { color: #7a7a7a; background: #fafafa; }
.gcalc-root .sat-calc-table-reg { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding-top: 6px; border-top: 1px solid #eee; flex-wrap: wrap; }
.gcalc-root .sat-calc-table-reg-select { flex: none; padding: 3px 4px; border: 1px solid #d4d4d4; border-radius: 4px; background: #fff; font-family: var(--sat-font-main); font-size: 12px; color: #444; }
.gcalc-root .sat-calc-table-reg-eq { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: #555; white-space: nowrap; overflow-x: auto; }

/* Sliders */
.gcalc-root .sat-calc-slider { display: none; align-items: center; gap: 8px; padding-top: 2px; }
.gcalc-root .sat-calc-expr-row.sat-is-slider .sat-calc-slider { display: flex; }
.gcalc-root .sat-calc-expr-row.sat-is-slider { min-height: 96px; }
.gcalc-root .sat-calc-slider-min, .gcalc-root .sat-calc-slider-max { width: 42px; min-width: 0; padding: 2px 0; border: 1px solid transparent; border-radius: 3px; background: transparent; font-size: 12.5px; font-family: var(--sat-font-main); color: #666; text-align: center; }
.gcalc-root .sat-calc-slider-min:hover, .gcalc-root .sat-calc-slider-max:hover, .gcalc-root .sat-calc-slider-min:focus, .gcalc-root .sat-calc-slider-max:focus { border-color: #c4c4c4; background: #fff; outline: none; }
.gcalc-root .sat-calc-slider input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 24px; margin: 0; background: transparent; cursor: pointer; }
.gcalc-root .sat-calc-slider input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #d3d3d3; }
.gcalc-root .sat-calc-slider input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #d3d3d3; }
.gcalc-root .sat-calc-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #2f50d0; box-shadow: 0 0 0 6px rgba(47,80,208,0.22); }
.gcalc-root .sat-calc-slider input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #2f50d0; box-shadow: 0 0 0 6px rgba(47,80,208,0.22); }

/* Expanded: expression list on the left, graph on the right */
.gcalc-root.sat-expanded .sat-calc-body { flex-direction: row; }
.gcalc-root.sat-expanded .sat-calc-side { order: -1; flex: 0 0 340px; max-height: none; border-top: none; border-right: 1px solid #b5b5b5; }
/* Collapsed: a slim numbered strip, the way Desmos's own collapse does --
   not a second half-width empty panel next to the graph. Only the toggle
   itself (the double chevron) stays reachable; the rest of the toolbar has
   no room and would just clip awkwardly. */
.gcalc-root.sat-expanded .sat-calc-side.sat-calc-collapsed { flex-basis: 42px; }
.gcalc-root.sat-expanded .sat-calc-side.sat-calc-collapsed .sat-calc-toolbar > *:not(#satCalcCollapseBtn) { display: none; }
.gcalc-root.sat-expanded .sat-calc-side.sat-calc-collapsed .sat-calc-toolbar { padding: 0; justify-content: center; }
.gcalc-root.sat-expanded .sat-calc-expr-list { max-height: none; }
.gcalc-root.sat-expanded .sat-calc-graph-wrap { min-width: 0; min-height: 0; }

.gcalc-root .sat-calc-keypad-wrap { display: none; flex-shrink: 0; border-top: 1px solid #c6c6c6; background: #ededed; position: relative; }
.gcalc-root .sat-calc-keypad-wrap.sat-calc-open { display: block; }
.gcalc-root .sat-calc-keypad { display: flex; align-items: stretch; gap: 10px; padding: 8px; }
.gcalc-root .sat-calc-kp-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; gap: 5px; flex: 1 1 0; min-width: 0; }
.gcalc-root .sat-calc-kp-rightcol { display: grid; grid-template-rows: 1fr 1fr 1fr 1.4fr; gap: 5px; width: 25%; min-width: 64px; }
.gcalc-root .sat-calc-kp-arrows { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.gcalc-root .sat-calc-key { min-width: 0; min-height: 34px; padding: 4px 2px; border: 1px solid #c9c9c9; border-radius: 4px; background: #fff; color: #111; font-size: 15px; line-height: 1.1; text-align: center; cursor: pointer; font-family: var(--sat-font-main); display: flex; align-items: center; justify-content: center; }
.gcalc-root .sat-calc-key:hover { background: #f4f4f4; }
.gcalc-root .sat-calc-key:active { background: #e2e2e2; }
.gcalc-root .sat-calc-key svg { width: 19px; height: 19px; fill: currentColor; }
.gcalc-root .sat-calc-key-math { font-family: "Times New Roman", Times, serif; font-style: italic; font-size: 18px; }
.gcalc-root .sat-calc-key-num { background: #c6c6c6; border-color: #bcbcbc; }
.gcalc-root .sat-calc-key-num:hover { background: #b9b9b9; }
.gcalc-root .sat-calc-key-op { background: #e4e4e4; border-color: #d2d2d2; }
.gcalc-root .sat-calc-key-dark { background: #c6c6c6; border-color: #bcbcbc; color: #222; font-size: 13px; font-weight: 600; }
.gcalc-root .sat-calc-key-dark:hover { background: #b9b9b9; }
.gcalc-root .sat-calc-key-fnbtn { background: #c6c6c6; border-color: #bcbcbc; color: #222; font-size: 14px; }
.gcalc-root .sat-calc-key-fnbtn:hover { background: #b9b9b9; }
.gcalc-root .sat-calc-key-fnbtn.sat-calc-key-active { background: #8f8f8f; color: #fff; }
.gcalc-root #satCalcKpLeft, .gcalc-root #satCalcKpRight { background: #c6c6c6; border-color: #bcbcbc; }
.gcalc-root #satCalcKpBackspace { background: #a9a9a9; border-color: #9c9c9c; }
.gcalc-root .sat-calc-key-enter { background: #2f50d0; border-color: #2f50d0; color: #fff; font-size: 18px; font-weight: 700; }
.gcalc-root .sat-calc-key-enter:hover { background: #2843b3; }

/* The functions pop-up floats above the keypad */
.gcalc-root .sat-calc-fn-panel { display: none; position: absolute; right: 8px; bottom: calc(100% + 4px); width: 262px; max-height: 270px; overflow-y: auto; padding: 4px 10px 10px; background: #fff; border: 1px solid #b9b9b9; border-radius: 6px; box-shadow: 0 3px 14px rgba(0,0,0,0.28); z-index: 20; }
.gcalc-root .sat-calc-fn-panel.sat-calc-open { display: block; }
.gcalc-root .sat-calc-fn-title { margin: 10px 0 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #4d4d4d; }
.gcalc-root .sat-calc-fn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.gcalc-root .sat-calc-fn-grid .sat-calc-key { min-height: 30px; font-size: 13px; background: #f4f4f4; }


/* ===== Scientific calculator + the mode switch in the header ===== */
.gcalc-root .sat-calc-header { padding-left: 6px; }
.gcalc-root .sat-calc-modebtn { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: calc(56% - 14px); overflow: hidden; padding: 4px 6px; border: none; border-radius: 5px; background: none; color: #fff; cursor: pointer; font-family: var(--sat-font-main); }
.gcalc-root .sat-calc-modebtn:hover { background: rgba(255,255,255,0.16); }
.gcalc-root .sat-calc-modebtn .sat-calc-title { max-width: none; flex: 1 1 auto; }
.gcalc-root .sat-calc-modecaret { flex: none; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #fff; }
.gcalc-root .sat-calc-modemenu { display: none; position: absolute; left: 6px; top: 40px; min-width: 210px; padding: 4px; background: #fff; border: 1px solid #b9b9b9; border-radius: 6px; box-shadow: 0 3px 14px rgba(0,0,0,0.3); z-index: 40; }
.gcalc-root .sat-calc-modemenu.sat-calc-open { display: block; }
.gcalc-root .sat-calc-modemenu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: none; border-radius: 4px; background: none; color: #222; font-size: 14px; text-align: left; cursor: pointer; font-family: var(--sat-font-main); }
.gcalc-root .sat-calc-modemenu button:hover { background: #f0f0f0; }
.gcalc-root .sat-calc-modemenu button::before { content: ''; width: 14px; flex: none; }
.gcalc-root .sat-calc-modemenu button.sat-calc-on::before { content: '\2713'; color: #2f50d0; font-weight: 700; }

.gcalc-root .sat-sci-keypad { display: none; flex: none; background: #ededed; border-top: 1px solid #c6c6c6; }
.gcalc-root.sat-sci .sat-sci-keypad { display: block; }
.gcalc-root.sat-sci .sat-calc-graph-wrap,
.gcalc-root.sat-sci .sat-calc-toolbar,
.gcalc-root.sat-sci .sat-calc-kbtoggle,
.gcalc-root.sat-sci .sat-calc-keypad-wrap { display: none !important; }
.gcalc-root.sat-sci .sat-calc-panel { height: 100%; }
.gcalc-root.sat-sci .sat-calc-side { flex: 1 1 auto; max-height: none; border-top: none; }
.gcalc-root.sat-sci.sat-expanded .sat-calc-body { flex-direction: column; }
.gcalc-root.sat-sci.sat-expanded .sat-calc-side { order: 0; flex: 1 1 auto; border-right: none; }
/* Lines stack up from the bottom, the line being typed sitting just above the keypad */
.gcalc-root.sat-sci .sat-calc-expr-list { display: flex; flex-direction: column; max-height: none; border-top: none; }
.gcalc-root.sat-sci .sat-calc-expr-list > :first-child { margin-top: auto; }
.gcalc-root.sat-sci .sat-calc-expr-gutter { display: none; }
.gcalc-root.sat-sci .sat-calc-expr-row { flex: none; min-height: 54px; }
.gcalc-root.sat-sci .sat-calc-expr-main { padding-left: 16px; }
.gcalc-root.sat-sci .sat-calc-expr-input { font-size: 20px; }
.gcalc-root.sat-sci .sat-calc-expr-preview .katex { font-size: 1.45em; }
.gcalc-root.sat-sci .sat-calc-expr-result { font-size: 21px; }
.gcalc-root.sat-sci .sat-calc-slider { display: none !important; }

.gcalc-root .sat-sci-tabbar { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 6px 0 4px; }
.gcalc-root .sat-sci-tabs { display: flex; flex: 0 0 auto; }
.gcalc-root .sat-sci-tab { padding: 7px 6px 6px; border: none; border-bottom: 3px solid transparent; background: none; color: #666; font-size: 13px; white-space: nowrap; cursor: pointer; font-family: var(--sat-font-main); }
.gcalc-root .sat-sci-tab.sat-sci-on { color: #000; border-bottom-color: #2a6ee0; }
.gcalc-root .sat-sci-angle { display: flex; margin-left: 2px; flex: none; }
.gcalc-root .sat-sci-angle button { padding: 4px 6px; border: 1px solid #bdbdbd; background: #f6f6f6; color: #444; font-size: 12.5px; cursor: pointer; font-family: var(--sat-font-main); }
.gcalc-root .sat-sci-angle button:first-child { border-radius: 4px 0 0 4px; }
.gcalc-root .sat-sci-angle button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.gcalc-root .sat-sci-angle button.sat-calc-on { background: #d4dff6; border: 1px solid #2f5fc4; color: #1f4fb6; }
.gcalc-root .sat-sci-angle button.sat-calc-on:last-child { border-left: 1px solid #2f5fc4; }
.gcalc-root .sat-sci-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 25px; height: 27px; padding: 0; border: none; border-radius: 4px; background: none; color: #666; cursor: pointer; }
.gcalc-root .sat-sci-icon svg { width: 18px; height: 18px; fill: currentColor; }
.gcalc-root .sat-sci-icon:hover:not(:disabled) { background: #dedede; }
.gcalc-root .sat-sci-icon:disabled { color: #bdbdbd; cursor: default; }
.gcalc-root .sat-sci-clear { flex: none; padding: 4px 4px; border: none; background: none; color: #555; font-size: 13px; white-space: nowrap; cursor: pointer; font-family: var(--sat-font-main); }
.gcalc-root .sat-sci-clear:disabled { color: #b3b3b3; cursor: default; }
.gcalc-root .sat-sci-tabbar .sat-sci-clear { margin-left: auto; }

.gcalc-root .sat-sci-pane { display: none; gap: 10px; padding: 3px 6px 8px; }
.gcalc-root .sat-sci-pane.sat-sci-on { display: flex; }
.gcalc-root .sat-sci-grid { display: grid; grid-auto-rows: 1fr; gap: 4px; min-width: 0; }
.gcalc-root .sat-sci-g3 { grid-template-columns: repeat(3, 1fr); flex: 3 1 0; }
.gcalc-root .sat-sci-g4 { grid-template-columns: repeat(4, 1fr); flex: 4 1 0; }
.gcalc-root .sat-sci-g2 { grid-template-columns: repeat(2, 1fr); flex: 2 1 0; }
.gcalc-root #satSciFuncL, .gcalc-root #satSciFuncR { flex: 1 1 0; }
.gcalc-root .sat-sci-keypad .sat-calc-key { min-height: 30px; font-family: "Times New Roman", Times, serif; font-size: 15px; }
.gcalc-root .sat-sci-keypad .sat-calc-key svg { width: 17px; height: 17px; }
.gcalc-root .sat-sci-keypad .sat-calc-key-math { font-size: 15px; }
.gcalc-root .sat-sci-keypad .sat-calc-key-enter { font-family: var(--sat-font-main); font-size: 16px; }
.gcalc-root .sat-sci-wide { grid-column: 1 / -1; }
.gcalc-root .sat-sci-back75 { grid-column: 1 / -1; justify-self: end; width: 75%; }
.gcalc-root .sat-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-style: italic; }
.gcalc-root .sat-frac > span:first-child { padding: 0 3px 2px; border-bottom: 1px solid currentColor; }
.gcalc-root .sat-frac > span:last-child { padding-top: 2px; }

.gcalc-root .sat-sci-abc { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.gcalc-root .sat-sci-abcrow { display: flex; gap: 4px; justify-content: center; }
.gcalc-root .sat-sci-abcrow > .sat-calc-key { flex: 0 0 calc((100% - 36px) / 10); }
.gcalc-root .sat-sci-abcrow > .sat-sci-w15 { flex-basis: calc((100% - 36px) / 10 * 1.5 + 2px); }
.gcalc-root .sat-sci-letter { font-style: italic; }
.gcalc-root .sat-sci-abcrow .sat-calc-key-active { background: #8f8f8f; color: #fff; }


/* options.keypad === false */
.gcalc-root.sat-calc-no-keypad .sat-calc-keypad-wrap,
.gcalc-root.sat-calc-no-keypad .sat-sci-keypad,
.gcalc-root.sat-calc-no-keypad .sat-calc-kbtoggle { display: none !important; }

/* ---- Notes, folders, per-row options, share buttons ---- */
.gcalc-root .sat-calc-expr-row.sat-folded { display: none; }
.gcalc-root .sat-calc-expr-row.sat-in-folder .sat-calc-expr-gutter { border-left: 3px solid #c9cfe6; }
.gcalc-root .sat-calc-note-row .sat-calc-expr-main { padding: 6px 30px 6px 14px; }
.gcalc-root .sat-calc-note-input { width: 100%; box-sizing: border-box; border: none; outline: none; background: transparent; resize: none; overflow-y: auto; font: 15px/1.4 var(--sat-font-main); color: #333; padding: 4px 0; min-height: 28px; }
.gcalc-root .sat-calc-folder-row { background: #f3f4f8; }
.gcalc-root .sat-calc-folder-row .sat-calc-expr-main { padding: 6px 54px 6px 14px; }
.gcalc-root .sat-calc-folder-title { width: 100%; box-sizing: border-box; border: none; outline: none; background: transparent; font: 600 16px var(--sat-font-main); color: #222; padding: 6px 0; }
.gcalc-root .sat-calc-folder-chev { border: none; background: none; cursor: pointer; font-size: 15px; color: #555; padding: 2px 4px; }
.gcalc-root .sat-calc-folder-eye { position: absolute; top: 3px; right: 34px; width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: none; color: #555; cursor: pointer; z-index: 2; }
.gcalc-root .sat-calc-folder-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.gcalc-root .sat-calc-folder-row.sat-off .sat-calc-folder-eye { color: #bbb; }
.gcalc-root .sat-calc-expr-opts { position: absolute; top: 3px; right: 34px; width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: none; color: #a3a3a3; cursor: pointer; font-size: 15px; z-index: 2; opacity: 0; transition: opacity .12s; }
.gcalc-root .sat-calc-expr-row:hover .sat-calc-expr-opts, .gcalc-root .sat-calc-expr-row.sat-focus .sat-calc-expr-opts, .gcalc-root .sat-calc-expr-opts:focus { opacity: 1; }
.gcalc-root .sat-calc-expr-opts:hover { background: #e6e6e6; color: #2f50d0; }
.gcalc-root .sat-calc-expr-row:last-child .sat-calc-expr-opts { visibility: hidden; }
.gcalc-root .sat-calc-expr-result { margin-right: 62px; }
.gcalc-root .sat-calc-opts-pop { display: none; position: absolute; z-index: 30; width: 276px; box-sizing: border-box; padding: 6px 10px 10px; background: #fff; border: 1px solid #b9b9b9; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.28); font: 13px var(--sat-font-main); color: #1a1a2e; }
.gcalc-root .sat-calc-opts-pop.sat-calc-open { display: block; }
.gcalc-root .sat-opts-row { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 6px 0; }
.gcalc-root .sat-opts-row > span { flex: none; width: 48px; font-weight: 600; color: #555; }
.gcalc-root .sat-opts-row input[type=range] { flex: 1; min-width: 0; }
.gcalc-root .sat-opts-row input[type=text] { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid #c4c4c4; border-radius: 4px; font: inherit; }
.gcalc-root .sat-opts-swatch { width: 18px; height: 18px; padding: 0; border: 2px solid #fff; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 1px #c4c4c4; }
.gcalc-root .sat-opts-swatch.sat-on { box-shadow: 0 0 0 2px #2f50d0; }
.gcalc-root .sat-opts-seg { padding: 3px 8px; border: 1px solid #c4c4c4; border-radius: 4px; background: #fff; cursor: pointer; font: 12px var(--sat-font-main); color: #333; }
.gcalc-root .sat-opts-seg:hover { background: #f1f1f1; }
.gcalc-root .sat-opts-seg.sat-on { background: #dfe5fa; border-color: #2f50d0; color: #2f50d0; }
.gcalc-root .sat-calc-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Geometry tool palette */
.gcalc-root .sat-geo-bar { display: none; position: absolute; top: 6px; left: 6px; right: 52px; z-index: 6; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; background: rgba(255,255,255,0.96); border: 1px solid #d4d4d4; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.gcalc-root .sat-geo-bar.sat-geo-open { display: flex; }
.gcalc-root .sat-geo-bar button { border: none; border-radius: 4px; background: #ececec; color: #333; font: 12px var(--sat-font-main, sans-serif); padding: 5px 8px; cursor: pointer; }
.gcalc-root .sat-geo-bar button:hover { background: #dcdcdc; }
.gcalc-root .sat-geo-bar button.sat-geo-on { background: #d5dcf7; color: #2f50d0; font-weight: 600; }
.gcalc-root .sat-geo-hint { flex-basis: 100%; font-size: 11px; color: #666; min-height: 14px; padding: 0 4px; }

/* ---- structured math editor (GeoMathixMathEditor) in the expression rows ---- */
.gcalc-root .mx-ed.mx-flat { min-height: 34px; max-height: none; padding: 4px 0; background: transparent; border: 0; box-shadow: none !important; overflow: visible;
  font: 20px/1.25 KaTeX_Main, "Times New Roman", "STIX Two Text", Georgia, serif; color: #111; cursor: text; }
.gcalc-root.sat-sci .mx-ed.mx-flat { font-size: 23px; }
.gcalc-root .mx-ed.mx-flat .mx-inner { display: block; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.gcalc-root .mx-ed.mx-flat .mx-row.mx-root { min-height: 1.4em; }
.gcalc-root .mx-ed.mx-flat:not(.mx-focus) .mx-cur { display: none; }
.gcalc-root .mx-ed.mx-flat:not(.mx-focus) .mx-row.mx-root > .mx-box:only-child { visibility: hidden; }
.gcalc-root .mx-ed.mx-flat .mx-box { border-color: #b8bcc6; }
.gcalc-root .mx-ed.mx-flat .mx-cur { border-left-color: #2f50d0; }
.gcalc-root .mx-ed.mx-flat .mx-var, .gcalc-root .mx-ed.mx-flat .mx-greek { font-family: KaTeX_Math, "Times New Roman", serif; }
.gcalc-root .mx-ed.mx-flat .mx-num + .mx-fbar { border-top-color: currentColor; }
.gcalc-root .sat-calc-expr-row.sat-focus .mx-ed.mx-flat { color: #111; }
