/* --- KB Modal Specifics --- */
.modal-base.keyboard {
  border: 2px solid var(--accent-mauve);
  z-index: 1000;
  width: 650px;
  max-width: 95vw;
  box-shadow:
    0 25px 60px var(--shadow-strong),
    0 0 30px var(--shadow-light);
}

#kbModal h3 {
  margin: 0;
  color: var(--accent-mauve);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#kbModal h5 {
  margin: 0;
  text-align: center;
  color: var(--text-sub);
  font-weight: normal;
}

.kb-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 8px;
}

.kb-map-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--hud-btn-bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid transparent;
  transition: border 0.2s;
}

.kb-map-item:hover {
  border-color: var(--bg-surface2);
  background: var(--btn-hover-bg);
}

.kb-map-item button {
  padding: 6px 10px;
  margin: 0;
  font-size: 12px;
  width: 85px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.modal-actions button {
  font-size: 13px;
  padding: 10px;
  flex: 1;
  min-width: 85px;
}

#gamepadCanvas {
  background: radial-gradient(circle at center, var(--bg-mantle), var(--bg-base));
  border-radius: 12px;
  border: 1px solid var(--bg-surface1);
  margin: 0 auto;
  display: block;
  box-shadow: inset 0 5px 15px var(--shadow-medium);
}

/* Continue */

.modal-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--bg-surface1);
  padding-bottom: 5px;
}
.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}
.tab-btn:hover {
  color: var(--text-dark) !important;
}
.tab-btn.active {
  color: var(--accent-mauve);
  border-bottom: 2px solid var(--accent-mauve);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

.profile-header {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}
.profile-header select {
  flex: 1;
  background: var(--bg-base);
  color: var(--text-main);
  border: 1px solid var(--bg-surface1);
  padding: 6px;
  border-radius: 4px;
}

.profile-editor label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.profile-editor input {
  background: var(--bg-base);
  border: 1px solid var(--bg-surface1);
  color: var(--text-main);
  padding: 6px;
  border-radius: 4px;
  margin-top: 4px;
}
.profile-editor input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mapping-grids {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}
.map-col {
  flex: 1;
}
.map-col h4 {
  margin: 0 0 5px 0;
  font-size: 13px;
  color: var(--accent-mauve);
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 5px;
}
.profile-grid input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.raw-debug {
  background: var(--bg-base);
  padding: 10px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-green);
  height: 40px;
  border: 1px solid var(--bg-surface0);
  overflow-y: auto;
}
