/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 12px 12px 0 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition:
    color 0.2s,
    background 0.2s;
}
.modal-close:hover {
  color: var(--text);
  background: var(--border2);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.kb-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.kb-card:hover {
  background: rgba(0, 229, 255, 0.05);
  border-color: rgba(0, 229, 255, 0.3);
}

.kb-card.selected {
  border-color: var(--accent);
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 0 1px var(--accent);
}

.kb-name {
  font-size: 13px;
  font-weight: 600;
  color: #eef0fa;
  margin-bottom: 4px;
}
.kb-switch {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-confirm {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 9px 22px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    opacity 0.2s,
    box-shadow 0.2s;
}
.btn-confirm:hover {
  opacity: 0.85;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
