/* Prime CAS Studio V5.3 — single-viewport app layout.
   Only the LCD and dialogs can scroll. The calculator/keypad/navigation stay in view. */
:root{--v53-topbar:51px;--v53-mobile-nav:62px}
html,body{margin:0!important;width:100%;height:100%;min-height:0!important;max-height:100%!important;overflow:hidden!important;overscroll-behavior:none!important}
body{height:100dvh!important;max-height:100dvh!important;display:flex!important;flex-direction:column!important}
.site-head.appbar{box-sizing:border-box!important;flex:0 0 var(--v53-topbar)!important;min-height:0!important;height:var(--v53-topbar)!important;padding:5px 14px!important;z-index:20}
.site-head.appbar .brand-icon{width:32px;height:32px;font-size:21px}
.layout.app-layout{box-sizing:border-box!important;display:grid!important;grid-template-columns:minmax(0,1fr) 92px!important;grid-template-rows:minmax(0,1fr)!important;width:100%!important;max-width:none!important;min-width:0!important;min-height:0!important;height:0!important;flex:1 1 auto!important;overflow:hidden!important;margin:0!important;padding:10px 12px!important;gap:10px!important}
.device-column.app-device{min-width:0!important;min-height:0!important;height:100%!important;max-width:none!important;overflow:hidden!important;display:flex!important;align-items:center!important;justify-content:center!important}
.calculator-shell{box-sizing:border-box!important;width:100%!important;max-width:1580px!important;height:100%!important;max-height:100%!important;min-height:0!important;overflow:hidden!important;margin:0 auto!important;padding:7px!important;display:grid!important;grid-template-columns:minmax(0,.94fr) minmax(0,1.06fr)!important;grid-template-rows:minmax(0,1fr)!important;gap:7px!important;border-radius:22px!important}
.calc-head{box-sizing:border-box!important;grid-column:1!important;grid-row:1!important;display:flex!important;flex-direction:column!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;margin:0!important;padding:10px!important;border-radius:15px 6px 6px 15px!important;overflow:hidden!important}
.calc-engraving{flex:0 0 auto!important;padding:0 3px 7px!important;min-height:0!important}
.lcd,.calculator-shell.suite-active .lcd{box-sizing:border-box!important;width:100%!important;min-height:0!important;height:0!important;flex:1 1 auto!important;overflow:hidden!important}
.screen-content{min-height:0!important;height:0!important;flex:1 1 auto!important;overflow:auto!important;overscroll-behavior:contain!important}
.hardware-controls{flex:0 0 auto!important;min-width:0!important;width:100%!important;margin:9px 0 0!important;gap:5px!important}
.control-button{height:clamp(25px,4.9dvh,38px)!important;min-height:0!important}
.dpad{width:100%;max-width:clamp(42px,12dvh,94px)!important;max-height:clamp(42px,12dvh,94px)!important;min-width:0;aspect-ratio:1}
.keypad{box-sizing:border-box!important;grid-column:2!important;grid-row:1!important;min-width:0!important;min-height:0!important;width:100%!important;height:100%!important;overflow:hidden!important;margin:0!important;padding:10px 10px 8px!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,2fr) minmax(0,5fr)!important;gap:6px!important;align-items:stretch!important;justify-content:stretch!important;border-radius:6px 15px 15px 6px!important}
.keys-six,.keys-five{min-width:0!important;min-height:0!important;height:100%!important;display:grid!important;align-items:stretch!important;justify-items:stretch!important;gap:5px!important;margin:0!important}
.keys-six{grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important}
.keys-five{grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(5,minmax(0,1fr))!important}
.keys-six .key,.keys-five .key,.key-special{box-sizing:border-box!important;display:flex!important;height:100%!important;min-height:0!important;max-height:none!important;width:100%!important;min-width:0!important;padding:1px 1px 3px!important;justify-content:center!important;align-items:center!important;line-height:1.05!important;gap:1px!important}
.key{font-size:clamp(10px,1.65dvh,17px)!important;border-bottom-width:2px!important}
.key-number{font-size:clamp(13px,2.5dvh,23px)!important}
.key-special{font-size:clamp(9px,1.38dvh,13px)!important}
.key small,.key-special small{font-size:clamp(4px,.8dvh,8px)!important;line-height:1.1!important}
.keypad-stamp{display:none!important}
.nav-shell.workspace{min-height:0!important;height:100%!important;max-height:100%!important;min-width:0!important;position:relative!important;grid-column:2!important;grid-row:1!important;display:flex!important;padding:0!important;margin:0!important;overflow:visible!important}
.nav-shell>.workspace-card,.nav-shell>.small-print,.nav-shell>.utility-hidden{display:none!important;position:absolute!important;width:0!important;height:0!important;overflow:hidden!important}
.mode-picker.app-nav{box-sizing:border-box!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:minmax(0,1fr)!important;align-content:stretch!important;justify-content:stretch!important;gap:5px!important;width:100%!important;height:100%!important;max-height:100%!important;min-height:0!important;padding:6px!important;overflow:hidden!important}
.mode-picker.app-nav>.mode-tile{box-sizing:border-box!important;min-height:0!important;height:100%!important;padding:2px 1px!important;gap:2px!important;justify-content:center!important}
.mode-tile span{font-size:clamp(15px,2.8dvh,23px)!important;line-height:1!important}
.mode-tile strong{font-size:clamp(9px,1.4dvh,12px)!important}
.mode-tile small{font-size:8px!important}
.more-toggle{display:none!important}
.more-modes-panel[hidden]{display:none!important}
.more-modes-panel{bottom:5px!important}

