.hk {
  --hk-size: 136px;
  --hk-tail: 50%;
  --hk-ink: #111;
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: clip;
  pointer-events: none;
  color: var(--hk-ink);
}

.hk [hidden] {
  display: none !important;
}

.hk-dock,
.hk-arrow,
.hk-tip,
.hk-card {
  position: absolute;
}

.hk-dock {
  top: 0;
  left: 0;
  z-index: 2;
  width: var(--hk-size);
  display: grid;
  justify-items: center;
  gap: 2px;
  will-change: transform;
}

.hk-switch,
.hk-actions button,
.hk-actions a {
  pointer-events: auto;
}

.hk-dock.hk-pass > *,
.hk-dock.hk-pass .hk-hit,
.hk-actions .hk-pass {
  pointer-events: none;
}

.hk-mascot {
  width: var(--hk-size);
  height: var(--hk-size);
  padding: 0;
  border: 0;
  border-radius: 36%;
  background: transparent;
  cursor: grab;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}

.hk-mascot:active {
  cursor: grabbing;
}

.hk-mascot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.hk-mascot .hk-hit {
  pointer-events: fill;
}

.hk :focus-visible {
  outline: 2px solid #000;
  box-shadow: 0 0 0 3px #fff;
}

.hk-mark {
  fill: #000;
  stroke: #fff;
  stroke-width: 2;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

.hk-float,
.hk-pose {
  transform-origin: 74px 74px;
}

.hk-limbs {
  /* The existing SVG hit circle handles mascot clicks. */
  pointer-events: none;
}

.hk-hand,
.hk-wrist,
.hk-leg {
  transform-origin: 0 0;
}

.hk-hand {
  transform: rotate(var(--hk-arm-angle, 26deg));
  transition: transform 180ms ease-out;
}

.hk-wrist {
  transform: rotate(var(--hk-wrist-angle, 0deg));
  transition: transform 180ms ease-out;
  animation: var(--hk-wrist-animation, hk-wrist-sway 4.8s ease-in-out var(--hk-wrist-delay, 0s) infinite);
}

.hk-hand-right {
  --hk-wrist-delay: -2.4s;
}

.hk-glove-open { display: var(--hk-open-glove, inline); }
.hk-glove-point { display: var(--hk-point-glove, none); }
.hk-glove-thumb { display: var(--hk-thumb-glove, none); }
.hk-glove-grip { display: var(--hk-grip-glove, none); }

.hk-leg {
  fill: #000;
  stroke: #fff;
  stroke-width: 1.2;
  paint-order: stroke fill;
  animation: hk-foot-rock 4.8s ease-in-out infinite;
}

.hk-leg-right {
  animation-delay: -2.4s;
}

.hk:where(:not(.hk-wave, .hk-thumbs, .hk-approve, .hk-clap, .hk-hold, .hk-sleep, .hk-dragging, .hk-is-off))
  :is([data-hk-point="left"] .hk-hand-left, [data-hk-point="right"] .hk-hand-right) {
  --hk-arm-angle: var(--hk-point-arm);
  --hk-wrist-angle: var(--hk-point-wrist);
  --hk-wrist-animation: none;
  --hk-open-glove: none;
  --hk-point-glove: inline;
}

.hk-wave .hk-hand-left {
  --hk-arm-angle: -68deg;
  --hk-wrist-animation: hk-wave-wrist 1.3s ease-in-out;
}

.hk:is(.hk-thumbs, .hk-approve, .hk-clap) .hk-hand-right {
  --hk-arm-angle: -24deg;
  --hk-wrist-angle: 24deg;
  --hk-wrist-animation: none;
  --hk-open-glove: none;
  --hk-thumb-glove: inline;
}

.hk-hold .hk-hand-left,
.hk-hold:where(:not(.hk-approve)) .hk-hand-right {
  --hk-arm-angle: 46deg;
  --hk-wrist-angle: -20deg;
  --hk-wrist-animation: none;
  --hk-open-glove: none;
  --hk-grip-glove: inline;
}

.hk-compass,
.hk-ring,
.hk-star,
.hk-face {
  transform-origin: 50px 54px;
}

.hk-float {
  animation: hk-float 5.8s ease-in-out infinite;
}

.hk-compass {
  transform: rotate(var(--hk-bearing, 0rad));
}

.hk-face {
  transform: rotate(calc(0rad - var(--hk-bearing, 0rad)));
}

.hk-ring {
  animation: hk-sweep 8s ease-in-out infinite;
}

.hk-gaze {
  transform: translate(var(--hk-look-x, 0px), var(--hk-look-y, 0px));
}

.hk-eye {
  transform-box: fill-box;
  transform-origin: center;
}

.hk-blink .hk-eye {
  animation: hk-blink 180ms ease-in-out;
}

.hk-wave .hk-star {
  animation: hk-bow 1.2s ease-in-out;
}

.hk-thumbs .hk-star {
  animation: hk-bow .7s ease-in-out;
}

.hk-beckon .hk-ring {
  animation: hk-sweep 1.3s ease-in-out;
}

.hk-think .hk-star,
.hk-watch .hk-star {
  animation: hk-lean .76s ease-in-out;
}

.hk-shrug .hk-star {
  --hk-lean: 7deg;
  animation: hk-lean .96s ease-in-out;
}

.hk-peek .hk-star {
  animation: hk-peek 1.2s ease-in-out;
}

.hk-pet .hk-star,
.hk-stretch .hk-pose {
  animation: hk-pulse .94s ease-in-out;
}

.hk-clap .hk-star {
  animation: hk-pulse .52s ease-in-out 3;
}

.hk-hold .hk-star {
  --hk-lean: 5deg;
  animation: hk-lean .82s ease-out;
}

.hk-giggle .hk-pose {
  animation: hk-bounce .4s ease-in-out 2;
}

.hk-hop .hk-pose,
.hk-cheer .hk-pose {
  animation: hk-bounce .52s ease-in-out;
}

.hk-travel .hk-pose {
  animation: hk-pulse var(--hk-hop-time, .55s) ease-in-out;
}

.hk-sleep .hk-float {
  animation: hk-rest 6.2s ease-in-out infinite;
}

.hk-sleep .hk-eye {
  transform: scaleY(.24);
}

.hk-sleep :is(.hk-ring, .hk-wrist, .hk-leg),
.hk-is-off svg *,
.hk-dragging svg * {
  animation: none;
}

.hk-is-off .hk-mascot svg {
  opacity: .66;
}

.hk-switch {
  min-width: 40px;
  min-height: 24px;
  padding: 0 .55rem;
  border: 1px solid #c5c5c5;
  border-radius: 99px;
  background: #fff;
  color: var(--hk-ink);
  font: 700 .6875rem/1 var(--font-display);
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}

.hk-switch:hover {
  border-color: var(--hk-ink);
}

.hk-switch[aria-pressed="false"] {
  background: var(--hk-ink);
  border-color: #fff;
  color: #fff;
}

.hk-arrow {
  z-index: 4;
  width: 12px;
  height: 10px;
  fill: none;
  stroke: var(--hk-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: left center;
}

.hk-arrow svg {
  display: block;
  filter: drop-shadow(0 0 .75px #fff);
  overflow: visible;
}

.hk-tip,
.hk-card {
  border: 1px solid #d4d4d4;
  background: #fff;
  box-shadow: 0 3px 9px #00000014, 0 10px 28px #00000019;
}

.hk-tip {
  z-index: 3;
  width: max-content;
  max-width: min(16.5rem, calc(100vw - 24px));
  margin: 0;
  padding: .55rem .75rem;
  border-radius: 13px;
  font-size: .875rem;
  line-height: 1.4;
  animation: hk-appear 180ms ease-out both;
}

.hk-card {
  z-index: 4;
  width: min(18.5rem, calc(100vw - 24px));
  border-radius: 18px;
  transform-origin: var(--hk-tail) bottom;
  animation: hk-appear 220ms cubic-bezier(.2, .75, .28, 1) both;
}

.hk-card.hk-obscured {
  clip-path: inset(50%);
}

.hk-card::after {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid #d4d4d4;
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.hk-card[data-tail=""]::after {
  display: none;
}

.hk-card[data-tail="bottom"]::after,
.hk-card[data-tail="top"]::after {
  left: calc(var(--hk-tail) - 6px);
}

.hk-card[data-tail="bottom"]::after {
  bottom: -7px;
  border-top: 0;
  border-left: 0;
}

.hk-card[data-tail="top"] {
  transform-origin: var(--hk-tail) top;
}

.hk-card[data-tail="top"]::after {
  top: -7px;
  border-bottom: 0;
  border-right: 0;
}

.hk-card[data-tail="left"]::after,
.hk-card[data-tail="right"]::after {
  top: calc(var(--hk-tail) - 6px);
}

.hk-card[data-tail="left"] {
  transform-origin: left var(--hk-tail);
}

.hk-card[data-tail="left"]::after {
  left: -7px;
  border-top: 0;
  border-right: 0;
}

.hk-card[data-tail="right"] {
  transform-origin: right var(--hk-tail);
}

.hk-card[data-tail="right"]::after {
  right: -7px;
  border-bottom: 0;
  border-left: 0;
}

.hk-card-content {
  max-height: var(--hk-room, 22rem);
  padding: .95rem 1rem .9rem;
  overflow: auto;
  border-radius: inherit;
}

.hk-kicker,
.hk-title,
.hk-body {
  margin: 0;
}

.hk-kicker {
  color: #555;
  font: 750 .75rem/1.3 var(--font-display);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.hk-title {
  font: 750 1.05rem/1.3 var(--font-display);
  letter-spacing: -.024em;
  text-wrap: pretty;
}

.hk-body {
  margin-top: .35rem;
  color: #333;
  font-size: .9rem;
  line-height: 1.5;
}

.hk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.hk-actions:not(:has(> :not([hidden]))) {
  display: none;
}

.hk-actions > :not([hidden]) {
  margin-top: .7rem;
}

.hk-actions button,
.hk-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: .3rem .75rem;
  border: 1px solid #c8c8c8;
  border-radius: 99px;
  background: #fff;
  color: var(--hk-ink);
  font: 700 .8125rem/1.3 var(--font-display);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms;
}

.hk-actions button:hover:not(:disabled),
.hk-actions a:hover {
  background: #ededed;
  border-color: var(--hk-ink);
}

.hk-actions .hk-go {
  background: var(--hk-ink);
  border-color: var(--hk-ink);
  color: #fff;
}

.hk-actions .hk-go:hover:not(:disabled) {
  background: #333;
  color: #fff;
}

.hk-actions button:disabled {
  opacity: .45;
  cursor: default;
}

[data-hoku-tip]:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}

.hero [data-hoku-tip]:focus-visible,
.page-hero [data-hoku-tip]:focus-visible,
.site-footer [data-hoku-tip]:focus-visible {
  outline-color: #fff;
}

[data-hoku-tour] {
  scroll-margin: 5.5rem;
}

@keyframes hk-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes hk-wrist-sway {
  0%, 60%, 100% { transform: rotate(0); }
  75% { transform: rotate(9deg); }
  88% { transform: rotate(-5deg); }
}

@keyframes hk-foot-rock {
  0%, 54%, 100% { transform: rotate(0); }
  72% { transform: rotate(6deg); }
  85% { transform: rotate(-3deg); }
}

@keyframes hk-wave-wrist {
  0%, 100% { transform: rotate(0); }
  15%, 43%, 72% { transform: rotate(-23deg); }
  29%, 57%, 86% { transform: rotate(19deg); }
}

@keyframes hk-sweep {
  0%, 100% { transform: rotate(0); }
  32% { transform: rotate(5deg); }
  72% { transform: rotate(-4deg); }
}

@keyframes hk-bow {
  0%, 100% { transform: none; }
  42% { transform: translateY(2px) scale(1, .91); }
}

@keyframes hk-lean {
  0%, 100% { transform: none; }
  38%, 63% { transform: rotate(var(--hk-lean, -6deg)); }
}

@keyframes hk-peek {
  0%, 100% { transform: none; }
  25% { transform: translateX(-1.5px) rotate(-5deg); }
  65% { transform: translateX(1.5px) rotate(5deg); }
}

@keyframes hk-pulse {
  0%, 100% { transform: none; }
  48% { transform: scale(1.055); }
}

@keyframes hk-bounce {
  0%, 100% { transform: none; }
  40% { transform: translateY(-4px); }
  78% { transform: translateY(1px); }
}

@keyframes hk-blink {
  0%, 100% { transform: scaleY(1); }
  44%, 58% { transform: scaleY(.16); }
}

@keyframes hk-rest {
  0%, 100% { transform: translateY(1px) scale(.99); }
  50% { transform: translateY(-1px) scale(1.015); }
}

@keyframes hk-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 1080px) {
  .site-header:has(.nav.is-open) ~ .hk :is(.hk-dock, .hk-card, .hk-arrow) {
    visibility: hidden;
  }
}

@media (max-width: 800px) {
  .hk {
    --hk-size: 94px;
  }

  .hk-actions button,
  .hk-actions a {
    min-height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hk *,
  .hk *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .hk {
    display: none;
  }
}
