:root {
  --hunt-blue: #0632b8;
  --hunt-yellow: #fff56a;
  --hunt-pink: #ec62e9;
  --hunt-paper: #fffdf8;
  --hunt-ink: #111111;
}

/* Keep the real MapLibre canvas visible as the board, but remove the normal
   event-map chrome while the game owns the screen. */
.hei-hunt-active .today-map-shell > :not(#today-map) { visibility: hidden; }
.hei-hunt-active .today-main > :not(.today-explorer) { visibility: hidden; }

.hei-hunt {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--hunt-ink);
  font-family: Arial, Helvetica, sans-serif;
}

.hei-hunt::backdrop { background: transparent; }
.hei-hunt:not([open]) { display: none; }

.hei-hunt__canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hei-hunt__top {
  position: absolute;
  z-index: 2;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.hei-hunt__copy,
.hei-hunt__actions,
.hei-hunt__pad,
.hei-hunt__credit { pointer-events: auto; }

.hei-hunt__copy {
  padding: 9px 11px 10px;
  border: 1px solid rgb(17 17 17 / .2);
  border-radius: 10px;
  background: rgb(255 253 248 / .94);
  box-shadow: 0 4px 15px rgb(17 17 17 / .13);
}

.hei-hunt__eyebrow,
.hei-hunt__instructions,
.hei-hunt__score,
.hei-hunt__status,
.hei-hunt__credit { margin: 0; }

.hei-hunt__eyebrow {
  color: var(--hunt-blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
}

.hei-hunt__instructions {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.hei-hunt__actions { display: flex; align-items: center; gap: 6px; }

.hei-hunt__score,
.hei-hunt__icon-button {
  display: grid;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  place-items: center;
  border: 1px solid rgb(17 17 17 / .2);
  border-radius: 999px;
  background: rgb(255 253 248 / .95);
  box-shadow: 0 4px 15px rgb(17 17 17 / .13);
  color: var(--hunt-blue);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.hei-hunt__icon-button {
  width: 42px;
  padding: 0;
  cursor: pointer;
  font-size: 21px;
}

.hei-hunt__icon-button:hover { border-color: var(--hunt-blue); background: var(--hunt-yellow); }

.hei-hunt__status {
  position: absolute;
  z-index: 3;
  top: max(98px, calc(env(safe-area-inset-top) + 84px));
  left: 50%;
  max-width: min(460px, calc(100vw - 40px));
  padding: 8px 12px;
  border-radius: 999px;
  background: rgb(6 50 184 / .92);
  box-shadow: 0 3px 12px rgb(17 17 17 / .15);
  color: var(--hunt-paper);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  transform: translateX(-50%);
}

.hei-hunt__status:empty { display: none; }

/* The board is road-bound, but the thumbstick accepts a full 360° heading.
   The small compass marks remain keyboard and screen-reader fallbacks without
   sitting on top of the drag surface. */
.hei-hunt__pad {
  --stick-x: 0px;
  --stick-y: 0px;
  position: absolute;
  z-index: 3;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 154px;
  height: 154px;
  border: 1px solid rgb(17 17 17 / .26);
  border-radius: 50%;
  background: rgb(255 253 248 / .82);
  box-shadow: 0 6px 20px rgb(17 17 17 / .18);
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: crosshair;
}

.hei-hunt__pad::before {
  position: absolute;
  inset: 19px;
  border: 2px solid rgb(6 50 184 / .2);
  border-radius: 50%;
  content: "";
}

.hei-hunt__stick {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border: 2px solid var(--hunt-blue);
  border-radius: 50%;
  background: var(--hunt-yellow);
  box-shadow: 0 3px 8px rgb(17 17 17 / .2);
  pointer-events: none;
  transform: translate(calc(-50% + var(--stick-x)), calc(-50% + var(--stick-y)));
  transition: transform 120ms cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}

.hei-hunt__pad.is-dragging .hei-hunt__stick { transition: none; }

.hei-hunt__pad button {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: rgb(6 50 184 / .52);
  cursor: default;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.hei-hunt__pad button.is-active { color: var(--hunt-blue); }

.hei-hunt__pad button[data-hei-hunt-direction="up"] { top: 8px; left: 50%; transform: translateX(-50%); }
.hei-hunt__pad button[data-hei-hunt-direction="left"] { top: 50%; left: 8px; transform: translateY(-50%); }
.hei-hunt__pad button[data-hei-hunt-direction="down"] { bottom: 8px; left: 50%; transform: translateX(-50%); }
.hei-hunt__pad button[data-hei-hunt-direction="right"] { top: 50%; right: 8px; transform: translateY(-50%); }

.hei-hunt__credit {
  position: absolute;
  z-index: 3;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: 4px 6px;
  border-radius: 5px;
  background: rgb(255 253 248 / .78);
  color: rgb(17 17 17 / .66);
  font-size: 9px;
  line-height: 1;
}

.hei-hunt__credit a { color: inherit; text-decoration: none; }
.hei-hunt__credit a:hover { color: var(--hunt-blue); text-decoration: underline; }

.hei-hunt__icon-button:focus-visible,
.hei-hunt__pad button:focus-visible { outline: 3px solid var(--hunt-pink); outline-offset: 3px; }

@media (max-width: 520px) {
  .hei-hunt__top { gap: 8px; }
  .hei-hunt__copy { max-width: calc(100vw - 178px); }
  .hei-hunt__instructions { font-size: 11px; }
  .hei-hunt__actions { gap: 4px; }
  .hei-hunt__score,
  .hei-hunt__icon-button { min-width: 38px; width: 38px; height: 38px; padding: 0; }
  .hei-hunt__score { width: auto; min-width: 45px; padding: 0 8px; }
  .hei-hunt__status { top: max(87px, calc(env(safe-area-inset-top) + 73px)); font-size: 11px; }
  .hei-hunt__pad { width: 148px; height: 148px; }
  .hei-hunt__credit { right: auto; left: max(12px, env(safe-area-inset-left)); max-width: 245px; }
}

@media (prefers-reduced-motion: reduce) {
  .hei-hunt *,
  .hei-hunt *::before,
  .hei-hunt *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
