.tk { position: fixed; inset: 0; pointer-events: none; font: 11px Tahoma, 'Microsoft Sans Serif', sans-serif; color: #000; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; z-index: 10; }
body:not(.tk-on) .tk > :not(.tk-restore) { display: none; }
body.tk-on .tk-restore { display: none; }
@media (pointer: fine) { body:not(.tk-on) .tk-restore { display: none; } }
.tk-key, .tk-pad, .tk-panel { pointer-events: auto; touch-action: none; }
.tk-key { box-sizing: border-box; min-width: 40px; height: 36px; padding: 0 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; background: rgba(192, 192, 192, 0.82); border: 2px outset #fff; }
.tk-key b { font-size: 14px; }
.tk-key span { font-size: 9px; margin-top: 2px; white-space: nowrap; }
.tk-key.on { border-style: inset; background: rgba(150, 150, 150, 0.92); }
.tk-key.latched { border-style: inset; background: rgba(0, 0, 128, 0.88); color: #fff; }
.tk-small { height: 28px; flex-direction: row; gap: 4px; }
.tk-small span { margin-top: 0; }
.tk-debug, .tk-debug b { color: #800000; }
.tk-key.tk-debug.on { color: #fff; background: rgba(128, 0, 0, 0.9); }
.tk-top, .tk-restore { position: absolute; top: max(6px, env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); }
.tk-top { display: flex; flex-wrap: wrap; gap: 4px; width: 176px; }
.tk-sl { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); }
.tk-pad { position: relative; width: 150px; height: 150px; border-radius: 50%; background: rgba(0, 0, 0, 0.28); }
.tk-arm { position: absolute; width: 50px; height: 50px; box-sizing: border-box; background: rgba(192, 192, 192, 0.82); border: 2px outset #fff; }
.tk-arm::after { content: ''; position: absolute; left: 50%; top: 50%; border: 8px solid transparent; transform: translate(-50%, -50%); }
.tk-up { left: 50px; top: 0; }
.tk-down { left: 50px; top: 100px; }
.tk-left { left: 0; top: 50px; }
.tk-right { left: 100px; top: 50px; }
.tk-up::after { border-bottom-color: #000; margin-top: -4px; }
.tk-down::after { border-top-color: #000; margin-top: 4px; }
.tk-left::after { border-right-color: #000; margin-left: -4px; }
.tk-right::after { border-left-color: #000; margin-left: 4px; }
.tk-pad[data-dir=up] .tk-up, .tk-pad[data-dir=down] .tk-down, .tk-pad[data-dir=left] .tk-left, .tk-pad[data-dir=right] .tk-right { border-style: inset; background: rgba(150, 150, 150, 0.92); }
.tk-sr { position: absolute; right: max(6px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.tk-quick { display: grid; grid-template-columns: repeat(4, 40px); gap: 3px; }
.tk-face { position: relative; width: 150px; height: 136px; }
.tk-face .tk-key { position: absolute; }
.tk-a { right: 0; bottom: 30px; width: 66px; height: 66px; border-radius: 50%; }
.tk-b { right: 76px; bottom: 0; width: 56px; height: 56px; border-radius: 50%; }
.tk-a b, .tk-b b { font-size: 18px; }
.tk-q { right: 84px; top: 0; width: 44px; }
.tk-e { right: 22px; top: 0; width: 44px; }
.tk-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #c0c0c0; border: 2px outset #fff; padding: 3px; box-shadow: 2px 2px 0 #000; max-height: calc(100% - 20px); overflow: auto; }
.tk-panel[hidden] { display: none; }
.tk-title { background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: bold; padding: 3px 5px; }
.tk-grid { display: grid; grid-template-columns: repeat(4, 66px); gap: 4px; padding: 6px 4px; }
.tk-grid .tk-key { height: 40px; }
.tk-close { margin: 0 4px 4px; height: 30px; }
@media (orientation: portrait) {
  body.tk-on #game { height: 75vw; margin-top: calc(40px + env(safe-area-inset-top)); }
  body.tk-on:has(.hsr98-wide) #game { height: 56.25vw; }
  .tk-top { width: auto; }
  .tk-sr { right: max(12px, env(safe-area-inset-right)); }
}
