/**
 * TypeRush - Virtual Keymap CSS (Phase 10)
 *
 * Interactive on-screen keyboard supporting:
 * - Staggered, Matrix, and Split keyboard arrangements
 * - Keypress active glow, next-key targets, error flash
 * - Blank keycaps, lowercase/uppercase legends
 *
 * @package TypeRush
 */

.keymap-container {
  width: 100%;
  max-width: 820px;
  margin: 1.5rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.keymap-container:hover {
  opacity: 1;
}

.keymap-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.keymap-key {
  height: 38px;
  min-width: 38px;
  flex: 1;
  max-width: 52px;
  background-color: var(--sub-alt-color, #1e2023);
  color: var(--sub-color, #646669);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: default;
  transition: background-color 0.08s ease, color 0.08s ease, transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

/* Modifier keys */
.keymap-key.key-tab { flex: 1.5; max-width: 68px; }
.keymap-key.key-caps { flex: 1.75; max-width: 78px; }
.keymap-key.key-shift { flex: 2.25; max-width: 95px; }
.keymap-key.key-backspace { flex: 1.8; max-width: 80px; }
.keymap-key.key-enter { flex: 2.2; max-width: 95px; }
.keymap-key.key-space { flex: 6; max-width: 280px; }

/* Interactive Key States */
.keymap-key.key-pressed {
  background-color: var(--main-color, #e2b714) !important;
  color: var(--bg-color, #323437) !important;
  transform: translateY(2px);
  box-shadow: 0 0 10px var(--main-color, #e2b714);
}

.keymap-key.key-next {
  border-color: var(--main-color, #e2b714);
  color: var(--text-color, #d1d0c5);
  box-shadow: inset 0 0 6px rgba(226, 183, 20, 0.35);
  animation: keyPulse 1.2s infinite ease-in-out;
}

.keymap-key.key-error {
  background-color: var(--error-color, #ca4754) !important;
  color: #fff !important;
  box-shadow: 0 0 12px var(--error-color, #ca4754) !important;
  transform: scale(0.96);
}

@keyframes keyPulse {
  0%, 100% { border-color: rgba(226, 183, 20, 0.4); }
  50% { border-color: var(--main-color, #e2b714); }
}

/* Style: Matrix (strictly grid aligned) */
.keymap-style-matrix .keymap-key {
  flex: 1 !important;
  max-width: 44px !important;
  border-radius: 2px;
}
.keymap-style-matrix .keymap-key.key-space {
  max-width: 140px !important;
}

/* Style: Split (ortho/ergonomic split with center gap) */
.keymap-style-split .keymap-row {
  justify-content: space-between;
}
.keymap-style-split .keymap-split-half {
  display: flex;
  gap: 5px;
}
.keymap-style-split .keymap-split-gap {
  width: 40px;
}

/* Legend: Blank (touch typist mode) */
.keymap-legend-blank .keymap-key {
  color: transparent !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .keymap-container {
    display: none !important;
  }
}