/* Portrait phones: display above a full, visible keypad; compact six-item bottom rail. */
@media (max-width:700px) and (orientation:portrait){
 :root{--v53-topbar:43px;--v53-mobile-nav:59px}
 .site-head.appbar{padding:3px 8px!important}
 .site-head.appbar .brand-icon{width:30px!important;height:30px!important;font-size:19px!important}
 .site-head.appbar .brand strong{font-size:13px!important}.site-head.appbar .brand small{display:none!important}
 .head-actions{gap:3px!important}.top-button{min-height:28px!important;padding:4px 7px!important;font-size:12px!important}.head-actions .offline-indicator{display:none!important}
 .layout.app-layout{display:flex!important;flex-direction:column!important;gap:0!important;padding:5px 5px calc(var(--v53-mobile-nav) + env(safe-area-inset-bottom) + 4px)!important}
 .device-column.app-device{width:100%!important;height:100%!important;flex:1 1 auto!important;min-height:0!important;order:1!important}
 .calculator-shell{max-width:510px!important;height:100%!important;min-height:0!important;max-height:100%!important;padding:5px!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,.8fr) minmax(0,1.2fr)!important;gap:3px!important;border-radius:15px!important}
 .calc-head{grid-column:1!important;grid-row:1!important;padding:6px 7px!important;border-radius:11px 11px 4px 4px!important}
 .calc-engraving{padding:0 2px 4px!important;min-height:0!important}.engraving-title{font-size:11px!important}.engraving-sub{font-size:6px!important}
 .lcd{border-width:2px!important}.lcd-status{height:19px!important;min-height:19px!important;font-size:8px!important}.lcd-softkeys{height:21px!important}.lcd-softkeys button{font-size:7px!important}
 .lcd-editor{font-size:13px!important;min-height:20px!important}.lcd-editor-wrap{padding:2px 6px!important}
 .hardware-controls{margin:5px 0 0!important;grid-template-columns:repeat(2,minmax(0,1fr)) minmax(39px,1.1fr) repeat(2,minmax(0,1fr))!important;gap:3px!important}
 .control-cluster{gap:2px!important}.control-button{height:clamp(16px,2.75dvh,26px)!important;font-size:8px!important;padding:0!important;border-radius:3px!important}.control-button small{font-size:4px!important;margin:0!important}.dpad{max-width:clamp(30px,7dvh,59px)!important;max-height:clamp(30px,7dvh,59px)!important;padding:2px!important}
 .keypad{grid-column:1!important;grid-row:2!important;padding:5px 4px 5px!important;grid-template-rows:minmax(0,2fr) minmax(0,5fr)!important;gap:4px!important;border-radius:4px 4px 12px 12px!important}
 .keys-six,.keys-five{gap:3px!important}.key{border-radius:4px!important;font-size:clamp(9px,1.75dvh,13px)!important}.key-number{font-size:clamp(12px,2.6dvh,19px)!important}.key-special{font-size:clamp(8px,1.45dvh,11px)!important}.key small{font-size:clamp(3.5px,.76dvh,6px)!important}
 .nav-shell.workspace{position:fixed!important;z-index:45!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;height:calc(var(--v53-mobile-nav) + env(safe-area-inset-bottom))!important;min-height:0!important;max-height:none!important;width:100%!important;padding:3px 5px calc(4px + env(safe-area-inset-bottom))!important;display:block!important;pointer-events:none!important}
 .mode-picker.app-nav{pointer-events:auto!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:minmax(0,1fr)!important;grid-auto-rows:unset!important;height:100%!important;gap:3px!important;padding:3px!important;border-radius:12px!important}
 .mode-picker.app-nav>.mode-tile{padding:1px!important;min-height:0!important;gap:2px!important;border-radius:8px!important}
 .mode-tile span{font-size:clamp(15px,2.5dvh,20px)!important}.mode-tile strong{font-size:clamp(8px,1.45dvh,11px)!important}.mode-tile small{display:none!important}
 .mode-picker.app-nav>.nav-secondary{display:none!important}.mode-picker.app-nav>.more-toggle{display:flex!important}
 .more-modes-panel{pointer-events:auto!important;position:fixed!important;bottom:calc(var(--v53-mobile-nav) + env(safe-area-inset-bottom) + 4px)!important;right:7px!important;top:auto!important;width:min(300px,90vw)!important;max-height:60dvh;overflow:auto!important}
}
/* Compact/short phones: give slightly more room to the keypad and suppress status ornaments. */
@media (max-width:700px) and (orientation:portrait) and (max-height:680px){
 :root{--v53-mobile-nav:52px;--v53-topbar:38px}
 .calculator-shell{grid-template-rows:minmax(0,.66fr) minmax(0,1.34fr)!important}
 .calc-engraving{display:none!important}
 .calc-head{padding:4px!important}
 .hardware-controls{margin-top:3px!important}.control-button{height:clamp(15px,2.55dvh,20px)!important}
 .dpad{max-width:37px!important;max-height:37px!important}
 .keypad{padding:4px 3px!important;gap:3px!important}
 .keys-six,.keys-five{gap:2px!important}
 .lcd-status{height:17px!important;min-height:17px!important}.lcd-softkeys{height:18px!important}
 .mode-tile span{font-size:14px!important}
}
/* Desktop and tablet with a short landscape viewport: screen left, keys right, nav rail at edge. */
@media (orientation:landscape) and (max-height:630px){
 :root{--v53-topbar:34px}
 .site-head.appbar{padding:2px 8px!important}
 .site-head.appbar .brand-icon{width:25px!important;height:25px!important;font-size:16px!important}
 .layout.app-layout{grid-template-columns:minmax(0,1fr) 60px!important;gap:5px!important;padding:4px 5px!important}
 .calculator-shell{grid-template-columns:minmax(0,.87fr) minmax(0,1.13fr)!important;padding:4px!important;gap:4px!important;border-radius:13px!important}
 .calc-head{padding:5px!important;border-radius:8px 3px 3px 8px!important}
 .calc-engraving{display:none!important}
 .lcd{border-width:2px!important}.lcd-status{height:18px!important}.lcd-softkeys{height:18px!important}
 .hardware-controls{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:2px!important;margin:3px 0 0!important}
 .control-button{height:clamp(14px,4.2dvh,25px)!important;font-size:7px!important;padding:0!important}.control-button small{font-size:4px!important;margin:0!important}.control-cluster{gap:2px!important}.dpad{display:none!important}
 .keypad{padding:3px!important;gap:3px!important;border-radius:3px 8px 8px 3px!important}
 .keys-six,.keys-five{gap:2px!important}.key{font-size:clamp(9px,3dvh,12px)!important}.key-number{font-size:clamp(11px,4dvh,17px)!important}.key-special{font-size:clamp(8px,2.8dvh,10px)!important}.key small{font-size:clamp(3px,1.2dvh,5px)!important}
 .mode-picker.app-nav{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:repeat(6,minmax(0,1fr))!important;grid-auto-rows:unset!important;gap:2px!important;padding:3px!important}
 .mode-picker.app-nav>.nav-secondary{display:none!important}.mode-picker.app-nav>.more-toggle{display:flex!important}
 .mode-tile span{font-size:clamp(11px,3.4dvh,15px)!important}.mode-tile strong{font-size:clamp(7px,2.3dvh,9px)!important}.mode-tile small{display:none!important}
 .more-modes-panel{right:calc(100% + 5px)!important;bottom:0!important;max-height:80dvh;overflow:auto}
}
/* Keyboard focus/graph/table/Suite scrolling is localized to calculator display. */
#screen-content,#calc-history,.eng-table-wrap,.table-scroller{overscroll-behavior:contain}
@media (prefers-reduced-motion:reduce){.calculator-shell,.key{transition:none!important}}

