/* teclado_mq.css — teclado matemático propio (modo emergente), ver
   static/js/teclado_mq.js y temas/teclas_mq.py. Prefijo hlc- para no
   chocar con el resto. Solo disposición y color con los tokens de app.css. */

:root {
  --hlc-tec-alto-tecla: 52px;
  --hlc-tec-gap: 3px;
  --hlc-tec-gap-filas: 4px;
  --hlc-tec-max: 560px;
  --hlc-tec-z: 40;
}

.hlc-tec { display: none; }

html.hlc-tec-on .hlc-tec {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--hlc-tec-z);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 6px max(3px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(3px, env(safe-area-inset-left, 0px));
  transform: translateY(105%);
  transition: transform .14s ease-out;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
html.hlc-tec-on .hlc-tec.hlc-tec-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html.hlc-tec-on .hlc-tec { transition: none; }
}

.hlc-tec-filas {
  display: grid;
  gap: var(--hlc-tec-gap-filas);
  max-width: var(--hlc-tec-max);
  margin: 0 auto;
}
/* Modo inputs planos (dígitos, −, /, ⌫, ⌨): 5 columnas, teclas anchas. */
.hlc-tec-filas[data-cols="5"] { max-width: 380px; }
.hlc-tec-fila {
  display: grid;
  grid-template-columns: repeat(var(--hlc-tec-cols, 10), minmax(0, 1fr));
  gap: var(--hlc-tec-gap);
}

.hlc-tecla {
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  height: var(--hlc-tec-alto-tecla);
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}
.hlc-tecla-op { background: color-mix(in srgb, var(--surface-2) 55%, var(--bg)); }
.hlc-tecla:active { background: color-mix(in srgb, var(--accent) 35%, var(--surface-2)); }
.hlc-tecla-txt { font-size: .85rem; letter-spacing: -.01em; }
.hlc-tecla[data-k="arctg"] { font-size: .66rem; }
.hlc-tecla sup { font-size: .6em; vertical-align: .5em; line-height: 0; }
.hlc-tecla .icono-frac { font-size: 1rem; }

/* Con el teclado propio vigente sobran los botones por campo. */
html.hlc-tec-on .campo-math-botones { display: none; }

/* El panel tapa el borde inferior: reservar su alto (lo mide el JS). */
html.hlc-tec-vis { scroll-padding-bottom: var(--hlc-tec-alto, 0px); }
html.hlc-tec-vis body .area { padding-bottom: calc(var(--hlc-tec-alto, 0px) + 24px); }

/* Botón flotante para volver al teclado propio (solo táctil, si se apagó). */
.hlc-tec-reactivar { display: none; }
html.hlc-tec-reactivable .hlc-tec-reactivar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: var(--hlc-tec-z);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}
