/* LassePad. Device drawn in design units (px) at 473 x 1085 and scaled with JS. */
:root {
  --page: #b6b6b6;
  --appbar: #ffffff;
  --blue: #f0782a;
  --body: #2a2e35;
  --bezel: #1a1d22;
  --key-dark: #4b515b;
  --key-dark-hi: #5a616c;
  --key-white: #ffffff;
  --exe: #f0782a;
  --cyan: #ff9a4d;
  --lcd: #ffffff;
  --sel: #3db5ee;
  --lcd-font: 'Courier Prime', 'Courier New', Courier, monospace;
  --ui-font: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--page); overflow: hidden; }
body { font-family: var(--ui-font); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }

#app { display: flex; flex-direction: column; height: 100%; }
.appbar { position: relative; flex: 0 0 auto; height: calc(44px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  background: var(--appbar); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d2d2d2; color: #333; }
.ab-btn { width: 44px; height: 44px; display: grid; place-items: center; color: #444; }
.ab-right { display: flex; }
.ab-title { position: absolute; left: 50%; bottom: 13px; transform: translateX(-50%); font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; font-size: 13px; font-weight: 600; color: #222; }
.stage { flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; padding-top: 6px; }
.device-wrap { position: relative; }
.device { position: absolute; left: 0; top: 0; width: 473px; height: 1085px; transform-origin: 0 0; }
.foot { flex: none; padding-bottom: calc(2px + env(safe-area-inset-bottom)); text-align: center; line-height: 12px; font-size: 10px; color: #666; }

/* ---------- shell ---------- */
.shell-outer { position: absolute; inset: 0; border-radius: 48px 48px 84px 84px; background: linear-gradient(90deg, #3b4049, #50565f 6%, #50565f 94%, #3b4049); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.shell-blue { position: absolute; left: 9px; right: 9px; top: 8px; bottom: 9px; border-radius: 41px 41px 76px 76px; background: var(--blue); }
.shell-body { position: absolute; left: 13px; right: 13px; top: 12px; bottom: 13px; border-radius: 37px 37px 72px 72px; background: linear-gradient(#30353d, var(--body) 40%); }
.wordmark { position: absolute; left: 0; right: 0; top: 17px; text-align: center; font-family: var(--ui-font); font-size: 21px; font-weight: 400; font-style: italic; letter-spacing: 1px; color: #e9ecf0; pointer-events: none; }
.wordmark b { color: var(--blue); font-weight: 700; }
.bezel { position: absolute; left: 47px; top: 47px; width: 379px; height: 630px; border-radius: 26px; background: var(--bezel); box-shadow: inset 0 0 0 1px #3a3f47; }
.navpanel { position: absolute; left: 47px; top: 699px; width: 379px; height: 92px; border-radius: 46px; background: var(--bezel); box-shadow: inset 0 0 0 1px #3a3f47; }

/* ---------- LCD ---------- */
.screen { position: absolute; left: 68px; top: 64px; width: 337px; height: 556px; background: var(--lcd); overflow: hidden;
  display: flex; flex-direction: column; font-family: var(--ui-font); color: #111; }
.menubar { flex: 0 0 31px; display: flex; align-items: stretch; background: linear-gradient(#fbfbfb, #ececec); border-bottom: 1px solid #c9c9c9; padding-left: 4px; }
.mb-item { padding: 0 3.5px; font-size: 15.5px; font-weight: 500; color: #1a1a1a; letter-spacing: -0.1px; display: flex; align-items: center; }
.mb-gear { padding: 0 6px 0 4px; color: #333; }
.mb-item.open { background: var(--sel); }
.mb-spacer { flex: 1; }
.mb-close { width: 23px; height: 21px; margin: 4px 4px 0 0; border: 1px solid #c8c8c8; background: #f6f6f6; color: #c2c2c2; font-size: 14px; line-height: 19px; border-radius: 2px; }

.toolbar { flex: 0 0 37px; display: flex; gap: 0; align-items: center; padding: 1px 0 1px 1px; background: #ffffff; border-bottom: 1px solid #c6c6c6; }
.tb { height: 33px; min-width: 39px; padding: 0 3px; margin-right: 1.5px; display: flex; align-items: center; justify-content: center; gap: 1px;
  background: linear-gradient(#ffffff, #e9e9e9 60%, #dcdcdc); border: 1px solid #a9a9a9; border-radius: 3px; font-family: 'Times New Roman', serif; color: #000; }
.tb:active, .tb.pressed { background: linear-gradient(#cfcfcf, #e9e9e9); }
.tb-dd { min-width: 18px; width: 18px; font-size: 10px; padding: 0; }
.tb-simp { font-size: 16px; font-weight: 700; min-width: 42px; }
.tb-next { flex: 1; min-width: 0; color: #c9c9c9; background: linear-gradient(#fbfbfb, #ededed); border-color: #cfcfcf; margin-right: 0; font-size: 12px; }
.tb-fd { position: relative; width: 30px; height: 26px; font-weight: 700; }
.tb-fd .a { position: absolute; left: 0; top: -1px; font-size: 10.5px; font-family: Arial, sans-serif; }
.tb-fd .b { position: absolute; right: 0; top: 3px; font-size: 10px; font-family: Arial, sans-serif; }
.tb-fd .fr { display: inline-flex; flex-direction: column; align-items: center; line-height: 9px; }
.tb-fd .fr span:first-child { border-bottom: 1.2px solid #000; padding: 0 1px; }
.tb-fd .arr { position: absolute; left: 1px; bottom: 1px; width: 15px; height: 12px; }
.tb-int { display: flex; flex-direction: column; font-size: 11px; line-height: 10px; font-weight: 700; }
.tb-intp { font-size: 13px; font-weight: 700; border-bottom: 1.4px solid #000; line-height: 13px; }

/* work area */
.work-wrap { flex: 1 1 auto; min-height: 0; display: flex; position: relative; border-bottom: 1px solid #b9b9b9; }
.work { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 4px 2px 6px 4px; scrollbar-width: none; font-family: var(--lcd-font); font-size: 16px; color: #000; }
.work::-webkit-scrollbar { display: none; }
.vscroll { flex: 0 0 21px; display: flex; flex-direction: column; padding: 3px 3px 3px 1px; gap: 2px; }
.vs-btn { height: 19px; border-radius: 3px; background: linear-gradient(#a9a9a9, #8f8f8f); color: #fff; font-size: 10px; line-height: 19px; }
.vs-track { flex: 1; background: #d3d3d3; border-radius: 2px; position: relative; }
.vs-thumb { position: absolute; left: 0; right: 0; top: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #a3a3a3, #8b8b8b); }

.entry { position: relative; }
.inp { min-height: 22px; line-height: 22px; white-space: pre-wrap; word-break: break-all; padding-right: 2px; position: relative; }
.inp .pc { display: inline; }
.inp .vx { font-weight: 700; font-style: italic; font-family: 'Times New Roman', Times, serif; font-size: 17px; }
.inp .ph { display: inline-block; width: 9px; height: 13px; border: 1px solid #000; vertical-align: -1px; margin-left: 1px; }
.cursor { display: inline-block; width: 0; height: 17px; border-left: 1.6px solid #000; vertical-align: -3px; margin-right: -1.6px; animation: blink 1s steps(1) infinite; position: relative; z-index: 1; }
@keyframes blink { 50% { opacity: 0; } }
.out-row { display: flex; align-items: center; justify-content: flex-end; min-height: 22px; margin: 1px 0 5px; }
.out { overflow-x: auto; scrollbar-width: none; white-space: nowrap; text-align: right; max-width: 100%; padding: 1px 0; }
.out::-webkit-scrollbar { display: none; }
.out-inner { display: inline-block; text-align: left; }
.out-more { flex: 0 0 auto; width: 15px; height: 17px; margin-left: 2px; border: 1px solid #555; background: linear-gradient(#f5f5f5, #d6d6d6); font-size: 10px; line-height: 15px; color: #000; display: none; }
.out-row.ovf .out-more { display: block; }
.out-row.ovf .out { text-align: left; }
.entry.active .inp { }

/* system-of-equations template */
.sys { display: inline-flex; align-items: stretch; vertical-align: middle; margin: 2px 1px; line-height: 20px; }
.sys-br { width: 7px; border: 1.4px solid #000; border-right: 0; border-radius: 6px 0 0 6px; margin-right: 2px; }
.sys-rows { display: inline-flex; flex-direction: column; padding-right: 3px; border-right: 1.4px solid #000; }
.sys-row { min-height: 20px; white-space: nowrap; }
.sys-vars { align-self: flex-end; padding-left: 2px; font-size: 14px; white-space: nowrap; }
.slot .ph { width: 8px; height: 12px; }

/* 2D input templates */
.inp .tfrac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 1px; line-height: 1.15; }
.inp .tf-n { padding: 0 2px 1px; border-bottom: 1.3px solid #000; min-width: 10px; text-align: center; }
.inp .tf-d { padding: 1px 2px 0; min-width: 10px; text-align: center; }
.inp .tsqrt { display: inline-flex; align-items: stretch; vertical-align: middle; }
.inp .ts-r { font-family: 'Times New Roman', serif; transform: scaleY(1.15); margin-right: -1px; }
.inp .ts-a { border-top: 1.3px solid #000; padding: 1px 1px 0; }
.inp .tpow > .slot { font-size: .72em; vertical-align: .75em; line-height: 0; }
.inp .tpow { line-height: 0; }
.inp .troot { display: inline-flex; align-items: flex-start; vertical-align: middle; }
.inp .tr-n { font-size: .65em; margin-right: 1px; margin-top: -2px; }
.inp .tl-b { font-size: .7em; vertical-align: -.35em; line-height: 0; }
.inp .slot .ph { width: 8px; height: 11px; }
.inp .tpow .ph, .inp .tr-n .ph, .inp .tl-b .ph { width: 6px; height: 8px; }
.sk.on { background: #bfe6f8; }

/* matrix/vector template */
.tmat td { padding: 0 3px; min-width: 12px; }
.sk.on { background: #bfe6f8; }

/* tall braces around lists with fractions, selected output */
.mbr.tall { font-size: 2em; line-height: 1; vertical-align: middle; display: inline-block; transform: scaleX(.65); margin: 0 -2px; font-weight: 300; }
.out-row { touch-action: none; }
.inp { touch-action: pan-y; } /* sideways drag marks, up/down scrolls */
.inp.has-hl { touch-action: none; } /* the marking can be dragged anywhere */
.hl, .out-row.sel .out-inner { background: var(--sel); }
.hl, .hl *, .out-row.sel .out-inner, .out-row.sel .out-inner *, .out-row.sel .mmat::before, .out-row.sel .mmat::after, .hl.mmat::before, .hl.mmat::after { color: #fff !important; border-color: #fff !important; }
.drag-ghost { position: fixed; z-index: 200; pointer-events: none; background: rgba(61,181,238,.85); color: #000; padding: 1px 4px; font-family: var(--lcd-font); font-size: 15px; border-radius: 2px; white-space: nowrap; transform: translate(-50%, -120%); }

/* Grafik & Tabelle */
.mb-items { display: flex; }
.mb-close.can { color: #333; border-color: #999; }
.panes { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pane { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.pane[hidden], .toolbar[hidden] { display: none; }
#gTools, .g-tabs { display: none; }
/* gtools: a graph or table window is active; split: more than one window */
.screen.gtools #toolbar { display: none; }
.screen.gtools #gTools, .screen.graph .g-tabs { display: flex; }
.screen.split .inp { touch-action: none; } /* lines can be dragged into the graph */
.screen.split .pane { border: 2px solid #c9ccd0; }
.screen.split .pane.focus { border-color: var(--sel); }
.screen.split .work-wrap { border-bottom: 0; }
.screen.graph .work { padding-top: 0; }
.screen.graph .sb[data-sb="alg"], .screen.graph .sb[data-sb="dec"] { display: none; }
.screen.graph .sb-gap { order: 3; }
.screen.graph .sb[data-sb="cplx"] { order: 2; margin-left: 14px; }
.screen.graph .sb[data-sb="ang"] { order: 1; text-align: left; }
.screen.graph .sb-busy { order: 4; } .screen.graph .sb-bat { order: 5; }
#gTools .tb { min-width: 0; flex: 0 1 41px; padding: 0 1px; }
#gTools .tb:disabled { opacity: .35; }
#gTools .tb-next { flex: 1; margin-right: 1px; }
#gTools .tb-next:not(:disabled) { color: #000; }
.tb svg text { font-family: Arial, sans-serif; }
.tb-y { font-size: 11px; line-height: 11px; font-weight: 700; text-align: left; }
.tb-t { font-size: 17px; font-weight: 700; }
.g-tabs { flex: 0 0 22px; align-items: flex-end; gap: 1px; padding: 0 1px; background: #f3f3f3; border-bottom: 1px solid #8f8f8f; }
.g-tabs button { height: 20px; padding: 0 5px; border: 1px solid #8f8f8f; border-bottom: 0; border-radius: 0 7px 0 0; background: #e3e3e3; font-size: 14px; font-weight: 500; }
.g-tabs button.on { background: #fff; height: 22px; margin-bottom: -1px; }
.entry.row { display: flex; align-items: flex-start; min-height: 24px; color: var(--c); }
.entry.row .inp { flex: 1 1 auto; min-width: 0; }
.entry.row .inp .ph, .entry.row .cursor, .entry.row .tfrac .tf-n, .entry.row .ts-a { border-color: currentColor; }
.g-chk { flex: 0 0 17px; height: 17px; margin: 2px 4px 0 0; border: 1.4px solid #8f8f8f; background: #fff; color: #000; font: 700 13px/14px Arial, sans-serif; }
.g-chk.on { background: var(--sel); border-color: #2793c9; }
.g-y { line-height: 22px; }
.g-line { flex: 0 0 22px; height: 3px; margin: 10px 2px 0; background: var(--c); }
#gCanvas { flex: 1 1 0; min-height: 0; width: 100%; display: block; touch-action: none; background: #fff; cursor: grab; }
.g-msg { flex: 0 0 22px; display: flex; align-items: center; border-top: 1px solid #a7a7a7; padding-left: 3px; font-family: var(--lcd-font); font-size: 15px; white-space: nowrap; overflow: hidden; background: #fff; }
.g-msg > span { flex: 1; overflow: hidden; }
.g-msg > span > .hl { flex: 0; }
.g-msg button { flex: 0 0 30px; height: 100%; border-left: 1px solid #a7a7a7; display: grid; place-items: center; }
.g-msg .kico { transform: scale(.75); }
.g-table { flex: 1 1 0; min-height: 0; overflow: auto; font-family: var(--lcd-font); font-size: 16px; }
.g-table table { border-collapse: separate; border-spacing: 8px 0; min-width: 60%; }
.g-table th { position: sticky; top: 0; background: #fff; font-weight: 400; border-bottom: 1px solid currentColor; padding-top: 4px; }
.g-table td { text-align: right; line-height: 20px; min-width: 62px; white-space: nowrap; }
.g-table td.sel { background: var(--sel); color: #fff; }
.dlg-field.fresh { background: var(--sel); color: #fff; }

/* math rendering */
.mn, .mv, .mt { font-family: var(--lcd-font); }
.mv { }
.me { font-family: 'Times New Roman', Times, serif; font-weight: 700; font-style: italic; font-size: 1.05em; }
.mi { font-family: 'Times New Roman', Times, serif; font-style: italic; }
.mE { font-size: .8em; }
.mdot { padding: 0 0.5px; }
.ms { font-size: 0.72em; vertical-align: 0.65em; line-height: 0; }
.mf { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 1px; line-height: 1.15; }
.mfn { padding: 0 2px 1px; border-bottom: 1.3px solid #000; }
.mfd { padding: 1px 2px 0; }
.mfd:has(.ms) { padding-top: 5px; }
.mr { display: inline-flex; align-items: stretch; }
.mrs { font-family: 'Times New Roman', serif; transform: scaleY(1.15); margin-right: -1px; }
.mri { border-top: 1.3px solid #000; padding: 0 1px; }
.mroot { margin-right: 1px; vertical-align: 0.8em; }
.mp { }
.mmat { display: inline-block; vertical-align: middle; border-left: 1.4px solid #000; border-right: 1.4px solid #000; padding: 0 2px; position: relative; margin: 1px 2px; }
.mmat::before, .mmat::after { content: ''; position: absolute; top: 0; bottom: 0; width: 4px; border-top: 1.4px solid #000; border-bottom: 1.4px solid #000; }
.mmat::before { left: 0; } .mmat::after { right: 0; }
.mmat table { border-collapse: collapse; }
.mmat td { padding: 1px 4px; text-align: center; }

/* soft keyboard */
.softkb { flex: 0 0 221px; min-height: 0; overflow: hidden; display: flex; padding: 4px 3px 3px 2px; background: #ffffff; border-top: 1px solid #c8c8c8; gap: 3px; }
.softkb[hidden] { display: none; }
.sk-tabs { flex: 0 0 66px; display: flex; flex-direction: column; gap: 1px; }
.sk-tab { height: 30px; text-align: center; font-size: 16px; font-weight: 500; letter-spacing: -0.2px; border: 1px solid #b4b4b4; border-right: 0; border-radius: 7px 0 0 7px;
  background: linear-gradient(#efefef, #d7d7d7); color: #222; }
.sk-tab.on { background: #ffffff; }
.sk-tab.dis { color: #b5b5b5; }
.sk-tabnav { margin-top: auto; display: flex; height: 30px; border: 1px solid #b4b4b4; border-radius: 3px; overflow: hidden; }
.sk-tabnav button { flex: 1; font-size: 11px; color: #333; background: linear-gradient(#fafafa, #e3e3e3); }
.sk-tabnav button + button { border-left: 1px solid #b4b4b4; }
.sk-tabnav button:disabled { color: #ccc; }
.sk-main { flex: 1; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.sk-grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 34px; border: 1px solid #a7a7a7; background: #a7a7a7; gap: 1px; }
.sk-bottom { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 34px; margin-top: 6px; border: 1px solid #a7a7a7; background: #a7a7a7; gap: 1px; }
.sk { background: linear-gradient(#ffffff, #f0f0f0 55%, #e2e2e2); font-family: 'Times New Roman', Times, serif; font-size: 18px; color: #111; display: flex; align-items: center; justify-content: center; line-height: 1; overflow: hidden; white-space: nowrap; }
.sk:active, .sk.pressed { background: linear-gradient(#c9c9c9, #e6e6e6); }
.sk sup { font-size: 0.62em; vertical-align: 0.6em; line-height: 0; }
.sk sub { font-size: 0.62em; vertical-align: -0.3em; line-height: 0; }
.kcond { font-family: var(--ui-font); font-size: 17px; font-weight: 500; }
.kline { font-family: 'Times New Roman', serif; font-weight: 400; font-size: 18px; }
.ksm { font-size: 15px; }
.kxs { font-size: 11.5px; line-height: 1.05; text-align: center; font-family: var(--ui-font); }
.kb { display: inline-block; width: 9px; height: 11px; background: #111; vertical-align: -1px; margin: 0 .5px; }
.kw { display: inline-block; width: 9px; height: 11px; border: 1.2px solid #111; vertical-align: -1px; margin: 0 .5px; }
.ks { width: 6px; height: 8px; }
.kfr { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; vertical-align: middle; }
.kfr > * { margin: 0; }
.kfrt { font-size: 12px; line-height: 12px; }
.kfrt > span:first-child { border-bottom: 1px solid #111; padding: 0 1px; }
.kfr > span { display: flex; }
.kbs { font-family: Arial, sans-serif; font-size: 20px; font-weight: 700; }
.kico { width: 18px; height: 20px; position: relative; display: inline-block; }
.kcopy::before, .kcopy::after, .kpaste::before, .kpaste::after { content: ''; position: absolute; border: 1.2px solid #333; background: repeating-linear-gradient(#fff 0 2px, #777 2px 3px); }
.kcopy::before { left: 0; top: 0; width: 11px; height: 13px; }
.kcopy::after { left: 6px; top: 6px; width: 11px; height: 13px; }
.kpaste::before { left: 0; top: 1px; width: 12px; height: 15px; background: #e5e5e5; }
.kpaste::after { left: 6px; top: 6px; width: 11px; height: 13px; }
.kmat { font-size: 15px; display: inline-flex; align-items: center; }

/* abc keyboard */
.sk-abc { flex: 1; display: flex; flex-direction: column; }
.abc-tabs { display: flex; height: 29px; }
.abc-tab { flex: 1; border: 1px solid #b4b4b4; border-bottom: 0; border-radius: 8px 8px 0 0; background: linear-gradient(#f2f2f2, #dedede); font-size: 15px; font-weight: 500; margin-right: -1px; }
.abc-tab.on { background: #fff; position: relative; z-index: 1; }
.abc-grid { display: grid; grid-template-columns: repeat(11, 1fr); grid-auto-rows: 34px; border: 1px solid #a7a7a7; background: #a7a7a7; gap: 1px; }
.abc-grid .sk { font-size: 17px; font-family: 'Times New Roman', serif; }
.abc-grid .sk.kc { font-family: var(--ui-font); font-size: 10px; font-weight: 700; }
.abc-grid .sk.on { background: #bfe6f8; }
.abc-bottom { display: grid; grid-template-columns: 1.6fr 0.25fr 1.3fr 2.6fr 1.3fr; grid-auto-rows: 34px; margin-top: 7px; gap: 0; }
.abc-bottom .sk { border: 1px solid #a7a7a7; margin-left: -1px; }
.abc-bottom .gap { background: transparent; border: 0; }

/* catalog */
.cat { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cat-letters button:first-child, .cat-letters button:last-child { flex: 0 0 22px; font-size: 10px; }
.cat-letters { display: flex; height: 28px; border: 1px solid #a7a7a7; background: #a7a7a7; gap: 1px; }
.cat-letters button { flex: 1; background: linear-gradient(#fff, #e3e3e3); font-family: var(--ui-font); font-size: 14px; font-weight: 500; }
.cat-letters button.on { background: var(--sel); }
.cat-body { flex: 1; display: flex; gap: 6px; margin-top: 4px; min-height: 0; }
.cat-list { flex: 1; overflow-y: auto; border: 1px solid #8f8f8f; font-family: var(--lcd-font); font-size: 15px; scrollbar-width: thin; }
.cat-list div { padding: 0 3px; line-height: 19px; white-space: nowrap; }
.cat-list div.on { background: var(--sel); }
.cat-side { flex: 0 0 64px; display: flex; flex-direction: column; gap: 6px; }
.cat-side .lbl { text-align: center; font-size: 14px; font-weight: 500; }
.cat-side .btn { height: 30px; border: 1px solid #a7a7a7; background: linear-gradient(#fff, #e3e3e3); font-size: 15px; font-weight: 500; border-radius: 2px; }
.cat-side .sel { height: 26px; border: 1px solid #a7a7a7; display: flex; align-items: center; justify-content: space-between; padding: 0 3px 0 6px; font-size: 15px; font-weight: 500; }

/* status bar */
.statusbar { flex: 0 0 27px; display: flex; align-items: center; padding: 0 3px 0 4px; background: linear-gradient(#f6f6f6, #e5e5e5); border-top: 1px solid #c3c3c3; font-size: 16px; font-weight: 500; color: #222; gap: 0; }
.sb { padding: 0 3px; height: 100%; letter-spacing: -0.2px; }
.sb[data-sb="alg"] { width: 52px; text-align: left; }
.sb[data-sb="dec"] { width: 76px; text-align: left; padding-left: 14px; }
.sb-gap { flex: 1; }
.sb[data-sb="cplx"] { width: 48px; }
.sb[data-sb="ang"] { width: 44px; }
.sb-busy { width: 30px; height: 18px; border-left: 1.4px solid #ccc; margin-left: 10px; }
.sb-busy.on { background: repeating-linear-gradient(90deg, #555 0 3px, transparent 3px 6px); background-size: 12px 6px; background-repeat: repeat-x; background-position: 4px center; animation: busy .6s linear infinite; }
@keyframes busy { to { background-position: 16px center; } }
.sb-bat { margin-left: 2px; }

/* menus (inside LCD) */
.menu-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.menu-layer.on { pointer-events: auto; }
.dd { position: absolute; background: #fff; border: 1px solid #222; box-shadow: 2px 2px 0 rgba(0,0,0,.25); min-width: 60px; font-size: 15.5px; font-weight: 500; color: #111; padding: 0; }
.dd-it { display: flex; align-items: center; height: 20.5px; padding: 0 3px; white-space: nowrap; gap: 12px; }
.dd-it .ar { margin-left: auto; font-size: 8px; }
.dd-it.dis { color: #b9b9b9; }
.dd-it.hl { background: var(--sel); }
.dd-sep { height: 1px; background: #9a9a9a; margin: 0; }

/* dialogs */
.dialog-layer { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.dialog-layer.on { pointer-events: auto; }
.dlg { position: absolute; left: 1px; right: 1px; top: 0; background: #fff; border: 1px solid #333; font-size: 15px; font-weight: 500; }
.dlg-title { height: 21px; background: linear-gradient(#5b5b5b, #3b3b3b); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 3px 0 6px; }
.dlg-title button { width: 17px; height: 15px; border: 1px solid #fff; color: #fff; font-size: 11px; line-height: 13px; }
.dlg-body { padding: 4px 4px 6px; }
.dlg-row { display: flex; align-items: center; height: 21px; margin: 2px 0; }
.dlg-row label { flex: 0 0 88px; }
.dlg-field { flex: 0 0 95px; height: 18px; border: 1px solid #555; font-family: var(--lcd-font); font-size: 14px; line-height: 16px; padding: 0 2px; overflow: hidden; white-space: nowrap; }
.dlg-field.wide { flex: 1; }
.dlg-field.focus { outline: 1px solid var(--sel); }
.dlg-btns { display: flex; justify-content: space-between; margin-top: 8px; }
.dlg-btn { height: 21px; min-width: 62px; border: 1px solid #555; padding: 0 8px; background: #fff; box-shadow: inset 0 0 0 1px #fff, inset 0 0 0 2px #999; }
.dlg-btn:active { background: #ddd; }
.dlg-msg { padding: 10px 6px 4px; text-align: center; }
.dlg-check { display: flex; align-items: center; gap: 6px; height: 24px; }
.dlg-check input { width: 15px; height: 15px; margin: 0; }
.dlg-select { font: inherit; height: 22px; flex: 1; }

/* launcher (Menu) */
.launcher { position: absolute; inset: 0; z-index: 25; background: #fff; display: flex; flex-direction: column; }
.launcher[hidden] { display: none; }
.ln-head { height: 22px; display: flex; align-items: center; gap: 4px; padding-left: 4px; background: linear-gradient(#fbfbfb, #ececec); border-bottom: 1px solid #c9c9c9; font-size: 15px; font-weight: 500; }
.ln-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 48px; gap: 2px 6px; padding: 6px 4px; align-content: start; }
.ln-app { display: flex; align-items: center; gap: 2px; border-radius: 4px; padding: 2px; background: linear-gradient(#f7f7f7, #d9d9d9); box-shadow: 0 1px 2px rgba(0,0,0,.45); font-size: 14px; font-weight: 500; text-align: left; line-height: 1.05; }
.ln-app.wide { grid-column: span 2; }
.ln-app .ic { width: 36px; height: 36px; border-radius: 3px; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700; flex: 0 0 auto; }
.ln-app.dis { opacity: .35; }
.ln-foot { height: 22px; display: flex; justify-content: center; align-items: center; gap: 3px; }
.ln-foot i { width: 16px; height: 4px; background: #3b6fb6; border-radius: 2px; }
.ln-foot i + i { background: #ccc; }

.screen-off { position: absolute; inset: 0; background: #0d0d0d; z-index: 40; }
.screen-off[hidden] { display: none; }

/* ---------- icon bar ---------- */
.iconbar { position: absolute; left: 59px; top: 627px; width: 355px; height: 44px; display: flex; justify-content: space-between; }
.ib { width: 50px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #d8d8d8; }
.ib span { font-family: Arial, Helvetica, sans-serif; font-size: 11px; letter-spacing: 0.2px; color: #cfcfcf; }
.ib svg { width: 19px; height: 19px; }
.ib-main { font-family: 'Times New Roman', serif; font-size: 20px; color: #fff; font-weight: 400; line-height: 19px; }
.ib-main i { font-size: 19px; }
.ib:active svg, .ib:active .ib-main { opacity: .55; }

/* ---------- nav + hardware keys ---------- */
.hk { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 14px; color: #fff; font-family: 'Arial Rounded MT Bold', 'Varela Round', Arial, sans-serif; font-weight: 700; }
.hk-nav { width: 89px; height: 27px; background: var(--key-dark); font-size: 13px; letter-spacing: 0.4px; color: #e6e6e6; }
#kKeyboard { left: 58px; top: 709px; }
#kShift { left: 58px; top: 755px; color: var(--cyan); }
#kShift.on { background: #7a7a7a; box-shadow: inset 0 0 0 1.5px var(--cyan); }
#kBs { left: 327px; top: 709px; }
.hk-clear { left: 327px; top: 755px; gap: 7px; }
.hk:active, .hk.pressed { filter: brightness(1.35); }
.dpad { position: absolute; left: 161px; top: 702px; width: 152px; height: 87px; border-radius: 34px / 40px; border: 3px solid var(--blue); background: #22262c; }
.dp { position: absolute; display: grid; place-items: center; }
.dp:active { background: rgba(255,255,255,.12); }
.dp-up { left: 40px; right: 40px; top: 0; height: 30px; border-radius: 20px 20px 0 0; }
.dp-down { left: 40px; right: 40px; bottom: 0; height: 30px; border-radius: 0 0 20px 20px; }
.dp-left { left: 0; top: 18px; bottom: 18px; width: 40px; border-radius: 30px 0 0 30px; }
.dp-right { right: 0; top: 18px; bottom: 18px; width: 40px; border-radius: 0 30px 30px 0; }
.dp-up svg, .dp-down svg { width: 10px; height: 8px; }
.dp-left svg, .dp-right svg { width: 8px; height: 10px; }
.dp-center { position: absolute; left: 39px; right: 39px; top: 36px; height: 13px; border-radius: 3px; background: #3e3e3e; pointer-events: none; }

.keys { position: absolute; inset: 0; pointer-events: none; }
.key { position: absolute; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; pointer-events: auto;
  background: var(--key-dark); color: #f2f2f2; font-family: 'Arial Rounded MT Bold', 'Varela Round', Arial, sans-serif; font-weight: 700; font-size: 19px; }
.key.white { background: linear-gradient(#ffffff, #e9ebee); color: #1d2026; font-size: 20px; }
.key.exe { background: var(--exe); color: #fff; font-size: 15px; letter-spacing: 1px; }
.key.small { font-size: 14px; letter-spacing: 0.6px; }
.key.var { font-family: 'Times New Roman', serif; font-style: italic; font-size: 21px; font-weight: 400; }
.key:active, .key.pressed { filter: brightness(0.82); }
.key.dark:active, .key.dark.pressed { filter: brightness(1.3); }

/* app-bar sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.sheet[hidden] { display: none; }
.sheet-card { background: #fff; border-radius: 12px; max-width: 420px; width: 100%; padding: 18px 18px 12px; font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; font-size: 14px; color: #222; line-height: 1.45; user-select: text; -webkit-user-select: text; }
.sheet-card h2 { font-size: 17px; margin: 0 0 8px; }
.sheet-card ul { padding-left: 18px; margin: 6px 0; }
.sheet-card .close { display: block; margin: 12px 0 0 auto; padding: 7px 16px; border-radius: 8px; background: #1f7cf2; color: #fff; font-weight: 600; }
.wish label { display: block; font-weight: 600; margin: 10px 0 4px; }
.wish label span { font-weight: 400; color: #777; }
.wish textarea { width: 100%; font: inherit; font-size: 15px; padding: 8px; border: 1px solid #c8c8c8; border-radius: 8px; resize: vertical; }
.wish textarea:focus { outline: 2px solid #1f7cf2; border-color: transparent; }
.wish .hint { font-size: 12px; color: #777; margin: 8px 0 0; }
.wish .send { display: block; margin: 12px 0 0 auto; padding: 7px 16px; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 600; }
.wish .send:disabled { opacity: .5; cursor: default; }
.wish .msg { margin: 8px 0 0; font-weight: 600; }
.wish .msg.err { color: #c00; }
