/* css/keyboard.css
   Virtual keyboard monitor + key heatmap + top keys highlight
*/

/* ===== Grid ===== */
.kbd-grid{
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
  margin-top: 8px;
  user-select: none;
}

/* ===== Keys ===== */
.kbd-key{
  position: relative;
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 11px;

  border: 1px solid rgba(0,255,140,.22);
  background: rgba(0,255,140,.06);
  color: rgba(200,255,230,.9);
  box-shadow: inset 0 0 0 1px rgba(0,255,140,.06);
}

.kbd-key.dim{
  opacity: .4;
  border-style: dashed;
}

/* ===== Immediate bad key flash ===== */
.kbd-key.bad{
  border-color: rgba(255,70,110,.9);
  background: rgba(255,70,110,.18);
  color: #ffd6df;
  box-shadow:
    0 0 10px rgba(255,70,110,.65),
    inset 0 0 0 1px rgba(255,70,110,.45);
  animation: badKeyFlash .35s linear 1;
}

@keyframes badKeyFlash{
  0%   { transform: scale(1); }
  30%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ===== Heatmap levels (cumulative) ===== */
.kbd-key.heat1{ border-color: rgba(255,120,150,.45); background: rgba(255,70,110,.08); }
.kbd-key.heat2{ border-color: rgba(255,100,140,.55); background: rgba(255,70,110,.12); }
.kbd-key.heat3{ border-color: rgba(255,90,130,.70);  background: rgba(255,70,110,.18); box-shadow: 0 0 10px rgba(255,70,110,.25); }
.kbd-key.heat4{ border-color: rgba(255,80,120,.85);  background: rgba(255,70,110,.26); box-shadow: 0 0 16px rgba(255,70,110,.45); }
.kbd-key.heat5{ border-color: rgba(255,70,110,.98);  background: rgba(255,70,110,.34); box-shadow: 0 0 22px rgba(255,70,110,.65); }

/* ===== Heat badge ===== */
.kbd-key .heat-badge{
  position:absolute;
  top:-7px; right:-7px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display:none;
  align-items:center;
  justify-content:center;
  font-size: 10px;
  line-height: 18px;
  border: 1px solid rgba(255,70,110,.55);
  background: rgba(40,0,10,.75);
  color: rgba(255,220,230,.95);
}

.kbd-key.has-heat .heat-badge{
  display:inline-flex;
}

/* ===== Top keys highlight (after finish) ===== */
@keyframes topPulse {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-1px); filter: brightness(1.25); }
}
.kbd-key.topkey{
  outline: 2px solid rgba(255,70,110,.55);
  outline-offset: 1px;
  animation: topPulse .45s linear infinite;
}
