/* Velotecla · Teclado virtual. El dedo se indica con una franja fina bajo cada tecla. */

.kb-area { margin-top: 40px; }
.kb-area[hidden] { display: none; }

.kb {
  display: grid;
  gap: 5px;
  max-width: 740px;
  margin: 0 auto 14px;
}
.kb__row { display: flex; gap: 5px; }

.key {
  --fc: transparent;
  position: relative;
  flex: 1 0 0;
  min-width: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--fc), inset 0 0 0 1px var(--line);
  transition: background-color .12s, color .12s, transform .08s;
}
.key[data-f="p"] { --fc: color-mix(in srgb, var(--f-pinky) 70%, transparent); }
.key[data-f="r"] { --fc: color-mix(in srgb, var(--f-ring) 70%, transparent); }
.key[data-f="m"] { --fc: color-mix(in srgb, var(--f-middle) 70%, transparent); }
.key[data-f="i"] { --fc: color-mix(in srgb, var(--f-index) 70%, transparent); }
.key[data-f="t"] { --fc: color-mix(in srgb, var(--f-thumb) 70%, transparent); }
.key[data-f="x"] {
  justify-content: flex-start;
  padding-left: 9px;
  font-family: var(--font-ui);
  font-size: 0.625rem;
  color: var(--pending);
  background: transparent;
}

.key__shift {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 0.5625rem;
  color: var(--pending);
}

/* Relieve de F y J */
.key.is-home::after {
  content: "";
  position: absolute;
  bottom: 7px;
  left: 50%;
  width: 8px;
  height: 1.5px;
  margin-left: -4px;
  border-radius: 1px;
  background: currentColor;
  opacity: .6;
}

/* Siguiente tecla a pulsar */
.key.is-next {
  background: var(--accent);
  color: var(--bg);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--bg) 25%, transparent);
}
.key.is-next .key__shift { color: color-mix(in srgb, var(--bg) 70%, transparent); }

/* Pulsación */
.key.is-pressed { transform: translateY(1px); color: var(--text); background: var(--surface-2); }
.key.is-pressed.is-next { background: var(--accent); color: var(--bg); }
.key.is-pressed::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1.5px var(--accent);
  animation: key-ripple .38s ease-out forwards;
  pointer-events: none;
}
.key.is-wrong::before { box-shadow: 0 0 0 1.5px var(--error); }
@keyframes key-ripple {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.14); }
}

.kb-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  font-size: 0.75rem;
  color: var(--muted);
}
.dot { display: inline-block; width: 12px; height: 3px; margin-right: 6px; border-radius: 2px; vertical-align: middle; }
.dot--pinky { background: var(--f-pinky); }
.dot--ring { background: var(--f-ring); }
.dot--middle { background: var(--f-middle); }
.dot--index { background: var(--f-index); }
.dot--thumb { background: var(--f-thumb); }
.kb-legend .select-wrap { margin-left: 8px; padding-left: 18px; border-left: 1px solid var(--line); }
.kb-legend .select-wrap select { font-size: 0.75rem; }

/* ---------- Manos guía (apoyadas sobre el teclado) ---------- */
.hands {
  /* Tono de piel (cálido y neutro) */
  --skin-light: #e9bf9c;
  --skin-dark: #c78f68;
  --skin-line: #7a4a2e;
  --skin-crease: #a46d4c;
  --nail: #f6d9c8;
  position: relative;
  max-width: 740px;
  margin: -14px auto 6px;
  pointer-events: none;
}
.hands svg { position: absolute; left: 0; display: block; overflow: visible; z-index: 2; }
/* Casi opacas, como manos reales; la yema apoya bajo la letra para no taparla */
.hands__rest, .hands__act { opacity: .92; transition: opacity .2s; }
/* Cuando un dedo debe pulsar, el resto de la mano se vuelve translúcida: se ven las teclas */
.has-active .hands__rest { opacity: .62; }
.has-active .hands__act { opacity: 1; }
.hands__line { fill: none; stroke: var(--skin-line); stroke-width: 2.4; stroke-linejoin: round; }
.hands__crease { fill: none; stroke: var(--skin-crease); stroke-width: 1.2; stroke-linecap: round; opacity: .75; }
.hands__nail { fill: var(--nail); stroke: color-mix(in srgb, var(--skin-crease) 60%, transparent); stroke-width: .8; }
/* Dedo que debe pulsar: contorno y brillo con el color de ese dedo */
.hands__ring { fill: none; stroke: transparent; stroke-width: 3; transition: stroke .12s; }
.hands__ring.is-active {
  stroke: var(--fcol);
  fill: color-mix(in srgb, var(--fcol) 22%, transparent);
  filter: drop-shadow(0 0 7px var(--fcol));
}

/* Frase "índice izquierdo → F" */
.hands-hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  margin: 0 0 10px;
  font-size: 0.875rem;
  color: var(--text);
}
.hands-hint .dot { margin-right: 2px; }
.hands-hint kbd { margin-left: 2px; }

/* ---------- Tipo de teclado: cápsula visible junto a la leyenda ---------- */
.kb-legend__fingers { display: inline-flex; flex-wrap: wrap; gap: 8px 18px; }
.kb-layout {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: box-shadow .2s;
}
.kb-layout:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.kb-layout .icon { width: 16px; height: 16px; color: var(--accent); }
.kb-layout select {
  appearance: none;
  padding-right: 16px;
  border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") right center / 8px no-repeat;
  color: inherit;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.kb-layout select:focus-visible { outline: none; }
.kb-layout:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.kb-layout select option { background: var(--surface); color: var(--text); }

/* Alto contraste de Windows: la siguiente tecla sigue destacada */
@media (forced-colors: active) {
  .key { border: 1px solid CanvasText; }
  .key.is-next { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
