.k {
  cursor: pointer;
  border-radius: 3px;
}

.k:hover,
.k.k--on {
  background: var(--surface-hi);
}

.k:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  background: var(--surface-hi);
}

.kt-pop {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem;
  max-inline-size: calc(100vw - 16px);
  padding: 0.375rem 0.625rem;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  line-height: 1.3;
  box-shadow: 0 4px 14px #0004;
}

.kt-pop[hidden] {
  display: none;
}

.kt-ch {
  font-family: var(--font-ja);
  font-size: var(--fs-md);
  font-weight: 600;
}

.kt-rom {
  font-weight: 600;
}

.kt-sc {
  font-size: var(--fs-xs);
  opacity: 0.82;
}

@media (forced-colors: active) {
  .kt-pop {
    background: Canvas;
    color: CanvasText;
    border: 2px solid CanvasText;
  }
}

@media print {
  .kt-pop {
    display: none !important;
  }
  .k {
    background: none !important;
    outline: none !important;
  }
}

/* Per-character .k wraps disable word-break:auto-phrase, which made long
   cheat-sheet natives overflow at 320px. Allow breaks between kana. */
:lang(ja):has(> .k) {
  line-break: anywhere;
  overflow-wrap: anywhere;
  word-break: normal;
}
