/* TI-30XS-style practice calculator (first-party; added Nov 21, 2026) */
.calc-open-btn {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.3rem 0.7rem;
  min-height: 36px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #e8eef4);
  background: var(--accent-soft, rgba(255, 107, 26, 0.15));
  border: 1px solid var(--accent, #ff6b1a);
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
}
.calc-open-btn:hover, .calc-open-btn[aria-expanded="true"] { background: var(--accent-dim, #c44f0f); }
.calc-open-btn:focus-visible, .calc-key:focus-visible, .calc-close:focus-visible, .calc-angle:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 2px;
}
.calc-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--bg-card, #232d3a);
  color: var(--text, #e8eef4);
  border: 1px solid var(--border, #2e3a4a);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}
.calc-panel[hidden] { display: none; }
.calc-panel:focus { outline: none; }
.calc-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.calc-title { flex: 1; margin: 0; font-size: 0.95rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.calc-angle, .calc-close {
  min-width: 44px; min-height: 44px;
  font: inherit; font-weight: 700;
  color: var(--text, #e8eef4);
  background: var(--bg-elevated, #1a222c);
  border: 1px solid var(--border, #2e3a4a);
  border-radius: 8px;
  cursor: pointer;
}
.calc-display {
  background: #0b1016;
  border: 1px solid var(--border, #2e3a4a);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.6rem;
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  text-align: right;
}
.calc-expr { min-height: 1.4em; font-size: 1rem; color: var(--text-muted, #9aabbc); overflow-wrap: anywhere; }
.calc-result { min-height: 1.5em; font-size: 1.5rem; font-weight: 700; overflow-wrap: anywhere; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.calc-key {
  min-height: 46px;
  font: inherit; font-size: 1.05rem; font-weight: 600;
  color: var(--text, #e8eef4);
  background: var(--bg-elevated, #1a222c);
  border: 1px solid var(--border, #2e3a4a);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.calc-key:active { transform: translateY(1px); }
.calc-key--op { background: #2b3a4d; }
.calc-key--fn { background: #33291f; }
.calc-key--eq { grid-column: 1 / -1; background: var(--accent-dim, #c44f0f); border-color: var(--accent, #ff6b1a); }
.calc-note { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--text-muted, #9aabbc); }
.calc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) {
  .calc-panel {
    left: 0; right: 0; bottom: 0;
    width: auto; max-width: none;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    padding: 0.6rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }
  .calc-key { min-height: 48px; font-size: 1.1rem; }
  html.calc-open body { padding-bottom: 85vh; }
}
