.keypad-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 18px; max-width: 880px; margin-top: 26px; align-items: stretch; }
.keypad { padding: 16px; display: grid; gap: 14px; align-content: start; }
.keypad:focus, .keypad:focus-visible { outline: none; }
.keypad-display { min-width: 0; padding: 12px 14px 10px; border-radius: 12px; background: var(--result-bg); color: var(--result-text); display: grid; gap: 2px; }
.keypad-top { display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 14px; color: var(--result-muted); font-variant-numeric: tabular-nums; }
.keypad-memory { font-weight: 700; color: var(--accent); }
.keypad-expr { margin-left: auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.keypad-main { display: flex; align-items: center; gap: 4px; min-width: 0; }
.keypad-value { flex: 1; min-width: 0; text-align: right; font-family: var(--font-heading); font-weight: 700; font-size: 42px; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.keypad-value[data-size="m"] { font-size: 33px; }
.keypad-value[data-size="s"] { font-size: 27px; }
.keypad-value[data-size="error"] { font-size: 21px; line-height: 1.3; white-space: normal; padding: 6px 0; }
.keypad-back { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--result-muted); cursor: pointer; }
.keypad-back svg { width: 26px; height: 26px; }
.keypad-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.key { min-width: 0; min-height: 58px; padding: 0 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 23px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: transform .08s; }
.key:active, .key.is-pressed { transform: scale(.95); }
.key-fn { background: var(--chip-const); font-size: 17px; }
.key-op { background: var(--chip); color: var(--chip-text); border-color: transparent; font-size: 27px; }
.key-eq { background: var(--accent); color: var(--accent-text); border-color: transparent; font-size: 27px; }
.keypad-noscript { color: var(--error); font-size: 14px; }
.keypad-tape { min-width: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.tape-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; }
.tape-title { font-size: 18px; }
.tape-clear { min-height: 34px; padding: 0 12px; font-size: 14px; }
.tape-list { flex: 1; min-height: 0; max-height: 400px; margin: 0; padding: 0; list-style: none; overflow-y: auto; font-variant-numeric: tabular-nums; }
.tape-list li { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 0 6px; padding: 7px 0; border-bottom: 1px dashed var(--border); text-align: right; }
.tape-expr { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.tape-result { margin-right: -6px; padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 17px; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; }
.keypad-note, .tool-widget { margin-top: 14px; }
.keypad-shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 28px; margin: 0; }
.keypad-shortcuts div { display: flex; align-items: baseline; gap: 12px; }
.keypad-shortcuts dt { flex: none; min-width: 96px; }
.keypad-shortcuts dd { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.keypad-shortcuts kbd { display: inline-block; min-width: 26px; margin-right: 2px; padding: 0 7px; border: 1px solid var(--field-border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font: 600 14px/1.6 var(--font); text-align: center; }
@media (hover: hover) {
  .key:hover { border-color: var(--field-border); }
  .keypad-back:hover { color: var(--result-text); }
  .tape-result:hover { background: var(--surface-2); }
}
@media (max-width: 760px) {
  .keypad-layout { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
  .tape-list { max-height: 260px; }
}
@media (max-width: 420px) {
  .keypad { padding: 10px; gap: 10px; }
  .keypad-keys { gap: 6px; }
  .key { min-height: 54px; font-size: 21px; }
  .key-fn { font-size: 15px; }
  .keypad-value { font-size: 36px; }
  .keypad-value[data-size="m"] { font-size: 28px; }
  .keypad-value[data-size="s"] { font-size: 23px; }
}
