/* Scientific calculator: display, two keypads and history. Colours follow the
   site palette; the build appends dark-theme variants automatically. */
.sci-app{margin:8px 0 28px}
.sci-app .lead{max-width:760px}
.sci-body{display:grid;grid-template-columns:minmax(0,1fr) 300px;grid-template-areas:"display history" "pads history";gap:16px;align-items:start}
.sci-display{grid-area:display;border:1px solid #cfded5;border-radius:12px;background:#f7faf8;padding:14px 16px}
.sci-input{width:100%;box-sizing:border-box;border:0;background:transparent;font:500 26px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#16261e;text-align:right;padding:4px 0;outline:none}
.sci-input:focus-visible{box-shadow:0 2px 0 #087e68}
.sci-result{display:block;min-height:30px;text-align:right;font:600 22px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#087e68;overflow-wrap:anywhere}
.sci-result[data-state=pending],.sci-result[data-state=error]{color:#8a9890}
.sci-status{min-height:20px;margin:4px 0 0;text-align:right;font-size:13px;color:#5c7062}
.sci-help{margin:6px 0 0;font-size:12px;color:#6b7c72}
.sci-pads{grid-area:pads;display:grid;grid-template-columns:5fr 4fr;gap:12px}
.sci-pad{display:grid;gap:6px}
.sci-functions{grid-template-columns:repeat(5,1fr)}
.sci-numbers{grid-template-columns:repeat(4,1fr)}
.sci-key{min-height:48px;border:1px solid #d5e1d8;border-radius:9px;background:#fff;color:#1f3a2c;font:500 16px/1 system-ui,-apple-system,"Segoe UI",sans-serif;cursor:pointer;touch-action:manipulation}
.sci-key:hover{background:#eef6f1}
.sci-key:active{transform:translateY(1px)}
.sci-key:focus-visible{outline:3px solid #087e68;outline-offset:2px}
.sci-functions .sci-key{font-size:14px;background:#f3f8f4}
.sci-numbers .sci-key[data-sci-key="÷"],.sci-numbers .sci-key[data-sci-key="×"],.sci-numbers .sci-key[data-sci-key="−"],.sci-numbers .sci-key[data-sci-key="+"]{background:#e6f1ea;font-size:20px}
.sci-key.sci-equals{grid-column:span 2;background:#087e68;border-color:#087e68;color:#fff;font-size:20px;font-weight:600}
.sci-key.sci-equals:hover{background:#066b58}
.sci-key.sci-clear,.sci-key.sci-backspace{color:#a33b2f}
.sci-key.sci-angle{font-weight:700;color:#087e68}
.sci-history-panel{grid-area:history;border:1px solid #d5e1d8;border-radius:12px;padding:12px 14px;max-height:520px;overflow:auto}
.sci-history-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin-bottom:6px}
.sci-history-head h2{flex:1 0 100%;margin:0;font-size:16px}
.sci-link{border:0;background:none;padding:6px 0;min-height:32px;color:#087e68;font-size:13px;cursor:pointer;text-decoration:underline}
.sci-history{list-style:none;margin:0;padding:0}
.sci-history button{display:flex;flex-direction:column;align-items:flex-end;gap:2px;width:100%;min-height:44px;border:0;border-top:1px solid #e3ebe6;background:none;padding:8px 2px;text-align:right;cursor:pointer;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#3d5446;overflow-wrap:anywhere}
.sci-history button strong{color:#16261e}
.sci-history button:hover{background:#f3f8f4}
.sci-history-empty{color:#6b7c72;font-size:13px;padding:6px 0}
.sci-guide h3{font-size:17px;margin:22px 0 6px}
.sci-examples code{font-size:14px}
.sci-faq{border-top:1px solid #dbe5de;padding:4px 0}
.sci-faq summary{min-height:44px;display:flex;align-items:center;font-weight:600;cursor:pointer}
.sci-faq p{margin:4px 0 12px}
@media (max-width:860px){.sci-body{grid-template-columns:1fr;grid-template-areas:"display" "pads" "history"}.sci-history-panel{max-height:none}}
@media (max-width:560px){.sci-pads{grid-template-columns:1fr}.sci-input{font-size:22px}.sci-key{min-height:46px}}

:root[data-theme=dark]{color-scheme:dark;--bg:#0b1311;--surface:#121c1a;--text:#e4ece9;--muted:#a3b5b0;--line:#26342f;--green:#087e68;--mint:#16302a;--dark:#0e2b25}:root[data-theme=dark] .sci-display{border:1px solid #385243;background:#111c15}:root[data-theme=dark] .sci-input{color:#d3e6dd}:root[data-theme=dark] .sci-result{color:#88ddcd}:root[data-theme=dark] .sci-status{color:#aebcb2}:root[data-theme=dark] .sci-help{color:#a8b4ad}:root[data-theme=dark] .sci-key{border:1px solid #384e3e;background:#101715;color:#c8e2d4}:root[data-theme=dark] .sci-key:hover{background:#122218}:root[data-theme=dark] .sci-functions .sci-key{background:#121f15}:root[data-theme=dark] .sci-numbers .sci-key[data-sci-key="÷"],:root[data-theme=dark] .sci-numbers .sci-key[data-sci-key="×"],:root[data-theme=dark] .sci-numbers .sci-key[data-sci-key="−"],:root[data-theme=dark] .sci-numbers .sci-key[data-sci-key="+"]{background:#15261c}:root[data-theme=dark] .sci-key.sci-clear,:root[data-theme=dark] .sci-key.sci-backspace{color:#dd9188}:root[data-theme=dark] .sci-key.sci-angle{color:#88ddcd}:root[data-theme=dark] .sci-history-panel{border:1px solid #384e3e}:root[data-theme=dark] .sci-link{color:#88ddcd}:root[data-theme=dark] .sci-history button{border-top:1px solid #34483b;color:#bccec3}:root[data-theme=dark] .sci-history button strong{color:#d3e6dd}:root[data-theme=dark] .sci-history button:hover{background:#121f15}:root[data-theme=dark] .sci-history-empty{color:#a8b4ad}:root[data-theme=dark] .sci-faq{border-top:1px solid #364b3d}