/* Machine > Keyboard > Show Keyboard (js/ui/keyboardwindow.js). Keys sit on
   a grid of quarter-key columns and scale with the window's width. */

.kb-body {
  flex: 1;
  min-height: 0;
  padding: 10px;
  background: #1a1a22;
  container-type: inline-size;
  display: flex;
  align-items: center;
}

.kb-grid {
  width: 100%;
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: 4px;
  height: min(100%, 42cqw);
  font-size: clamp(8px, 1.45cqw, 15px);
}

.kb-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 1px;
  border-radius: 4px;
  background: linear-gradient(#4a4a55, #3a3a44);
  border: 1px solid #22222a;
  box-shadow: 0 2px 0 #15151b;
  color: #f0f0f4;
  font-weight: 600;
  line-height: 1.05;
  user-select: none;
  touch-action: none;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}
.kb-key:hover { filter: brightness(1.15); }

.kb-named { font-size: 0.72em; letter-spacing: 0.02em; }
.kb-pad { background: linear-gradient(#35507a, #2b4266); }
.kb-return { background: linear-gradient(#35507a, #2b4266); }

.kb-top, .kb-bottom { display: block; min-height: 1em; }
.kb-bottom { opacity: 0.8; }
.kb-main { font-size: 1.15em; }

.kb-key.down, .kb-key.latched {
  background: var(--accent);
  color: #10131a;
  box-shadow: none;
  transform: translateY(1px);
}

.kb-info {
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keyboard > Remap Keys (js/ui/remapwindow.js), on the same key styles. */
.remap-body:focus { outline: none; }
.remap-pc { color: var(--accent); font-size: 0.85em; opacity: 1; }
.kb-key.latched .remap-pc { color: inherit; }
.kb-key.remap-bound { border-color: var(--accent); }
.remap-joy {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 10px 8px;
  background: #1a1a22;
  font-size: 12px;
}
.remap-joy-label { align-self: center; margin-right: 6px; opacity: 0.75; }
.remap-joykey { flex: 1; min-height: 34px; }
.remap-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-right: 8px;
}
.remap-bar .kb-info { flex: 1; border-top: none; }
.remap-bar button {
  padding: 3px 10px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.remap-bar button:disabled { opacity: 0.4; cursor: default; }
