/* WideMath TI-36X Pro style calculator (/ti-36x-pro-calculator/).
   An original keypad drawing: the key order and labels follow the handheld,
   the colours and shapes are WideMath's own. Every selector starts with .ti36.
   Sizes come from custom properties that wm-ti36.js sets from the viewport
   (--ti-kh key height, --ti-lcd display height, --ti-w device width), so the
   whole device, display to enter, fits one screen. */

.ti36 { --ti-kh: 40px; --ti-lcd: 120px; --ti-w: 400px; --ti-lab: 13px; --ti-rg: 5px; --ti-cg: 8px; --ti-pad: 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 18px; align-items: start; }
.ti36 .ti36-dev { grid-column: 2; width: var(--ti-w); max-width: 100%; }

/* ---- body ---------------------------------------------------------------- */
.ti36 .ti36-calc { position: relative; box-sizing: border-box; width: 100%; background: linear-gradient(180deg, #e7ecf2 0%, #d5dde7 100%); border: 1px solid #c3ccd8;
  border-radius: 22px 22px 28px 28px; padding: 7px var(--ti-pad) 12px; box-shadow: 0 1px 0 #fff inset, 0 8px 22px rgba(15, 23, 42, .11); outline: none; }
.ti36 .ti36-calc:focus-visible { box-shadow: 0 0 0 2px rgba(22, 163, 74, .45), 0 8px 22px rgba(15, 23, 42, .11); }

/* top strip: model switch on the left, icon toolbar on the right */
.ti36 .ti36-strip { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 32px; margin-bottom: 6px; }
.ti36 .ti36-seg { display: inline-flex; border: 1px solid #b8c2cf; border-radius: 8px; overflow: hidden; background: #f1f5f9; }
.ti36 .ti36-seg button { appearance: none; border: 0; background: transparent; color: #475569; font: 600 .72rem/1 'Segoe UI', system-ui, sans-serif; padding: 0 9px; height: 26px; cursor: pointer; white-space: nowrap; }
.ti36 .ti36-seg button + button { border-left: 1px solid #b8c2cf; }
.ti36 .ti36-seg button[aria-pressed="true"] { background: #15803d; color: #fff; }
.ti36 .ti36-seg button:not([aria-pressed="true"]):hover { background: #f0fdf4; color: #15803d; }
.ti36 .ti36-tools { display: inline-flex; gap: 2px; }
.ti36 .ti36-ic { appearance: none; border: 0; background: transparent; color: #334155; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.ti36 .ti36-ic svg { width: 18px; height: 18px; }
.ti36 .ti36-ic:hover, .ti36 .ti36-ic[aria-expanded="true"] { background: rgba(21, 128, 61, .12); color: #15803d; }
@media (hover: none), (pointer: coarse) { .ti36 .ic-keyboard { display: none; } }
/* narrow frames (a 320 px embed): the model switch and the icons share one row */
@media (max-width: 379px) {
  .ti36 .ti36-seg button { padding: 0 6px; font-size: .68rem; }
  .ti36 .ti36-ic { width: 26px; }
  .ti36 .ic-keyboard { display: none; }
}
.ti36 .ti36-seg button:focus-visible, .ti36 .ti36-ic:focus-visible, .ti36 .ti36-pi:focus-visible, .ti36 .ti36-keystog:focus-visible { outline: 2px solid #16a34a; outline-offset: 1px; }

/* popovers (Examples, Keyboard) and the copy toast */
.ti36 .ti36-pop { position: absolute; z-index: 20; top: 36px; right: 0; width: min(270px, 100%); max-height: calc(var(--ti-lcd) + 9 * (var(--ti-kh) + var(--ti-lab)) - 10px); overflow-y: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .18); padding: 8px; font: .85rem/1.4 'Segoe UI', system-ui, sans-serif; color: #334155; }
.ti36 .ti36-pt { margin: 2px 6px 6px; font-size: .74rem; font-weight: 600; color: #64748b; }
.ti36 .ti36-pi { display: block; width: 100%; text-align: left; appearance: none; border: 0; background: transparent; border-radius: 8px; padding: 8px 8px; min-height: 36px;
  font: 500 .86rem/1.3 'Segoe UI', system-ui, sans-serif; color: #0f172a; cursor: pointer; }
.ti36 .ti36-pi:hover { background: #f0fdf4; color: #15803d; }
.ti36 .ti36-pop table { width: 100%; border-collapse: collapse; margin: 0; border: 0; font-size: .8rem; }
.ti36 .ti36-pop td { padding: 3px 6px; border: 0; vertical-align: top; }
.ti36 .ti36-pop kbd { font: .74rem 'Segoe UI', system-ui, sans-serif; border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #f8fafc; white-space: nowrap; }
.ti36 .ti36-toast { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); background: #0f172a; color: #fff; font: 600 .74rem/1 'Segoe UI', system-ui, sans-serif;
  padding: 7px 10px; border-radius: 999px; pointer-events: none; opacity: 0; transition: opacity 160ms ease; white-space: nowrap; z-index: 21; }
.ti36 .ti36-toast.on { opacity: 1; }

/* ---- display --------------------------------------------------------------- */
.ti36 .ti36-lcd { background: #dfe8d9; border: 2px solid #8f9aa7; border-radius: 9px; padding: 2px 8px 4px; box-shadow: inset 0 2px 6px rgba(15, 23, 42, .18); margin-bottom: 4px; }
.ti36 .ti36-flags { display: flex; gap: 8px; justify-content: flex-end; height: 14px; font: 700 .6rem/14px 'Segoe UI', system-ui, sans-serif; color: #3f4b3a; letter-spacing: .04em; overflow: hidden; }
.ti36 .ti36-flags .on2 { color: #fff; background: #15803d; border-radius: 3px; padding: 0 4px; margin-right: auto; }
.ti36 .ti36-scr { height: var(--ti-lcd); overflow: hidden; font: 1.08rem/1.5 'Cambria Math', Cambria, 'Times New Roman', serif; color: #17202a; position: relative; }
.ti36 .ti36-scr.v-home { display: flex; flex-direction: column; justify-content: flex-end; }
.ti36 .ti36-scr.v-home > * { flex-shrink: 0; }
.ti36 .ti36-ent, .ti36 .ti36-cur { text-align: left; padding: 1px 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.ti36 .ti36-rl { text-align: right; padding: 0 2px 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.ti36 .ti36-ent .note { float: right; font-size: .8em; color: #485544; }
.ti36 .ti36-ent::-webkit-scrollbar, .ti36 .ti36-rl::-webkit-scrollbar, .ti36 .ti36-cur::-webkit-scrollbar { display: none; }
.ti36 .inv { background: #17202a; color: #dfe8d9; border-radius: 2px; }
.ti36 .inv * { color: inherit; }
.ti36 .mp { display: inline-block; white-space: nowrap; }

/* MathPrint layout */
.ti36 .fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px; font-size: .92em; }
.ti36 .fr > .n { border-bottom: 1.5px solid currentColor; padding: 0 2px 1px; display: block; text-align: center; white-space: nowrap; }
.ti36 .fr > .d { padding: 1px 2px 0; display: block; text-align: center; white-space: nowrap; }
.ti36 .fr.sm { font-size: .78em; }
.ti36 .mx { display: inline-flex; align-items: center; vertical-align: middle; }
.ti36 sup { font-size: .72em; vertical-align: .6em; line-height: 0; }
.ti36 sub { font-size: .7em; vertical-align: -.35em; line-height: 0; }
.ti36 .rt { display: inline-flex; align-items: flex-end; margin: 0 1px; vertical-align: middle; }
.ti36 .rt .rs { font-size: 1.05em; margin-right: -1px; }
.ti36 .rt .rr { border-top: 1.5px solid currentColor; padding: 1px 2px 0 1px; display: block; white-space: nowrap; }
.ti36 .rt .ri { margin-right: -5px; align-self: flex-start; }
.ti36 .ab { border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; padding: 0 3px; margin: 0 2px; display: inline-block; }
.ti36 .big { display: inline-block; white-space: nowrap; }
.ti36 .lims { display: inline-flex; flex-direction: column; align-items: center; font-size: .7em; line-height: 1.05; margin-right: 1px; vertical-align: middle; }
.ti36 .lims .sym { font-size: 1.9em; line-height: .95; }
.ti36 .dd { display: inline-block; white-space: nowrap; }
.ti36 .dd .at { display: inline-block; }
.ti36 .v, .ti36 i { font-style: italic; }
.ti36 .ng { font-size: .78em; vertical-align: .3em; }
.ti36 .op { margin: 0 1px; }
.ti36 .ee { font-size: .78em; margin: 0 1px; }
.ti36 .kw { font-family: 'Segoe UI', system-ui, sans-serif; font-size: .9em; }
.ti36 .ph { font-weight: 700; }
.ti36 .cv, .ti36 .un { font-family: 'Segoe UI', system-ui, sans-serif; font-size: .82em; }
.ti36 .bs { font-size: .78em; }
.ti36 .box { display: inline-block; min-width: .62em; height: .95em; border: 1px dashed #5b6b57; vertical-align: middle; margin: 0 1px; position: relative; }
.ti36 .box.on { border-color: #17202a; }
.ti36 .c { display: inline-block; width: 2px; height: 1.05em; background: #17202a; vertical-align: middle; margin: 0 -1px; animation: ti36-blink 1s steps(1) infinite; }
.ti36 .c.ins { height: 3px; width: .55em; vertical-align: -.15em; margin: 0; }
.ti36 .box .c { position: absolute; left: 0; top: 0; height: 100%; margin: 0; }
.ti36 .blk { background: #17202a; color: #dfe8d9; animation: ti36-blk 1s steps(1) infinite; }
@keyframes ti36-blink { 50% { opacity: 0; } }
@keyframes ti36-blk { 50% { background: transparent; color: inherit; } }
@media (prefers-reduced-motion: reduce) { .ti36 .c, .ti36 .blk { animation: none; } .ti36 .ti36-toast { transition: none; } }

/* menus, mode screen, solver screens */
.ti36 .ti36-scr.v-menu, .ti36 .ti36-scr.v-mode, .ti36 .ti36-scr.v-lines, .ti36 .ti36-scr.v-err { font: 600 .88rem/1.55 'Segoe UI', system-ui, sans-serif; overflow-y: auto; scrollbar-width: none; }
.ti36 .ti36-scr.v-lines .ti36-ln { font-family: 'Cambria Math', Cambria, serif; font-size: 1.02rem; font-weight: 400; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.ti36 .ti36-ln.act::before { content: '\25B8'; font-size: .8em; margin-right: 3px; }
.ti36 .ti36-scr.v-lines .fr { font-size: .84em; }
.ti36 .ti36-mhead { display: flex; gap: 10px; margin-bottom: 1px; }
.ti36 .ti36-mhead span { padding: 0 4px; }
.ti36 .ti36-mi { padding: 0 4px; line-height: 24px; }
.ti36 .ti36-more { position: absolute; right: 4px; bottom: 0; font-size: .7rem; }
.ti36 .ti36-mrow { display: flex; flex-wrap: wrap; gap: 1px 7px; }
.ti36 .ti36-mrow span { padding: 0 3px; }
.ti36 .ti36-mrow .cur { outline: 1.5px solid #17202a; animation: ti36-blink 1s steps(1) infinite; }
.ti36 .ti36-mrow .inv.cur { outline-color: #15803d; }
.ti36 .opt { padding: 0 3px; }
.ti36 .opt.on { background: #17202a; color: #dfe8d9; border-radius: 2px; }
.ti36 .ti36-foot { display: flex; gap: 12px; margin-top: 3px; font: 700 .76rem/1.6 'Segoe UI', system-ui, sans-serif; }
.ti36 .ti36-foot span { padding: 0 4px; }
.ti36 .tc { display: inline-block; min-width: 33%; padding-right: 6px; }
.ti36 .tc.on { background: #17202a; color: #dfe8d9; }
.ti36 .cell { display: inline-flex; min-width: 1.4em; justify-content: flex-end; border-bottom: 1px dotted #5b6b57; margin: 0 2px; }
.ti36 .cell.act { border-bottom: 2px solid #17202a; }
.ti36 .hint { font: 400 .76rem/1.4 'Segoe UI', system-ui, sans-serif; color: #485544; }
.ti36 .ti36-errs { display: flex; flex-direction: column; gap: 3px; }
.ti36 .ti36-errs b { font-size: .98rem; }
.ti36 .ti36-errs span { font-weight: 400; font-size: .82rem; line-height: 1.35; }

/* ---- keypad ------------------------------------------------------------------- */
.ti36 .ti36-pad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: var(--ti-cg); row-gap: var(--ti-rg); position: relative; }
/* the 2nd label sits above the key face inside the button, so tapping it presses the key */
.ti36 .tk { position: relative; appearance: none; border: 0; border-radius: 9px; height: var(--ti-kh); margin-top: var(--ti-lab); padding: 0 2px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font: 600 .9rem/1.1 'Segoe UI', system-ui, sans-serif; color: #fff; background: #334155; box-shadow: 0 2px 0 #1e293b, 0 3px 6px rgba(15, 23, 42, .18);
  transition: transform 60ms ease, box-shadow 60ms ease, background 120ms ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ti36 .tk .s2 { position: absolute; top: calc(-1 * var(--ti-lab)); left: 50%; transform: translateX(-50%); height: var(--ti-lab); display: flex; align-items: center;
  font: 600 .6rem/1 'Segoe UI', system-ui, sans-serif; color: #15803d; white-space: nowrap; letter-spacing: -.01em; }
.ti36 .tk .p { display: inline-block; white-space: nowrap; }
.ti36 .tk .p small { font-size: .62rem; font-weight: 600; opacity: .8; margin-left: 2px; }
.ti36 .tk .p sup { color: inherit; font-size: .66em; vertical-align: .55em; }
.ti36 .tk .p i { font-family: 'Cambria Math', Cambria, serif; }
.ti36 .tk .nd { display: inline-flex; flex-direction: column; align-items: center; font-size: .66rem; line-height: 1; vertical-align: middle; }
.ti36 .tk .nd span:first-child { border-bottom: 1px solid currentColor; padding: 0 1px; }
.ti36 .tk:hover { background: #475569; }
.ti36 .tk:active, .ti36 .tk.hit { transform: translateY(2px); box-shadow: 0 0 0 #1e293b, 0 1px 2px rgba(15, 23, 42, .2); }
.ti36 .tk:focus-visible, .ti36 .dk:focus-visible { outline: 2px solid #16a34a; outline-offset: 2px; }
.ti36 .kdig { background: #f8fafc; color: #0f172a; font-size: 1.1rem; box-shadow: 0 2px 0 #94a3b8, 0 3px 6px rgba(15, 23, 42, .12); }
.ti36 .kdig:hover { background: #fff; }
.ti36 .kop { background: #64748b; font-size: 1.15rem; }
.ti36 .kop:hover { background: #75839a; }
.ti36 .k2 { background: #15803d; box-shadow: 0 2px 0 #14532d, 0 3px 6px rgba(15, 23, 42, .18); }
.ti36 .k2:hover { background: #16a34a; }
.ti36.sec .k2 { background: #22c55e; color: #052e16; }
.ti36.sec .tk .s2 { color: #fff; background: #15803d; border-radius: 3px; padding: 0 3px; }
.ti36 .kent { background: #0f172a; }
.ti36 .kclr { background: #475569; }

/* arrow pad: columns 4-5, rows 1-2 */
.ti36 .ti36-dpad { grid-column: 4 / span 2; grid-row: 1 / span 2; position: relative; margin: var(--ti-lab) 6px 0; height: calc(2 * var(--ti-kh) + var(--ti-lab) + var(--ti-rg)); border-radius: 50%;
  background: radial-gradient(circle at 50% 47%, #f1f5f9 0 21%, #cbd5e1 22% 100%); box-shadow: 0 2px 0 #94a3b8, 0 4px 10px rgba(15, 23, 42, .15); }
.ti36 .dk { position: absolute; appearance: none; border: 0; background: transparent; color: #1e293b; font-size: .8rem; cursor: pointer; width: 46px;
  height: min(42px, calc(var(--ti-kh) + var(--ti-lab) / 2)); border-radius: 10px; touch-action: manipulation; }
.ti36 .dk:hover { background: rgba(21, 128, 61, .14); }
.ti36 .dk.hit, .ti36 .dk:active { background: rgba(21, 128, 61, .3); }
.ti36 .dk.up { top: 0; left: 50%; transform: translateX(-50%); }
.ti36 .dk.down { bottom: 0; left: 50%; transform: translateX(-50%); }
.ti36 .dk.left { left: 0; top: 50%; transform: translateY(-50%); }
.ti36 .dk.right { right: 0; top: 50%; transform: translateY(-50%); }

/* ---- keys tape: beside the device on desktop, behind a toggle on phones ---------- */
.ti36 .ti36-tape { grid-column: 3; justify-self: start; width: min(210px, 100%); margin-top: 6px; }
.ti36 .ti36-tapeh { margin: 0 0 6px 2px; font: 600 .74rem/1.2 'Segoe UI', system-ui, sans-serif; color: #64748b; }
.ti36 .ti36-chips { max-height: var(--ti-tape-h, 560px); overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px;
  padding: 8px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; scrollbar-width: thin; }
.ti36 .ti36-chips .ch { font: 600 .74rem/1 'Segoe UI', system-ui, sans-serif; padding: 5px 6px; border-radius: 6px; background: #334155; color: #fff; }
.ti36 .ti36-chips .ch.c2 { background: #15803d; }
.ti36 .ti36-chips .ch.cs { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.ti36 .ti36-chips .none { color: #94a3b8; font: .8rem/1.4 'Segoe UI', system-ui, sans-serif; }
.ti36 .ti36-keystog { display: none; }
.ti36.ti36-embed .ti36-tape, .ti36.ti36-embed .ti36-keystog, .ti36.ti36-embed .ic-keyboard { display: none; }

/* phones and narrow windows: the device takes the full width, the tape hides behind a toggle.
   A media query, not a class, so the layout is right before any script runs (a rotated phone
   never sees a too-wide layout and zooms out). */
@media (max-width: 759px) {
  .ti36 { --ti-lab: 12px; --ti-rg: 4px; --ti-cg: 6px; --ti-pad: 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .ti36 .ti36-ic { width: 36px; height: 34px; }
  .ti36 .ti36-keystog { display: block; width: 100%; margin-top: 6px; appearance: none; border: 1px solid #e2e8f0; background: #fff; border-radius: 10px; min-height: 40px;
    font: 600 .84rem/1 'Segoe UI', system-ui, sans-serif; color: #334155; cursor: pointer; }
  .ti36 .ti36-tape { display: none; width: auto; margin: 0; }
  .ti36 .ti36-tapeh { display: none; }
  .ti36.tape-open .ti36-tape { display: block; }
  .ti36 .ti36-chips { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .ti36 .ti36-chips .ch { flex: none; }
}
@media print { .ti36 .ti36-pad, .ti36 .ti36-tools, .ti36 .ti36-seg, .ti36 .ti36-tape, .ti36 .ti36-keystog { display: none; } }
