:root {
  --kon-bg: #ffe867;
  --kon-fg: #111;
  --kon-accent: #2457ff;
}

/* Strong, theme-independent keyboard focus */
html.kon-keyboard-user :focus,
html.kon-keyboard-user :focus-visible {
  outline: 3px solid var(--kon-accent) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px #fff !important;
}

.kon-hint {
  position: fixed;
  z-index: 2147483646;
  min-width: 20px;
  padding: 3px 5px;
  border: 1px solid #111;
  border-radius: 4px;
  background: var(--kon-bg);
  color: var(--kon-fg);
  font: 800 12px/1.1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: .3px;
  text-align: center;
  box-shadow: 0 2px 7px rgba(0,0,0,.35);
  pointer-events: none;
  transform: translate(-2px, -2px);
}
.kon-hint.kon-match { background: #fff; }
.kon-hint .kon-typed { color: #b00020; }

#kon-status {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 2147483645;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(0,0,0,.35);
  border-radius: 999px;
  background: rgba(20,20,20,.93);
  color: #fff;
  font: 600 12px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 3px 14px rgba(0,0,0,.25);
  pointer-events: none;
}
#kon-status kbd {
  padding: 1px 5px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font: inherit;
}
#kon-status.kon-active { background: #153cce; }
#kon-status.kon-typing { background: #6b3f00; }
#kon-status strong { letter-spacing: .04em; }

#kon-toast {
  position: fixed;
  left: 50%;
  bottom: 58px;
  z-index: 2147483647;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 7px;
  background: rgba(0,0,0,.88);
  color: #fff;
  font: 600 13px/1.3 system-ui, sans-serif;
  pointer-events: none;
}

#kon-help {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(0,0,0,.58);
  display: grid;
  place-items: center;
  padding: 20px;
}
.kon-help-card {
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  color: #111;
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 18px 60px rgba(0,0,0,.4);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.kon-help-card h2 { margin: 0 0 8px; font-size: 24px; }
.kon-help-card p { margin: 0 0 18px; }
.kon-help-close {
  float: right;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #f7f7f7;
  padding: 6px 10px;
  font-size: 16px;
}
.kon-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 16px;
  align-items: center;
}
.kon-grid kbd {
  display: inline-block;
  min-width: 54px;
  text-align: center;
  padding: 4px 7px;
  border: 1px solid #aaa;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #f6f6f6;
  font-weight: 800;
}

/* Make JS-enhanced custom controls visibly keyboard-operable */
.kon-enhanced-control { cursor: pointer; }

@media (max-width: 520px) {
  #kon-status { right: 8px; bottom: 8px; font-size: 11px; }
  .kon-help-card { padding: 18px; }
  .kon-grid { grid-template-columns: 1fr; gap: 5px; }
  .kon-grid kbd { width: max-content; }
}
