/* ghacks Tools: keyboard tester (prefix gtkb-) */
.gtkb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 12px; }
.gtkb-start { min-width: 132px; }
.gtkb-status { flex: 1 1 280px; margin: 0; font-size: 14px; line-height: 1.4; color: var(--gt-muted); min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.gtkb-state { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--gt-line); background: var(--gt-field); color: var(--gt-ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.gtkb-state[data-s="on"] { background: var(--gt-brand); border-color: var(--gt-brand-hover); color: var(--gt-brand-ink); }
.gtkb-state[data-s="on"]::before { content: "\25CF  "; color: #b03a2e; }
.gtkb-state[data-s="paused"] { border-color: var(--gt-accent); }

/* Keyboard: the focusable surface is the only place key events are captured */
.gtkb-scroll { margin: 0 -4px; padding: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gtkb-surface { position: relative; padding: 8px; border: 1px dashed #c3c8d0; border-radius: var(--gt-radius); background: #fbfbfc; cursor: pointer; container-type: inline-size; }
.gtkb-surface:focus { outline: 3px solid var(--gt-accent); outline-offset: 1px; border-style: solid; border-color: var(--gt-accent); background: #fffaf0; cursor: default; }
.gtkb-board { position: relative; height: 0; }
.gtkb-k { position: absolute; padding: 2px; }
.gtkb-c { position: relative; display: block; height: 100%; overflow: hidden; border: 1px solid #c9ced6; border-radius: 5px; background: var(--gt-field); color: var(--gt-ink); box-shadow: inset 0 -2px 0 rgba(16, 24, 40, .07); transition: background-color .06s, transform .06s; }
.gtkb-l { position: absolute; left: 3px; top: 2px; right: 1px; font-size: 11px; font-size: clamp(9px, 1.4cqw, 13px); line-height: 1.15; font-weight: 600; white-space: nowrap; overflow: hidden; }
.gtkb-long .gtkb-l { font-size: 9px; font-size: clamp(7px, 1.02cqw, 11px); font-weight: 600; letter-spacing: -.2px; }
.gtkb-b { position: absolute; right: 3px; bottom: 1px; font-size: 10px; font-size: clamp(7px, 1.1cqw, 12px); line-height: 1.2; font-weight: 700; }
.gtkb-k.is-ok .gtkb-c { border-color: #1e8449; background: #e9f6ee; }
.gtkb-k.is-ok .gtkb-b { color: #1e7a43; }
.gtkb-k.is-down .gtkb-c { background: var(--gt-brand); border-color: #b7791f; color: var(--gt-brand-ink); transform: translateY(1px); box-shadow: none; }
.gtkb-k.is-chat .gtkb-c { border-color: #c0392b; box-shadow: inset 0 0 0 1px #c0392b; }
.gtkb-k.is-chat .gtkb-b, .gtkb-k.is-stuck .gtkb-b { color: #fff; background: #b03a2e; border-radius: 3px; padding: 0 3px; }
.gtkb-k.is-stuck .gtkb-c { border-color: #b03a2e; }
.gtkb-k.is-target .gtkb-c { outline: 2px dashed var(--gt-accent); outline-offset: -4px; }
.gtkb-isoenter .gtkb-c { clip-path: polygon(0 0, 100% 0, 100% 100%, 17% 100%, 17% 50%, 0 50%); }

.gtkb-warn { margin: 8px 0 12px; font-size: 13px; line-height: 1.4; color: var(--gt-muted); }

/* Results: fixed heights so live updates never move the layout */
.gtkb-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.gtkb-stats > div { min-width: 0; height: 88px; padding: 8px 10px; border: 1px solid var(--gt-line); border-radius: 8px; background: var(--gt-bg); overflow: hidden; }
.gtkb-stats dt { font-size: 13px; color: var(--gt-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtkb-stats dd { margin: 0; }
.gtkb-stats dd:nth-of-type(1) { font-size: 20px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtkb-v-last { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 18px !important; }
.gtkb-code { font-size: 14px; font-weight: 500; color: var(--gt-muted); }
.gtkb-sub { font-size: 12px; line-height: 1.35; color: var(--gt-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

.gtkb-notes:empty { display: none; }
.gtkb-notes { margin: 0 0 12px; }
.gtkb-note { margin: 0 0 6px; padding: 8px 12px; font-size: 14px; line-height: 1.45; border-left: 3px solid var(--gt-accent); background: var(--gt-field); border-radius: 0 6px 6px 0; }

.gtkb-set { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px 12px; margin: 0 0 12px; }
.gtkb-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; font-weight: 600; }
.gtkb-f > span { overflow-wrap: anywhere; }
.gtkb-f select { width: 100%; height: 44px; padding: 0 8px; font: inherit; font-weight: 400; font-size: 15px; color: var(--gt-ink); background: var(--gt-field); border: 1px solid var(--gt-line); border-radius: 8px; }
.gtkb-thr-v { font-weight: 700; }
.gtkb-range { width: 100%; height: 44px; margin: 0; accent-color: var(--gt-accent); cursor: pointer; }

.gtkb-guided { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 12px; padding: 12px 0 0; border-top: 1px solid var(--gt-line); }
.gtkb-guided .gtkb-f { flex: 1 1 260px; }
.gtkb-run { min-width: 96px; }
.gtkb-gres { flex: 1 0 100%; margin: 0; min-height: 21px; font-size: 14px; line-height: 1.45; }
.gtkb-gres[data-ok="1"] { color: #1e7a43; font-weight: 600; }
.gtkb-gres[data-ok="0"] { color: #b03a2e; font-weight: 600; }

.gtkb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.gtkb-copied { font-size: 14px; font-weight: 600; color: #1e7a43; }
.gtkb-report { display: block; width: 100%; margin: 0 0 8px; padding: 10px; font: 13px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; color: var(--gt-ink); background: var(--gt-field); border: 1px solid var(--gt-line); border-radius: 8px; resize: vertical; }
.gtkb-report[hidden] { display: none; }

.gtkb-more { margin: 0; border-top: 1px solid var(--gt-line); font-size: 14px; }
.gtkb-more summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.gtkb-logwrap { max-height: 240px; overflow: auto; margin: 0 0 10px; }
.gtkb-log { width: 100%; border-collapse: collapse; font: 12px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
.gtkb-log th, .gtkb-log td { padding: 3px 6px; border-bottom: 1px solid var(--gt-line); text-align: left; white-space: nowrap; }
.gtkb-log th { position: sticky; top: 0; background: var(--gt-bg); font-family: inherit; color: var(--gt-muted); }
.gtkb-cannot { margin: 0 0 12px; padding-left: 1.2em; line-height: 1.5; }
.gtkb-cannot li { margin: 0 0 4px; }
.gtkb-privacy { margin: 8px 0 0; font-size: 13px; color: var(--gt-muted); }
.gtkb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
	.gtkb-stats, .gtkb-set { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones: the keyboard keeps a readable size and scrolls inside its own box, never the page */
@media (max-width: 600px) {
	.gtkb-surface { min-width: 560px; }
	.gtkb-status { flex-basis: 100%; }
	.gtkb-bar .gt-btn { flex: 1 1 0; }
	.gtkb-stats > div { height: 92px; padding: 8px; }
	.gtkb-stats dd:nth-of-type(1) { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
	.gtkb-c { transition: none; }
	.gtkb-k.is-down .gtkb-c { transform: none; }
}
.gtkb-more summary { list-style: none; }
.gtkb-more summary::-webkit-details-marker { display: none; }
.gtkb-more summary::before { content: "\25B8"; margin-right: 8px; color: var(--gt-accent); }
.gtkb-more[open] summary::before { content: "\25BE"; }
