.tn-kb-page {
  --kb-paper: #faf6ee;
  --kb-wash: #f5efdf;
  --kb-ink: #1a1208;
  --kb-muted: #5a4a30;
  --kb-line: #b8a888;
  --kb-soft: #ddd4be;
  --kb-button: #ede6d4;
  --kb-button-text: #1a1208;
  --kb-hover: #dfd4bb;
  --kb-action: #1a1208;
  --kb-action-hover: #873600;
  --kb-action-text: #f7ead1;
  --kb-focus: #a83d00;
  --kb-sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", system-ui, sans-serif;
  --kb-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
}
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]) .tn-kb-page,
html:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]) body:not([data-scheme="light"]) .tn-kb-page {
  --kb-paper: #241d12;
  --kb-wash: #322a1a;
  --kb-ink: #efe6d2;
  --kb-muted: #c3b492;
  --kb-line: #6f6047;
  --kb-soft: #574a37;
  --kb-button: #2f2115;
  --kb-button-text: #f7ead1;
  --kb-hover: #3a2a1b;
  --kb-action: #6a3b1f;
  --kb-action-hover: #824826;
  --kb-action-text: #f7ead1;
  --kb-focus: #e8823f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"] .tn-kb-page,
  html[data-scheme="auto"] body:not([data-scheme="light"]) .tn-kb-page {
    --kb-paper: #241d12;
    --kb-wash: #322a1a;
    --kb-ink: #efe6d2;
    --kb-muted: #c3b492;
    --kb-line: #6f6047;
    --kb-soft: #574a37;
    --kb-button: #2f2115;
    --kb-button-text: #f7ead1;
    --kb-hover: #3a2a1b;
    --kb-action: #6a3b1f;
    --kb-action-hover: #824826;
    --kb-action-text: #f7ead1;
    --kb-focus: #e8823f;
    color-scheme: dark;
  }
}
.tn-kb-page [hidden] { display: none !important; }
.tn-kb-page .tn-kb-tool {
  width: 100%;
  min-width: 0;
  margin: 0;
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  font-family: var(--kb-sans);
  font-size: 14px;
  line-height: 1.6;
}
.tn-kb-tool,
.tn-kb-tool *,
.tn-kb-tool *::before,
.tn-kb-tool *::after { box-sizing: border-box; }
.tn-kb-tool :is(dl, dt, dd, ul, li, label) { margin: 0; padding: 0; }
.tn-kb-tool p { margin: 0; }
.tn-kb-tool .tn-kb-workspace {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--kb-line);
  background: var(--kb-paper);
}
.tn-kb-tool :is(.tn-kb-toolbar, .tn-kb-options, .tn-kb-actions, .tn-kb-modes) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tn-kb-tool .tn-kb-toolbar { justify-content: space-between; gap: 12px 20px; }
.tn-kb-tool .tn-kb-options { gap: 10px 16px; }
.tn-kb-tool .tn-kb-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}
.tn-kb-tool label {
  display: block;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: none;
}
.tn-kb-tool :is(select, textarea) {
  display: block;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--kb-line);
  border-radius: 0;
  background-color: var(--kb-paper);
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  font-family: var(--kb-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  box-shadow: none;
}
.tn-kb-tool select {
  appearance: none;
  -webkit-appearance: none;
  width: 160px;
  height: 40px;
  padding: 0 30px 0 10px;
  background-color: var(--kb-wash);
  background-image: linear-gradient(45deg, transparent 50%, var(--kb-ink) 50%), linear-gradient(135deg, var(--kb-ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  font-size: 13px;
  line-height: normal;
  cursor: pointer;
}
.tn-kb-tool select option { background: var(--kb-paper); color: var(--kb-ink); }
.tn-kb-tool .tn-kb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  cursor: pointer;
}
.tn-kb-tool .tn-kb-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--kb-muted);
  border-radius: 0;
  background: var(--kb-paper);
  color: var(--kb-focus);
  -webkit-text-fill-color: var(--kb-focus);
  box-shadow: none;
  cursor: pointer;
}
.tn-kb-tool .tn-kb-check input[type="checkbox"]:checked { border-color: var(--kb-focus); background: var(--kb-wash); }
.tn-kb-tool .tn-kb-check input[type="checkbox"]:checked::after {
  content: "";
  width: 6px;
  height: 10px;
  margin-top: -2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.tn-kb-tool button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  max-width: 100%;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--kb-line);
  border-radius: 0;
  background: var(--kb-button);
  color: var(--kb-button-text);
  -webkit-text-fill-color: var(--kb-button-text);
  font-family: var(--kb-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  box-shadow: none;
  cursor: pointer;
}
.tn-kb-tool button:is(:hover, :focus-visible):not(:disabled) { background: var(--kb-hover); }
.tn-kb-tool :is(#tnKeyboardStart, button[data-kb-mode][aria-pressed="true"]) {
  border-color: var(--kb-action);
  background: var(--kb-action);
  color: var(--kb-action-text);
  -webkit-text-fill-color: var(--kb-action-text);
}
.tn-kb-tool :is(#tnKeyboardStart, button[data-kb-mode][aria-pressed="true"]):is(:hover, :focus-visible):not(:disabled) { background: var(--kb-action-hover); }
.tn-kb-tool button[data-kb-mode][aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
.tn-kb-tool button:disabled { opacity: .55; cursor: not-allowed; }
.tn-kb-tool :is(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--kb-focus);
  outline-offset: 3px;
  box-shadow: none;
}
.tn-kb-tool #tnKeyboardKeyPane,
.tn-kb-tool .tn-kb-text-pane { min-width: 0; }
.tn-kb-tool .tn-kb-text-pane { display: grid; gap: 5px; }
.tn-kb-tool .tn-kb-pad {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 180px;
  padding: 30px 20px;
  border: 1px dashed var(--kb-line);
  background: var(--kb-wash);
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: text;
}
.tn-kb-tool .tn-kb-pad strong { font-size: 17px; font-weight: 700; }
.tn-kb-tool .tn-kb-pad p { color: var(--kb-muted); -webkit-text-fill-color: var(--kb-muted); font-size: 13px; }
.tn-kb-tool .tn-kb-pad:focus { border-style: solid; border-color: var(--kb-focus); }
.tn-kb-tool #tnKeyboardText {
  width: 100%;
  min-height: 220px;
  height: auto;
  padding: 14px;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
.tn-kb-tool #tnKeyboardText::placeholder {
  color: var(--kb-muted);
  -webkit-text-fill-color: var(--kb-muted);
  opacity: .7;
}
.tn-kb-tool :is(.tn-kb-hint, .tn-kb-status) {
  color: var(--kb-muted);
  -webkit-text-fill-color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.tn-kb-tool .tn-kb-status {
  min-height: 22px;
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  font-size: 13px;
}
.tn-kb-tool .tn-kb-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--kb-line);
  border-bottom: 1px solid var(--kb-line);
}
.tn-kb-tool .tn-kb-metrics > div { min-width: 0; padding: 4px 8px; }
.tn-kb-tool .tn-kb-metrics dt {
  color: var(--kb-muted);
  -webkit-text-fill-color: var(--kb-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.tn-kb-tool .tn-kb-metrics dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  line-height: 1.4;
}
.tn-kb-tool .tn-kb-metrics dd > span {
  min-width: 0;
  font-family: var(--kb-sans);
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: lining-nums tabular-nums;
  overflow-wrap: anywhere;
}
.tn-kb-tool .tn-kb-metrics small { font-size: 11px; font-weight: 400; }
.tn-kb-tool .tn-kb-readout { display: grid; gap: 5px; min-width: 0; }
.tn-kb-tool .tn-kb-readout p { display: flex; flex-wrap: wrap; gap: 3px 12px; min-width: 0; font-size: 12px; }
.tn-kb-tool .tn-kb-readout strong { color: var(--kb-muted); -webkit-text-fill-color: var(--kb-muted); font-weight: 400; }
.tn-kb-tool .tn-kb-readout span { min-width: 0; overflow-wrap: anywhere; font-family: var(--kb-sans); }
.tn-kb-tool .tn-kb-map-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; min-width: 0; padding-top: 8px; }
.tn-kb-tool .tn-kb-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; list-style: none; }
.tn-kb-tool .tn-kb-legend li { display: inline-flex; align-items: center; gap: 5px; list-style: none; font-size: 12px; }
.tn-kb-tool .tn-kb-legend li::before { content: none; }
.tn-kb-tool .tn-kb-legend-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--kb-line);
  background: var(--kb-paper);
  color: var(--kb-muted);
  -webkit-text-fill-color: var(--kb-muted);
  font-size: 12px;
  line-height: 1;
}
.tn-kb-tool .tn-kb-legend-mark--seen { border-bottom: 3px solid var(--kb-ink); background: var(--kb-wash); color: var(--kb-ink); -webkit-text-fill-color: var(--kb-ink); }
.tn-kb-tool .tn-kb-legend-mark--down { border: 2px solid var(--kb-action-text); outline: 1px solid var(--kb-action); background: var(--kb-action); color: var(--kb-action-text); -webkit-text-fill-color: var(--kb-action-text); }
.tn-kb-tool .tn-kb-board-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 2px 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
  scrollbar-color: var(--kb-line) var(--kb-wash);
}
.tn-kb-tool .tn-kb-board { display: flex; align-items: flex-start; gap: 14px; width: max-content; min-width: 0; margin: 0 auto; }
.tn-kb-tool :is(.tn-kb-main, .tn-kb-navigation, .tn-kb-numpad) { display: grid; flex: 0 0 auto; gap: 4px; min-width: 0; }
.tn-kb-tool .tn-kb-row { display: flex; align-items: stretch; gap: 4px; min-height: 44px; }
.tn-kb-tool .tn-kb-navigation .tn-kb-row { justify-content: center; }
.tn-kb-tool .tn-kb-key[data-code] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 calc(var(--kb-key-width, 1) * 42px + (var(--kb-key-width, 1) - 1) * 4px);
  width: calc(var(--kb-key-width, 1) * 42px + (var(--kb-key-width, 1) - 1) * 4px);
  min-width: 0;
  min-height: 44px;
  padding: 4px 3px 6px;
  border: 1px solid var(--kb-line);
  border-bottom-width: 3px;
  border-radius: 2px;
  background: var(--kb-paper);
  color: var(--kb-ink);
  -webkit-text-fill-color: var(--kb-ink);
  font-family: var(--kb-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: none;
  cursor: default;
}
.tn-kb-tool .tn-kb-key-main { font-size: 11px; font-weight: 600; }
.tn-kb-tool .tn-kb-key-sub { margin-top: 2px; color: var(--kb-muted); -webkit-text-fill-color: var(--kb-muted); font-size: 10px; font-weight: 400; }
.tn-kb-tool .tn-kb-numpad { position: relative; width: 180px; grid-template-rows: repeat(5, 44px); }
.tn-kb-tool .tn-kb-numpad .tn-kb-row { height: 44px; }
.tn-kb-tool .tn-kb-numpad .tn-kb-key:is([data-code="NumpadAdd"], [data-code="NumpadEnter"]) {
  position: absolute;
  right: 0;
  height: 92px;
}
.tn-kb-tool .tn-kb-numpad .tn-kb-key[data-code="NumpadAdd"] { top: 48px; }
.tn-kb-tool .tn-kb-numpad .tn-kb-key[data-code="NumpadEnter"] { top: 144px; }
.tn-kb-tool .tn-kb-key[data-code].is-seen { border-bottom-color: var(--kb-ink); background: var(--kb-wash); }
.tn-kb-tool .tn-kb-key[data-code].is-seen::after { content: "✓"; position: absolute; top: 1px; right: 2px; font-size: 9px; line-height: 1; }
.tn-kb-tool .tn-kb-key[data-code].is-down {
  border-color: var(--kb-action-text);
  border-width: 2px;
  outline: 1px solid var(--kb-action);
  outline-offset: -1px;
  background: var(--kb-action);
  color: var(--kb-action-text);
  -webkit-text-fill-color: var(--kb-action-text);
}
.tn-kb-tool .tn-kb-key[data-code].is-down::after { content: "●"; position: absolute; top: 1px; right: 2px; font-size: 8px; line-height: 1; }
.tn-kb-tool .tn-kb-key[data-code].is-down :is(.tn-kb-key-main, .tn-kb-key-sub) { color: var(--kb-action-text); -webkit-text-fill-color: var(--kb-action-text); }
.tn-kb-tool :is(.tn-kb-privacy, .tn-kb-limit, noscript p) {
  margin: 10px 0 0;
  color: var(--kb-muted);
  -webkit-text-fill-color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.tn-kb-tool .tn-kb-privacy { padding-top: 12px; border-top: 1px solid var(--kb-line); }
.tn-kb-page .tn-kb-ad {
  width: 100%;
  max-width: 900px;
  min-height: 90px;
  height: auto;
  max-height: none;
  margin: 24px auto;
  border: 0;
  background: transparent;
  overflow: visible;
}
.tn-kb-page .tn-kb-ad--top { margin-top: 0; }
@media (max-width: 1000px) {
  .tn-kb-tool .tn-kb-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 0; }
}
@media (max-width: 600px) {
  .tn-kb-tool .tn-kb-workspace { gap: 10px; padding: 12px; }
  .tn-kb-tool .tn-kb-toolbar { align-items: flex-start; }
  .tn-kb-tool .tn-kb-options { width: 100%; justify-content: space-between; gap: 6px 10px; }
  .tn-kb-tool .tn-kb-pad { min-height: 180px; padding: 24px 12px; }
  .tn-kb-tool .tn-kb-pad strong { font-size: 15px; }
  .tn-kb-tool #tnKeyboardText { min-height: 180px; padding: 10px; }
  .tn-kb-tool .tn-kb-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tn-kb-tool .tn-kb-metrics > div { padding: 2px 5px; }
  .tn-kb-tool .tn-kb-metrics dd > span { font-size: 22px; }
  .tn-kb-tool .tn-kb-actions { gap: 6px; }
  .tn-kb-tool .tn-kb-actions button { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tn-kb-tool,
  .tn-kb-tool *,
  .tn-kb-tool *::before,
  .tn-kb-tool *::after { animation: none; transition: none; scroll-behavior: auto; }
}
