/* V2.5 SINGLE LAYOUT: remove all previous 100vh, 100dvh and physical-height patches. */
:root{color-scheme:dark;--bg:#101217;--key:#22252b;--gold:#f4a344;--ink:#f7f7f9;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-tap-highlight-color:transparent}
button,input,select{font:inherit}button{cursor:pointer}
.app{position:fixed;inset:0;width:100%;height:auto;max-width:490px;margin:0 auto;padding:calc(max(var(--safe-top),48px) + 4px) 12px calc(max(var(--safe-bottom),13px) + 5px);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:38px minmax(64px,.95fr) 14px 44px minmax(0,0fr) minmax(200px,3.5fr) 18px;gap:5px;overflow:hidden;background:var(--bg)}
@media(display-mode:browser){.app{padding-top:calc(max(var(--safe-top),8px) + 5px)}}
@media(max-height:690px){.app{grid-template-rows:34px minmax(54px,.7fr) 14px 38px minmax(0,0fr) minmax(160px,3.5fr) 18px;gap:4px}}
.top{display:flex;align-items:center;justify-content:flex-end;min-height:0}.branding{display:none}.header-actions{display:flex;gap:7px;margin-left:auto}.iconbtn{height:38px;width:40px;border:0;background:transparent;color:#e3e5e9;border-radius:9px;font-size:24px}.iconbtn.on{color:var(--gold)}
.screen{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-end;min-height:0;min-width:0;text-align:right;padding:0 6px 3px;overflow:hidden}
.expression{color:#d4d6dc;font-size:clamp(26px,7vw,43px);line-height:1.15;white-space:nowrap;overflow-x:auto;scrollbar-width:none}.answer{font-size:clamp(38px,9.5vw,58px);line-height:1.14;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.history-handle{min-height:0;border:0;padding:0;display:flex;justify-content:center;align-items:center;background:transparent;touch-action:manipulation}.handle-line{width:52px;height:5px;border-radius:99px;background:#d7d9df}
.shortcuts{min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.shortcuts button{min-width:0;min-height:0;border:1px solid #363b45;background:#1b202a;color:#dde3eb;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;font-size:12px}.shortcuts button span{font-size:22px;line-height:23px;color:var(--gold)}
.keypad{min-width:0;min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(5,minmax(0,1fr));gap:5px}.key{min-width:0;min-height:0;position:relative;isolation:isolate;border:1px solid #2e323a;border-radius:12px;background:var(--key);color:#f5f5f6;font-size:clamp(29px,7.6vw,41px);font-weight:400;touch-action:manipulation;user-select:none;-webkit-user-select:none;overflow:hidden}.key:active{background:#3a404e}.key.utility{color:#f7b45d;font-size:clamp(23px,6vw,30px)}.key.operator{background:#25252b;color:var(--gold)}.key.equals{background:#f3a343;color:#171a20;font-weight:600;font-size:42px}.key .native-switch{position:absolute;inset:0;width:100%;height:100%;opacity:.001;z-index:2}
.calculator-credit{position:static;align-self:stretch;display:flex;align-items:center;justify-content:center;min-height:0;margin:0;padding:0;font-size:11px;color:#adb4bf;white-space:nowrap;line-height:1.2}
.inline-history{grid-row:5;min-height:0;display:flex;flex-direction:column;overflow:hidden;border-radius:12px;padding:10px;background:#17191e}.inline-history[hidden]{display:none!important}
.history-open .app{grid-template-rows:38px minmax(72px,.75fr) 17px 0 0 minmax(160px,3.5fr) 18px}.history-open .shortcuts,.history-open .keypad{display:none}
@media(max-height:690px){.history-open .app{grid-template-rows:34px minmax(60px,.65fr) 15px 0 0 minmax(160px,3.5fr) 18px}}

.overlay{position:fixed;inset:0;z-index:10;display:flex;align-items:flex-end;justify-content:center}.hidden{display:none!important}.backdrop{position:absolute;inset:0;background:rgba(0,0,0,.7)}.sheet{position:relative;width:min(100%,490px);max-height:88dvh;background:#1a1e26;border-radius:22px 22px 0 0;padding:0 17px calc(max(var(--safe-bottom),14px) + 10px);display:flex;flex-direction:column;overflow:hidden;box-shadow:0 -10px 70px #0009}.sheet-head{position:relative;display:flex;justify-content:space-between;align-items:center;min-height:64px;flex-shrink:0;border-bottom:1px solid #363943}.handle{position:absolute;top:8px;left:50%;transform:translateX(-50%);width:38px;height:4px;border-radius:4px;background:#545966}.sheet-title{font-size:18px;font-weight:750;padding-top:9px}.close{border:0;color:#dbe0e5;background:#30343d;width:34px;height:34px;border-radius:50%;font-size:16px}.sheet-content{overflow:auto;overscroll-behavior:contain;padding:17px 0;scrollbar-width:thin;min-height:0}.panel{display:flex;flex-direction:column;gap:12px}.field{display:flex;flex-direction:column;gap:6px;color:#aeb8c7;font-size:12px}.field input,.field select{border:1px solid #414753;background:#242a34;color:#f4f4fa;border-radius:10px;padding:13px 12px;width:100%;min-height:46px;font-size:16px}.pair{display:grid;grid-template-columns:1fr 1fr;gap:10px}.action{border:none;background:#dc9c4d;color:#1d2026;font-weight:750;border-radius:11px;min-height:46px;padding:9px 13px}.action.secondary{background:#303845;color:#e4e9f2;border:1px solid #46505f}.action.danger{background:#4b292a;color:#ffbebe}.hint,.muted{font-size:12px;color:#9da6b6;line-height:1.65}.box{border:1px solid #343a45;border-radius:13px;background:#222731;padding:14px}.big-number{font-size:27px;font-weight:650;overflow-wrap:anywhere}.row{display:flex;align-items:center;justify-content:space-between;gap:10px}.row.wrap{flex-wrap:wrap}.small{font-size:12px}.history-row{border-bottom:1px solid #383e48;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 0}.history-row .expression-small{color:#aab4c2;font-size:15px}.history-row .result-small{font-size:22px;margin-top:3px}.linkbtn{padding:7px 10px;border:1px solid #464b58;background:#282e39;color:#f4c68a;border-radius:9px;font-size:12px}.switchline{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:44px}.switchline input{width:23px;height:23px;accent-color:var(--gold)}.toast{position:fixed;left:50%;bottom:calc(max(var(--safe-bottom),15px) + 25px);transform:translateX(-50%);background:#343a46;color:white;padding:10px 16px;border-radius:13px;z-index:12;opacity:0;pointer-events:none;transition:opacity .15s;font-size:13px;white-space:nowrap;max-width:94vw;overflow:hidden;text-overflow:ellipsis}.toast.show{opacity:1}body.light{--bg:#f2f4f8;--surface:#fff;--key:#fff;--stroke:#e1e4e9;--ink:#20242c;--sub:#6e7480;background:#e7eaf0;color:var(--ink)}body.light .app{background:#f2f4f8}body.light .key{background:white;color:#2b3040;border-color:#e5e6eb}body.light .key.operator,body.light .key.utility{color:#bf731e}body.light .key.equals{background:#e99b37;color:#181818}body.light .shortcuts button,body.light .copy-result{background:#fff;color:#333;border-color:#d5d7dd}body.light .screen-top,body.light .screen-tip,body.light .footer{color:#737b87}body.light .expression{color:#737b87}body.light .answer{color:#20242c}body.light .sheet{background:#fff;color:#20242c}body.light .sheet-content .box{background:#f3f5f8;color:#20242c}body.light .field input,body.light .field select{background:#f3f5f8;color:#20242c}body.light .iconbtn{color:#444}
.fx-picker-row{display:grid;grid-template-columns:minmax(0,1fr) 40px minmax(0,1fr);align-items:end;gap:5px}
.fx-picker-row .field{min-width:0}
.fx-picker-row select{font-size:15px;padding:11px 5px}
.fx-swap-inline{height:46px;background:#303743;color:#f3ac50;border:1px solid #47505c;border-radius:10px;font-size:23px}
.fx-showcase{border-radius:13px;background:#242a34;border:1px solid #424953;padding:14px}
.fx-flag-line{font-size:17px;font-weight:600;display:flex;align-items:center;justify-content:space-between;gap:12px}
.fx-flag-line small{font-size:11px;color:#aab2be;font-weight:400}

body.light .inline-history{background:#e5e8ee}body.light .inline-history-item{color:#20242c;border-color:#d2d6dd}body.light .inline-history-item .formula{color:#333}body.light .history-handle{color:#777}body.light .fx-showcase{background:#f1f2f5}



/* V2.6: single viewport grid; inline tools take one short row only. */
.app{grid-template-rows:38px minmax(64px,.95fr) 14px 43px 0px minmax(200px,3.6fr) 18px;padding-bottom:max(env(safe-area-inset-bottom,0px),10px);}
.app.quick-active{grid-template-rows:38px minmax(64px,.85fr) 14px 39px 54px minmax(200px,3.6fr) 18px}
@media(max-height:690px){.app{grid-template-rows:34px minmax(50px,.6fr) 12px 35px 0px minmax(160px,3.4fr) 16px}.app.quick-active{grid-template-rows:34px minmax(50px,.55fr) 12px 35px 50px minmax(160px,3.4fr) 16px}}
.shortcuts button{font-size:11px;gap:0;border-radius:10px}.shortcuts button span{font-size:17px;line-height:18px;color:#aab0b8}.shortcuts button.active{background:#30343b;border-color:#5c626c;color:#fff}.shortcuts button.active span{color:#d6dae0}
.quick-panel{min-width:0;min-height:0;width:100%;display:flex;align-items:center;gap:5px;padding:4px 5px;border-radius:10px;background:#1c1f25;border:1px solid #343841;overflow:hidden}
.quick-panel[hidden]{display:none!important}
.quick-panel input,.quick-panel select{min-width:0;border:1px solid #3d414b;background:#24272e;color:#f2f3f6;border-radius:8px;font-size:14px;height:39px;padding:0 6px;outline:none}
.quick-panel input{width:25%;flex:1 1 18%}.quick-panel select{max-width:76px;flex:0 1 76px}.quick-panel .quick-result{flex:1 1 35%;text-align:right;font-variant-numeric:tabular-nums;font-size:clamp(13px,3.6vw,17px);color:#e5e8ec;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.quick-panel .quick-arrow{font-size:14px;color:#a0a4ac;flex:0 0 auto}
.quick-panel .quick-status{position:absolute;left:-9999px}.quick-panel input[type=date]{width:36%;font-size:12px;padding:0 1px;color-scheme:dark}
.quick-panel .quick-result.long{font-size:12px;white-space:normal;line-height:1.25}
.iconbtn{background:#263443;border:1px solid #40536b;border-radius:11px;width:38px;height:37px;font-size:22px;color:#dce3ec}.iconbtn.on{color:#f1b15b}
.keypad{grid-row:6}.calculator-credit{grid-row:7;font-size:10px;color:#9da4ad}.history-open .inline-history{grid-row:6}
.history-open .quick-panel{display:none!important}
body.light .quick-panel{background:#e9ebee;border-color:#d2d5dd}body.light .quick-panel input,body.light .quick-panel select{background:white;color:#30343b}body.light .quick-panel .quick-result{color:#30343b}

/* V2.7: unobtrusive FX network status and clear speaker icon. No layout-height changes. */
.top{justify-content:space-between}
.fx-live-status{display:inline-flex;align-items:center;gap:7px;min-width:0;max-width:calc(100% - 104px);padding:6px 9px;background:#1c1e22;border-radius:999px;color:#a7abb3;font-size:11px;white-space:nowrap;overflow:hidden}
.fx-live-status[hidden]{display:none!important}
.fx-live-dot{width:7px;height:7px;flex:0 0 7px;background:#727985;border-radius:50%}
.fx-live-status.ready .fx-live-dot{background:#32cb78;box-shadow:0 0 4px #32cb783f}
.fx-live-status.unavailable .fx-live-dot{background:#d19555}
.iconbtn{display:inline-flex;align-items:center;justify-content:center}
.iconbtn svg{display:block;pointer-events:none}
body.light .fx-live-status{background:#e4e7ed;color:#606978}