/* GSZ Calculator identity: independent product branding and splash/icon */
.gsz-brand-icon{padding:0!important;overflow:hidden;flex-shrink:0;background:transparent!important;box-shadow:0 4px 16px #067eab38!important;border-color:#349ed499!important}
.gsz-brand-icon img,.gsz-boot-mark img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.gsz-boot-mark{background:transparent!important;padding:0!important;overflow:hidden;box-shadow:0 12px 50px #069bca40!important}
.boot-name{letter-spacing:.8px;white-space:nowrap;font-size:clamp(18px,4vw,29px)!important}
.boot-sub{letter-spacing:1.4px}
.site-head.appbar .brand strong{letter-spacing:.2px!important;font-size:clamp(12px,1.4vw,18px)!important;white-space:nowrap}
.site-head.appbar .brand small{letter-spacing:1.05px!important}
.calc-engraving .engraving-title{letter-spacing:1.4px;white-space:nowrap}
@media(max-width:700px) and (orientation:portrait){.site-head.appbar .brand strong{font-size:13px!important}.calc-engraving .engraving-title{font-size:10.5px!important;letter-spacing:.8px!important}}
@media(max-width:375px){.site-head.appbar .brand strong{font-size:12px!important}.brand-icon.gsz-brand-icon{width:33px!important;height:33px!important}}

/* GSZ Calculator V5.5 — accessible, color-coded tactile keyboard.
   Semantic colors help distinguish numbers, operations and navigation at a glance.
   Sizes and grid measurements remain unchanged so the one-screen fit is preserved. */
.keypad .key {
  color:#f4f8ff!important;
  background:linear-gradient(167deg,#3e5779 0%,#2a4163 55%,#1c314e 100%)!important;
  border-color:#172946!important;
  border-bottom-color:#0e2039!important;
  box-shadow:inset 0 1px 1px #ffffff42,0 2px 3px #0b1b369e!important;
  font-weight:850!important;
  text-shadow:0 1px 1px #07112455;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.keypad .key small {
  color:#b5deff!important;
  font-weight:850!important;
  letter-spacing:.1px!important;
  text-shadow:none!important;
  opacity:1!important;
}
/* Light numeral group: dark text is much easier to read than low-contrast grey. */
.keypad .key-number {
  background:linear-gradient(169deg,#ffffff 0%,#e9f3ff 52%,#cfdef3 100%)!important;
  color:#092449!important;
  border-color:#9bb0ca!important;
  border-bottom-color:#7f99bb!important;
  text-shadow:none!important;
}
.keypad .key-number small {color:#315f97!important}
/* Specials stand apart from trig and logarithm controls. */
.keypad .key-special {
  background:linear-gradient(166deg,#277d91,#1a536e 66%,#133a57)!important;
  color:#ffffff!important;
  border-color:#13506a!important;
  border-bottom-color:#0c3247!important;
}
.keypad .key-special small{color:#d2faff!important}
.keypad .key-operator{
  background:linear-gradient(164deg,#5a86ed,#3467d2 64%,#2451ac)!important;
  color:#ffffff!important;
  border-color:#2c58b8!important;
  border-bottom-color:#183f8e!important;
}
.keypad .key-operator small{color:#e5efff!important}
.keypad .key-enter{
  background:linear-gradient(163deg,#1eba85 0%,#13916e 60%,#086949 100%)!important;
  color:white!important;
  border-color:#0e8c66!important;
  border-bottom-color:#08563e!important;
}
.keypad .key-enter small{color:#dcfff3!important}
.keypad .key-shift{
  background:linear-gradient(160deg,#42b8f7,#1683cd 60%,#0860a4)!important;
  color:#ffffff!important;
  border-color:#0976bd!important;
  border-bottom-color:#054a85!important;
}
.keypad .key-shift small{color:#e9f9ff!important}
.keypad .key-alpha{
  background:linear-gradient(161deg,#ffcb78,#ffa443 57%,#ef8527)!important;
  color:#3a200a!important;
  border-color:#cb7626!important;
  border-bottom-color:#995018!important;
  text-shadow:none!important;
}
.keypad .key-alpha small{color:#61360b!important}
.keypad .key-power,
.keypad .key[data-action="delete"]{
  background:linear-gradient(162deg,#ed7184,#cd485e 64%,#a73047)!important;
  color:#ffffff!important;
  border-color:#ae3a50!important;
  border-bottom-color:#7e2538!important;
}
.keypad .key-power small,.keypad .key[data-action="delete"] small{color:#ffe0e8!important}
.keypad .key[data-insert="ans"]{
  background:linear-gradient(164deg,#735ac7,#5943a8 64%,#44328e)!important;
  color:#fff!important;
  border-color:#5140a2!important;
  border-bottom-color:#302468!important;
}
.keypad .key[data-insert="ans"] small{color:#e7dfff!important}
.keypad .key:active,.keypad .key.pressed{
  filter:brightness(.93)!important;
  transform:translateY(1px)!important;
  box-shadow:inset 0 2px 4px #08192d70!important;
}
.keypad .key:focus-visible{outline:2px solid #f7cc64!important;outline-offset:1px!important}
/* The labels were 3–5px on short phones: raise legibility without resizing rows. */
@media (orientation:portrait) and (max-width:700px){
 .keypad .key small{font-size:clamp(5.5px,.9dvh,8px)!important;letter-spacing:0!important}
 .keypad .key-special small{font-size:clamp(5px,.8dvh,7px)!important}
 .keypad .key{font-weight:850!important}
}
@media (orientation:landscape) and (max-height:630px){
 .keypad .key small{font-size:clamp(4px,1.4dvh,7px)!important;letter-spacing:0!important}
 .keypad .key-special small{font-size:clamp(3.6px,1.25dvh,6px)!important}
}
