/* ============================================================
   KEYBOARD HEATMAP — keyboard-heatmap.css
   Monkey-Type.in
   ============================================================ */

/* ── Outer wrapper (sits below the WPM chart) ─────────────── */
#heatmap-wrap {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #E0E0F0);
  position: relative;
}

/* ── Header row ────────────────────────────────────────────── */
#heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#heatmap-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text, #0F0E2B);
  letter-spacing: 0.01em;
}

#heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.73rem;
  color: var(--text-muted, #6B6A8A);
  font-weight: 500;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── SVG keyboard ──────────────────────────────────────────── */
#heatmap-svg {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

/* ── Tooltip ───────────────────────────────────────────────── */
#heatmap-tooltip {
  position: absolute;
  background: #1a1a2e;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  line-height: 1.5;
  font-family: var(--font-ui, 'Inter', sans-serif);
}

#heatmap-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: #1a1a2e transparent transparent;
}

/* ── Perfect run message ───────────────────────────────────── */
#heatmap-perfect {
  text-align: center;
  color: var(--correct, #10B981);
  font-size: 0.88rem;
  padding: 0.75rem;
  background: rgba(16,185,129,0.07);
  border-radius: 10px;
  margin-top: 0.75rem;
}

/* ── Mobile: shrink a bit ──────────────────────────────────── */
@media (max-width: 520px) {
  #heatmap-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #heatmap-legend {
    font-size: 0.68rem;
  }

  #heatmap-svg {
    max-width: 100%;
  }
}
