dialog[data-keyboard-layout] { width: min(930px, calc(100% - 28px)); }
.settings-only dialog[data-keyboard-layout] { width: calc(100% - 20px); }
.input-tabs { margin: 0 0 16px; }
.keyboard-toolbar, .keyboard-capture { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.keyboard-toolbar { justify-content: space-between; }
.keyboard-toolbar .check-setting { margin: 0; }
.keyboard-toolbar button, .keyboard-capture button { min-height: 35px; padding: 6px 11px; font-size: .8rem; }
.settings-section .keyboard-description { margin: 9px 0 13px; }
.keyboard-diagram {
  position: relative; isolation: isolate; display: grid; align-items: center;
  grid-template-columns: minmax(108px, 22%) minmax(0, 1fr) minmax(108px, 22%);
  gap: 12px; overflow: hidden; min-height: 322px; padding: 13px;
  border: 1px solid #33354c; border-radius: 16px;
  background: radial-gradient(ellipse at center, #2e2b4c 0%, #1a1b2c 47%, #11121e 86%);
}
.keyboard-controller { position: relative; width: 133%; justify-self: center; }
.keyboard-controller img {
  display: block; width: 100%; height: auto; user-select: none;
  filter: drop-shadow(0 16px 20px #080711b0);
}
.keyboard-points, #keyboard-lines { position: absolute; inset: 0; pointer-events: none; }
#keyboard-lines { width: 100%; height: 100%; z-index: 1; }
.keyboard-points { z-index: 2; }
.keyboard-callouts { display: grid; gap: 7px; position: relative; z-index: 3; }
button.keyboard-callout {
  justify-content: space-between; min-width: 0; min-height: 34px;
  padding: 4px 8px 4px 10px; gap: 6px; border-radius: 8px;
  background: #232438; border-color: #484969; color: #f3f0ff;
  font-size: .79rem; white-space: normal; text-align: left;
}
button.keyboard-callout:hover, button.keyboard-callout[data-selected="true"] {
  background: #353056; border-color: #a397ec; color: #fff;
}
.keyboard-callout span { min-width: 0; }
.keyboard-callout kbd {
  flex: 0 1 auto; min-width: 22px; max-width: 70px; padding: 3px 5px;
  overflow: hidden; border: 1px solid #56547a; border-radius: 5px;
  background: #151625; color: #ece6ff; text-overflow: ellipsis; text-align: center; white-space: nowrap;
  font: 600 .72rem/1.2 Inter, "Segoe UI", sans-serif;
}
button.keyboard-dot {
  position: absolute; display: grid; place-items: center; width: 23px; height: 23px;
  min-height: 0; padding: 0; transform: translate(-50%, -50%);
  pointer-events: auto; border: 0; border-radius: 50%; background: transparent;
}
button.keyboard-dot:hover, button.keyboard-dot[data-selected="true"] { background: #9584d84a; }
.keyboard-dot::before {
  content: ""; width: 7px; height: 7px; border: 1px solid #ece5ff;
  border-radius: 50%; background: #7e68d6; box-shadow: 0 0 0 2px #1c184fb0;
}
.keyboard-dot[data-selected="true"]::before { background: #e4d7ff; box-shadow: 0 0 0 3px #9271e88c; }
.keyboard-editor {
  margin-top: 12px; padding: 11px 12px 12px; border: 1px solid #48496b;
  border-radius: 12px; background: #1e2032;
}
.keyboard-editor h3 { margin: 0 0 9px; font-size: .92rem; }
.keyboard-editor-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(106px, 1fr)); gap: 7px; }
.keyboard-status { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.settings-section #keyboard-feedback { margin: 10px 0 0; color: #ded5ff; }
#keyboard-feedback:empty { display: none; }
.keyboard-capture { margin-top: 8px; }

@media (max-width: 620px) {
  .keyboard-diagram { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px; }
  .keyboard-controller { grid-row: 1; grid-column: 1 / -1; width: min(112%, 460px); align-self: center; }
  #keyboard-lines { display: none; }
  button.keyboard-dot { width: 20px; height: 20px; }
}
