/* ResearchHunger Calculator v3 — classic dark scientific calculator */
.rhcalc-v3{--rh3-bg:#17191c;--rh3-panel:#22262b;--rh3-key:#30353b;--rh3-key2:#3a4047;--rh3-ink:#f7f8fa;--rh3-muted:#aab1ba;--rh3-accent:#9acb55;--rh3-red:#d95b52;max-width:900px;margin:20px auto;color:var(--rh3-ink);font-family:Arial,Helvetica,sans-serif}
.rhcalc-v3 *{box-sizing:border-box}
.rh3-device{position:relative;background:linear-gradient(145deg,#292d32,#101214);border:1px solid #08090a;border-radius:18px;padding:clamp(14px,2.2vw,24px);box-shadow:0 16px 38px rgba(0,0,0,.25),inset 0 1px 1px rgba(255,255,255,.12);overflow:hidden}
.rh3-top{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}
.rh3-brand{display:flex;align-items:center;gap:12px;min-width:0}
.rh3-logo{display:grid;place-items:center;width:42px;height:42px;border-radius:10px;background:linear-gradient(145deg,#4b83ff,#5530db);font-size:27px;font-weight:800;color:#fff;box-shadow:0 4px 12px rgba(58,87,230,.3)}
.rh3-brand strong{display:block;font-size:13px;letter-spacing:2px;text-transform:uppercase;color:#f5f6f8}
.rh3-brand span:last-child{display:block;margin-top:4px;font-size:9px;letter-spacing:1.2px;color:#9da4ad}
.rh3-modes{display:flex;gap:4px;padding:4px;border:1px solid #41464c;border-radius:9px;background:#111315;flex-shrink:0}
.rh3-modes button{border:0;border-radius:6px;background:transparent;color:#c4c9cf;padding:9px 15px;font-size:12px;font-weight:700;cursor:pointer}
.rh3-modes button.is-active{background:linear-gradient(#a5d45e,#77a936);color:#10150b;box-shadow:0 2px 7px rgba(0,0,0,.35)}
.rh3-screen{min-height:118px;background:linear-gradient(145deg,#d7e0d2,#b9c7b5);border:5px solid #080a0b;border-radius:7px;padding:10px 14px 8px;color:#182019;box-shadow:inset 0 2px 8px rgba(0,0,0,.25),0 2px 0 rgba(255,255,255,.08);margin-bottom:14px}
.rh3-screen-top{display:flex;justify-content:space-between;align-items:center;min-height:25px}
.rh3-angle-pill{font-size:10px;font-weight:800;color:#263322;letter-spacing:.5px}
.rh3-screen-actions{display:flex;gap:7px}
.rh3-screen-actions button{width:29px;height:25px;border:1px solid rgba(32,43,31,.3);border-radius:4px;background:rgba(255,255,255,.28);color:#273327;font-size:16px;line-height:1;cursor:pointer}
.rh3-expression{min-height:22px;text-align:left;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:14px;color:#435043;overflow-wrap:anywhere}
.rh3-result{display:block;min-height:36px;text-align:right;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:clamp(27px,4vw,36px);font-weight:700;line-height:1.1;color:#101710;overflow-wrap:anywhere}
.rh3-screen-status{text-align:right;font-size:9px;letter-spacing:1px;color:#52604f;margin-top:3px;min-height:11px}
.rh3-science{margin:0 0 12px}
.rh3-science-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.rh3-tabs{display:flex;gap:5px;flex-wrap:wrap}
.rh3-tabs button,.rh3-angle-switch button{border:1px solid #454b51;border-radius:5px;background:linear-gradient(#41474e,#292e33);color:#e1e5e9;padding:7px 11px;font-size:10px;font-weight:800;letter-spacing:.4px;cursor:pointer}
.rh3-tabs button.is-active,.rh3-angle-switch button.is-active{background:linear-gradient(#a5d45e,#77a936);border-color:#8ab94b;color:#17200d}
.rh3-angle-switch{display:flex;gap:4px;flex-shrink:0}
.rh3-angle-switch button{min-width:42px;padding:7px 9px}
.rh3-function-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
.rh3-function-grid button{min-height:36px;border:1px solid #4c535a;border-radius:5px;background:linear-gradient(#42484f,#2d3238);color:#f0f2f4;font-size:12px;font-weight:700;box-shadow:0 3px 0 #111416,0 4px 7px rgba(0,0,0,.22);cursor:pointer}
.rh3-keypad{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.rh3-keypad button{min-width:0;min-height:clamp(44px,6.2vw,58px);border:1px solid #080a0c;border-radius:6px;background:linear-gradient(180deg,#555c63 0%,#30363c 55%,#24292e 100%);color:#f7f8fa;font-size:clamp(17px,2.4vw,22px);font-weight:700;text-shadow:0 1px 1px #000;box-shadow:0 4px 0 #090b0d,0 5px 8px rgba(0,0,0,.3),inset 0 1px rgba(255,255,255,.14);cursor:pointer;transition:filter .12s ease,transform .12s ease}
.rh3-keypad button:hover,.rh3-function-grid button:hover{filter:brightness(1.16)}
.rh3-keypad button:active,.rh3-function-grid button:active{transform:translateY(2px);box-shadow:0 2px 0 #090b0d}
.rh3-keypad .rh3-control{background:linear-gradient(#6a7279,#3c4349);color:#f4f5f6;font-size:15px}
.rh3-keypad .rh3-control:first-child{background:linear-gradient(#9acb55,#65942e);color:#14200a}
.rh3-keypad .rh3-operator{background:linear-gradient(#444a51,#282d32);color:#a9d96a;font-size:23px}
.rh3-keypad .rh3-equals{background:linear-gradient(#a6d85f,#6e9f35);color:#17200c;font-size:26px}
.rh3-footnote{margin:12px 0 0;text-align:center;color:#929aa2;font-size:10px;line-height:1.4}
.rh3-history{position:absolute;z-index:5;right:18px;top:70px;width:min(360px,calc(100% - 36px));max-height:65%;overflow:auto;padding:13px;background:#20252a;border:1px solid #555e66;border-radius:9px;box-shadow:0 12px 30px rgba(0,0,0,.55)}
.rh3-history-head{display:flex;align-items:center;gap:8px;justify-content:space-between;padding-bottom:9px;border-bottom:1px solid #41474d;color:#b4dc76;font-size:11px;letter-spacing:.7px}
.rh3-history-head button{border:1px solid #66704f;border-radius:4px;background:#30382a;color:#e6f3d3;padding:6px 8px;font-size:10px;cursor:pointer}
.rh3-history-head button[data-action="close-history"]{font-size:17px;line-height:12px;padding:4px 8px}
.rh3-history-list{display:grid;gap:6px;padding-top:9px}
.rh3-history-list>p{margin:8px 0;color:#aeb6bd;font-size:12px;text-align:center}
.rh3-history-row{display:flex;gap:6px}
.rh3-history-row button{border:1px solid #505961;border-radius:4px;background:#30363c;color:#f1f3f5;padding:8px;font-size:11px;cursor:pointer}
.rh3-history-row button:first-child{flex:1;text-align:left;overflow-wrap:anywhere}
.rh3-history-row button:last-child{min-width:36px;color:#b4dc76}
.rhcalc-v3 [hidden]{display:none!important}
@media(max-width:560px){.rhcalc-v3{margin:10px auto}.rh3-device{padding:12px;border-radius:13px}.rh3-top{margin-bottom:11px}.rh3-logo{width:35px;height:35px;font-size:22px}.rh3-brand strong{font-size:11px;letter-spacing:1.2px}.rh3-brand span:last-child{font-size:8px}.rh3-modes button{padding:8px 10px;font-size:11px}.rh3-screen{min-height:105px;padding:8px 10px;margin-bottom:11px}.rh3-keypad{gap:6px}.rh3-keypad button{min-height:47px}.rh3-function-grid{gap:5px}.rh3-function-grid button{min-height:34px;font-size:11px}.rh3-tabs button,.rh3-angle-switch button{padding:7px 8px;font-size:9px}.rh3-science-head{align-items:flex-start}.rh3-history{top:58px;right:12px;width:calc(100% - 24px)}}
@media(prefers-reduced-motion:reduce){.rh3-keypad button,.rh3-function-grid button{transition:none}}

/* v3.0.1 refinements: keypad order and display action icons */
.rh3-screen-actions{align-items:center}
.rh3-screen-actions button{display:grid;place-items:center;width:38px;height:32px;padding:6px;border:1px solid rgba(32,43,31,.28);border-radius:6px;background:rgba(255,255,255,.38);color:#263326;box-shadow:0 1px 2px rgba(0,0,0,.12);transition:background .15s ease,border-color .15s ease,transform .15s ease}
.rh3-screen-actions button:hover{background:rgba(255,255,255,.72);border-color:rgba(32,43,31,.55);transform:translateY(-1px)}
.rh3-screen-actions svg{display:block;width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:560px){.rh3-screen-actions button{width:34px;height:30px}.rh3-screen-actions svg{width:16px;height:16px}}
@media(prefers-reduced-motion:reduce){.rh3-screen-actions button{transition:none}}
