/* ============================================
   SYNTHWAVE TYPER — Virtual Keyboard
   On-screen keyboard with finger color coding,
   key states, and visual feedback
   ============================================ */

/* ── Keyboard Container ── */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-lg);
  background: rgba(10, 10, 26, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.keyboard-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

/* ── Individual Key ── */
.key {
  width: var(--keyboard-key-size);
  height: var(--keyboard-key-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  position: relative;
  text-transform: uppercase;
  user-select: none;
  flex-shrink: 0;
}

/* Key hover effect */
.key:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: var(--bg-surface-light);
}

/* ── Finger Color Coding ── */
.key[data-finger="pinky-l"]  { border-bottom: 3px solid var(--finger-pinky-l); }
.key[data-finger="ring-l"]   { border-bottom: 3px solid var(--finger-ring-l); }
.key[data-finger="middle-l"] { border-bottom: 3px solid var(--finger-middle-l); }
.key[data-finger="index-l"]  { border-bottom: 3px solid var(--finger-index-l); }
.key[data-finger="thumb"]    { border-bottom: 3px solid var(--finger-thumb); }
.key[data-finger="index-r"]  { border-bottom: 3px solid var(--finger-index-r); }
.key[data-finger="middle-r"] { border-bottom: 3px solid var(--finger-middle-r); }
.key[data-finger="ring-r"]   { border-bottom: 3px solid var(--finger-ring-r); }
.key[data-finger="pinky-r"]  { border-bottom: 3px solid var(--finger-pinky-r); }

/* ── Key States ── */
/* Highlighted (next key to press) */
.key.highlight {
  background: var(--neon-cyan);
  color: var(--bg-dark);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px var(--neon-cyan-glow), 0 0 30px rgba(0, 240, 255, 0.2);
  animation: glowBorder 2s ease-in-out infinite;
  font-weight: 700;
  transform: scale(1.08);
  z-index: 2;
}

/* Correct keypress */
.key.correct {
  animation: keyCorrect 0.5s ease forwards;
}

/* Wrong keypress */
.key.wrong {
  animation: keyWrong 0.4s ease forwards;
}

/* Pressed state */
.key.pressed {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.3);
}

/* Home row indicators */
.key.home-key::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
}

.key.home-key.highlight::after {
  background: var(--bg-dark);
}

/* ── Special Keys ── */
.key--space {
  width: 280px;
  font-size: var(--fs-xs);
  letter-spacing: 3px;
}

.key--tab,
.key--caps {
  width: 68px;
  font-size: var(--fs-xs);
}

.key--shift {
  width: 90px;
  font-size: var(--fs-xs);
}

.key--shift-r {
  width: 110px;
}

.key--backspace {
  width: 80px;
  font-size: var(--fs-xs);
}

.key--enter {
  width: 90px;
  font-size: var(--fs-xs);
}

/* ── Finger Guide (hand diagram) ── */
.finger-guide {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-md) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.finger-guide__hand {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.finger-guide__finger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.finger-guide__dot {
  width: 14px;
  height: 24px;
  border-radius: 7px;
  transition: all var(--transition-base);
  opacity: 0.4;
}

.finger-guide__dot.active {
  opacity: 1;
  transform: scaleY(1.2);
  box-shadow: 0 0 10px currentColor;
}

.finger-guide__label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Left hand finger colors */
.finger-guide__hand--left .finger-guide__dot:nth-child(1) { background: var(--finger-pinky-l); color: var(--finger-pinky-l); }
.finger-guide__hand--left .finger-guide__dot:nth-child(2) { background: var(--finger-ring-l); color: var(--finger-ring-l); }
.finger-guide__hand--left .finger-guide__dot:nth-child(3) { background: var(--finger-middle-l); color: var(--finger-middle-l); }
.finger-guide__hand--left .finger-guide__dot:nth-child(4) { background: var(--finger-index-l); color: var(--finger-index-l); }

/* Right hand finger colors */
.finger-guide__hand--right .finger-guide__dot:nth-child(1) { background: var(--finger-index-r); color: var(--finger-index-r); }
.finger-guide__hand--right .finger-guide__dot:nth-child(2) { background: var(--finger-middle-r); color: var(--finger-middle-r); }
.finger-guide__hand--right .finger-guide__dot:nth-child(3) { background: var(--finger-ring-r); color: var(--finger-ring-r); }
.finger-guide__hand--right .finger-guide__dot:nth-child(4) { background: var(--finger-pinky-r); color: var(--finger-pinky-r); }

/* ── Lesson Typing Area (above keyboard) ── */
.typing-area {
  text-align: center;
  padding: var(--space-xl);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: rgba(10, 10, 26, 0.88);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 240, 255, 0.12);
  backdrop-filter: blur(12px);
}

.typing-area__prompt {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: var(--space-md);
}

.typing-area__text {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  letter-spacing: 8px;
  line-height: 2;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

.typing-area__char {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s ease;
  position: relative;
}

.typing-area__char.current {
  color: var(--neon-cyan);
  text-shadow: var(--glow-text-cyan);
  border-bottom: 2px solid var(--neon-cyan);
  animation: neonPulseCyan 1.5s ease-in-out infinite;
}

.typing-area__char.correct {
  color: var(--neon-green);
  text-shadow: 0 0 7px var(--neon-green);
}

.typing-area__char.incorrect {
  color: #ff3333;
  text-shadow: 0 0 7px rgba(255, 50, 50, 0.5);
  background: rgba(255, 50, 50, 0.15);
}

.typing-area__char.pending {
  color: var(--text-muted);
}

/* Cursor blink */
.typing-area__char.current::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}
