/*
 * Huskies — Dividal Night Run · styles
 *
 * Visual identity: a dark Arctic night. Frosted-glass navy panels, aurora-green
 * (go / good) and warm lantern-amber (attention / action) accents, a red-orange
 * for danger, and the musher's red hat as a brand note. Rounded friendly type
 * (Nunito, system fallbacks). All text is English except the dog commands
 * Haw! / Gee!; big labels with a small helper line underneath.
 *
 * Sections: tokens · base (core) · loading · HUD common · buttons · title ·
 * yard · dog card · ride · banner/toasts/flash · win · responsive ·
 * reduced motion · low quality.
 */

/* ------------------------------------------------------------------ tokens */
:root {
  --night: #050d16;
  --ink: #f0f7ff;
  --ink-2: #b8cadb;
  --ink-3: #8299ae;
  --glass-a: rgba(22, 43, 64, 0.8);
  --glass-b: rgba(8, 19, 32, 0.86);
  --glass-solid-a: rgba(20, 39, 58, 0.93);
  --glass-solid-b: rgba(8, 18, 30, 0.95);
  --edge: rgba(176, 228, 255, 0.17);
  --edge-hi: rgba(214, 246, 255, 0.3);
  --aurora: #63f3b8;
  --aurora-2: #2fcf9f;
  --aurora-ink: #03261b;
  --teal: #41d8d0;
  --violet: #b394ff;
  --pink: #ff86cf;
  --amber: #ffbe55;
  --amber-2: #ff963a;
  --amber-ink: #2b1503;
  --danger: #ff5c3f;
  --danger-2: #e8371d;
  --hat: #d8262f;
  --accent: var(--aurora);
  --warn: var(--amber);
  --panel: var(--glass-b);
  --panel-edge: var(--edge);
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', 'Varela Round', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gap: 16px;
}

/* -------------------------------------------------------------- base (core) */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#view {
  position: absolute;
  inset: 0;
}

#view canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

/* The HUD overlay never eats pointer events itself; only its controls do. */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: var(--font);
  line-height: 1.25;
}

#hud button,
#hud input,
#hud select,
#hud a,
#hud .interactive,
#hud [role='slider'],
#hud .hud-card {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

kbd {
  font-family: var(--mono);
}

/* ---------------------------------------------------------------- loading */
#loading {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #0f3440 0%, #071827 45%, var(--night) 100%);
  transition: opacity 0.7s ease;
}

#loading.done {
  opacity: 0;
  pointer-events: none;
}

.loading-sky,
.loading-sky i {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.loading-sky .aur {
  inset: -20% -30% auto;
  height: 70%;
  opacity: 0.55;
  background:
    radial-gradient(40% 30% at 30% 60%, rgba(99, 243, 184, 0.55), transparent 70%),
    radial-gradient(35% 26% at 62% 48%, rgba(65, 216, 208, 0.42), transparent 70%),
    radial-gradient(30% 24% at 78% 30%, rgba(179, 148, 255, 0.35), transparent 70%);
  animation: aurora-drift 9s ease-in-out infinite alternate;
}

.loading-sky .aur.a2 {
  top: -10%;
  opacity: 0.35;
  transform: scaleX(-1);
  animation-duration: 13s;
  animation-delay: -4s;
}

.loading-sky .stars {
  opacity: 0.7;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 8%, #d8ecff, transparent),
    radial-gradient(1.4px 1.4px at 46% 22%, #fff, transparent),
    radial-gradient(1px 1px at 63% 12%, #cfe6ff, transparent),
    radial-gradient(1.3px 1.3px at 81% 20%, #fff, transparent),
    radial-gradient(1px 1px at 92% 6%, #fff, transparent),
    radial-gradient(1px 1px at 6% 40%, #cfe6ff, transparent),
    radial-gradient(1.2px 1.2px at 88% 44%, #fff, transparent),
    radial-gradient(1px 1px at 36% 36%, #fff, transparent),
    radial-gradient(1px 1px at 72% 34%, #d8ecff, transparent);
}

@keyframes aurora-drift {
  from {
    transform: translateX(-4%) scaleY(0.9) skewX(-6deg);
  }
  to {
    transform: translateX(5%) scaleY(1.12) skewX(6deg);
  }
}

.loading-inner {
  position: relative;
  width: min(440px, calc(100vw - 48px));
  text-align: center;
}

.loading-title {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 4.4rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  background: linear-gradient(100deg, #8bffd0 10%, #5ee7d6 45%, #b9a0ff 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(99, 243, 184, 0.35));
}

.loading-sub {
  margin: 0.5rem 0 4.4rem;
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.loading-track {
  position: relative;
  height: 8px;
  margin: 0 8px;
}

.loading-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  border-radius: 4px;
  background: linear-gradient(90deg, #2fcf9f, #63f3b8 60%, #b394ff);
  box-shadow: 0 0 12px rgba(99, 243, 184, 0.6);
  transition: width 0.35s ease;
}

.loading-paws {
  position: absolute;
  left: 0;
  top: 14px;
  height: 12px;
  width: calc(var(--p, 0) * 100% - 40px);
  max-width: 100%;
  opacity: 0.32;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 12'%3E%3Cg fill='%23cfe8ff'%3E%3Cellipse cx='5' cy='4' rx='2.2' ry='1.8'/%3E%3Ccircle cx='2.4' cy='1.6' r='.8'/%3E%3Ccircle cx='4.2' cy='.8' r='.8'/%3E%3Ccircle cx='6.2' cy='.9' r='.8'/%3E%3Ccircle cx='7.8' cy='2' r='.8'/%3E%3Cellipse cx='19' cy='9' rx='2.2' ry='1.8'/%3E%3Ccircle cx='16.4' cy='6.6' r='.8'/%3E%3Ccircle cx='18.2' cy='5.8' r='.8'/%3E%3Ccircle cx='20.2' cy='5.9' r='.8'/%3E%3Ccircle cx='21.8' cy='7' r='.8'/%3E%3C/g%3E%3C/svg%3E")
    repeat-x left center / 28px 12px;
  transition: width 0.35s ease;
}

.loading-husky {
  position: absolute;
  left: calc(var(--p, 0) * 100%);
  bottom: 2px;
  width: 118px;
  height: 63px;
  transform: translateX(-80%);
  transition: left 0.35s ease;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.loading-husky .lh-dark {
  fill: #48505f;
}

.loading-husky .lh-light {
  fill: #eef3f8;
}

.loading-husky .lh-leg path {
  fill: none;
  stroke: #48505f;
  stroke-width: 6.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading-husky .lh-far path {
  stroke: #2c323d;
}

.loading-husky .lh-leg .lh-sock {
  stroke: #eef3f8;
  stroke-width: 6.6;
}

.loading-husky .lh-far .lh-sock {
  stroke: #b9c4d0;
}

.loading-husky .lh-ear {
  fill: #f0b8b8;
}

.loading-husky .lh-tail {
  fill: none;
  stroke: #5a6272;
  stroke-width: 6;
  stroke-linecap: round;
}

.loading-husky .lh-harness {
  fill: none;
  stroke: var(--hat);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.loading-husky .lh-eye {
  fill: #8fd3ff;
}

.loading-husky .lh-nose {
  fill: #121216;
}

.loading-husky .lh-tongue {
  fill: #ff7b8e;
}

.loading-husky .lh-puff {
  fill: #e8f4ff;
  opacity: 0;
}

.loading-husky .lh-body {
  animation: lh-bob 0.44s ease-in-out infinite;
}

.loading-husky .lh-front {
  transform-origin: 75px 37px;
}

.loading-husky .lh-back {
  transform-origin: 36px 35px;
}

.loading-husky .lh-near.lh-front,
.loading-husky .lh-far.lh-front {
  animation: lh-leg-a 0.44s ease-in-out infinite;
}

.loading-husky .lh-near.lh-back,
.loading-husky .lh-far.lh-back {
  animation: lh-leg-b 0.44s ease-in-out infinite;
}

.loading-husky .lh-far {
  animation-delay: -0.08s !important;
}

.loading-husky .lh-tail {
  transform-origin: 31px 26px;
  animation: lh-tail 0.44s ease-in-out infinite;
}

.loading-husky .lh-head {
  transform-origin: 84px 26px;
  animation: lh-head 0.44s ease-in-out infinite;
}

.loading-husky .lh-puff.p1 {
  animation: lh-puff 0.44s ease-out infinite;
}

.loading-husky .lh-puff.p2 {
  animation: lh-puff 0.44s ease-out infinite;
  animation-delay: -0.22s;
}

@keyframes lh-bob {
  0%,
  100% {
    transform: translateY(1px) rotate(1.5deg);
  }
  50% {
    transform: translateY(-3px) rotate(-2deg);
  }
}

@keyframes lh-leg-a {
  0%,
  100% {
    transform: rotate(36deg);
  }
  50% {
    transform: rotate(-44deg);
  }
}

@keyframes lh-leg-b {
  0%,
  100% {
    transform: rotate(-40deg);
  }
  50% {
    transform: rotate(34deg);
  }
}

@keyframes lh-tail {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(8deg);
  }
}

@keyframes lh-head {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes lh-puff {
  0% {
    opacity: 0.8;
    transform: translate(0, 0) scale(0.6);
  }
  100% {
    opacity: 0;
    transform: translate(-16px, -6px) scale(1.6);
  }
}

.loading-text {
  margin: 2.2rem 0 0;
  min-height: 2.6em;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
}

.loading-text small {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
}

.loading-error {
  color: var(--danger) !important;
}

/* ------------------------------------------------- error & debug (core) */
#error-overlay {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  max-height: 45vh;
  overflow: auto;
  padding: 10px 12px;
  background: rgba(120, 0, 0, 0.92);
  border: 2px solid #ff4040;
  border-radius: 8px;
  color: #fff;
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
  pointer-events: auto;
}

#error-overlay strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

#error-overlay pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

#error-overlay button {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* (family playtest) the title's Graphics: Detailed / Fast switch — a small button beside Start */
.ht-actions .hb.ht-gfx {
  flex: none;
  width: auto;
  min-width: 0;
  margin-left: 10px;
  padding: 4px 40px 4px 12px; /* (room for the G key chip) */
  gap: 6px;
  border-radius: 16px;
}

@media (hover: none) and (pointer: coarse) {
  .ht-actions .hb.ht-gfx {
    padding-right: 12px; /* (no key chips on touch screens) */
  }
}

.hb.ht-gfx .hb-no {
  font-size: 0.95rem;
}

.hb.ht-gfx .hb-en {
  font-size: 0.6rem;
}

.hb.ht-gfx .hb-ico {
  width: 20px;
  height: 20px;
  color: var(--amber);
}

/* (family playtest) the players' version of an error: a short friendly note, no stack trace */
#error-friendly {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1000;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(12, 26, 40, 0.94);
  border: 1px solid rgba(176, 228, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  color: #e9f2ff;
  font: 600 0.95rem/1.35 Nunito, system-ui, sans-serif;
  pointer-events: auto;
}

#error-friendly strong {
  font-size: 1.05rem;
  font-weight: 800;
}

#error-friendly .ef-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

#error-friendly button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(176, 228, 255, 0.4);
  border-radius: 12px;
  background: rgba(124, 200, 255, 0.18);
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#error-friendly .ef-close {
  padding: 0 12px;
  background: none;
}

#loading.is-failed .loading-track {
  opacity: 0.35;
  filter: grayscale(1);
}

#loading.is-failed .loading-text b {
  display: block;
}

#debug-overlay {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 900;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  color: #b8ffd8;
  font: 11px/1.35 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
  pointer-events: none;
}

/* -------------------------------------------------------------- HUD common */
.hud-root .off {
  display: none !important;
}

/* Sections and cards fade in when they appear. */
.hud-sec,
.hud-card,
.hud-portrait,
.hud-scrim {
  /* "backwards", not "both": a forwards-filling animation stays "active" for ever and
     keeps a full-screen compositor layer alive. */
  animation: hud-in 0.32s ease-out backwards;
}

/*
 * Each HUD cluster gets its own small compositor layer. Without this Chrome squashes
 * everything that overlaps the WebGL canvas into one viewport-sized layer, which is
 * re-blended every frame (very costly with software rendering).
 */
.hud-portrait,
.hud-mute,
.hud-card,
.yard-panel,
.yard-actions,
.hud-dogcard,
.ride-stats,
.ride-compass,
.ride-alert,
.ride-steer,
.ride-actions,
.ride-brake,
.ride-team,
.ride-skip,
.hud-banner,
.hud-toasts {
  will-change: transform;
}

@keyframes hud-in {
  from {
    opacity: 0;
  }
}

/* Glass surfaces */
.hud-card,
.yard-panel,
.ya-hint,
.hud-dogcard,
.ride-stats,
.rc-dist,
.ride-alert,
.hud-toast,
.hud-banner,
.ride-brake,
.hb {
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Frosted blur only on the larger panels (each blur re-runs every frame over a live
   WebGL canvas); buttons and toasts are opaque enough without it. */
.yard-panel,
.ya-hint,
.hud-dogcard,
.ride-stats,
.rc-dist,
.ride-alert,
.ride-brake,
.hb-steer {
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
  backdrop-filter: blur(10px) saturate(1.25);
}

.hb {
  background: linear-gradient(180deg, rgba(24, 46, 68, 0.88), rgba(9, 20, 33, 0.92));
}

.hud-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 80% at 50% 50%, rgba(3, 10, 18, 0.62), rgba(3, 10, 18, 0.3) 70%, rgba(3, 10, 18, 0.15));
}

.hud-fade {
  position: absolute;
  inset: 0;
  background: #02060b;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.hud-fade.on {
  opacity: 1;
}

.fav {
  font-size: 0.85em;
  margin-left: 0.18em;
  font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* Generic small tag / chip */
.tag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(99, 243, 184, 0.14);
  color: var(--aurora);
  border: 1px solid rgba(99, 243, 184, 0.3);
}

.tag small {
  font-weight: 600;
  opacity: 0.8;
  font-size: 0.68rem;
}

.tag.loan {
  background: rgba(255, 190, 85, 0.16);
  color: var(--amber);
  border-color: rgba(255, 190, 85, 0.4);
}

/* --------------------------------------------------------------- buttons */
.hb {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 56px;
  min-height: 56px;
  margin: 0;
  padding: 8px 46px 8px 14px;
  border-radius: 16px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    filter 0.2s ease,
    opacity 0.22s ease,
    transform 0.22s ease,
    display 0.22s allow-discrete;
}

.hb-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  color: var(--aurora);
}

.hb-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hb-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.08;
}

.hb-no {
  font-weight: 850;
  font-size: 1.08rem;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.hb-en {
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

.hb-en:empty {
  display: none;
}

.hb-key {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-2);
  background: rgba(3, 10, 18, 0.55);
  border: 1px solid var(--edge-hi);
  border-bottom-width: 2px;
  white-space: nowrap;
}

@media (hover: hover) {
  .hb:hover:not(:disabled) {
    border-color: var(--edge-hi);
    filter: brightness(1.12);
  }
}

.hb:active:not(:disabled) {
  transform: scale(0.96);
}

.hb:disabled {
  filter: saturate(0.4);
  cursor: default;
}

/* Dim the content, not the panel: a see-through disabled button let the yard show through its label. */
.hb:disabled > * {
  opacity: 0.45;
}

.hb:focus-visible,
.rb-slider:focus-visible,
.yp-toggle:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 3px;
}

/* Contextual buttons fade/scale in and out. */
.hb.off {
  opacity: 0;
  transform: translateY(12px) scale(0.92);
}

@starting-style {
  .hb:not(.off) {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
}

/* Primary: aurora green */
.hb-primary {
  background: linear-gradient(180deg, #8cf9cd, #34d2a2 55%, #22b88c);
  border-color: rgba(200, 255, 232, 0.75);
  color: var(--aurora-ink);
  box-shadow: 0 8px 26px rgba(47, 207, 159, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.65), inset 0 -2px 0 rgba(0, 60, 40, 0.25);
}

.hb-primary .hb-ico,
.hb-amber .hb-ico {
  color: currentColor;
}

.hb-primary .hb-en {
  color: rgba(3, 38, 27, 0.72);
}

.hb-primary .hb-key {
  color: var(--aurora-ink);
  background: rgba(3, 38, 27, 0.12);
  border-color: rgba(3, 38, 27, 0.32);
}

/* Amber: lantern light */
.hb-amber {
  background: linear-gradient(180deg, #ffd27a, #ffaa45 55%, #f48a2c);
  border-color: rgba(255, 228, 170, 0.8);
  color: var(--amber-ink);
  box-shadow: 0 8px 24px rgba(255, 150, 58, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 0 rgba(90, 40, 0, 0.25);
}

.hb-amber .hb-en {
  color: rgba(43, 21, 3, 0.72);
}

.hb-amber .hb-key {
  color: var(--amber-ink);
  background: rgba(43, 21, 3, 0.12);
  border-color: rgba(43, 21, 3, 0.3);
}

.hb-big {
  min-height: 64px;
  padding: 10px 62px 10px 18px;
  border-radius: 18px;
}

.hb-big .hb-no {
  font-size: 1.3rem;
}

.hb-big .hb-ico {
  width: 30px;
  height: 30px;
}

.hb-wide {
  width: 100%;
}

/* Round icon button (mute) */
.hb-round {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

.hb-round .hb-txt {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.hb-round .hb-ico {
  width: 26px;
  height: 26px;
  color: var(--ink);
}

.hb-round .hb-key {
  top: auto;
  bottom: -6px;
  right: -4px;
  transform: none;
  min-width: 20px;
  height: 18px;
  font-size: 0.6rem;
  padding: 0 5px;
  background: #0a1622;
}

.hud-mute {
  position: absolute;
  z-index: 7;
  top: calc(var(--gap) + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
}

.hud-mute.is-muted .hb-ico {
  color: var(--ink-3);
}

/*
 * Attention pulses are drawn by a ring pseudo-element that only animates
 * transform + opacity (compositor-only: no repaint per frame, cheap even with
 * software rendering). --ring sets the colour.
 */
.hb::after,
.ride-alert::after,
.ride-brake::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--ring, rgba(255, 190, 85, 0.85));
  opacity: 0;
  pointer-events: none;
}

.hb.urge::after {
  animation: ring 1.6s ease-out infinite;
}

@keyframes ring {
  0% {
    opacity: 0.95;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.05, 1.16);
  }
}

/* ------------------------------------------------------------- portrait */
.hud-portrait {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(var(--gap) + var(--safe-t));
  z-index: 2;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  background: #10283a;
  border: 3px solid rgba(240, 247, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.35), 0 10px 26px rgba(0, 0, 0, 0.5);
}

.hud-portrait svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ----------------------------------------------------------------- cards */
.hud-card {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100% - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px 28px 24px;
  border-radius: 26px;
  border-color: rgba(176, 228, 255, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  scrollbar-width: thin;
  /* Nearly opaque already; a backdrop blur on a scrolling card only costs (and can band). */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: linear-gradient(180deg, rgba(20, 40, 60, 0.9), rgba(8, 18, 30, 0.93));
}

/* Aurora hairline along the top edge of cards */
.hud-card::before {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--aurora) 25%, var(--teal) 55%, var(--violet) 80%, transparent);
  opacity: 0.85;
}

/* ----------------------------------------------------------------- title */
.ht-head,
.hw-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.ht-portrait,
.hw-portrait {
  flex: none;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(240, 247, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(99, 243, 184, 0.3), 0 0 34px rgba(99, 243, 184, 0.28), 0 12px 30px rgba(0, 0, 0, 0.5);
}

.ht-portrait svg,
.hw-portrait svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ht-names {
  min-width: 0;
}

.ht-name {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 3.9rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #9dffd6 5%, #63f3b8 35%, #5ee2dc 60%, #c0a6ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(99, 243, 184, 0.28));
}

.ht-sub {
  margin: 6px 0 0;
  color: var(--amber);
  font-weight: 850;
  font-size: 0.86rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.ht-tag {
  margin: 12px 0 0;
  font-weight: 750;
  font-size: 1.02rem;
  color: var(--ink);
}

.ht-tag small,
.hw-sub small {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink-2);
}

.ht-howto {
  list-style: none;
  margin: 20px 0 0;
  padding: 14px 16px;
  display: grid;
  gap: 11px;
  border-radius: 18px;
  background: rgba(3, 10, 18, 0.35);
  border: 1px solid rgba(176, 228, 255, 0.1);
}

.ht-howto li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ht-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--aurora);
  background: rgba(99, 243, 184, 0.12);
  border: 1px solid rgba(99, 243, 184, 0.22);
}

.ht-ico svg {
  width: 20px;
  height: 20px;
}

.ht-howto li:nth-child(1) .ht-ico {
  color: var(--amber);
  background: rgba(255, 190, 85, 0.13);
  border-color: rgba(255, 190, 85, 0.28);
}

.ht-howto b {
  display: block;
  font-weight: 850;
  font-size: 0.98rem;
}

.ht-howto small {
  display: block;
  margin-top: 1px;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
}

.ht-howto kbd,
.ya-hint kbd {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  min-width: 20px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  color: var(--ink-2);
  background: rgba(3, 10, 18, 0.6);
  border: 1px solid var(--edge-hi);
  border-bottom-width: 2px;
  vertical-align: 2px;
}

.ht-actions,
.hw-actions {
  position: sticky;
  bottom: -24px;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin: 12px -8px -8px;
  padding: 8px 8px 8px;
  border-radius: 20px;
}

/* (the title and end cards take the focus when they open, as dialogs: no ring round the whole card) */
.hud-title:focus,
.hud-win:focus {
  outline: none;
}

/* A card that has to scroll: a "More ↓" tab above the sticky main button until the bottom is reached.
   (L2 polish) The button is 44 px tall for fingers; the pill drawn inside it is slimmer. It floats on a
   fade over the card's last lines (they fade out under it), so it never sits on a word or a chip you
   can still read; when the button row has room beside the buttons (a wide card on a short screen,
   `.more-side`, measured in hud.js) it sits there instead and nothing fades. */
.hc-more {
  display: none;
  position: absolute;
  left: 50%;
  top: -38px;
  height: 44px;
  translate: -50% 0;
  isolation: isolate;
  align-items: center;
  gap: 4px;
  padding: 0 14px 0 16px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  cursor: pointer;
  animation: hc-more-bob 1.6s ease-in-out infinite;
}

.hc-more::before {
  content: '';
  position: absolute;
  inset: 8px 0;
  z-index: -1;
  border-radius: 999px;
  border: 1px solid rgba(176, 228, 255, 0.45);
  background: rgba(14, 34, 54, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.hc-more svg {
  width: 16px;
  height: 16px;
}

.has-more .hc-more {
  display: inline-flex;
}

.has-more:not(.more-side) .ht-actions::before,
.has-more:not(.more-side) .hw-actions::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -64px;
  height: 76px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(9, 20, 33, 0), rgba(9, 20, 33, 0.9) 30px, rgba(9, 20, 33, 0.95));
}

.more-side .hc-more {
  top: 50%;
  left: auto;
  right: 10px;
  translate: 0 -50%;
}

@keyframes hc-more-bob {
  50% {
    transform: translateY(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hc-more {
    animation: none;
  }
}

/* When a card has to scroll (small screens), its main button stays in reach. */
@media (max-height: 760px), (max-width: 640px) {
  .ht-actions,
  .hw-actions {
    background: linear-gradient(180deg, rgba(9, 20, 33, 0), rgba(9, 20, 33, 0.92) 30%);
  }
}

.ht-actions .hb,
.hw-actions .hb {
  min-width: 240px;
  justify-content: center;
}

/* ------------------------------------------------------------------ yard */
.hud-sec {
  position: absolute;
  inset: 0;
}

.yard-panel {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(124px + var(--safe-t));
  width: 270px;
  padding: 14px 14px 12px;
  border-radius: 20px;
}

.yp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.yp-count {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.yp-k {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.yp-n {
  margin-top: 3px;
  font-size: 1.85rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.yp-en {
  margin-top: 3px;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yard-panel.is-ready .yp-n {
  color: var(--aurora);
}

.yp-tie {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 14px;
  background: rgba(255, 190, 85, 0.12);
  border: 1px solid rgba(255, 190, 85, 0.38);
  color: var(--amber);
}

.yp-tie.tied {
  background: rgba(99, 243, 184, 0.12);
  border-color: rgba(99, 243, 184, 0.4);
  color: var(--aurora);
}

.yp-tie-ico {
  display: grid;
  width: 24px;
  height: 24px;
}

.yp-tie-ico svg {
  width: 100%;
  height: 100%;
}

.yp-tie-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.yp-tie-txt b {
  font-weight: 850;
  font-size: 0.92rem;
  white-space: nowrap;
}

.yp-tie-txt small {
  font-size: 0.64rem;
  font-weight: 700;
  opacity: 0.8;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.yp-toggle {
  display: none;
}

.yp-meter {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin: 12px 0 10px;
}

.yp-meter i {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: rgba(176, 228, 255, 0.14);
  transition: background 0.25s ease;
}

.yp-meter i.on {
  background: linear-gradient(90deg, var(--aurora-2), var(--aurora));
  box-shadow: 0 0 6px rgba(99, 243, 184, 0.45);
}

.yp-meter i.min::after {
  content: '';
  position: absolute;
  right: -2.5px;
  top: -4px;
  bottom: -4px;
  width: 2px;
  border-radius: 1px;
  background: var(--amber);
  opacity: 0.8;
}

.yp-meter i.hide {
  visibility: hidden;
}

.yp-rows {
  display: grid;
  gap: 5px;
}

.yp-row {
  display: grid;
  grid-template-columns: 50px 1fr 2px 1fr;
  align-items: center;
  gap: 6px;
}

.yp-label {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.yp-label b {
  font-size: 0.8rem;
  font-weight: 850;
  color: var(--ink);
}

.yp-label small {
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.yp-row:first-child .yp-label b {
  color: var(--amber);
}

.yp-line {
  align-self: stretch;
  margin: -4px 0;
  border-radius: 1px;
  background: rgba(176, 228, 255, 0.3);
}

.yp-slot {
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  background: none;
  border: 1.5px dashed rgba(176, 228, 255, 0.22);
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}

/* the Tie button while Dau is on her way to the tree */
.hb.is-tying {
  opacity: 0.78;
  filter: saturate(0.7);
}

/* (the harness spots are buttons: fill or empty one from the keyboard) */
.yp-slot:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

.yp-slot .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yp-slot .fav {
  flex: none;
}

/* (v7 fix) a dog whose place in the ride differs from its row's name (an odd team): its own role on its spot */
.yp-slot .rl {
  flex: none;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 6px;
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(176, 228, 255, 0.16);
  color: var(--ink-2, var(--ink));
}

.yp-slot .rl.is-wheel {
  background: rgba(255, 196, 92, 0.22);
}

.yp-slot .rl.is-lead {
  background: rgba(255, 196, 92, 0.32);
}

.yp-slot .empty {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.yp-slot.filled {
  border: 1.5px solid rgba(99, 243, 184, 0.45);
  background: rgba(99, 243, 184, 0.14);
  color: var(--ink);
}

.yp-sled {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 0.72rem;
  font-weight: 800;
}

.yp-sled svg {
  width: 22px;
  height: 22px;
  color: var(--hat);
}

.yard-actions {
  position: absolute;
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ya-hint {
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px;
  pointer-events: none;
}

.ya-hint.empty {
  display: none;
}

.ya-hint b {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--amber);
}

.ya-hint small {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-2);
}

.ya-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ya-btns .hb {
  min-height: 62px;
}

.ya-btns .hb.ready::after {
  --ring: rgba(99, 243, 184, 0.9);
  animation: ring 1.8s ease-out infinite;
}

/* -------------------------------------------------------------- dog card */
.hud-dogcard {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  width: 300px;
  padding: 14px 16px 14px;
  border-radius: 20px;
  transform: translate(var(--x, 0px), var(--y, 0px));
  pointer-events: none;
  transition: opacity 0.18s ease, display 0.18s allow-discrete;
  border-color: rgba(176, 228, 255, 0.24);
}

.hud-dogcard.off {
  opacity: 0;
}

@starting-style {
  .hud-dogcard:not(.off) {
    opacity: 0;
  }
}

.dc-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dc-face {
  flex: none;
  width: 56px;
  height: 56px;
  padding: 3px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #1d3e57, #0b1a29);
  border: 1px solid var(--edge);
}

.dc-id {
  min-width: 0;
}

.dc-id h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.dc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.dc-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 12px 0 10px;
}

.dc-traits .chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: help;
  background: rgba(176, 228, 255, 0.1);
  border: 1px solid rgba(176, 228, 255, 0.16);
}

.dc-traits .chip.lead {
  background: rgba(255, 190, 85, 0.16);
  border-color: rgba(255, 190, 85, 0.45);
  color: var(--amber);
}

.dc-bars {
  display: grid;
  gap: 6px;
}

.dc-bar {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 8px;
}

.dc-bl {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-2);
}

.dc-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(176, 228, 255, 0.12);
  overflow: hidden;
}

.dc-track i {
  display: block;
  height: 100%;
  width: calc(8% + var(--v, 0) * 92%);
  border-radius: 4px;
  background: linear-gradient(90deg, var(--aurora-2), var(--aurora));
}

.dc-bar:nth-child(2) .dc-track i {
  background: linear-gradient(90deg, #3fb7e8, #7fd8ff);
}

.dc-bar:nth-child(3) .dc-track i {
  background: linear-gradient(90deg, #f0a03a, var(--amber));
}

.dc-coat {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 11px;
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--ink-2);
}

.dc-coat b {
  color: var(--ink);
  font-weight: 850;
}

.dc-sw,
.dc-eyes {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dc-sw i,
.dc-eyes i {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
}

.dc-eyes {
  margin-left: auto;
}

.dc-eyes small {
  margin-left: 3px;
  font-size: 0.66rem;
}

.dc-bio {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(3, 10, 18, 0.35);
  font-size: 0.84rem;
  font-weight: 650;
  font-style: italic;
  color: var(--ink);
}

.dc-bio::before {
  content: '“';
  color: var(--aurora);
  font-weight: 900;
  margin-right: 2px;
}

.dc-bio::after {
  content: '”';
  color: var(--aurora);
  font-weight: 900;
  margin-left: 1px;
}

.hud-dogcard.docked {
  left: calc(12px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  top: calc(100px + var(--safe-t));
  width: auto;
  transform: none;
}

/* ------------------------------------------------------------------ ride */
.ride-stats {
  position: absolute;
  left: calc(var(--gap) + 66px + var(--safe-l));
  top: calc(var(--gap) + 16px + var(--safe-t));
  min-width: 150px;
  padding: 8px 16px 8px 38px;
  border-radius: 0 20px 20px 0;
  border-left: 0;
}

.rs-speed {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
}

.rs-v {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 1.2em;
}

.rs-u {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-2);
}

.rs-speed.hot .rs-v {
  color: var(--amber);
}

.rs-time {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.rs-ico {
  display: grid;
  width: 15px;
  height: 15px;
}

.rs-ico svg {
  width: 100%;
  height: 100%;
}

.rs-stamina {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.rs-sl {
  display: flex;
  flex-direction: column;
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
  color: var(--amber);
}

.rs-sl small {
  font-size: 0.54rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rs-bar {
  flex: 1;
  min-width: 70px;
  height: 8px;
  border-radius: 4px;
  background: rgba(176, 228, 255, 0.14);
  overflow: hidden;
}

.rs-bar i {
  display: block;
  height: 100%;
  width: calc(var(--v, 1) * 100%);
  border-radius: 4px;
  background: linear-gradient(90deg, var(--amber-2), var(--amber));
}

.rs-stamina.low .rs-bar i {
  background: linear-gradient(90deg, var(--danger-2), var(--danger));
}

/* Compass */
.ride-compass {
  position: absolute;
  left: 50%;
  top: calc(12px + var(--safe-t));
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rc-dial {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  /* A box-shadow (rastered once), not filter: drop-shadow — a filter over the rotating
     needle layer would be re-applied by the compositor every frame. */
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.rc-ring,
.rc-needle,
.rc-needle svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rc-face {
  fill: rgba(9, 20, 33, 0.82);
  stroke: rgba(176, 228, 255, 0.3);
  stroke-width: 1.5;
}

.rc-ticks line {
  stroke: rgba(176, 228, 255, 0.45);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.rc-needle {
  transition: transform 0.15s linear;
  will-change: transform;
}

.rc-arrow {
  fill: var(--aurora);
  stroke: #d9fff0;
  stroke-width: 1;
  stroke-linejoin: round;
}

.rc-tail {
  fill: rgba(176, 228, 255, 0.35);
}

.rc-hub {
  fill: #f0f7ff;
}

.rc-dist {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.rc-hut {
  display: grid;
  width: 18px;
  height: 18px;
  color: var(--ink-2);
}

.rc-hut svg {
  width: 100%;
  height: 100%;
}

.rc-no {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--ink-2);
}

.rc-km {
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* Alert line under the compass */
.ride-alert {
  position: absolute;
  left: 50%;
  top: calc(134px + var(--safe-t));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 20px 10px 12px;
  border-radius: 18px;
  transition: opacity 0.25s ease, transform 0.25s ease, display 0.25s allow-discrete;
}

.ride-alert.off {
  opacity: 0;
  transform: translateY(-8px);
}

@starting-style {
  .ride-alert:not(.off) {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.ra-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(176, 228, 255, 0.12);
  color: var(--ink);
}

.ra-ico svg {
  width: 22px;
  height: 22px;
}

.ra-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ra-txt b {
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.1;
}

.ra-txt small {
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-2);
}

.ride-alert.good .ra-ico {
  background: rgba(99, 243, 184, 0.18);
  color: var(--aurora);
}

.ride-alert.good {
  border-color: rgba(99, 243, 184, 0.45);
}

.ride-alert.warn {
  border-color: rgba(255, 190, 85, 0.55);
}

.ride-alert.warn .ra-ico {
  background: rgba(255, 190, 85, 0.18);
  color: var(--amber);
}

.ride-alert.warn b {
  color: var(--amber);
}

.ride-alert.danger {
  background: linear-gradient(180deg, rgba(92, 24, 16, 0.9), rgba(52, 12, 10, 0.92));
  border-color: rgba(255, 120, 90, 0.65);
}

.ride-alert.danger .ra-ico {
  background: rgba(255, 92, 63, 0.25);
  color: #ff8a6a;
}

.ride-alert.danger b {
  color: #ffd2c4;
}

.ride-alert.hot::after,
.ride-brake.urge::after {
  --ring: rgba(255, 150, 58, 0.9);
  animation: ring 0.75s ease-out infinite;
}

/* Voice commands: Whoa! / On by! (compact row) above Haw! (left) / Gee! (right) */
.ride-steer {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  bottom: calc(var(--gap) + var(--safe-b));
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    'w o'
    'l r';
  gap: 10px 12px;
}

.ride-steer [data-id='whoa'] {
  grid-area: w;
}

.ride-steer [data-id='onby'] {
  grid-area: o;
}

.ride-steer [data-id='left'] {
  grid-area: l;
}

.ride-steer [data-id='right'] {
  grid-area: r;
}

.hb-steer {
  width: 122px;
  height: 116px;
  padding: 12px 8px 10px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: center;
  border-radius: 22px;
}

.hb-steer .hb-ico {
  width: 34px;
  height: 34px;
  color: var(--aurora);
}

.hb-steer .hb-txt {
  align-items: center;
}

.hb-steer .hb-no {
  font-size: 1.2rem;
}

.hb-steer .hb-key {
  top: 7px;
  right: 7px;
  transform: none;
  height: 20px;
  min-width: 0;
  font-size: 0.62rem;
}

.hb-steer.hb-steer-r .hb-key {
  right: auto;
  left: 7px;
}

.hb-paws {
  display: flex;
  justify-content: center;
  gap: 3px;
  height: 16px;
  margin-top: 5px;
}

.hb-paws i {
  display: block;
  width: 16px;
  height: 16px;
  color: var(--amber);
  opacity: 0;
  transform: scale(0.3) rotate(-20deg);
  transition: opacity 0.15s ease, transform 0.22s cubic-bezier(0.3, 1.6, 0.5, 1), color 0.2s ease;
}

.hb-paws i:nth-child(even) {
  translate: 0 -3px;
}

.hb-paws svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hb[data-pips='1'] .hb-paws i:nth-child(-n + 1),
.hb[data-pips='2'] .hb-paws i:nth-child(-n + 2),
.hb[data-pips='3'] .hb-paws i:nth-child(-n + 3),
.hb[data-pips='4'] .hb-paws i:nth-child(-n + 4) {
  opacity: 1;
  transform: none;
}

.hb-steer.is-accepted {
  border-color: rgba(99, 243, 184, 0.85);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.45), 0 0 30px rgba(99, 243, 184, 0.45), var(--shadow);
}

.hb-steer.is-accepted .hb-paws i {
  color: var(--aurora);
}

.ride-steer.urge .hb-steer {
  border-color: rgba(255, 190, 85, 0.7);
}

.ride-steer.urge .hb-steer::after {
  animation: ring 1.4s ease-out infinite;
}

/* Centre actions: contextual row above, Duck! below (never moves) */
.ride-actions {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b));
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 2 * 300px);
}

.ra-ctx,
.ra-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.hb-ctx {
  min-height: 62px;
}

.hb-duck {
  min-width: 232px;
  min-height: 66px;
  justify-content: center;
  border-radius: 20px;
}

.hb-duck .hb-no {
  font-size: 1.25rem;
}

.hb-duck .hb-ico {
  color: #ff9b74;
}

.hb-duck.is-down,
.hb-duck.is-ducking {
  transform: translateY(4px) scale(0.97);
  border-color: rgba(176, 228, 255, 0.45);
}

.hb-duck.urgent {
  background: linear-gradient(180deg, #ff8a5c, #f05a2e 55%, #d63a1c);
  border-color: rgba(255, 210, 190, 0.85);
  color: #fff;
  box-shadow: 0 8px 28px rgba(240, 90, 46, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: duck-bob 0.62s ease-in-out infinite alternate;
}

.hb-duck.urgent::after {
  --ring: rgba(255, 150, 110, 0.95);
  animation: ring 0.62s ease-out infinite;
}

.hb-duck.urgent .hb-ico {
  color: #fff;
}

.hb-duck.urgent .hb-en {
  color: rgba(255, 255, 255, 0.85);
}

.hb-duck.urgent .hb-key {
  color: #fff;
  background: rgba(60, 10, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

@keyframes duck-bob {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

/* Help with progress ring */
.hb-help {
  background: linear-gradient(180deg, #c5abff, #9474f5 55%, #7a58e6);
  border-color: rgba(230, 220, 255, 0.8);
  color: #fff;
  box-shadow: 0 8px 24px rgba(140, 100, 245, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hb-help .hb-en {
  color: rgba(255, 255, 255, 0.82);
}

.hb-help .hb-key {
  color: #fff;
  background: rgba(30, 10, 80, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
}

.hb-help .hb-ico {
  position: relative;
  width: 36px;
  height: 36px;
  color: #fff;
}

.hb-ring {
  position: absolute;
  inset: 0;
}

.hb-ring circle {
  fill: none;
  stroke-width: 3.5;
}

.hb-ring .ring-bg {
  stroke: rgba(255, 255, 255, 0.22);
}

.hb-ring .ring-fg {
  stroke: #fff;
  stroke-linecap: round;
  transition: stroke-dasharray 0.15s linear;
}

.hb-ring-ico {
  position: relative;
  display: grid;
  width: 18px;
  height: 18px;
}

.hb-ring-ico svg {
  width: 100%;
  height: 100%;
}

.hb-help.is-helping:disabled {
  opacity: 1;
  filter: none;
  cursor: progress;
}

.hb-help.is-helping:disabled > * {
  opacity: 1;
}

/* Brake bar */
.ride-brake {
  --rb-h: 230px;
  position: absolute;
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 10px;
  border-radius: 24px;
}

.rb-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.rb-label b {
  font-size: 1.05rem;
  font-weight: 900;
}

.rb-label small {
  margin-top: 2px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.rb-slider {
  --b: 0;
  position: relative;
  width: 76px;
  height: var(--rb-h);
  margin: 10px 0 6px;
  border-radius: 14px;
  cursor: ns-resize;
  touch-action: none;
}

.rb-rail {
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 16px;
  translate: -50% 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #08121d, #13253a 50%, #08121d);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(176, 228, 255, 0.16);
  overflow: hidden;
}

.rb-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(var(--b) * 100%);
  background: linear-gradient(180deg, rgba(255, 190, 85, 0.6), var(--amber-2) 60%, var(--danger));
}

.rb-ticks {
  position: absolute;
  inset: 8px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rb-ticks i {
  display: block;
  height: 2px;
  margin: 0 3px;
  border-radius: 1px;
  background: rgba(240, 247, 255, 0.28);
}

/* The thumb is the brake bar itself: a wide rubber-gripped bar with two claws. */
.rb-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26px;
  transform: translateY(calc(var(--b) * (var(--rb-h) - 26px)));
  border-radius: 9px;
  background: linear-gradient(180deg, #e6edf5, #a8b6c6 55%, #7f8ea0);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.55), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.08s linear;
}

.rb-grip {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 7px;
  bottom: 7px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #26313d 0 3px, #3c4958 3px 6px);
}

.rb-claw {
  position: absolute;
  bottom: -9px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 10px solid #8a98a8;
  transition: transform 0.15s ease;
  transform: scaleY(0.4);
  transform-origin: top;
}

.rb-claw.l {
  left: 14px;
}

.rb-claw.r {
  right: 14px;
}

.ride-brake.is-on .rb-claw {
  transform: scaleY(1);
}

.ride-brake.is-on .rb-bar {
  background: linear-gradient(180deg, #ffe0b0, #ffad5a 55%, #e87a2a);
  border-color: rgba(255, 230, 190, 0.9);
}

.rb-slider.is-drag .rb-bar {
  transition: none;
}

.rb-value {
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.rb-keys {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.rb-keys kbd {
  padding: 0 5px;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 18px;
  color: var(--ink-2);
  background: rgba(3, 10, 18, 0.6);
  border: 1px solid var(--edge-hi);
  border-bottom-width: 2px;
}

.ride-brake.urge {
  border-color: rgba(255, 150, 58, 0.85);
}

/* ---------------------------------------------- banner / toasts / flash */
.hud-banner {
  position: absolute;
  left: 50%;
  /* (centred below the alert line, which ends ≈ 200 px down: on short screens 31 % sat on it) */
  top: max(31%, calc(250px + var(--safe-t)));
  translate: -50% -50%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px 12px 14px;
  border-radius: 20px;
  border-color: rgba(99, 243, 184, 0.7);
  background: linear-gradient(180deg, rgba(18, 82, 64, 0.9), rgba(8, 44, 36, 0.92));
  box-shadow: 0 0 40px rgba(99, 243, 184, 0.3), var(--shadow);
  white-space: nowrap;
  transition: opacity 0.3s ease, transform 0.3s ease, display 0.3s allow-discrete;
}

.hud-banner.off {
  opacity: 0;
  transform: scale(0.96);
}

@starting-style {
  .hud-banner.to-left:not(.off) {
    opacity: 0;
    transform: translateX(40px);
  }
  .hud-banner.to-right:not(.off) {
    opacity: 0;
    transform: translateX(-40px);
  }
}

.hbn-ico {
  display: grid;
  width: 36px;
  height: 36px;
  color: var(--aurora);
}

.hbn-ico svg {
  width: 100%;
  height: 100%;
}

.hud-banner b {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
}

.hud-banner small {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(214, 255, 238, 0.8);
}

.hud-toasts {
  position: absolute;
  left: 50%;
  top: calc(var(--gap) + var(--safe-t));
  translate: -50% 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(520px, calc(100vw - 2 * 92px));
}

.hud-root[data-mode='ride'] .hud-toasts {
  top: calc(206px + var(--safe-t));
}

.hud-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 9px 18px 9px 10px;
  border-radius: 16px;
  animation: toast-in 0.28s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.hud-toast.pending {
  display: none;
}

.hud-toast.leaving {
  animation: toast-out 0.26s ease-in both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
}

.tt-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(176, 228, 255, 0.12);
  color: var(--teal);
}

.tt-ico svg {
  width: 18px;
  height: 18px;
}

.tt-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tt-txt b {
  font-size: 1rem;
  font-weight: 850;
}

.tt-txt small {
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--ink-2);
}

.hud-toast.warn {
  border-color: rgba(255, 190, 85, 0.6);
}

.hud-toast.warn .tt-ico {
  background: rgba(255, 190, 85, 0.18);
  color: var(--amber);
}

.hud-toast.warn b {
  color: #ffd590;
}

.hud-toast.good {
  border-color: rgba(99, 243, 184, 0.55);
}

.hud-toast.good .tt-ico {
  background: rgba(99, 243, 184, 0.18);
  color: var(--aurora);
}

.hud-flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.hud-flash.hit {
  background: radial-gradient(70% 60% at 50% 40%, rgba(255, 255, 255, 0.95), rgba(225, 240, 255, 0.7) 45%, rgba(200, 225, 255, 0.25) 80%, rgba(200, 225, 255, 0.1));
}

.hud-flash.snow {
  background: radial-gradient(90% 80% at 50% 45%, rgba(240, 248, 255, 0.55), rgba(240, 248, 255, 0.2));
}

.hud-flash i {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 35%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
}

/* ------------------------------------------------------------------- win */
.hud-win {
  width: min(660px, calc(100vw - 32px));
}

.hw-names h2 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 900;
  line-height: 1.02;
  background: linear-gradient(100deg, #ffe3a6, var(--amber) 45%, #ff9a6a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 190, 85, 0.3));
}

.hw-sub {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 750;
}

.hw-portrait {
  box-shadow: 0 0 0 4px rgba(255, 190, 85, 0.35), 0 0 34px rgba(255, 190, 85, 0.3), 0 12px 30px rgba(0, 0, 0, 0.5);
}

.hw-stats {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  margin: 20px 0 0;
}

.hw-tile {
  grid-column: span var(--s, 4);
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(3, 10, 18, 0.38);
  border: 1px solid rgba(176, 228, 255, 0.12);
}

.hw-tile.big {
  grid-column: span var(--s, 6);
}

.hw-tile dt {
  font-size: 0.78rem;
  font-weight: 850;
  color: var(--ink-2);
  line-height: 1.1;
}

.hw-tile dt small {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hw-tile dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hw-tile.big dd {
  font-size: 2.1rem;
  color: var(--aurora);
}

.hw-tile.good dd {
  color: var(--aurora);
}

.hw-tile.bad dd {
  color: #ffb199;
}

.hw-team {
  margin-top: 16px;
}

.hw-team h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 900;
}

.hw-team h3 small {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 4px;
}

.hw-team ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hw-team li {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  background: rgba(99, 243, 184, 0.12);
  border: 1px solid rgba(99, 243, 184, 0.3);
}

.hw-team li.fav-dog {
  background: rgba(255, 134, 207, 0.14);
  border-color: rgba(255, 134, 207, 0.4);
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .ride-actions {
    max-width: calc(100vw - 2 * 290px);
  }

  .ra-ctx {
    flex-direction: column;
    align-items: center;
  }

  .hb-ctx .hb-en {
    white-space: normal;
  }
}

/* Narrow: the centre actions sit above Haw!/Gee!, left of the brake column. */
@media (max-width: 820px) {
  .ride-actions {
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + 104px + var(--safe-r));
    bottom: calc(var(--gap) + 202px + var(--safe-b));
    translate: none;
    width: auto;
    max-width: none;
    gap: 8px;
  }

  .ra-ctx {
    align-items: stretch;
    width: min(100%, 300px);
    gap: 8px;
  }

  .ra-main {
    width: min(100%, 300px);
  }

  .hb-duck {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --gap: 12px;
  }

  .hud-portrait {
    width: 60px;
    height: 60px;
    border-width: 2px;
  }

  .hb-no {
    font-size: 1rem;
  }

  /* Yard: compact team bar between the portrait and the mute button */
  .yard-panel {
    left: calc(84px + var(--safe-l));
    right: calc(80px + var(--safe-r));
    top: calc(var(--gap) + var(--safe-t));
    width: auto;
    padding: 6px 6px 6px 12px;
    border-radius: 18px;
  }

  .yp-n {
    font-size: 1.35rem;
    margin-top: 1px;
  }

  .yp-en {
    display: none;
  }

  .yp-k {
    font-size: 0.62rem;
  }

  .yp-tie {
    padding: 4px 8px 4px 6px;
    gap: 5px;
    border-radius: 12px;
  }

  .yp-tie-ico {
    width: 20px;
    height: 20px;
  }

  .yp-tie-txt b {
    font-size: 0.8rem;
  }

  .yp-tie-txt small {
    display: none;
  }

  .yp-toggle {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--edge);
    background: rgba(3, 10, 18, 0.4);
    color: var(--ink);
    cursor: pointer;
  }

  .yp-toggle {
    position: relative;
  }

  .yp-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
  }

  .yp-toggle .hb-key {
    top: auto;
    bottom: -6px;
    right: -5px;
    transform: none;
    min-width: 18px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.56rem;
    background: #0a1622;
  }

  .yard-panel.expanded .yp-toggle svg {
    transform: rotate(180deg);
  }

  .yp-meter {
    margin: 6px 6px 2px 0;
  }

  .yard-panel:not(.expanded) .yp-rows,
  .yard-panel:not(.expanded) .yp-sled {
    display: none;
  }

  .yard-panel.expanded .yp-rows {
    margin: 8px 6px 2px 0;
  }

  .yard-actions {
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + var(--safe-r));
    width: auto;
  }

  .ya-btns {
    flex-direction: row;
  }

  .ya-btns .hb {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px 8px 10px;
    gap: 8px;
  }

  .ya-btns .hb .hb-no {
    white-space: normal;
    font-size: 0.95rem;
  }

  .ya-btns .hb .hb-en {
    white-space: normal;
  }

  .ya-btns .hb-key {
    top: 5px;
    right: 6px;
    transform: none;
    height: 18px;
    min-width: 0;
    font-size: 0.58rem;
    padding: 0 4px;
  }

  .ya-btns .hb-ico {
    width: 24px;
    height: 24px;
  }

  .ya-btns .hb .hb-txt {
    padding-right: 18px;
  }

  /* Ride */
  .ride-stats {
    left: calc(var(--gap) + var(--safe-l));
    top: calc(80px + var(--safe-t));
    min-width: 0;
    padding: 6px 12px;
    border-radius: 16px;
    border-left: 1px solid var(--edge);
  }

  .rs-v {
    font-size: 1.5rem;
  }

  .rs-sl {
    display: none;
  }

  .rs-bar {
    min-width: 64px;
  }

  .ride-stats {
    max-width: calc(50vw - 62px);
  }

  .rc-dial {
    width: 60px;
    height: 60px;
  }

  .rc-dist {
    padding: 3px 10px 3px 7px;
  }

  .rc-no {
    display: none;
  }

  .ride-alert {
    top: calc(160px + var(--safe-t));
    padding: 8px 14px 8px 8px;
    width: max-content;
    max-width: calc(100vw - 24px);
  }

  .ra-txt b {
    font-size: 0.98rem;
  }

  .ra-ico {
    width: 28px;
    height: 28px;
  }

  .hb-steer {
    width: 92px;
    height: 96px;
    border-radius: 20px;
  }

  .hb-steer .hb-ico {
    width: 28px;
    height: 28px;
  }

  .hb-steer .hb-no {
    font-size: 1.02rem;
  }

  .ride-steer {
    gap: 8px;
  }

  .ride-brake {
    --rb-h: 168px;
    width: 80px;
    padding: 8px 6px;
    border-radius: 20px;
  }

  .rb-slider {
    width: 64px;
    margin: 6px 0 4px;
  }

  .rb-keys {
    display: none;
  }

  .ride-actions {
    right: calc(var(--gap) + 88px + var(--safe-r));
    bottom: calc(var(--gap) + 170px + var(--safe-b));
  }

  .hb-ctx {
    min-height: 56px;
  }

  .hb-duck {
    min-height: 60px;
  }

  .hud-banner {
    top: max(40%, calc(256px + var(--safe-t)));
    padding: 10px 16px 10px 10px;
    white-space: normal;
    width: max-content;
    max-width: calc(100vw - 24px);
  }

  .hud-banner b {
    font-size: 1.05rem;
  }

  .hud-toasts {
    width: calc(100vw - 24px);
    top: calc(84px + var(--safe-t));
  }

  .hud-root[data-mode='ride'] .hud-toasts {
    top: calc(226px + var(--safe-t));
  }

  /* Cards */
  .hud-card {
    width: calc(100vw - 24px);
    max-height: calc(100% - 24px);
    padding: 20px 16px 18px;
    border-radius: 22px;
  }

  .ht-head,
  .hw-head {
    gap: 14px;
  }

  .ht-portrait,
  .hw-portrait {
    width: 96px;
    height: 96px;
  }

  .ht-name {
    font-size: 2.3rem;
  }

  .ht-sub {
    font-size: 0.7rem;
    letter-spacing: 0.22em;
  }

  .ht-tag {
    font-size: 0.9rem;
  }

  .ht-howto {
    padding: 12px;
    gap: 9px;
  }

  .ht-howto b {
    font-size: 0.9rem;
  }

  .ht-howto small {
    font-size: 0.74rem;
  }

  .ht-actions .hb,
  .hw-actions .hb {
    width: 100%;
    min-width: 0;
  }

  .ht-actions,
  .hw-actions {
    bottom: -18px;
  }

  .hw-stats {
    grid-template-columns: repeat(12, 1fr);
  }

  .hw-tile {
    grid-column: span var(--sp, 6);
  }

  .hw-tile dd {
    font-size: 1.3rem;
  }

  .hw-tile.big dd {
    font-size: 1.7rem;
  }

  .hw-tile.big {
    grid-column: span var(--sp, 6);
  }
}

@media (max-width: 380px) {
  .hb-steer {
    width: 84px;
  }

  .ht-portrait,
  .hw-portrait {
    width: 80px;
    height: 80px;
  }
}

@media (max-height: 560px) and (min-width: 641px) {
  .ride-brake {
    --rb-h: 150px;
  }

  .yard-panel {
    top: calc(var(--gap) + var(--safe-t));
    left: calc(124px + var(--safe-l));
  }

  .yp-rows {
    gap: 3px;
  }

  .yp-slot {
    height: 22px;
  }

  .ht-portrait,
  .hw-portrait {
    width: 96px;
    height: 96px;
  }
}

/* Keyboard hints are noise on touch-only devices; mobile GPUs also skip the blur. */
@media (hover: none) and (pointer: coarse) {
  #hud * {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .hb-key,
  .rb-keys,
  .ht-howto kbd {
    display: none !important;
  }

  .hb {
    padding-right: 14px;
  }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }

  /* Static rings instead of pulses. */
  .hb-duck.urgent,
  .hb-duck.urgent::after,
  .hb.urge::after,
  .ya-btns .hb.ready::after,
  .ride-alert.hot::after,
  .ride-brake.urge::after,
  .ride-steer.urge .hb-steer::after {
    animation: none !important;
  }

  .hb-duck.urgent::after,
  .hb.urge::after,
  .ya-btns .hb.ready::after,
  .ride-alert.hot::after,
  .ride-brake.urge::after,
  .ride-steer.urge .hb-steer::after {
    opacity: 1;
  }

  .loading-husky .lh-body,
  .loading-husky .lh-leg,
  .loading-husky .lh-tail,
  .loading-husky .lh-head,
  .loading-sky .aur {
    animation: none !important;
  }
}

/* ----------------------------------------------------------- low quality */
/* q=low (and software rendering): no backdrop blur; slightly more opaque glass. */
.q-low .hud-scrim {
  display: none;
}

.q-low .hud-card,
.q-low .yard-panel,
.q-low .ya-hint,
.q-low .hud-dogcard,
.q-low .ride-stats,
.q-low .rc-dist,
.q-low .ride-alert,
.q-low .hud-toast,
.q-low .hud-banner,
.q-low .ride-brake,
.q-low .hb {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.q-low .hud-card,
.q-low .yard-panel,
.q-low .hud-dogcard,
.q-low .ride-stats,
.q-low .ride-brake,
.q-low .hud-toast,
.q-low .ride-alert:not(.danger),
.q-low .rc-dist,
.q-low .ya-hint,
.q-low .hb:not(.hb-primary):not(.hb-amber):not(.hb-help):not(.urgent):not(.hb-danger):not(.hb-lean):not(.hb-snack):not(.hb-bag) {
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
}

/* q=low: decorative attention rings hold still (the Duck! and Too-fast pulses keep
   moving: they are gameplay-critical), and tighter shadows keep compositor layers small. */
.q-low {
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.q-low .hb.urge::after,
.q-low .ya-btns .hb.ready::after,
.q-low .ride-steer.urge .hb-steer::after {
  animation: none;
  opacity: 0.9;
}

.q-low .hud-portrait {
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.35), 0 4px 12px rgba(0, 0, 0, 0.45);
}

.q-low .hb-primary,
.q-low .hb-amber,
.q-low .hb-help,
.q-low .hb-duck.urgent {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* ------------------------------------------------- art pass (integration) */
/* Wide key chips ("Enter", "Space") need more room than the 26 px default so they never sit on
   the button's subtitle (e.g. Go! "RELEASE THE SNUB LINE"). */
@media not ((hover: none) and (pointer: coarse)) {
  .hb[aria-keyshortcuts~='Enter'],
  .hb[aria-keyshortcuts~='Space'] {
    padding-right: 64px;
  }
}

/* Win: on wide landscape screens the card docks to the left so the orbiting view of the hut
   (warm windows, chimney smoke) stays visible in the middle-right of the screen. */
@media (min-width: 1000px) and (min-aspect-ratio: 5/4) {
  .hud-win {
    left: calc(var(--gap) + var(--safe-l) + 12px);
    translate: 0 -50%;
    width: min(480px, 37vw);
    padding: 22px 22px 20px;
  }

  .hud-win .hw-names h2 {
    font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  }

  .hud-root[data-mode='win'] .hud-scrim {
    background: linear-gradient(90deg, rgba(3, 10, 18, 0.66), rgba(3, 10, 18, 0.32) 42%, rgba(3, 10, 18, 0) 68%);
  }
}

/* ------------------------------------------- short landscape (phones on their side) */
/* The desktop roster (270 px × ~300 px) would cover the gangline in a 390 px-tall view: use the
   collapsible team bar from the phone layout (R / the chevron opens it), and compact cards. */
@media (max-height: 500px) and (min-width: 641px) {
  .yard-panel {
    left: calc(var(--gap) + 84px + var(--safe-l));
    top: calc(var(--gap) + var(--safe-t));
    width: 300px;
    padding: 6px 6px 6px 12px;
    border-radius: 18px;
  }

  .hud-portrait {
    width: 64px;
    height: 64px;
    border-width: 2px;
  }

  .yp-n {
    font-size: 1.35rem;
    margin-top: 1px;
  }

  .yp-en,
  .yp-tie-txt small {
    display: none;
  }

  .yp-tie {
    padding: 4px 8px 4px 6px;
    gap: 5px;
    border-radius: 12px;
  }

  .yp-toggle {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--edge);
    background: rgba(3, 10, 18, 0.4);
    color: var(--ink);
    cursor: pointer;
  }

  .yp-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
  }

  .yp-toggle .hb-key {
    top: auto;
    bottom: -6px;
    right: -5px;
    transform: none;
    min-width: 18px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.56rem;
    background: #0a1622;
  }

  .yard-panel.expanded .yp-toggle svg {
    transform: rotate(180deg);
  }

  .yp-meter {
    margin: 6px 6px 2px 0;
  }

  .yard-panel:not(.expanded) .yp-rows,
  .yard-panel:not(.expanded) .yp-sled {
    display: none;
  }

  .yard-panel.expanded .yp-rows {
    margin: 6px 6px 2px 0;
  }

  /* Cards: everything on one screen (the main button stays sticky if it still has to scroll) */
  .hud-card {
    padding: 14px 18px 12px;
    max-height: calc(100% - 16px);
  }

  .ht-portrait,
  .hw-portrait {
    width: 72px;
    height: 72px;
  }

  .ht-howto {
    margin-top: 10px;
    padding: 8px 12px;
    gap: 6px;
  }

  .hw-names h2 {
    font-size: 1.6rem;
  }

  .hw-sub {
    margin-top: 4px;
    font-size: 0.86rem;
  }

  .hw-sub small {
    display: none;
  }

  .hw-stats {
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
    margin-top: 10px;
  }

  .hw-tile,
  .hw-tile.big {
    grid-column: span var(--sl, 3);
    padding: 6px 10px;
  }

  .hw-tile dd {
    font-size: 1.15rem;
  }

  .hw-tile.big dd {
    font-size: 1.35rem;
  }

  .hw-team {
    margin-top: 8px;
  }

  .hw-team h3 {
    margin-bottom: 4px;
  }

  .ht-actions,
  .hw-actions {
    margin-top: 6px;
    bottom: -12px;
  }

  .ht-actions .hb,
  .hw-actions .hb {
    min-height: 48px;
  }
}

/* ============================================================ expansion (v2) */
/* Whoa! / On by!, contextual actions (Lean!, Run!, Grab the sled, Right the sled, Give snacks,
   Load / Hook back in, Tie the dogs, Skip), the team strip, the trail chip, banners. */

/* ---- voice buttons: compact, same glass as Haw!/Gee!, key chip on the outer corner ---- */
.hb-voice {
  display: inline-grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    'i t'
    'p p';
  justify-content: center;
  align-content: center;
  align-items: center;
  column-gap: 6px;
  row-gap: 1px;
  width: 122px;
  height: 64px;
  min-height: 0;
  padding: 5px 8px 4px;
  border-radius: 18px;
  text-align: left;
}

.hb-voice .hb-ico {
  grid-area: i;
  width: 24px;
  height: 24px;
}

.hb-voice .hb-txt {
  grid-area: t;
}

.hb-voice .hb-no {
  font-size: 1.05rem;
}

.hb-voice .hb-en {
  margin-top: 1px;
  font-size: 0.6rem;
}

.hb-voice .hb-paws {
  grid-area: p;
  justify-self: center;
  height: 11px;
  margin-top: 2px;
  gap: 2px;
}

.hb-voice .hb-paws i {
  width: 11px;
  height: 11px;
}

.hb-voice .hb-paws i:nth-child(even) {
  translate: 0 -2px;
}

.hb-voice .hb-key {
  top: -7px;
  transform: none;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  font-size: 0.58rem;
  background: #0a1622;
}

.hb-voice-l .hb-key {
  right: auto;
  left: -5px;
}

.hb-voice-r .hb-key {
  right: -5px;
}

.hb-voice-l .hb-ico {
  color: var(--amber);
}

.hb-voice-r .hb-ico {
  color: var(--teal);
}

.hb-voice.is-accepted {
  border-color: rgba(99, 243, 184, 0.85);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.45), 0 0 26px rgba(99, 243, 184, 0.4), var(--shadow);
}

.hb-voice.is-accepted .hb-paws i {
  color: var(--aurora);
}

/* Whoa! in effect: the team stands */
.hb-voice.is-active {
  border-color: rgba(255, 190, 85, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 190, 85, 0.35), var(--shadow);
}

.hb-voice.is-active .hb-en {
  color: var(--amber);
}

/* ---- contextual action colours ---- */
.hb-danger,
.hb-lean {
  background: linear-gradient(180deg, #ff8a5c, #f05a2e 55%, #d63a1c);
  border-color: rgba(255, 210, 190, 0.85);
  color: #fff;
  box-shadow: 0 8px 26px rgba(240, 90, 46, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hb-snack {
  background: linear-gradient(180deg, #ffc2de, #f585b9 55%, #e2629f);
  border-color: rgba(255, 228, 240, 0.85);
  color: #3a0a22;
  box-shadow: 0 8px 24px rgba(242, 110, 170, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hb-bag {
  background: linear-gradient(180deg, #a0f3ea, #48d3c8 55%, #27b3aa);
  border-color: rgba(214, 255, 250, 0.85);
  color: #03241f;
  box-shadow: 0 8px 24px rgba(65, 216, 208, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hb-danger .hb-ico,
.hb-lean .hb-ico,
.hb-snack .hb-ico,
.hb-bag .hb-ico {
  color: currentColor;
}

.hb-danger .hb-en,
.hb-lean .hb-en {
  color: rgba(255, 255, 255, 0.86);
}

.hb-snack .hb-en {
  color: rgba(58, 10, 34, 0.72);
}

.hb-bag .hb-en {
  color: rgba(3, 36, 31, 0.72);
}

.hb-danger .hb-key,
.hb-lean .hb-key {
  color: #fff;
  background: rgba(60, 10, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.hb-snack .hb-key {
  color: #3a0a22;
  background: rgba(58, 10, 34, 0.12);
  border-color: rgba(58, 10, 34, 0.3);
}

.hb-bag .hb-key {
  color: #03241f;
  background: rgba(3, 36, 31, 0.12);
  border-color: rgba(3, 36, 31, 0.3);
}

/* Lean!: pulses while the runner lifts; the arrow nudges toward the side to lean to. */
.hb-lean {
  --dir: -1;
  padding-bottom: 12px;
}

.hb-lean.to-right {
  --dir: 1;
}

.hb-lean .hb-ico {
  width: 30px;
  height: 30px;
  animation: lean-nudge 0.5s ease-in-out infinite alternate;
}

.hb-lean.to-right .hb-ico svg {
  transform: scaleX(-1);
}

.hb-lean::after {
  --ring: rgba(255, 150, 110, 0.95);
  animation: ring 0.62s ease-out infinite;
}

.hb-lean.is-leaning,
.hb-lean.is-down,
.hb-danger.is-down {
  transform: translateY(3px) scale(0.97);
  background: linear-gradient(180deg, #e8663c, #c8401c 60%, #b0300f);
  box-shadow: inset 0 3px 8px rgba(60, 10, 0, 0.45), 0 4px 12px rgba(240, 90, 46, 0.35);
}

.hb-lean.is-leaning .hb-ico {
  animation: none;
  transform: translateX(calc(var(--dir) * 4px));
}

@keyframes lean-nudge {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(var(--dir) * 5px));
  }
}

/* tip risk gauge along the bottom edge of Lean! */
.hb-risk {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 4px;
  border-radius: 2px;
  background: rgba(60, 10, 0, 0.3);
  overflow: hidden;
}

.hb-risk i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: #fff;
  transform-origin: left;
  transform: scaleX(var(--r, 0));
  transition: transform 0.15s linear;
}

/* Run! (hold) */
.hb-danger.is-down .hb-ico {
  animation: lean-nudge 0.28s ease-in-out infinite alternate;
  --dir: -1;
}

/* Progress ring icons (Give snacks, Right the sled): same ring as Help */
.hb-ringed .hb-ico {
  position: relative;
  width: 36px;
  height: 36px;
  color: currentColor;
}

.hb-ringed .hb-ring .ring-bg {
  stroke: currentColor;
  stroke-opacity: 0.2;
}

.hb-ringed .hb-ring .ring-fg {
  stroke: currentColor;
}

.hb.is-busy:disabled {
  opacity: 1;
  filter: none;
  cursor: progress;
}

.hb.is-busy:disabled > * {
  opacity: 1;
}

.hb-snack.urge::after {
  --ring: rgba(255, 160, 205, 0.9);
}

.hb-primary.urge::after {
  --ring: rgba(140, 249, 205, 0.9);
}

/* Skip (arrival cut-scene): bottom-right, quiet */
.ride-skip {
  position: absolute;
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
}

.hb-skip {
  min-height: 52px;
  border-radius: 999px;
  padding-right: 58px;
}

.hb-skip .hb-ico {
  width: 22px;
  height: 22px;
  color: var(--ink-2);
}

/* Off the runners (tipped / chasing the team): the brake can't be reached. */
.ride-brake.is-off {
  opacity: 0.45;
  filter: saturate(0.4);
}

.ride-brake.is-off .rb-slider {
  pointer-events: none;
}

/* ---- trail chip: beside the compass dial ("On trail · Lake route") ---- */
.rc-trail {
  position: absolute;
  left: calc(50% + 37px + 12px);
  top: 24px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 850;
  color: #d4ffee;
  background: linear-gradient(180deg, rgba(18, 62, 52, 0.88), rgba(7, 32, 28, 0.92));
  border: 1px solid rgba(99, 243, 184, 0.38);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.rc-tico {
  display: grid;
  width: 16px;
  height: 16px;
  color: var(--aurora);
}

.rc-tico svg {
  width: 100%;
  height: 100%;
}

.rc-on {
  font-weight: 700;
  color: rgba(212, 255, 238, 0.7);
  white-space: pre;
}

.rc-tname {
  font-weight: 900;
}

/* ---- team strip: a mini gangline (lead row on top), one paw chip per dog ---- */
.ride-team {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(var(--gap) + 110px + var(--safe-t));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 7px 7px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20, 39, 58, 0.78), rgba(8, 18, 30, 0.82));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --chip: 26px;
}

/* The header doubles as the fold toggle on phones (R); on larger screens it is just a label. */
.rt-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none !important;
  cursor: default;
}

.rt-lbl {
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.rt-n {
  font-size: 0.82rem;
}

.rt-worst {
  display: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--aurora);
}

.rt-toggle .hb-key {
  display: none;
}

.rt-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: linear-gradient(90deg, transparent calc(50% - 1px), rgba(214, 236, 255, 0.4) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}

.rt-row {
  display: flex;
  align-items: center;
}

.rt-link {
  width: 8px;
  height: 2px;
  background: rgba(214, 236, 255, 0.4);
}

.rt-gap {
  width: var(--chip);
  height: var(--chip);
}

.rt-row.single {
  justify-content: center;
}

.rt-dog {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--chip);
  height: var(--chip);
  margin: 0;
  padding: 0;
  border-radius: 9px;
  border: 1.5px solid rgba(214, 236, 255, 0.35);
  background: #0b1826;
  color: #fff;
  cursor: help;
  overflow: visible;
  --e: 1;
  --ec: var(--aurora);
}

.rt-fill {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: var(--ec);
  transform-origin: bottom;
  transform: scaleY(var(--e));
  opacity: 0.88;
  transition: transform 0.4s ease;
}

.rt-dog[data-e='hi'] {
  --ec: #45dba3;
}

.rt-dog[data-e='mid'] {
  --ec: #c9d84a;
}

.rt-dog[data-e='low'] {
  --ec: #ffaa45;
}

.rt-dog[data-e='ex'] {
  --ec: #ff5c3f;
  border-color: rgba(255, 140, 110, 0.9);
}

.rt-paw {
  position: relative;
  display: grid;
  width: 62%;
  height: 62%;
  color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}

.rt-paw svg,
.rt-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.rt-badge {
  position: absolute;
  right: -5px;
  top: -5px;
  display: none;
  width: 14px;
  height: 14px;
  padding: 2px;
  border-radius: 50%;
  background: #0a1622;
  border: 1px solid rgba(214, 236, 255, 0.5);
}

.rt-dog.is-slack .rt-badge,
.rt-dog.is-bagged .rt-badge,
.rt-dog.is-tangled .rt-badge {
  display: block;
}

/* slack tug: the dog trots along without pulling */
.rt-dog.is-slack .rt-badge {
  color: var(--amber);
}

.rt-dog.is-slack .rt-paw {
  opacity: 0.65;
}

/* carried in the sled bag */
.rt-dog.is-bagged {
  border-style: dashed;
  border-color: rgba(65, 216, 208, 0.85);
}

.rt-dog.is-bagged .rt-badge {
  color: var(--teal);
}

.rt-dog.is-tangled {
  border-color: #ff7a5a;
}

.rt-dog.is-tangled .rt-badge {
  color: #ff8a6a;
}

.rt-dog::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid #ff7a5a;
  opacity: 0;
  pointer-events: none;
}

.rt-dog[data-e='ex']::after,
.rt-dog.is-tangled::after {
  animation: ring 1.1s ease-out infinite;
}

.rt-dog:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

@media (hover: hover) {
  .rt-dog:hover {
    border-color: #fff;
  }
}

/* name tooltip (hover / focus / tap) */
.rt-tip {
  position: absolute;
  left: calc(100% + 8px);
  top: var(--y, 50%);
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 11px;
  border-radius: 12px;
  white-space: nowrap;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid var(--edge-hi);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.rt-tip b {
  font-size: 0.92rem;
  font-weight: 900;
}

.rt-tip span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
}

.ride-team.collapsed .rt-rows,
.ride-team.collapsed .rt-tip {
  display: none;
}

/* ---- banners for the new voice commands ---- */
@starting-style {
  .hud-banner.to-stop:not(.off) {
    opacity: 0;
    transform: scale(1.12);
  }
  .hud-banner.to-on:not(.off) {
    opacity: 0;
    transform: translateY(24px);
  }
}

.hud-banner.to-stop .hbn-ico {
  color: var(--amber);
}

.hud-banner.to-on .hbn-ico {
  color: var(--teal);
}

/* ---- responsive (expansion) ---- */
@media (max-width: 1100px) {
  .hb-ctx .hb-en {
    white-space: normal;
  }
}

/* Phones (portrait): voice row 92 × 56 above Haw!/Gee!; the team strip folds (R / tap the header). */
@media (max-width: 640px) {
  .hb-voice {
    width: 92px;
    height: 56px;
    border-radius: 16px;
    column-gap: 4px;
    padding: 4px 4px 3px;
  }

  .hb-voice .hb-ico {
    width: 20px;
    height: 20px;
  }

  .hb-voice .hb-no {
    font-size: 0.95rem;
  }

  .hb-voice .hb-en {
    font-size: 0.56rem;
    letter-spacing: 0.05em;
  }

  .hb-voice .hb-paws {
    height: 10px;
  }

  .hb-voice .hb-paws i {
    width: 10px;
    height: 10px;
  }

  .rc-trail {
    position: static;
    margin-top: 5px;
    padding: 2px 10px 2px 6px;
    font-size: 0.74rem;
  }

  .rc-on {
    display: none;
  }

  .ride-team {
    --chip: 21px;
    top: calc(236px + var(--safe-t));
    padding: 5px 5px 6px;
    gap: 5px;
    border-radius: 14px;
  }

  .rt-rows {
    gap: 4px;
  }

  .rt-link {
    width: 6px;
  }

  .rt-dog {
    border-radius: 7px;
  }

  .rt-fill {
    border-radius: 5px;
  }

  .rt-badge {
    width: 12px;
    height: 12px;
    right: -4px;
    top: -4px;
    padding: 1.5px;
  }

  .hb-skip {
    min-height: 48px;
  }

  /* Win card: three small tiles a row, and the card stays clear of the mute button. */
  .hud-root[data-mode='win'] .hud-win {
    top: calc(50% + 30px + var(--safe-t) / 2);
    max-height: calc(100% - 84px - var(--safe-t));
  }

  .hw-stats {
    gap: 7px;
  }

  .hw-tile {
    padding: 8px 10px;
  }

  .hw-tile dt {
    font-size: 0.72rem;
  }
}

@media (max-width: 380px) {
  .hb-voice {
    width: 84px;
  }

  .hb-voice .hb-ico {
    display: none;
  }
}

/* Phones (portrait) and phones on their side: the strip header becomes a real toggle (R). */
@media (max-width: 640px), (max-height: 500px) {
  .rt-toggle {
    pointer-events: auto !important;
    min-height: 30px;
    min-width: 44px;
    padding: 0 6px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--ink);
  }

  .rt-worst {
    display: block;
  }

  .rt-worst[data-e='mid'] {
    background: #c9d84a;
  }

  .rt-worst[data-e='low'] {
    background: var(--amber-2);
  }

  .rt-worst[data-e='ex'] {
    background: var(--danger);
  }

  .rt-toggle .hb-key {
    display: grid;
    top: auto;
    bottom: -9px;
    right: -9px;
    transform: none;
    min-width: 16px;
    height: 15px;
    padding: 0 4px;
    font-size: 0.54rem;
    background: #0a1622;
  }

  .ride-team.collapsed {
    padding: 4px;
  }
}

/* Short landscape (phones on their side, ≤ 500 px tall): everything compact so the alert line,
   the voice cluster, the actions and the brake all fit without overlapping. */
@media (max-height: 500px) and (min-width: 641px) {
  .rc-dial {
    width: 56px;
    height: 56px;
  }

  .rc-dist {
    margin-top: 4px;
    padding: 2px 10px 2px 7px;
  }

  /* left of the dial: the Spotted! card sits right of it */
  .rc-trail {
    left: auto;
    right: calc(50% + 28px + 10px);
    top: 16px;
  }

  /* The alert line sits left of the middle, beside the team strip: centred under the compass it
     covered the lead dogs' speech bubbles ("Snack?", "Moose!!"), which stand right there. */
  .ride-alert {
    left: calc(var(--gap) + 92px + var(--safe-l));
    translate: none;
    top: calc(104px + var(--safe-t));
    max-width: min(340px, calc(50vw - 92px - var(--gap) - 60px));
    padding: 6px 16px 6px 8px;
  }

  /* the command banner below the alert line (it covered it). (integrator) Lower still: with the
     web font loaded a long alert ("Moose! The dogs want to chase it" + its hint) wraps to four
     lines in its narrow column and ends ≈ 185 px down; the banner's top edge sat at ≈ 170 px. */
  .hud-banner {
    top: max(58%, calc(222px + var(--safe-t)));
  }

  .ra-txt b {
    font-size: 0.98rem;
  }

  .ra-ico {
    width: 28px;
    height: 28px;
  }

  .hud-root[data-mode='ride'] .hud-toasts {
    top: calc(152px + var(--safe-t));
  }

  .ride-stats {
    left: calc(var(--gap) + 52px + var(--safe-l));
    top: calc(var(--gap) + 10px + var(--safe-t));
    padding: 5px 12px 5px 22px;
    min-width: 0;
  }

  .rs-v {
    font-size: 1.5rem;
  }

  .ride-steer {
    gap: 8px 10px;
  }

  .hb-steer {
    width: 100px;
    height: 80px;
    padding: 8px 6px 6px;
  }

  .hb-steer .hb-ico {
    width: 26px;
    height: 26px;
  }

  .hb-steer .hb-no {
    font-size: 1.02rem;
  }

  .hb-steer .hb-paws {
    margin-top: 2px;
  }

  .hb-voice {
    width: 100px;
    height: 50px;
    padding: 3px 4px;
  }

  .hb-voice .hb-ico {
    width: 20px;
    height: 20px;
  }

  .hb-voice .hb-no {
    font-size: 0.95rem;
  }

  .ride-actions {
    left: calc(var(--gap) + 222px + var(--safe-l));
    right: calc(var(--gap) + 94px + var(--safe-r));
    bottom: calc(var(--gap) + var(--safe-b));
    translate: none;
    width: auto;
    max-width: none;
    gap: 8px;
  }

  .ra-ctx {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .ra-main {
    width: auto;
  }

  .hb-ctx {
    min-height: 46px;
    padding-top: 4px;
    padding-bottom: 4px;
    gap: 8px;
  }

  .hb-ctx .hb-en {
    display: none;
  }

  .hb-ctx .hb-ico {
    width: 24px;
    height: 24px;
  }

  .hb-ringed .hb-ico,
  .hb-help .hb-ico {
    width: 30px;
    height: 30px;
  }

  .hb-lean {
    padding-bottom: 10px;
  }

  .hb-duck {
    width: auto;
    min-height: 50px;
    min-width: 200px;
  }

  .ride-brake {
    --rb-h: 112px;
    width: 82px;
    padding: 6px 6px 6px;
  }

  .rb-slider {
    width: 66px;
    margin: 4px 0 2px;
  }

  .rb-keys {
    display: none;
  }

  .ride-team {
    --chip: 16px;
    top: calc(var(--gap) + 70px + var(--safe-t));
    padding: 4px 4px 5px;
    gap: 4px;
    border-radius: 12px;
  }

  .rt-rows {
    gap: 3px;
  }

  .rt-link {
    width: 5px;
  }

  .rt-dog {
    border-radius: 5px;
    border-width: 1px;
  }

  .rt-fill {
    border-radius: 4px;
  }

  .rt-badge {
    width: 10px;
    height: 10px;
    right: -4px;
    top: -4px;
    padding: 1px;
  }

  .rt-toggle {
    min-height: 24px;
  }
}

/* Touch devices: no key chips on the new controls either. */
@media (hover: none) and (pointer: coarse) {
  .rt-toggle .hb-key {
    display: none !important;
  }

  .hb-skip {
    padding-right: 18px;
  }
}

@media not ((hover: none) and (pointer: coarse)) {
  .hb[aria-keyshortcuts~='Shift'],
  .hb[aria-keyshortcuts~='Escape'] {
    padding-right: 60px;
  }
}

/* Reduced motion: static rings, no nudging arrows. */
@media (prefers-reduced-motion: reduce) {
  .hb-lean::after,
  .hb-lean .hb-ico,
  .hb-danger.is-down .hb-ico,
  .rt-dog::after {
    animation: none !important;
  }

  .hb-lean::after,
  .rt-dog[data-e='ex']::after,
  .rt-dog.is-tangled::after {
    opacity: 1;
  }
}

/* q=low: opaque glass on the new panels, tight shadows; gameplay-critical pulses keep moving. */
.q-low .ride-team,
.q-low .rc-trail {
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
}

.q-low .hb-danger,
.q-low .hb-lean,
.q-low .hb-snack,
.q-low .hb-bag {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.q-low .hb-snack.urge::after,
.q-low .hb-primary.urge::after,
.q-low .hb-voice.urge::after {
  animation: none;
  opacity: 0.9;
}

/* (integrator) Short desktop windows (e.g. 960 × 600): the expansion's extra win tiles (snacks,
   moose, tip-overs, team lost, dogs carried) must fit without the pinned Play again button
   covering the team. */
@media (max-height: 700px) and (min-height: 481px) and (min-width: 641px) {
  .hud-win {
    padding-top: 16px;
    padding-bottom: 14px;
  }
  .hud-win .hw-portrait {
    width: 78px;
    height: 78px;
  }
  .hud-win .hw-names h2 {
    font-size: 1.75rem;
  }
  .hud-win .hw-sub {
    margin-top: 4px;
    font-size: 0.9rem;
  }
  .hud-win .hw-stats {
    margin-top: 12px;
    gap: 6px;
  }
  .hud-win .hw-tile {
    padding: 6px 10px;
  }
  .hud-win .hw-tile dd {
    font-size: 1.15rem;
  }
  .hud-win .hw-tile.big dd {
    font-size: 1.5rem;
  }
  .hud-win .hw-team {
    margin-top: 10px;
  }
  .hud-win .hw-team h3 {
    margin-bottom: 5px;
  }
  .hud-win .hw-team li {
    padding: 2px 9px;
    font-size: 0.8rem;
  }
  .hud-win .hw-actions {
    margin-top: 8px;
  }
}

/* ============================================ Spotter's Book, Dau and Show names (v3) */
/* The Book button (title, yard, ride), the "Spotted!" cards, the book itself (a field guide over
   the paused game), the yard's Show names toggle and the win card's new finds. No backdrop blur
   anywhere here: the book is opaque, the cards are small. */

/* ---- rarity colours (badges, tile edges, card glow) ---- */
.r-common {
  --rc: #63f3b8;
  --rc-bg: rgba(99, 243, 184, 0.14);
  --rc-edge: rgba(99, 243, 184, 0.45);
}

.r-uncommon {
  --rc: #6cc8ff;
  --rc-bg: rgba(108, 200, 255, 0.14);
  --rc-edge: rgba(108, 200, 255, 0.5);
}

.r-rare {
  --rc: #c1a6ff;
  --rc-bg: rgba(179, 148, 255, 0.16);
  --rc-edge: rgba(179, 148, 255, 0.55);
}

.r-legendary {
  --rc: #ffd36e;
  --rc-bg: rgba(255, 211, 110, 0.16);
  --rc-edge: rgba(255, 211, 110, 0.6);
}

.sp-rar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--rc);
  background: var(--rc-bg);
  border: 1px solid var(--rc-edge);
}

.sp-pips {
  display: inline-flex;
  gap: 2px;
}

.sp-pips i {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

/* ---- animal pictures: the 3D thumbnail, or the hand-drawn fallback; unknown = a dark silhouette ---- */
.sp-thumb {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #1a3b57 0%, #10283f 60%, #c9d8e8 60.5%, #9db4ca 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sp-thumb.has-img {
  background: radial-gradient(120% 100% at 50% 20%, #26506f 0%, #12304a 55%, #0a1c2e 100%);
}

.sp-thumb.is-unknown {
  background: radial-gradient(110% 90% at 50% 30%, #173a55 0%, #0c2135 60%, #08172a 100%);
}

.sp-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.sp-thumb.is-unknown img {
  filter: brightness(0) drop-shadow(0 0 3px var(--rc, #63f3b8));
  opacity: 0.92;
}

.sp-sil {
  display: block;
  width: 94%;
  height: 94%;
  color: var(--fur);
  fill: currentColor;
}

.sp-thumb.is-found .sp-sil .a1 {
  fill: var(--a1);
}

.sp-thumb.is-found .sp-sil .a2 {
  fill: var(--a2);
}

.sp-thumb.is-found .sp-sil .a3 {
  fill: var(--a3);
}

.sp-thumb.is-found .sp-sil .ey {
  fill: #101318;
}

.sp-sil .st {
  fill: none !important;
  stroke: currentColor;
}

.sp-thumb.is-found .sp-sil .st.a1 {
  stroke: var(--a1);
}

.sp-thumb.is-found .sp-sil .st.a3 {
  stroke: var(--a3);
}

.sp-thumb.is-unknown .sp-sil {
  color: #02070d;
  filter: drop-shadow(0 0 2.5px var(--rc, #63f3b8));
}

.sp-thumb.is-unknown .sp-sil * {
  fill: #02070d;
}

.sp-q {
  position: absolute;
  right: 8px;
  top: 4px;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--rc, var(--aurora));
  text-shadow: 0 0 10px var(--rc, var(--aurora));
}

/* ---- the Book button: round, under the sound button, with a "7/16" badge ---- */
.hud-bookbtn {
  position: absolute;
  z-index: 7;
  top: calc(var(--gap) + 68px + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
  will-change: transform;
}

.hud-bookbtn .hb-ico {
  width: 28px;
  height: 28px;
  color: var(--amber);
}

.bkb-count {
  position: absolute;
  left: -8px;
  top: -6px;
  min-width: 30px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--amber-ink);
  background: linear-gradient(180deg, #ffd98e, #ffb04d);
  border: 1px solid rgba(255, 236, 196, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hud-bookbtn.has-new {
  --ring: rgba(255, 211, 110, 0.95);
  border-color: rgba(255, 211, 110, 0.75);
}

.hud-bookbtn.has-new::after {
  animation: ring 1.5s ease-out infinite;
}

.hud-bookbtn.is-complete {
  border-color: rgba(255, 211, 110, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 211, 110, 0.25), var(--shadow);
}

/* ---- title: the way into the book, under the tagline ---- */
.ht-bookbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  padding: 7px 46px 7px 7px;
  min-height: 52px;
  border-radius: 16px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(180deg, rgba(255, 190, 85, 0.16), rgba(255, 150, 58, 0.08));
  border: 1px solid rgba(255, 190, 85, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: filter 0.2s ease, transform 0.15s ease;
}

@media (hover: hover) {
  .ht-bookbtn:hover {
    filter: brightness(1.15);
  }
}

.ht-bookbtn:active {
  transform: scale(0.97);
}

.ht-bookbtn:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 3px;
}

.htb-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: var(--amber-ink);
  background: linear-gradient(180deg, #ffd98e, #ffaa45);
}

.htb-ico svg {
  width: 26px;
  height: 26px;
}

.htb-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.12;
}

.htb-txt b {
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--amber);
}

.htb-txt small {
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-2);
}

.ht-bookbtn .htb-count {
  position: static;
  flex: none;
  margin-left: 4px;
}

.ht-bookbtn .hb-key {
  right: 9px;
}

/* ---- yard: Show names (a toggle styled like the other yard buttons, with a switch) ---- */
.ya-btns .hb-names {
  min-height: 52px;
}

.hb-names .hb-ico {
  color: var(--ink-2);
}

.hb-names.is-on .hb-ico {
  color: var(--aurora);
}

.hb-switch {
  flex: none;
  position: relative;
  width: 40px;
  height: 22px;
  margin-left: auto;
  border-radius: 11px;
  background: rgba(3, 10, 18, 0.6);
  border: 1px solid var(--edge-hi);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hb-switch i {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: transform 0.2s ease, background 0.2s ease;
}

.hb-names.is-on {
  border-color: rgba(99, 243, 184, 0.55);
}

.hb-names.is-on .hb-switch {
  background: linear-gradient(180deg, #8cf9cd, #2fcf9f);
  border-color: rgba(200, 255, 232, 0.8);
}

.hb-names.is-on .hb-switch i {
  transform: translateX(18px);
  background: #fff;
}

/* Phones: Show names is a round toggle under the portrait, with a little on/off switch below it */
.hb-names.is-compact {
  position: absolute;
  z-index: 3;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(var(--gap) + 76px + var(--safe-t));
  width: 56px;
  height: 56px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  will-change: transform;
}

.hb-names.is-compact .hb-txt {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Phones: the round Show names and Book buttons get a one-word caption under them (an icon alone
   didn't tell a child what it does) */
.hb-names.is-compact::before,
.hud-root[data-mode] .hud-bookbtn::before {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  top: calc(100% + 9px);
  padding: 1px 7px;
  border-radius: 8px;
  background: rgba(8, 20, 33, 0.72);
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.hb-names.is-compact::before {
  content: 'Names';
}

@media (max-width: 640px), (max-height: 500px) {
  .hud-root[data-mode] .hud-bookbtn::before {
    content: 'Book';
    top: calc(100% + 3px);
  }
}

.hb-names.is-compact .hb-ico {
  width: 26px;
  height: 26px;
}

.hb-names.is-compact .hb-switch {
  position: absolute;
  left: 50%;
  bottom: -8px;
  margin: 0 0 0 -15px;
  width: 30px;
  height: 16px;
  border-radius: 8px;
}

.hb-names.is-compact .hb-switch i {
  width: 10px;
  height: 10px;
}

.hb-names.is-compact.is-on .hb-switch i {
  transform: translateX(14px);
}

.hb-names.is-compact .hb-key {
  top: -6px;
  right: -6px;
  bottom: auto;
  transform: none;
  min-width: 20px;
  height: 18px;
  font-size: 0.6rem;
  padding: 0 5px;
  background: #0a1622;
}

/* ---- "Spotted!" cards: top right, left of the sound / Book column; never over the controls ---- */
.hud-spots {
  position: absolute;
  z-index: 8;
  top: calc(var(--gap) + var(--safe-t));
  right: calc(var(--gap) + 68px + var(--safe-r));
  width: min(372px, calc(100vw - 2 * var(--gap) - 68px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  will-change: transform;
}

.hud-spot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 12px 14px 12px;
  border-radius: 22px;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  background:
    radial-gradient(120% 90% at 0% 0%, var(--rc-bg), transparent 60%),
    linear-gradient(180deg, rgba(22, 46, 68, 0.97), rgba(8, 19, 32, 0.97));
  border: 1.5px solid var(--rc-edge);
  box-shadow: 0 0 28px var(--rc-bg), 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: spot-in 0.6s cubic-bezier(0.2, 1.25, 0.35, 1) backwards;
}

.hud-spot.leaving {
  animation: spot-out 0.32s ease-in forwards;
  pointer-events: none;
}

@keyframes spot-in {
  from {
    opacity: 0;
    transform: translateX(115%) rotate(4deg);
  }
  55% {
    opacity: 1;
  }
}

@keyframes spot-out {
  to {
    opacity: 0;
    transform: translateX(40%) scale(0.95);
  }
}

@media (hover: hover) {
  .hud-spot:hover {
    filter: brightness(1.1);
  }
}

.hud-spot:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 3px;
}

.spc-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spc-dau {
  flex: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  background: #10283a;
  border: 2px solid rgba(240, 247, 255, 0.92);
  box-shadow: 0 0 0 3px var(--rc-bg);
  animation: spot-dau 0.7s 0.25s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}

@keyframes spot-dau {
  from {
    transform: scale(0.4) rotate(-12deg);
  }
}

.spc-dau svg {
  display: block;
  width: 100%;
  height: 100%;
}

.spc-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.spc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rc);
}

.spc-kicker svg {
  width: 14px;
  height: 14px;
}

.spc-name {
  margin-top: 3px;
  font-size: 1.32rem;
  font-weight: 900;
  /* the whole name, always (a long one wraps: "White-throated / dipper") */
  overflow-wrap: break-word;
  text-wrap: balance;
}

/* "New!" in the kicker: only the compact landscape card (it has no footer line) shows it */
.spc-newtag {
  display: none;
}

.spc-rar {
  margin-left: auto;
  align-self: flex-start;
}

.spc-body {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.spc-thumb {
  flex: none;
  width: 92px;
  height: 72px;
  border: 1.5px solid var(--rc-edge);
}

.spc-bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  align-self: center;
  padding: 8px 11px;
  border-radius: 14px 14px 14px 14px;
  background: #f1f6fb;
  color: #12212f;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.3;
}

/* the bubble's tail points up at Dau */
.spc-bubble::before {
  content: '';
  position: absolute;
  left: 14px;
  top: -7px;
  border: 7px solid transparent;
  border-top: 0;
  border-bottom-color: #f1f6fb;
}

.spc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.spc-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--amber);
}

.is-again .spc-new {
  color: var(--ink-2);
  font-weight: 800;
}

.spc-new svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.spc-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.spc-open .hb-key {
  position: static;
  transform: none;
  min-width: 22px;
  height: 20px;
}

.spc-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rc), transparent);
  transform-origin: left center;
  animation: spot-timer var(--ms, 5200ms) linear forwards;
}

@keyframes spot-timer {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* legendary finds shimmer */
.hud-spot.r-legendary::after,
.bk-tile.is-found.r-legendary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 233, 170, 0.22) 45%, transparent 60%);
  background-size: 260% 100%;
  animation: legend-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes legend-shine {
  from {
    background-position: 130% 0;
  }
  to {
    background-position: -130% 0;
  }
}

/* ---- the book: a field guide over the dimmed, paused game ---- */
.hud-book {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.bk-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 80% at 50% 45%, rgba(3, 10, 18, 0.7), rgba(2, 6, 11, 0.86));
  animation: hud-in 0.3s ease-out backwards;
}

.bk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, calc(100vw - 32px));
  height: min(820px, calc(100% - 32px));
  border-radius: 28px;
  overflow: hidden;
  outline: none;
  background:
    radial-gradient(70% 40% at 15% 0%, rgba(99, 243, 184, 0.08), transparent 70%),
    radial-gradient(60% 40% at 90% 0%, rgba(179, 148, 255, 0.08), transparent 70%),
    linear-gradient(180deg, #132a40, #091727 70%, #08141f);
  border: 1px solid rgba(176, 228, 255, 0.22);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  animation: book-in 0.42s cubic-bezier(0.2, 1.15, 0.35, 1) backwards;
}

@keyframes book-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
}

.bk-card::before {
  content: '';
  position: absolute;
  left: 26px;
  right: 26px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--aurora) 25%, var(--teal) 55%, var(--violet) 80%, transparent);
  opacity: 0.85;
}

.bk-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px 22px;
  border-bottom: 1px solid rgba(176, 228, 255, 0.12);
}

.bk-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: var(--amber);
  background: rgba(255, 190, 85, 0.13);
  border: 1px solid rgba(255, 190, 85, 0.32);
}

.bk-logo svg {
  width: 32px;
  height: 32px;
}

.bk-titles {
  min-width: 0;
}

.bk-titles h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.85rem);
  font-weight: 900;
  line-height: 1.05;
  background: linear-gradient(100deg, #9dffd6 5%, #63f3b8 35%, #5ee2dc 60%, #c0a6ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bk-sub {
  margin: 4px 0 0;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}

.bk-prog {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.bk-count {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink-2);
  white-space: nowrap;
}

.bk-count b {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.bk-pips {
  display: flex;
  gap: 3px;
}

.bk-pips i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: rgba(176, 228, 255, 0.13);
  border: 1px solid rgba(176, 228, 255, 0.12);
}

.bk-pips i.on {
  background: var(--rc);
  border-color: transparent;
  box-shadow: 0 0 6px var(--rc);
}

.hb.hb-round.bk-close {
  flex: none;
  margin-left: 6px;
  padding: 0;
}

.bk-close .hb-ico {
  width: 24px;
  height: 24px;
}

.bk-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(176, 228, 255, 0.3) transparent;
}

.bk-grid-view,
.bk-detail {
  outline: none;
}

/* Dau's intro / "all found" line with her badge */
.bk-dau {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
}

.bk-dau-p,
.bkd-dau {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: #10283a;
  border: 3px solid rgba(240, 247, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(99, 243, 184, 0.25), 0 8px 20px rgba(0, 0, 0, 0.45);
}

.bk-dau-p svg,
.bkd-dau svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bk-say {
  position: relative;
  flex: 1;
  margin: 0;
  max-width: 640px;
  padding: 12px 16px;
  border-radius: 18px;
  background: #f1f6fb;
  color: #12212f;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.4;
}

.bk-say b,
.bkd-bubble small {
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8322a;
}

.bk-say::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  margin-top: -8px;
  border: 8px solid transparent;
  border-left: 0;
  border-right-color: #f1f6fb;
}

.bk-badge {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 211, 110, 0.14);
  border: 1px solid rgba(255, 211, 110, 0.55);
  color: #ffe3a6;
  animation: badge-in 0.8s 0.2s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}

@keyframes badge-in {
  from {
    transform: scale(0.3) rotate(-20deg);
    opacity: 0;
  }
}

.bk-badge svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 10px rgba(255, 211, 110, 0.5));
}

.bk-badge b {
  display: block;
  font-size: 1rem;
  font-weight: 900;
}

.bk-badge small {
  display: block;
  font-size: 0.7rem;
  font-weight: 750;
  color: var(--ink-2);
}

/* the grid: one section per rarity, common → legendary */
.bk-sec + .bk-sec {
  margin-top: 20px;
}

.bk-sec h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 1rem;
}

.bk-sec h3 .sp-rar {
  font-size: 0.78rem;
  padding: 3px 12px 3px 9px;
}

.bk-sec h3 small {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-3);
}

.bk-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 12px;
}

.bk-grid li {
  display: flex;
}

.bk-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 7px;
  border-radius: 18px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  background: rgba(3, 10, 18, 0.4);
  border: 1px solid rgba(176, 228, 255, 0.12);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.bk-tile.is-found {
  background: linear-gradient(180deg, var(--rc-bg), rgba(3, 10, 18, 0.35) 70%);
  border-color: var(--rc-edge);
}

@media (hover: hover) {
  .bk-tile:hover {
    transform: translateY(-2px);
    border-color: var(--rc-edge);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), 0 0 18px var(--rc-bg);
  }
}

.bk-tile:active {
  transform: scale(0.98);
}

.bk-tile:focus-visible,
.bkd-btn:focus-visible,
.bk-reset:focus-visible,
.bk-confirm button:focus-visible,
.bkd-src summary:focus-visible,
.bkd-src a:focus-visible,
.hw-spot:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

.bk-tthumb {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.bk-ribbon {
  position: absolute;
  left: -4px;
  top: 12px;
  padding: 3px 10px;
  border-radius: 0 999px 999px 0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--amber-ink);
  background: linear-gradient(180deg, #ffd98e, #ffaa45);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.bk-tinfo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 4px 3px;
}

.bk-tname {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.1;
}

.bk-tname.unknown {
  font-size: 0.9rem;
  font-weight: 850;
  color: var(--ink-3);
}

.bk-thint {
  font-size: 0.78rem;
  font-weight: 650;
  font-style: italic;
  line-height: 1.32;
  color: var(--ink-2);
}

.bk-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed rgba(176, 228, 255, 0.16);
}

.bk-note {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-3);
}

.bk-reset,
.bk-confirm button,
.bkd-btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(180deg, rgba(24, 46, 68, 0.9), rgba(9, 20, 33, 0.94));
  border: 1px solid var(--edge);
}

.bk-reset {
  color: #ffb199;
  border-color: rgba(255, 92, 63, 0.38);
  background: rgba(255, 92, 63, 0.07);
}

.bk-reset:disabled {
  opacity: 0.4;
  cursor: default;
}

.bk-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px 10px 16px;
  border-radius: 18px;
  background: rgba(255, 92, 63, 0.09);
  border: 1px solid rgba(255, 92, 63, 0.4);
}

.bk-confirm p {
  margin: 0;
}

.bk-confirm b {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
}

.bk-confirm small {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-2);
}

.bk-confirm-btns {
  display: flex;
  gap: 8px;
}

.bk-confirm .bk-yes {
  color: #fff;
  background: linear-gradient(180deg, #ff7a5c, var(--danger-2));
  border-color: rgba(255, 190, 170, 0.7);
}

/* card detail: the animal on the left, Dau and her three facts on the right */
.bkd-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.bkd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bkd-btn svg {
  width: 20px;
  height: 20px;
}

.bkd-back {
  padding-left: 10px;
}

.bkd-pos {
  margin-left: auto;
  font-size: 0.86rem;
  font-weight: 850;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.bkd-step {
  width: 48px;
  padding: 0;
  justify-content: center;
}

.bkd-main {
  display: grid;
  grid-template-columns: minmax(220px, 330px) 1fr;
  gap: 18px 28px;
  align-items: start;
}

.bkd-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  border: 2px solid var(--rc-edge);
  box-shadow: 0 0 30px var(--rc-bg);
}

.bkd-idtxt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 14px;
}

.bkd-name {
  margin: 8px 0 0;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 900;
  line-height: 1.02;
}

.bkd-name.unknown {
  color: var(--ink-3);
  font-size: 1.5rem;
}

.bkd-no {
  margin: 8px 0 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink-2);
}

.bkd-no b {
  color: var(--amber);
  font-weight: 900;
}

.bkd-sci {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.bkd-first {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
  color: var(--aurora);
  background: rgba(99, 243, 184, 0.12);
  border: 1px solid rgba(99, 243, 184, 0.32);
}

.is-unknown .bkd-first {
  color: var(--ink-2);
  background: rgba(176, 228, 255, 0.08);
  border-color: rgba(176, 228, 255, 0.2);
}

.bkd-first svg {
  width: 16px;
  height: 16px;
}

.bkd-talk {
  position: relative;
  min-height: 90px;
  padding-left: 96px;
}

.bkd-dau {
  position: absolute;
  left: 0;
  top: 0;
}

.bkd-bubbles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.bkd-bubble {
  position: relative;
  padding: 12px 16px 12px 48px;
  border-radius: 18px;
  background: #f1f6fb;
  color: #12212f;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.42;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  animation: bubble-in 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}

.bkd-bubble:nth-child(2) {
  animation-delay: 0.08s;
}

.bkd-bubble:nth-child(3) {
  animation-delay: 0.16s;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.97);
  }
}

.bkd-bubble:first-child::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 22px;
  border: 9px solid transparent;
  border-left: 0;
  border-right-color: #f1f6fb;
}

.bkd-bubble.is-hint {
  padding-left: 16px;
}

.bkd-n {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
  font-weight: 900;
  color: #0d1c2a;
  background: var(--rc);
}

.bkd-care {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  background: rgba(255, 134, 207, 0.1);
  border: 1px solid rgba(255, 134, 207, 0.38);
}

.bkd-care svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  color: var(--pink);
}

.bkd-care b {
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
}

.bkd-src {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.bkd-src summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-weight: 800;
  color: var(--ink-2);
  cursor: pointer;
}

.bkd-src ul {
  margin: 4px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.bkd-src a {
  color: var(--teal);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ---- win card: this run's new finds ---- */
.hw-spotted {
  margin-top: 14px;
}

.hw-spotted h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 900;
}

.hw-sico {
  display: grid;
  width: 22px;
  height: 22px;
  color: var(--amber);
}

.hw-sico svg {
  width: 100%;
  height: 100%;
}

.hw-spotted ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hw-spot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 3px 14px 3px 3px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
  color: var(--ink);
  cursor: pointer;
  background: var(--rc-bg);
  border: 1px solid var(--rc-edge);
}

.hw-sthumb {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

/* ---- responsive (v3) ---- */
@media (max-width: 1100px) {
  .bkd-main {
    grid-template-columns: minmax(200px, 280px) 1fr;
  }
}

/* Phones (portrait) */
@media (max-width: 640px) {
  .hud-bookbtn {
    top: calc(var(--gap) + 64px + var(--safe-t));
  }

  .hb-names.is-compact {
    top: calc(var(--gap) + 70px + var(--safe-t));
  }

  /* title: the Book button gets the card's full width under the portrait and the name */
  .ht-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
  }

  .ht-names {
    display: contents;
  }

  .ht-portrait {
    grid-row: 1 / span 3;
  }

  .ht-name,
  .ht-sub,
  .ht-tag {
    grid-column: 2;
  }

  .ht-bookbtn {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 14px;
  }

  .hud-spots {
    left: calc(var(--gap) + 84px + var(--safe-l));
    right: calc(var(--gap) + var(--safe-r));
    width: auto;
    top: calc(226px + var(--safe-t));
  }

  .hud-root[data-mode='yard'] .hud-spots,
  .hud-root[data-mode='title'] .hud-spots {
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + 68px + var(--safe-r));
    top: calc(150px + var(--safe-t));
  }

  .hud-spot {
    padding: 10px 12px 11px;
    gap: 7px;
    border-radius: 18px;
  }

  .spc-dau {
    width: 42px;
    height: 42px;
  }

  .spc-name {
    font-size: 1.1rem;
  }

  .spc-thumb {
    width: 70px;
    height: 58px;
  }

  .spc-bubble {
    font-size: 0.8rem;
  }

  .spc-rar .sp-pips {
    display: none;
  }

  .spc-new {
    font-size: 0.78rem;
  }

  .spc-open {
    display: none;
  }

  /* the book fills the screen */
  .bk-card {
    width: calc(100vw - 16px);
    height: calc(100% - 16px);
    border-radius: 22px;
  }

  .bk-head {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 14px 12px 12px 14px;
  }

  .bk-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .bk-logo svg {
    width: 26px;
    height: 26px;
  }

  .bk-titles {
    flex: 1;
  }

  .bk-sub {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .bk-close {
    order: 3;
    width: 48px;
    height: 48px;
    margin-left: 0;
  }

  .bk-prog {
    order: 4;
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .bk-count b {
    font-size: 1.25rem;
  }

  .bk-pips {
    gap: 2px;
  }

  .bk-pips i {
    width: 10px;
    height: 10px;
  }

  .bk-body {
    padding: 14px 12px 20px;
  }

  .bk-dau {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .bk-dau-p {
    width: 56px;
    height: 56px;
  }

  .bk-say {
    font-size: 0.9rem;
  }

  .bk-say::before {
    top: 22px;
  }

  .bk-badge {
    margin-left: 70px;
  }

  .bk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .bk-tile {
    padding: 6px;
    border-radius: 16px;
  }

  .bk-tname {
    font-size: 0.98rem;
  }

  .bk-thint {
    font-size: 0.74rem;
  }

  .bk-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-confirm-btns button {
    flex: 1;
  }

  .bkd-main {
    grid-template-columns: 1fr;
  }

  .bkd-id {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .bkd-thumb {
    flex: none;
    width: 136px;
    border-radius: 16px;
  }

  .bkd-idtxt {
    margin-top: 0;
    min-width: 0;
  }

  .bkd-name {
    font-size: 1.5rem;
  }

  .bkd-no {
    font-size: 0.88rem;
    margin-top: 6px;
  }

  .bkd-first {
    margin-top: 8px;
    font-size: 0.76rem;
  }

  .bkd-talk {
    padding-left: 0;
  }

  .bkd-dau {
    position: relative;
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 0 10px;
  }

  .bkd-bubble {
    font-size: 0.95rem;
    padding: 10px 14px 10px 44px;
  }

  .bkd-bubble:first-child::before {
    left: 22px;
    top: -9px;
    border: 9px solid transparent;
    border-top: 0;
    border-bottom-color: #f1f6fb;
  }

  .bkd-n {
    left: 10px;
    top: 10px;
    width: 24px;
    height: 24px;
  }

  .bkd-back span {
    font-size: 0.86rem;
  }

  .hw-spot {
    font-size: 0.84rem;
  }
}

/* Short landscape (phones on their side): compact card under the alert line, a compact book */
@media (max-height: 500px) and (min-width: 641px) {
  .hud-bookbtn {
    top: calc(var(--gap) + 66px + var(--safe-t));
  }

  .hb-names.is-compact {
    top: calc(var(--gap) + 74px + var(--safe-t));
  }

  /* one compact card at the top right, left of the sound / Book column (above the alert line,
     clear of the compass and its distance label) */
  .hud-spots {
    top: calc(10px + var(--safe-t));
    right: calc(var(--gap) + 68px + var(--safe-r));
    width: min(300px, calc(50vw - 68px - var(--gap) - 64px));
  }

  .hud-spot {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 4px 8px;
    padding: 7px 9px 8px;
    border-radius: 16px;
  }

  .spc-head,
  .spc-body {
    display: contents;
  }

  .spc-dau {
    grid-column: 1;
    grid-row: 1;
    width: 30px;
    height: 30px;
    border-width: 1.5px;
  }

  .spc-id {
    grid-column: 2;
    grid-row: 1;
  }

  .spc-kicker {
    font-size: 0.6rem;
  }

  .spc-kicker svg {
    width: 11px;
    height: 11px;
  }

  .spc-name {
    font-size: 0.98rem;
    margin-top: 1px;
  }

  .spc-rar,
  .spc-foot {
    display: none;
  }

  /* Dau's whole line across the card (the thumbnail is left out: there is no room for it and her
     full line above the alert line; the animal is on screen and in the book) */
  .spc-bubble {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: start;
    font-size: 0.72rem;
    line-height: 1.25;
    padding: 3px 8px 4px;
    border-radius: 10px;
  }

  .spc-bubble::before {
    display: none;
  }

  .spc-thumb {
    display: none;
  }

  .hud-spot .spc-id {
    grid-column: 2 / -1;
  }

  .is-new .spc-newtag {
    display: inline;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 6px;
    color: #10202e;
    background: var(--amber);
    letter-spacing: 0.08em;
  }

  .hud-root[data-mode='yard'] .hud-spots,
  .hud-root[data-mode='title'] .hud-spots {
    top: calc(var(--gap) + var(--safe-t));
  }

  .bk-card {
    width: calc(100vw - 16px);
    height: calc(100% - 16px);
    border-radius: 20px;
  }

  .bk-head {
    padding: 8px 10px 8px 14px;
    gap: 10px;
  }

  .bk-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .bk-logo svg {
    width: 24px;
    height: 24px;
  }

  .bk-titles h2 {
    font-size: 1.2rem;
  }

  .bk-sub {
    display: none;
  }

  .bk-count b {
    font-size: 1.15rem;
  }

  .bk-pips i {
    width: 8px;
    height: 8px;
  }

  .bk-close {
    width: 46px;
    height: 46px;
  }

  .bk-body {
    padding: 10px 14px 16px;
  }

  .bk-dau-p,
  .bkd-dau {
    width: 56px;
    height: 56px;
  }

  .bk-say {
    font-size: 0.88rem;
    padding: 8px 12px;
  }

  .bk-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .bk-thint {
    font-size: 0.72rem;
  }

  .bkd-nav {
    margin-bottom: 10px;
  }

  .bkd-main {
    grid-template-columns: minmax(170px, 230px) 1fr;
    gap: 12px 18px;
  }

  .bkd-name {
    font-size: 1.45rem;
  }

  .bkd-talk {
    padding-left: 68px;
  }

  .bkd-bubble {
    font-size: 0.9rem;
    padding: 9px 12px 9px 42px;
  }

  .bkd-n {
    left: 9px;
    top: 9px;
    width: 24px;
    height: 24px;
  }
}

/* Touch-only devices: no key chips here either. */
@media (hover: none) and (pointer: coarse) {
  .spc-open {
    display: none !important;
  }

  .ht-bookbtn {
    padding-right: 12px;
  }
}

/* Reduced motion: no shimmer, no ring pulse on the Book button. */
@media (prefers-reduced-motion: reduce) {
  .hud-spot.r-legendary::after,
  .bk-tile.is-found.r-legendary::after,
  .hud-bookbtn.has-new::after {
    animation: none !important;
  }

  .hud-bookbtn.has-new::after {
    opacity: 1;
  }
}

/* q=low: the Book button's "new" ring holds still; the cards keep tight shadows. */
.q-low .hud-bookbtn.has-new::after {
  animation: none;
  opacity: 0.9;
}

.q-low .hud-spot {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ===========================================================================
   v3 integrator: the Spotted! card in the RIDE on medium-wide screens (641–1439 px wide, not
   short). The full card is ~190 px tall at the top right: it sat over the compass's distance
   label (at 960 px) and over a long alert line (a moose / reindeer warning). Here it becomes a
   compact card that ends above the alert line (≈ 120 px), right of the compass; Dau's line and
   "New in your Spotter's Book!" still show. The yard, the title and wide screens keep the full card.
   =========================================================================== */
@media (min-width: 641px) and (max-width: 1439px) and (min-height: 501px) {
  /* the trail chip goes left of the dial: the compact card sits right of it */
  .rc-trail {
    left: auto;
    right: calc(50% + 37px + 12px);
  }

  .hud-root[data-mode='ride'] .hud-spots {
    top: calc(10px + var(--safe-t));
    right: calc(var(--gap) + 68px + var(--safe-r));
    width: min(340px, calc(50vw - 68px - var(--gap) - 70px));
  }

  .hud-root[data-mode='ride'] .hud-spot {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 66px;
    grid-template-rows: auto auto auto;
    gap: 4px 8px;
    padding: 7px 10px 9px;
    border-radius: 16px;
  }

  .hud-root[data-mode='ride'] .spc-head,
  .hud-root[data-mode='ride'] .spc-body {
    display: contents;
  }

  .hud-root[data-mode='ride'] .spc-dau {
    grid-column: 1;
    grid-row: 1;
    width: 30px;
    height: 30px;
    border-width: 1.5px;
  }

  .hud-root[data-mode='ride'] .spc-id {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .hud-root[data-mode='ride'] .spc-kicker {
    font-size: 0.6rem;
  }

  .hud-root[data-mode='ride'] .spc-kicker svg {
    width: 11px;
    height: 11px;
  }

  .hud-root[data-mode='ride'] .spc-name {
    font-size: 1rem;
    margin-top: 1px;
  }

  .hud-root[data-mode='ride'] .spc-rar,
  .hud-root[data-mode='ride'] .spc-open {
    display: none;
  }

  .hud-root[data-mode='ride'] .spc-bubble {
    grid-column: 1 / 3;
    grid-row: 2;
    align-self: start;
    font-size: 0.74rem;
    line-height: 1.25;
    padding: 3px 8px 4px;
    border-radius: 10px;
  }

  .hud-root[data-mode='ride'] .spc-bubble::before {
    display: none;
  }

  .hud-root[data-mode='ride'] .spc-thumb {
    grid-column: 3;
    grid-row: 2 / 4;
    width: 66px;
    height: auto;
    min-height: 50px;
    border-radius: 10px;
  }

  .hud-root[data-mode='ride'] .spc-foot {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .hud-root[data-mode='ride'] .spc-new {
    font-size: 0.7rem;
    gap: 5px;
  }

  .hud-root[data-mode='ride'] .spc-new svg {
    width: 14px;
    height: 14px;
  }
}

/* A narrow compact card (tablets in portrait): Dau's whole line across the card, no thumbnail */
@media (min-width: 641px) and (max-width: 900px) and (min-height: 501px) {
  .hud-root[data-mode='ride'] .spc-thumb {
    display: none;
  }

  .hud-root[data-mode='ride'] .spc-bubble,
  .hud-root[data-mode='ride'] .spc-foot {
    grid-column: 1 / -1;
  }

  .hud-root[data-mode='ride'] .spc-name {
    font-size: 0.9rem;
  }
}

/* Phones in portrait: two or more contextual buttons at a stop (Set snow hook, Give snacks,
   Load ‹dog›, Hike!…) sit two to a row instead of one tall stack over the team; an odd last one
   (hud.js .is-span) takes the whole row. */
@media (max-width: 640px) {
  .ra-ctx:not([data-n='0']):not([data-n='1']) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  .ra-ctx:not([data-n='0']):not([data-n='1']) > .hb-ctx {
    min-width: 0;
    min-height: 54px;
    padding-left: 8px;
    padding-right: 8px;
    gap: 6px;
  }

  .ra-ctx:not([data-n='0']):not([data-n='1']) > .hb-ctx .hb-no {
    white-space: normal;
    line-height: 1.05;
  }

  .ra-ctx:not([data-n='0']):not([data-n='1']) > .hb-ctx .hb-en {
    display: none;
  }

  .ra-ctx > .is-span {
    grid-column: 1 / -1;
  }
}

/* Phones in portrait: in the ride the Spotted! card is a compact card just above the bottom
   controls (hud.js sets --spot-bottom from where they start), so it stays clear of the horizon
   band where the animal it is about stands. */
@media (max-width: 640px) {
  .hud-root[data-mode='ride'] .hud-spots {
    top: auto;
    bottom: var(--spot-bottom, calc(330px + var(--safe-b)));
  }

  .hud-root[data-mode='ride'] .hud-spot {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 64px;
    grid-template-rows: auto auto auto;
    gap: 4px 8px;
    padding: 7px 10px 8px;
    border-radius: 16px;
  }

  .hud-root[data-mode='ride'] .spc-head,
  .hud-root[data-mode='ride'] .spc-body {
    display: contents;
  }

  .hud-root[data-mode='ride'] .spc-dau {
    grid-column: 1;
    grid-row: 1;
    width: 30px;
    height: 30px;
    border-width: 1.5px;
  }

  .hud-root[data-mode='ride'] .spc-id {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .hud-root[data-mode='ride'] .spc-kicker {
    font-size: 0.6rem;
  }

  .hud-root[data-mode='ride'] .spc-name {
    font-size: 1rem;
    margin-top: 1px;
  }

  .hud-root[data-mode='ride'] .spc-rar {
    display: none;
  }

  .hud-root[data-mode='ride'] .spc-bubble {
    grid-column: 1 / 3;
    grid-row: 2;
    align-self: start;
    font-size: 0.76rem;
    line-height: 1.25;
    padding: 3px 8px 4px;
    border-radius: 10px;
  }

  .hud-root[data-mode='ride'] .spc-bubble::before {
    display: none;
  }

  .hud-root[data-mode='ride'] .spc-thumb {
    grid-column: 3;
    grid-row: 2 / 4;
    width: 64px;
    height: auto;
    min-height: 50px;
    border-radius: 10px;
  }

  .hud-root[data-mode='ride'] .spc-foot {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .hud-root[data-mode='ride'] .spc-new {
    font-size: 0.72rem;
  }
}

/* v3 integrator: a Spotted! card under the mouse pointer waits (its timer bar holds still) */
.hud-spot.is-held .spc-timer {
  animation-play-state: paused;
}

/* ===========================================================================
 * Level 2: "Supply run & camp" (v4) — the level select, packing (the shelf, the sled bag, Dau's
 * tips and her packing check), the camp's step card, Dau's speech bubble and the Level 2 win card.
 * Kind colours: must-haves aurora green, nice-to-haves gold, silly stuff pink.
 * =========================================================================== */
.k-essential {
  --k: var(--aurora);
  --k-bg: rgba(99, 243, 184, 0.14);
  --k-ink: #03261b;
}

.k-extra {
  --k: #ffd36e;
  --k-bg: rgba(255, 211, 110, 0.14);
  --k-ink: #2b1d03;
}

.k-silly {
  --k: var(--pink);
  --k-bg: rgba(255, 134, 207, 0.14);
  --k-ink: #2a0618;
}

/* own compositor layers (as the other HUD clusters) */
.pack-shelf,
.pack-side,
.camp-card,
.camp-act,
.hud-say {
  will-change: transform;
}

/* ---- stars ---- */
.st-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.st-row i {
  display: block;
  width: 16px;
  height: 16px;
  color: rgba(176, 228, 255, 0.22);
}

.st-row i svg {
  display: block;
  width: 100%;
  height: 100%;
}

.st-row i.on {
  color: #ffd36e;
  filter: drop-shadow(0 0 4px rgba(255, 211, 110, 0.55));
}

/* ---- title: the level select ---- */
.ht-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 0;
}

.ht-level {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  border-radius: 18px;
  border: 2px solid rgba(176, 228, 255, 0.16);
  background: rgba(3, 10, 18, 0.42);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
  transition:
    border-color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.hl-art {
  position: relative;
  display: block;
  height: 74px;
  flex: none;
  overflow: hidden;
}

.hl-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hl-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 12px 10px;
}

.hl-k {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.hl-flag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}

.hl-flag svg {
  width: 11px;
  height: 11px;
}

.hl-flag.new {
  background: var(--pink);
  color: #2a0618;
}

.hl-flag.done {
  background: rgba(99, 243, 184, 0.18);
  color: var(--aurora);
}

.hl-name {
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.1;
}

.hl-sub {
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink-2);
}

.hl-stars {
  margin-top: 4px;
}

/* (v7 panel fix) Level 2's exact score beside its (never rounded-up) stars: "★★☆ 10/12" */
.hl-rate {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.hl-rate .hl-stars {
  margin-top: 0;
}

.hl-score {
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
  color: #ffd36e;
}

.ht-level .hb-key {
  top: 8px;
  right: 8px;
  transform: none;
}

.ht-level.is-selected {
  border-color: var(--aurora);
  background: linear-gradient(180deg, rgba(20, 70, 64, 0.55), rgba(5, 24, 30, 0.7));
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.22), 0 0 26px rgba(99, 243, 184, 0.2), 0 10px 26px rgba(0, 0, 0, 0.35);
}

.ht-level.is-selected::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--aurora) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.5 12.6l4.2 4.2 8.8-9.3' fill='none' stroke='%2303261b' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

@media (hover: hover) {
  .ht-level:hover:not(.is-locked) {
    border-color: rgba(99, 243, 184, 0.65);
    transform: translateY(-2px);
  }
}

.ht-level:active:not(.is-locked) {
  transform: scale(0.97);
}

.ht-level:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 3px;
}

.ht-level.is-locked {
  cursor: not-allowed;
  background: rgba(3, 10, 18, 0.5);
}

.ht-level.is-locked .hl-art svg {
  filter: grayscale(0.75) brightness(0.5);
}

.ht-level.is-locked .hl-name {
  color: var(--ink-2);
}

.ht-level.is-locked .hl-sub {
  color: var(--amber);
  font-weight: 800;
}

.hl-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.hl-lock svg {
  width: 34px;
  height: 34px;
  color: #eef6ff;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}

/* ---- Dau's speech bubble ---- */
.hud-say {
  position: absolute;
  z-index: 6;
  left: var(--say-l, 16px);
  top: calc(var(--say-t, 16px) + var(--safe-t));
  width: var(--say-w, min(440px, calc(100vw - 32px)));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  animation: say-in 0.32s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}

@keyframes say-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.94);
  }
}

.hs-dau {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: #10283a;
  border: 3px solid rgba(240, 247, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 190, 85, 0.35), 0 8px 20px rgba(0, 0, 0, 0.45);
}

.hs-dau svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hs-text {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 6px 0 0;
  padding: 8px 14px 10px;
  border-radius: 16px;
  background: #f4f8fc;
  color: #10202e;
  font-weight: 750;
  font-size: 0.96rem;
  line-height: 1.3;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
}

.hs-text::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 14px;
  border: 8px solid transparent;
  border-left: 0;
  border-right-color: #f4f8fc;
}

.hs-who {
  display: block;
  margin-bottom: 1px;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hat);
}

.hud-say.is-long .hs-text {
  font-size: 0.88rem;
}

/* (integrator) a slim bubble in a narrow band between two panels: no portrait, no tail */
.hud-say.is-narrow .hs-dau,
.hud-say.is-narrow .hs-text::before {
  display: none;
}

.hud-say.is-narrow .hs-text {
  margin: 0;
  font-size: 0.86rem;
}

/* ---- packing: the shelf ---- */
.pack-shelf,
.pack-bag,
.pack-info,
.camp-card {
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.pack-shelf,
.pack-bag,
.camp-card {
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
  backdrop-filter: blur(10px) saturate(1.25);
}

.pack-shelf {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(var(--gap) + var(--safe-t));
  bottom: calc(var(--gap) + var(--safe-b));
  width: min(410px, 36vw);
  display: flex;
  flex-direction: column;
  padding: 12px 10px 8px 12px;
  border-radius: 22px;
}

.ps-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 6px;
}

.ps-ico,
.pb-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  color: var(--amber);
  background: rgba(255, 190, 85, 0.13);
  border: 1px solid rgba(255, 190, 85, 0.3);
}

.ps-ico svg,
.pb-ico svg {
  width: 19px;
  height: 19px;
}

.ps-tt b {
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
}

.ps-tt small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
}

.ps-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -4px 0 -6px;
  padding: 2px 4px 6px 6px;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.ps-group.is-empty {
  display: none;
}

.ps-gh {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 2px 6px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.g-essential .ps-gl {
  color: var(--aurora);
}

.g-extra .ps-gl {
  color: #ffd36e;
}

.g-silly .ps-gl {
  color: var(--pink);
}

.ps-gh small {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}

.ps-gn {
  margin-left: auto;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.ps-group.is-full .ps-gn {
  color: var(--aurora);
}

.ps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 7px;
}

.ps-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  min-height: 90px;
  margin: 0;
  padding: 7px 4px 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(176, 228, 255, 0.14);
  background: linear-gradient(180deg, rgba(30, 56, 82, 0.72), rgba(10, 22, 36, 0.82));
  box-shadow: inset 0 3px 0 -0.5px var(--k);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.18s ease,
    opacity 0.2s ease;
}

.ps-item[hidden] {
  display: none;
}

.psi-pic {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.psi-pic svg,
.psi-pic img,
.pi-pic svg,
.pi-pic img,
.rv-pic svg,
.rv-pic img,
.pb-seg svg,
.pb-seg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.psi-name {
  display: flex;
  align-items: center;
  min-height: 2.2em;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
}

.psi-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.64rem;
  font-weight: 750;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.psi-size {
  display: inline-flex;
  gap: 2px;
}

.psi-size i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-2);
}

.psi-size i.half {
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.psi-in {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--aurora);
  color: var(--aurora-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.2s ease,
    transform 0.25s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.psi-in svg {
  width: 13px;
  height: 13px;
}

.ps-item.is-packed {
  border-color: rgba(99, 243, 184, 0.6);
  background: linear-gradient(180deg, rgba(34, 86, 78, 0.6), rgba(8, 30, 32, 0.82));
}

.ps-item.is-packed .psi-pic {
  opacity: 0.55;
  transform: scale(0.88);
}

.ps-item.is-packed .psi-in {
  opacity: 1;
  transform: scale(1);
}

.ps-item.no-fit {
  opacity: 0.5;
}

.ps-item.no-fit .psi-pic {
  filter: grayscale(0.7);
}

.ps-item.is-pending .psi-pic {
  animation: pk-pending 0.8s ease-in-out infinite;
}

@keyframes pk-pending {
  50% {
    transform: translateY(-4px) scale(0.9);
  }
}

@media (hover: hover) {
  .ps-item:hover {
    border-color: var(--k);
    transform: translateY(-2px);
  }
}

.ps-item:active {
  transform: scale(0.95);
}

.ps-item:focus-visible,
.ca-choice:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

/* ---- packing: the side column (the sled bag, the info card) ---- */
.pack-side {
  position: absolute;
  top: calc(var(--gap) + var(--safe-t));
  right: calc(2 * var(--gap) + 56px + var(--safe-r));
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pack-bag {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  border-radius: 22px;
}

.pb-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pb-tt {
  font-size: 1.1rem;
  font-weight: 900;
}

.pb-ess {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  color: var(--amber);
  background: rgba(255, 190, 85, 0.13);
  border: 1px solid rgba(255, 190, 85, 0.35);
  font-variant-numeric: tabular-nums;
}

.pb-essi {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 190, 85, 0.25);
}

.pb-essi svg {
  width: 12px;
  height: 12px;
}

.pb-essn {
  font-size: 0.92rem;
  font-weight: 900;
}

.pb-ess small {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pb-ess.all {
  color: var(--aurora);
  background: rgba(99, 243, 184, 0.14);
  border-color: rgba(99, 243, 184, 0.45);
}

.pb-ess.all .pb-essi {
  background: var(--aurora);
  color: var(--aurora-ink);
}

.pb-meter {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  row-gap: 5px;
}

.pb-ml {
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.pb-mv,
.pb-wv {
  justify-self: end;
  font-size: 0.92rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pb-slots {
  grid-column: 1 / -1;
  position: relative;
  height: 36px;
  border-radius: 11px;
  background: rgba(3, 10, 18, 0.58);
  border: 1px solid rgba(176, 228, 255, 0.16);
  overflow: hidden;
}

.pb-segs,
.pb-ticks {
  position: absolute;
  inset: 3px;
  display: flex;
}

.pb-ticks {
  pointer-events: none;
}

.pb-ticks i {
  flex: 1 1 0;
  border-right: 1px dashed rgba(176, 228, 255, 0.18);
}

.pb-ticks i:last-child {
  border-right: 0;
}

.pb-seg {
  display: grid;
  place-items: center;
  flex: 0 0 var(--w);
  height: 100%;
  padding: 2px;
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--k) 80%, #fff), var(--k));
  box-shadow: inset -2px 0 0 rgba(3, 10, 18, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: hidden;
  animation: pk-seg-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  transform-origin: left center;
}

.pb-seg.is-pending {
  opacity: 0.55;
}

@keyframes pk-seg-in {
  from {
    transform: scaleX(0.3);
    opacity: 0;
  }
}

.pb-seg svg,
.pb-seg img {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.pb-space.is-full .pb-slots {
  border-color: rgba(255, 190, 85, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 190, 85, 0.2);
}

.pb-wbar {
  grid-column: 1 / -1;
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(3, 10, 18, 0.58);
  border: 1px solid rgba(176, 228, 255, 0.16);
  overflow: hidden;
}

.pb-wfill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--v, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aurora), var(--teal));
  transition:
    width 0.35s ease,
    background 0.3s ease;
}

.pb-wmark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--v, 0.86) * 100%);
  width: 2px;
  background: rgba(255, 190, 85, 0.85);
}

.pb-weight.is-heavy .pb-wfill {
  background: linear-gradient(90deg, #ffd27a, var(--amber-2));
}

.pb-weight.is-heavy .pb-wv {
  color: var(--amber);
}

.pb-weight.is-max .pb-wfill {
  background: linear-gradient(90deg, #ff8a6a, var(--danger));
}

.pb-actions .hb {
  justify-content: center;
}

/* the info card: picture, name, kind, weight, space and Dau's tip */
.pack-info {
  position: relative;
  padding: 12px 14px 10px;
  border-radius: 20px;
  animation: hud-in 0.25s ease-out backwards;
}

.pi-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pi-pic {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--k-bg, rgba(99, 243, 184, 0.14));
  border: 1px solid color-mix(in srgb, var(--k, #63f3b8) 45%, transparent);
  padding: 5px;
}

.pi-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.pi-kind {
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--k);
  color: var(--k-ink);
}

.pi-name {
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.1;
}

.pi-detail {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-2);
}

.pi-stats {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.pi-stats span {
  padding: 1px 7px;
  border-radius: 7px;
  font-size: 0.7rem;
  font-weight: 850;
  background: rgba(3, 10, 18, 0.5);
  border: 1px solid rgba(176, 228, 255, 0.14);
  font-variant-numeric: tabular-nums;
}

.pi-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
}

.pi-dau,
.cc-dau {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #10283a;
  border: 2px solid rgba(240, 247, 255, 0.88);
}

.pi-dau svg,
.cc-dau svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pi-tipt,
.cc-tipt {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 7px 11px 8px;
  border-radius: 14px;
  background: #f4f8fc;
  color: #10202e;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.3;
}

.pi-tipt::before,
.cc-tipt::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 12px;
  border: 7px solid transparent;
  border-left: 0;
  border-right-color: #f4f8fc;
}

.pi-hint {
  display: block;
  margin-top: 7px;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.pack-info.is-in .pi-hint {
  color: var(--aurora);
}

.pack-info.no-fit .pi-hint {
  color: var(--amber);
}

/* ---- packing: Dau's check ---- */
.hud-review {
  width: min(600px, calc(100vw - 32px));
  background: linear-gradient(180deg, rgba(20, 40, 60, 0.97), rgba(8, 18, 30, 0.98));
}

.hud-review:focus {
  outline: none;
}

.rv-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rv-portrait {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(240, 247, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(255, 190, 85, 0.32), 0 10px 26px rgba(0, 0, 0, 0.5);
}

.rv-portrait svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rv-names {
  min-width: 0;
}

.rv-names h2 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 900;
  line-height: 1.02;
  background: linear-gradient(100deg, #ffe3a6, var(--amber) 45%, #ff9a6a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rv-sub {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 800;
}

.rv-ess {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
}

.rv-e {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 6px 4px 4px;
  border-radius: 12px;
  background: rgba(3, 10, 18, 0.38);
  border: 1px solid rgba(176, 228, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 800;
  animation: rv-in 0.3s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}

.rv-e.miss {
  background: rgba(255, 190, 85, 0.1);
  border-color: rgba(255, 190, 85, 0.45);
}

@keyframes rv-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.92);
  }
}

.rv-pic {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
}

.rv-n {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.1;
}

.rv-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 900;
  animation: rv-pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms + 260ms);
}

.rv-mark svg {
  width: 13px;
  height: 13px;
}

.rv-e.ok .rv-mark {
  background: var(--aurora);
  color: var(--aurora-ink);
}

.rv-e.miss .rv-mark {
  background: var(--amber);
  color: var(--amber-ink);
}

@keyframes rv-pop {
  from {
    transform: scale(0);
  }
}

.rv-allgood {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(99, 243, 184, 0.12);
  border: 1px solid rgba(99, 243, 184, 0.38);
  font-weight: 800;
  font-size: 0.9rem;
}

.rv-allgood span {
  display: grid;
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--aurora);
}

.rv-warn h3,
.rv-more h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 6px;
  font-size: 0.9rem;
  font-weight: 900;
}

.rv-warn h3 {
  color: var(--amber);
}

.rv-more h3 svg {
  width: 18px;
  height: 18px;
}

.rv-extras h3 {
  color: #ffd36e;
}

.rv-silly h3 {
  color: var(--pink);
}

.rv-warn ul,
.rv-more ul {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.rv-more ul {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rv-warn li,
.rv-more li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.rv-warn li {
  background: rgba(255, 190, 85, 0.1);
  border: 1px solid rgba(255, 190, 85, 0.3);
}

.rv-more li {
  background: rgba(3, 10, 18, 0.38);
  border: 1px solid rgba(176, 228, 255, 0.12);
}

.rv-more li b {
  display: block;
  font-weight: 900;
}

.rv-more li small {
  display: block;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--ink-2);
}

.rv-weight {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 4px 10px;
  margin-top: 14px;
}

.rv-wl {
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.rv-weight b {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.rv-wbar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(3, 10, 18, 0.58);
  border: 1px solid rgba(176, 228, 255, 0.16);
  overflow: hidden;
}

.rv-wbar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--v, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aurora), var(--teal));
}

.rv-weight.w-heavy .rv-wbar i {
  background: linear-gradient(90deg, #ffd27a, var(--amber-2));
}

.rv-weight small {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
}

.rv-actions {
  position: sticky;
  bottom: -24px;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px -8px -8px;
  padding: 8px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(9, 20, 33, 0), rgba(9, 20, 33, 0.94) 30%);
}

.rv-actions .hb {
  justify-content: center;
}

.rv-actions .hb-big {
  flex: 1 1 auto;
  max-width: 300px;
}

.rv-back {
  flex: 0 1 auto;
}

/* ---- the camp: the step card ---- */
.camp-card {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  top: calc(var(--gap) + var(--safe-t));
  width: min(350px, 34vw);
  max-height: calc(100% - 2 * var(--gap) - var(--safe-t) - var(--safe-b));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 13px 16px 14px;
  border-radius: 22px;
}

.cc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
}

.cc-head b {
  font-variant-numeric: tabular-nums;
}

.cc-dots {
  display: flex;
  gap: 4px;
}

.cc-dots i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(176, 228, 255, 0.2);
}

.cc-dots i.d-done {
  background: var(--aurora);
}

.cc-dots i.d-now {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 190, 85, 0.25);
}

.cc-title {
  margin: 6px 0 0;
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1.06;
}

.cc-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 10px;
}

.cc-dau {
  width: 46px;
  height: 46px;
}

.cc-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 190, 85, 0.12);
  border: 1px solid rgba(255, 190, 85, 0.42);
  color: #ffe3b0;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.3;
}

.cc-nico {
  display: grid;
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--amber);
}

.cc-fact {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(179, 148, 255, 0.12);
  border: 1px solid rgba(179, 148, 255, 0.34);
}

.cc-fico {
  display: grid;
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--violet);
}

.cc-fact p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.32;
}

.cc-fact b {
  margin-right: 2px;
  font-weight: 900;
  color: var(--violet);
}

/* (v6) Dau's lesson (how we build the lavvo, why no floor, why a fire inside is OK) and "What we
   brought" (the packed gear the step uses). The one-line teaser is for the folded phone card only. */
.cc-teaser {
  display: none;
}

/* (a step with a lesson or gear: the checklist steps aside on a computer, the dots in the card's head
   still show the steps; a phone's fold-out keeps it) */
.camp-card.has-more .cc-list {
  display: none;
}

.cc-learn,
.cc-kit {
  margin-top: 10px;
  padding: 8px 10px 9px;
  border-radius: 12px;
}

.cc-learn {
  background: rgba(99, 243, 184, 0.08);
  border: 1px solid rgba(99, 243, 184, 0.3);
}

.cc-kit {
  background: rgba(176, 228, 255, 0.05);
  border: 1px solid var(--edge);
}

.cc-lt,
.cc-kt {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
}

.cc-lt {
  color: var(--aurora);
}

.cc-kt {
  color: var(--ink-2);
}

.cc-lico,
.cc-kico {
  display: grid;
  flex: none;
  width: 18px;
  height: 18px;
}

.cc-ll,
.cc-kl {
  list-style: none;
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
}

.cc-ll li,
.cc-kl li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.3;
}

.ll-mk,
.kl-mk {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 900;
  background: rgba(176, 228, 255, 0.1);
}

.ll-mk svg,
.kl-mk svg {
  width: 10px;
  height: 10px;
}

/* (a "why" list: small dots instead of numbers) */
.cc-ll li.ll-pt .ll-mk {
  width: 6px;
  height: 6px;
  margin: 6px 5px 0;
  background: var(--aurora);
}

.cc-ll li.ll-done {
  color: var(--ink-2);
}

.cc-ll li.ll-done .ll-mk,
.cc-kl li.kl-ok .kl-mk,
.cc-kl li.kl-now .kl-mk {
  background: var(--aurora);
  color: var(--aurora-ink);
}

.cc-ll li.ll-now {
  color: var(--ink);
  font-weight: 900;
}

.cc-ll li.ll-now .ll-mk,
.cc-kl li.kl-now .kl-mk {
  background: var(--amber);
  color: var(--amber-ink);
  box-shadow: 0 0 0 3px rgba(255, 190, 85, 0.25);
}

.cc-ll li.ll-todo {
  color: var(--ink-3);
}

.kl-t b {
  font-weight: 900;
}

.kl-t span {
  color: var(--ink-2);
}

.cc-kl li.kl-now .kl-t span {
  color: var(--ink);
}

.cc-kl li.kl-miss {
  color: var(--ink-3);
}

.cc-kl li.kl-miss .kl-t span {
  color: var(--ink-3);
  font-style: italic;
}

/* ((v6 fix) …and when even that doesn't fit (960×600 at the fire step), hud.js fitCampCard sets
   is-tight: the fun fact steps aside for the step's lesson and gear) */
.hud-root:not(.hud--compact) .camp-card.is-tight .cc-fact {
  display: none;
}

/* (a short computer window, e.g. 1024×640: a little tighter, so the fire step's lesson, its gear, the
   fun fact and a note about the wind still fit without scrolling) */
@media (max-height: 700px) {
  .hud-root:not(.hud--compact) .camp-card.has-more {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .hud-root:not(.hud--compact) .camp-card.has-more .cc-tip,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-learn,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-kit,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-fact,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-note {
    margin-top: 7px;
  }

  .hud-root:not(.hud--compact) .camp-card.has-more .cc-learn,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-kit {
    padding: 6px 9px 7px;
  }

  .hud-root:not(.hud--compact) .camp-card.has-more .cc-ll,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-kl {
    gap: 1px;
  }

  .hud-root:not(.hud--compact) .camp-card.has-more .cc-ll li,
  .hud-root:not(.hud--compact) .camp-card.has-more .cc-kl li {
    font-size: 0.78rem;
    line-height: 1.26;
  }
}

.cc-list {
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(176, 228, 255, 0.12);
}

.cc-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--ink-3);
}

.cl-mk {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 900;
  background: rgba(176, 228, 255, 0.1);
}

.cl-mk svg {
  width: 12px;
  height: 12px;
}

.cc-list li.cl-done {
  color: var(--ink-2);
}

.cc-list li.cl-done .cl-mk {
  background: var(--aurora);
  color: var(--aurora-ink);
}

.cc-list li.cl-now {
  color: var(--ink);
  font-weight: 900;
}

.cc-list li.cl-now .cl-mk {
  background: var(--amber);
  color: var(--amber-ink);
  box-shadow: 0 0 0 3px rgba(255, 190, 85, 0.25);
}

.sec-camp.is-complete .cc-title {
  color: var(--aurora);
}

/* ---- the camp: the step's interaction (bottom, right of the card) ---- */
.camp-act {
  position: absolute;
  left: calc(min(350px, 34vw) + 2 * var(--gap) + var(--safe-l));
  right: calc(var(--gap) + 72px + var(--safe-r));
  bottom: calc(var(--gap) + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.camp-act.is-empty {
  display: none;
}

.ca-hint {
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  max-width: 100%;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 800;
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}

.ca-hint.empty {
  display: none;
}

.ca-prog {
  width: min(320px, 80%);
  height: 12px;
  border-radius: 999px;
  background: rgba(3, 10, 18, 0.66);
  border: 1px solid var(--edge-hi);
  overflow: hidden;
}

.ca-prog i {
  display: block;
  height: 100%;
  width: calc(var(--v, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aurora), var(--teal));
  transition: width 0.2s ease;
}

.ca-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ca-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  margin: 0;
  padding: 7px 14px 7px 8px;
  border-radius: 14px;
  border: 1.5px solid var(--edge-hi);
  background: linear-gradient(180deg, rgba(24, 46, 68, 0.9), rgba(9, 20, 33, 0.94));
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.ca-choice:disabled {
  opacity: 0.5;
  cursor: default;
}

.cac-n {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.86rem;
  color: var(--amber);
  background: rgba(255, 190, 85, 0.18);
}

.cac-t b {
  display: block;
  font-weight: 900;
  font-size: 0.95rem;
}

.cac-t small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
}

.ca-choice.is-good .cac-n {
  color: var(--aurora-ink);
  background: var(--aurora);
}

.ca-choice.is-on {
  border-color: var(--aurora);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.25), var(--shadow);
}

@media (hover: hover) {
  .ca-choice:hover:not(:disabled) {
    border-color: var(--aurora);
    filter: brightness(1.1);
  }
}

.ca-btns .hb {
  min-width: 240px;
  justify-content: center;
  pointer-events: auto;
}

/* ---- the win card: Level 2 ---- */
.hw-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 0;
  padding: 8px 14px 8px 8px;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(255, 211, 110, 0.17), rgba(255, 134, 207, 0.1));
  border: 1px solid rgba(255, 211, 110, 0.42);
}

.jm-badge {
  flex: none;
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
  animation: jm-in 0.75s cubic-bezier(0.2, 1.4, 0.4, 1) 0.25s backwards;
}

@keyframes jm-in {
  from {
    opacity: 0;
    transform: scale(0.3) rotate(-25deg);
  }
}

.hwb-txt {
  min-width: 0;
}

.hwb-k {
  display: block;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.hwb-txt b {
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.05;
}

.hwb-txt small {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-2);
}

.hwb-total {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 850;
}

.hwb-stars i {
  width: 21px;
  height: 21px;
}

.hw-cats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}

.hw-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(3, 10, 18, 0.38);
  border: 1px solid rgba(176, 228, 255, 0.12);
}

.hwc-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--aurora);
  background: rgba(99, 243, 184, 0.12);
}

.hwc-ico svg {
  width: 20px;
  height: 20px;
}

.hwc-txt {
  flex: 1 1 auto;
  min-width: 0;
}

.hwc-txt b {
  display: block;
  font-size: 0.92rem;
  font-weight: 900;
}

.hwc-txt small {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--ink-2);
}

/* ((v6 fix) Level 2: the trail moments in the ride's row, "Trail moments ⭐ 2/3" beside its name (on
   the next line where the row is too narrow); the row's height stays as it was) */
.hwc-tm {
  display: inline-block;
  margin-left: 3px;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
  max-width: 100%;
  vertical-align: 1px;
  color: var(--aurora);
}

.hwc-txt .hwc-tm b {
  display: inline;
  font-size: inherit;
  font-weight: 900;
  white-space: nowrap;
}

.hwc-stars {
  flex: none;
}

.hwc-stars i {
  width: 17px;
  height: 17px;
}

.hw-cat .st-row i.on {
  animation: star-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.18s + 0.45s);
}

.hw-cat .st-row i.on:nth-child(2) {
  animation-delay: calc(var(--i, 0) * 0.18s + 0.53s);
}

.hw-cat .st-row i.on:nth-child(3) {
  animation-delay: calc(var(--i, 0) * 0.18s + 0.61s);
}

@keyframes star-pop {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-40deg);
  }
}

.hw-stats2 {
  margin-top: 12px;
}

.hw-stats2 .hw-tile dd {
  font-size: 1.25rem;
}

.hw-unlock {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 7px 12px 7px 7px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 134, 207, 0.17), rgba(179, 148, 255, 0.12));
  border: 1px solid rgba(255, 134, 207, 0.48);
}

.hwu-art {
  position: relative;
  flex: none;
  width: 96px;
  height: 52px;
  border-radius: 11px;
  overflow: hidden;
}

.hwu-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hwu-new {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 900;
  background: var(--pink);
  color: #2a0618;
}

.hwu-txt b {
  display: block;
  font-weight: 900;
}

.hwu-txt small {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-2);
}

.hw-actions.two {
  gap: 10px;
}

/* two buttons side by side: Play again takes the room, the second one stays compact */
.hw-actions.two .hb {
  min-width: 0;
}

.hw-actions.two .hb-primary {
  flex: 1 1 auto;
}

.hw-actions.two .hw-second {
  flex: 0 1 auto;
}

.hw-actions.two .hb-en {
  display: none;
}

.hw-actions.two .hb-big .hb-no {
  font-size: 1.2rem;
}

/* ---- responsive (v4) ---- */
/* Phones in portrait and tall tablets: the bag on top, the shelf along the bottom, the info card above it. */
@media (max-width: 640px), (orientation: portrait) and (max-width: 1000px) {
  .pack-shelf {
    top: auto;
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + var(--safe-r));
    bottom: calc(var(--gap) + var(--safe-b));
    width: auto;
    height: min(42vh, 380px);
    padding: 8px 6px 4px 8px;
    border-radius: 20px;
  }

  .ps-head {
    padding-bottom: 2px;
  }

  .ps-ico {
    width: 26px;
    height: 26px;
  }

  .ps-tt b {
    display: inline;
    font-size: 0.98rem;
  }

  .ps-tt small {
    display: inline;
    margin-left: 6px;
  }

  .ps-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 6px;
  }

  .ps-item {
    min-height: 88px;
    padding: 5px 3px 5px;
  }

  .psi-pic {
    width: 42px;
    height: 42px;
  }

  .pack-side {
    display: contents;
  }

  .pack-bag {
    position: absolute;
    top: calc(var(--gap) + var(--safe-t));
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + 66px + var(--safe-r));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 9px 10px 10px;
    border-radius: 18px;
  }

  .pb-head {
    grid-column: 1 / -1;
  }

  .pb-ico {
    width: 26px;
    height: 26px;
  }

  .pb-tt {
    font-size: 0.98rem;
  }

  .pb-meter {
    grid-column: 1;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    column-gap: 6px;
  }

  .pb-ml {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .pb-slots,
  .pb-wbar {
    grid-column: 2;
    grid-row: 1;
  }

  .pb-mv,
  .pb-wv {
    grid-column: 3;
    grid-row: 1;
    font-size: 0.8rem;
  }

  .pb-slots {
    height: 30px;
    border-radius: 9px;
  }

  .pb-seg svg,
  .pb-seg img {
    width: 20px;
    height: 20px;
  }

  .pb-wbar {
    height: 12px;
  }

  .pb-actions {
    grid-column: 2;
    grid-row: 2 / 4;
    align-self: center;
  }

  .pb-actions .hb {
    min-height: 56px;
    width: 92px;
    padding: 6px 8px;
    flex-direction: column;
    gap: 2px;
    text-align: center;
  }

  .pb-actions .hb .hb-txt {
    align-items: center;
  }

  .pb-actions .hb .hb-no {
    font-size: 0.86rem;
    white-space: normal;
    line-height: 1.05;
  }

  .pb-actions .hb .hb-en,
  .pb-actions .hb .hb-key {
    display: none;
  }

  .pb-actions .hb .hb-ico {
    width: 22px;
    height: 22px;
  }

  .pack-info {
    position: absolute;
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + var(--safe-r));
    bottom: calc(min(42vh, 380px) + 2 * var(--gap) + var(--safe-b));
    padding: 9px 12px 8px;
    border-radius: 18px;
  }

  .pi-pic {
    width: 52px;
    height: 52px;
  }

  .pi-tip {
    margin-top: 7px;
  }

  .pi-dau {
    width: 34px;
    height: 34px;
  }

  .pi-hint {
    margin-top: 4px;
  }

  /* the camp: the card on top (dots instead of the checklist), the action at the bottom */
  .camp-card {
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + 66px + var(--safe-r));
    width: auto;
    max-height: 52vh;
    padding: 10px 12px 11px;
    border-radius: 18px;
  }

  .cc-title {
    font-size: 1.18rem;
  }

  .cc-dau {
    width: 38px;
    height: 38px;
  }

  .cc-tipt {
    font-size: 0.8rem;
  }

  .cc-fact p,
  .cc-note {
    font-size: 0.76rem;
  }

  .cc-list {
    display: none;
  }

  .camp-act {
    left: calc(var(--gap) + var(--safe-l));
    right: calc(var(--gap) + var(--safe-r));
  }

  .ca-hint {
    font-size: 0.84rem;
    padding: 7px 12px;
  }

  .ca-btns {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .ca-btns .hb {
    width: 100%;
    max-width: 360px;
    min-width: 0;
  }

  .ca-choices {
    width: 100%;
  }

  .ca-choice {
    flex: 1 1 140px;
  }
}

@media (max-width: 640px) {
  .ht-levels {
    gap: 8px;
    margin-top: 14px;
  }

  .hl-art {
    height: 54px;
  }

  .hl-txt {
    padding: 6px 9px 8px;
  }

  .hl-name {
    font-size: 0.9rem;
  }

  .hl-sub {
    display: none;
  }

  .ht-level.is-locked .hl-sub {
    display: block;
    font-size: 0.68rem;
  }

  .hl-k {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }

  .st-row i {
    width: 14px;
    height: 14px;
  }

  .hud-say {
    gap: 8px;
  }

  .hs-dau {
    width: 46px;
    height: 46px;
  }

  .hs-text {
    font-size: 0.86rem;
    padding: 7px 11px 8px;
  }

  .rv-portrait {
    width: 70px;
    height: 70px;
  }

  .rv-sub {
    font-size: 0.9rem;
  }

  .rv-ess {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rv-more ul {
    grid-template-columns: 1fr;
  }

  .rv-warn li,
  .rv-more li {
    font-size: 0.8rem;
  }

  .rv-actions {
    bottom: -18px;
  }

  .rv-actions .hb-big {
    min-height: 56px;
    padding-right: 14px;
  }

  .rv-back {
    padding-right: 14px;
  }

  .hw-badge {
    gap: 10px;
    padding: 6px 10px 6px 6px;
  }

  .jm-badge {
    width: 74px;
    height: 74px;
  }

  .hwb-txt b {
    font-size: 1.2rem;
  }

  .hwb-txt small {
    font-size: 0.72rem;
  }

  .hw-cats {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .hw-cat {
    padding: 6px 9px;
  }

  .hw-unlock {
    gap: 9px;
  }

  .hwu-art {
    width: 72px;
    height: 44px;
  }

  .hw-actions.two .hb,
  .rv-actions .hb {
    padding-right: 14px;
  }

  .hw-actions.two .hb-key,
  .rv-actions .hb-key,
  .rv-actions .hb-en {
    display: none;
  }

  .rv-actions .hb {
    flex: 1 1 auto;
    min-width: 0;
  }

  .rv-actions .hb-big .hb-no {
    font-size: 1.15rem;
  }
}

/* Short landscape (phones on their side): the shelf on the left, the bag and the info card on the
   right, the camp card a narrow column on the left. */
@media (max-height: 500px) and (min-width: 641px) {
  .ht-levels {
    gap: 8px;
    margin-top: 10px;
  }

  .ht-level {
    flex-direction: row;
  }

  .hl-art {
    width: 92px;
    height: auto;
  }

  .hl-txt {
    padding: 6px 30px 7px 10px;
  }

  .hl-name {
    font-size: 0.92rem;
  }

  .hl-sub {
    display: none;
  }

  .ht-level.is-locked .hl-sub {
    display: block;
    font-size: 0.68rem;
  }

  .ht-level .hb-key {
    top: auto;
    bottom: 6px;
    right: 6px;
  }

  .pack-shelf {
    top: calc(8px + var(--safe-t));
    bottom: calc(8px + var(--safe-b));
    width: min(360px, 44vw);
    padding: 8px 6px 4px 8px;
  }

  .ps-head {
    padding-bottom: 2px;
  }

  .ps-tt small {
    display: none;
  }

  .ps-grid {
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 5px;
  }

  .ps-item {
    min-height: 82px;
    padding: 4px 3px 4px;
  }

  .psi-pic {
    width: 38px;
    height: 38px;
  }

  .pack-side {
    top: calc(8px + var(--safe-t));
    right: calc(var(--gap) + 66px + var(--safe-r));
    width: min(250px, 30vw);
    gap: 8px;
  }

  .pack-bag {
    gap: 6px;
    padding: 8px 10px 10px;
    border-radius: 18px;
  }

  .pb-ess small {
    display: none;
  }

  .pb-slots {
    height: 28px;
  }

  .pb-seg svg,
  .pb-seg img {
    width: 20px;
    height: 20px;
  }

  .pb-wbar {
    height: 10px;
  }

  .pb-actions .hb {
    min-height: 48px;
  }

  .pb-actions .hb-en {
    display: none;
  }

  .pack-info {
    padding: 8px 10px 7px;
    border-radius: 16px;
  }

  .pi-pic {
    width: 44px;
    height: 44px;
  }

  .pi-name {
    font-size: 0.96rem;
  }

  .pi-detail {
    display: none;
  }

  .pi-tip {
    margin-top: 6px;
  }

  .pi-dau {
    display: none;
  }

  .pi-tipt {
    font-size: 0.76rem;
  }

  .pi-tipt::before {
    display: none;
  }

  .pi-hint {
    display: none;
  }

  .hud-review {
    width: min(640px, calc(100vw - 24px));
  }

  .rv-portrait {
    width: 60px;
    height: 60px;
  }

  .rv-names h2 {
    font-size: 1.5rem;
  }

  .rv-ess {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 10px;
    gap: 4px;
  }

  .rv-e {
    font-size: 0.72rem;
  }

  .rv-pic {
    width: 24px;
    height: 24px;
  }

  .rv-actions {
    bottom: -12px;
    margin-top: 8px;
  }

  .rv-actions .hb {
    min-height: 48px;
  }

  .camp-card {
    top: calc(8px + var(--safe-t));
    width: min(300px, 38vw);
    max-height: calc(100% - 16px - var(--safe-t) - var(--safe-b));
    padding: 9px 12px 10px;
  }

  .cc-title {
    font-size: 1.12rem;
  }

  .cc-dau {
    width: 34px;
    height: 34px;
  }

  .cc-tipt {
    font-size: 0.78rem;
  }

  .cc-fact p,
  .cc-note {
    font-size: 0.74rem;
  }

  .cc-list {
    display: none;
  }

  .camp-act {
    left: calc(min(300px, 38vw) + 2 * var(--gap) + var(--safe-l));
    bottom: calc(10px + var(--safe-b));
    gap: 6px;
  }

  .ca-btns .hb {
    min-width: 200px;
    min-height: 54px;
  }

  .hs-dau {
    width: 44px;
    height: 44px;
  }

  .hs-text {
    font-size: 0.84rem;
    margin-top: 2px;
  }

  .hw-badge {
    margin-top: 10px;
    padding: 4px 10px 4px 4px;
  }

  .jm-badge {
    width: 64px;
    height: 64px;
  }

  .hwb-txt b {
    font-size: 1.15rem;
  }

  .hw-cats {
    margin-top: 8px;
    gap: 5px;
  }

  .hw-cat {
    padding: 5px 9px;
  }

  .hwc-ico {
    width: 28px;
    height: 28px;
  }
}

/* Laptops (not tall): the level cards lie on their side (picture left) so the title fits without scrolling. */
@media (min-width: 641px) and (min-height: 501px) and (max-height: 900px) {
  .ht-levels {
    margin-top: 12px;
  }

  .ht-level {
    flex-direction: row;
  }

  .hl-art {
    width: 112px;
    height: auto;
  }

  .hl-txt {
    justify-content: center;
    padding: 8px 12px 9px 12px;
  }

  .ht-level .hb-key {
    top: auto;
    bottom: 8px;
  }

  .hl-sub {
    display: none;
  }

  .ht-level.is-locked .hl-sub {
    display: block;
  }

  .ht-howto {
    margin-top: 12px;
    padding: 10px 14px;
    gap: 5px;
  }
}

/* Docked win card (wide screens): two category columns still fit; one when it gets narrow. */
@media (min-width: 1000px) and (min-aspect-ratio: 5/4) and (max-width: 1200px) {
  .hud-win.is-l2 .hw-cats {
    grid-template-columns: 1fr;
  }

  /* (integrator) two buttons side by side in the narrow docked card: the key chips sat on top of
     "Play again" / "Level select" (the keys still work: Enter, L) */
  .hw-actions.two .hb {
    padding-right: 14px;
  }

  .hw-actions.two .hb-key {
    display: none;
  }
}

@media (hover: none) and (pointer: coarse) {
  .ht-level .hb-key,
  .ca-choice .hb-key {
    display: none !important;
  }

  .ht-howto-2 kbd {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-say,
  .pack-info,
  .pb-seg,
  .rv-e,
  .rv-mark,
  .jm-badge,
  .hw-cat .st-row i.on,
  .ps-item.is-pending .psi-pic {
    animation: none !important;
  }

  .ht-level,
  .ps-item,
  .psi-in,
  .pb-wfill,
  .ca-prog i {
    transition: none;
  }
}

/* ===========================================================================
 * Simplified phone and tablet controls (v5): the compact ride HUD
 * ---------------------------------------------------------------------------
 * hud.js puts .hud--compact on #hud on touch-first devices (pointer: coarse) or when the short side
 * of the screen is under 600 px (?compact=1 / ?compact=0 force it). Desktop and mouse layouts never
 * get the class, so nothing above changes for them. The ride (ARCHITECTURE "Simplified phone and
 * tablet controls (v5): contract"): Haw! / Gee! as big round thumb buttons in the bottom corners,
 * Whoa! / On by! smaller round ones above and inside them, a slim horizontal brake slider between
 * the thumbs, ONE action pill (+ at most one small second pill) above the brake, a top bar of small
 * pills (Dau + km/h, the compass, Book + ⋯), the team as a "🐾 8 ●" chip and one-line alerts.
 * =========================================================================== */

/* (desktop: these compact-only parts never show) */
.rt-pico,
.ra-short,
.ya-short,
.ps-handle,
.cc-toggle,
.hud-root .hud-more {
  display: none;
}

/* (the camp card's fun fact and checklist: a box of their own only in the compact layout) */
.cc-more {
  display: contents;
}

/* (no fade-out: the ⋯ button goes the moment the layout switches back to desktop) */
.hud-root .hud-more {
  transition: none;
}

#hud.hud--compact {
  --c-edge: 12px;
  --c-top: 12px;
  /* Haw! / Gee! (thumbs), Whoa! / On by! (voice), the brake and the action pills: sizes and offsets */
  --c-th: 74px;
  --c-th-x: 14px;
  --c-th-y: 22px;
  --c-vo: 50px;
  --c-vo-x: 96px;
  --c-vo-y: 96px;
  --c-bk-y: 37px;
  --c-act-y: 152px;
}

@media (orientation: landscape) {
  #hud.hud--compact {
    --c-th-x: 16px;
    --c-th-y: 16px;
    --c-vo-y: 84px;
    --c-bk-y: 22px;
    --c-act-y: 74px;
  }
}

/* (tablets: a little more to hold on to) */
@media (min-width: 700px) and (min-height: 700px) {
  #hud.hud--compact {
    --c-th: 82px;
    --c-th-x: 18px;
    --c-th-y: 24px;
    --c-vo: 54px;
    --c-vo-x: 108px;
    --c-vo-y: 108px;
    --c-bk-y: 43px;
    --c-act-y: 170px;
  }
}

/* ---- top bar: Dau + km/h (one pill), the compass pill, the Book and the ⋯ menu ---- */
#hud.hud--compact[data-mode='ride'] .hud-portrait {
  left: calc(var(--c-edge) + 4px + var(--safe-l));
  top: calc(var(--c-top) + 4px + var(--safe-t));
  width: 38px;
  height: 38px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(99, 243, 184, 0.5), 0 3px 8px rgba(0, 0, 0, 0.4);
}

#hud.hud--compact[data-mode='ride'] .ride-stats {
  left: calc(var(--c-edge) + var(--safe-l));
  top: calc(var(--c-top) + var(--safe-t));
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: none;
  height: 46px;
  padding: 0 14px 0 52px;
  border-radius: 999px;
  border-left: 1px solid var(--edge);
}

#hud.hud--compact[data-mode='ride'] .rs-v {
  min-width: 0;
  font-size: 1.32rem;
}

#hud.hud--compact[data-mode='ride'] .rs-u {
  font-size: 0.72rem;
}

#hud.hud--compact[data-mode='ride'] .rs-time {
  display: none;
}

/* (wider screens: the time beside the speed, "15 km/h · 5:12"; phones upright find it in the ⋯ menu) */
@media (min-width: 600px) {
  #hud.hud--compact[data-mode='ride'] .rs-time {
    display: flex;
    margin: 0;
    font-size: 0.8rem;
  }

  #hud.hud--compact[data-mode='ride'] .rs-time::before {
    content: '·';
    margin-right: 4px;
  }

  #hud.hud--compact[data-mode='ride'] .rs-ico {
    display: none;
  }
}

/* stamina (pushing): a thin underline along the bottom of the pill */
#hud.hud--compact[data-mode='ride'] .rs-stamina {
  position: absolute;
  left: 52px;
  right: 14px;
  bottom: 6px;
  margin: 0;
}

#hud.hud--compact[data-mode='ride'] .rs-sl {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .rs-bar {
  min-width: 0;
  height: 3px;
}

/* (centred on the screen; phones held upright: centred in the gap between the stats pill and the Book.
   No translate and no layer of its own: the trail chip inside it is placed on the screen, in the
   alert slot) */
#hud.hud--compact[data-mode='ride'] .ride-compass {
  left: 0;
  right: 0;
  top: calc(var(--c-top) + 1px + var(--safe-t));
  translate: none;
  width: fit-content;
  margin: 0 auto;
  flex-direction: row;
  gap: 6px;
  height: 44px;
  padding: 0 14px 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  will-change: auto;
}

#hud.hud--compact[data-mode='ride'] .rc-dial {
  width: 30px;
  height: 30px;
  box-shadow: none;
}

#hud.hud--compact[data-mode='ride'] .rc-ticks {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .rc-face {
  fill: rgba(3, 10, 18, 0.35);
  stroke: rgba(176, 228, 255, 0.45);
  stroke-width: 3;
}

#hud.hud--compact[data-mode='ride'] .rc-dist {
  gap: 5px;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#hud.hud--compact[data-mode='ride'] .rc-hut,
#hud.hud--compact[data-mode='ride'] .rc-no {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .rc-km {
  font-size: 1rem;
}

@media (max-width: 479.98px) {
  /* (a steady width: the compass beside it doesn't jiggle when the speed gets a second digit) */
  #hud.hud--compact[data-mode='ride'] .ride-stats {
    width: 128px;
  }

  #hud.hud--compact[data-mode='ride'] .ride-compass {
    left: calc(var(--c-edge) + 136px + var(--safe-l));
    right: calc(var(--c-edge) + 102px + var(--safe-r));
    max-width: calc(100vw - 2 * var(--c-edge) - 238px - var(--safe-l) - var(--safe-r));
    overflow: hidden;
  }
}

/* (the smallest phones: a slimmer compass pill) */
@media (max-width: 380px) {
  #hud.hud--compact[data-mode='ride'] .ride-compass {
    gap: 4px;
    padding: 0 10px 0 6px;
  }

  #hud.hud--compact[data-mode='ride'] .rc-dial {
    width: 26px;
    height: 26px;
  }

  #hud.hud--compact[data-mode='ride'] .rc-km {
    font-size: 0.94rem;
  }
}

/* "Hut" / "Camp" where there is room */
@media (min-width: 480px) {
  #hud.hud--compact[data-mode='ride'] .rc-no {
    display: inline;
    color: var(--ink);
    font-weight: 900;
    font-size: 0.92rem;
  }
}

#hud.hud--compact[data-mode='ride'] .hud-mute {
  display: none;
  transition: none;
}

#hud.hud--compact[data-mode='ride'] .hud-bookbtn {
  top: calc(var(--c-top) + 1px + var(--safe-t));
  right: calc(var(--c-edge) + 50px + var(--safe-r));
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
}

#hud.hud--compact[data-mode='ride'] .hud-bookbtn .hb-ico {
  width: 22px;
  height: 22px;
}

#hud.hud--compact[data-mode='ride'] .hud-bookbtn::before {
  content: none;
}

/* (the "3/16" badge on the Book's top right corner, as in the mockup: clear of the compass pill) */
#hud.hud--compact[data-mode='ride'] .hud-bookbtn .bkb-count {
  left: auto;
  right: -6px;
  top: -6px;
  min-width: 0;
  height: 16px;
  padding: 0 4px;
  font-size: 0.56rem;
}

#hud.hud--compact[data-mode='ride'] .hud-more {
  display: grid;
  position: absolute;
  z-index: 7;
  top: calc(var(--c-top) + 1px + var(--safe-t));
  right: calc(var(--c-edge) + var(--safe-r));
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
  place-items: center;
  will-change: transform;
}

#hud.hud--compact[data-mode='ride'] .hud-more .hb-ico {
  width: 22px;
  height: 22px;
}

#hud.hud--compact[data-mode='ride'] .hud-more.is-open {
  border-color: rgba(99, 243, 184, 0.75);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.25), var(--shadow);
}

/* ---- the team: a "🐾 8 ●" chip under the stats pill; a tap opens the full strip for a moment ---- */
#hud.hud--compact[data-mode='ride'] .ride-team {
  --chip: 26px;
  left: calc(var(--c-edge) + var(--safe-l));
  top: calc(var(--c-top) + 50px + var(--safe-t));
  align-items: flex-start;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

#hud.hud--compact[data-mode='ride'] .rt-toggle {
  pointer-events: auto !important;
  position: relative;
  isolation: isolate;
  justify-content: flex-start;
  gap: 6px;
  width: auto;
  min-width: 66px;
  min-height: 0;
  height: 44px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
}

/* the chip itself is drawn 32 px tall inside the 44 px touch target */
#hud.hud--compact[data-mode='ride'] .rt-toggle::before {
  content: '';
  position: absolute;
  inset: 6px 0;
  z-index: -1;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--edge);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#hud.hud--compact[data-mode='ride'] .ride-team:not(.collapsed) .rt-toggle::before {
  border-color: rgba(99, 243, 184, 0.6);
}

#hud.hud--compact[data-mode='ride'] .rt-toggle:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: -2px;
}

#hud.hud--compact[data-mode='ride'] .rt-pico {
  display: grid;
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}

#hud.hud--compact[data-mode='ride'] .rt-pico svg {
  width: 100%;
  height: 100%;
}

#hud.hud--compact[data-mode='ride'] .rt-lbl,
#hud.hud--compact[data-mode='ride'] .rt-toggle .hb-key {
  display: none !important;
}

#hud.hud--compact[data-mode='ride'] .rt-n {
  font-size: 0.95rem;
}

#hud.hud--compact[data-mode='ride'] .rt-worst {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--aurora);
  box-shadow: 0 0 6px rgba(99, 243, 184, 0.7);
}

#hud.hud--compact[data-mode='ride'] .rt-worst[data-e='low'] {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(255, 190, 85, 0.8);
}

#hud.hud--compact[data-mode='ride'] .rt-worst[data-e='ex'] {
  background: var(--danger);
  box-shadow: 0 0 7px rgba(255, 92, 63, 0.9);
}

/* the opened strip: the mini gangline on its own glass card under the chip */
#hud.hud--compact[data-mode='ride'] .rt-rows {
  gap: 5px;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid var(--edge-hi);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(214, 236, 255, 0.4) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) content-box,
    linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b)) padding-box;
  box-shadow: var(--shadow);
  animation: hud-in 0.2s ease-out backwards;
}

#hud.hud--compact[data-mode='ride'] .rt-link {
  width: 8px;
}

#hud.hud--compact[data-mode='ride'] .rt-dog {
  border-radius: 8px;
}

#hud.hud--compact[data-mode='ride'] .rt-fill {
  border-radius: 6px;
}

/* ---- one-line alerts under the top bar (a tap shows the longer hint); the trail chip shares the slot ---- */
#hud.hud--compact[data-mode='ride'] .ride-alert {
  left: calc(var(--c-edge) + 84px + var(--safe-l));
  right: calc(var(--c-edge) + var(--safe-r));
  top: calc(var(--c-top) + 50px + var(--safe-t));
  translate: none;
  isolation: isolate;
  gap: 8px;
  width: fit-content;
  max-width: calc(100vw - 2 * var(--c-edge) - 84px - var(--safe-l) - var(--safe-r));
  min-height: 44px;
  margin: 0 auto;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: 16px;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: auto;
  cursor: pointer;
}

/* the line is drawn 34 px tall inside its 44 px touch target */
#hud.hud--compact[data-mode='ride'] .ride-alert::before {
  content: '';
  position: absolute;
  inset: 5px 0;
  z-index: -1;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid var(--edge);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.38);
}

#hud.hud--compact[data-mode='ride'] .ride-alert::after {
  inset: 1px -4px;
  border-radius: 18px;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.good::before {
  border-color: rgba(99, 243, 184, 0.5);
}

#hud.hud--compact[data-mode='ride'] .ride-alert.warn::before {
  border-color: rgba(255, 190, 85, 0.6);
}

#hud.hud--compact[data-mode='ride'] .ride-alert.danger::before {
  background: linear-gradient(180deg, rgba(120, 26, 16, 0.92), rgba(72, 14, 10, 0.94));
  border-color: rgba(255, 130, 100, 0.7);
}

#hud.hud--compact[data-mode='ride'] .ra-ico {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

#hud.hud--compact[data-mode='ride'] .ra-ico svg {
  width: 16px;
  height: 16px;
}

#hud.hud--compact[data-mode='ride'] .ra-txt b,
#hud.hud--compact[data-mode='ride'] .ra-txt small {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .ra-txt {
  overflow: hidden;
}

/* (one line; a long one — a junction's two trail names on a small phone — may take a second) */
#hud.hud--compact[data-mode='ride'] .ra-short {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.15;
  text-wrap: balance;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.warn .ra-short {
  color: var(--amber);
}

#hud.hud--compact[data-mode='ride'] .ride-alert.danger .ra-short {
  color: #ffd9cd;
}

/* tapped: the full title and its hint */
#hud.hud--compact[data-mode='ride'] .ride-alert.is-open {
  padding-top: 9px;
  padding-bottom: 9px;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.is-open .ra-short {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.is-open .ra-txt b,
#hud.hud--compact[data-mode='ride'] .ride-alert.is-open .ra-txt small {
  display: block;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.is-open .ra-txt b {
  font-size: 0.92rem;
}

#hud.hud--compact[data-mode='ride'] .ride-alert.is-open .ra-txt small {
  font-size: 0.74rem;
}

/* the trail chip ("On trail · Lake route") sits in the alert slot while no alert is up */
#hud.hud--compact[data-mode='ride'] .rc-trail {
  position: fixed;
  left: calc(var(--c-edge) + 84px + var(--safe-l));
  right: calc(var(--c-edge) + var(--safe-r));
  top: calc(var(--c-top) + 56px + var(--safe-t));
  width: fit-content;
  height: 32px;
  margin: 0 auto;
  padding: 0 12px 0 8px;
  font-size: 0.76rem;
}

#hud.hud--compact[data-mode='ride'] .rc-on {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .sec-ride.has-alert .rc-trail {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .rc-trail {
  max-width: calc(100vw - 2 * var(--c-edge) - 84px - var(--safe-l) - var(--safe-r));
  overflow: hidden;
}

@media (orientation: landscape) {
  #hud.hud--compact[data-mode='ride'] .ride-alert,
  #hud.hud--compact[data-mode='ride'] .rc-trail {
    right: calc(var(--c-edge) + 84px + var(--safe-r));
    max-width: calc(100vw - 2 * var(--c-edge) - 168px - var(--safe-l) - var(--safe-r));
  }
}

/* (a thumb that drifts while it holds Lean! or Run!, or presses a call, must not turn into a pan that
   cancels the press: the ride never scrolls, so its buttons keep every touch to themselves) */
#hud.hud--compact[data-mode='ride'] .sec-ride .hb {
  touch-action: none;
}

/* ---- Haw! / Gee!: big round thumb buttons in the bottom corners; Whoa! / On by! above, inside ---- */
#hud.hud--compact[data-mode='ride'] .ride-steer {
  display: contents;
}

#hud.hud--compact[data-mode='ride'] .ride-steer .hb {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  text-align: center;
}

#hud.hud--compact[data-mode='ride'] .ride-steer .hb .hb-txt {
  align-items: center;
}

#hud.hud--compact[data-mode='ride'] .hb-steer {
  width: var(--c-th);
  height: var(--c-th);
  bottom: calc(var(--c-th-y) + var(--safe-b));
  border: 2px solid rgba(99, 243, 184, 0.55);
  background: linear-gradient(180deg, rgba(20, 42, 62, 0.86), rgba(9, 20, 33, 0.9));
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='left'] {
  left: calc(var(--c-th-x) + var(--safe-l));
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='right'] {
  right: calc(var(--c-th-x) + var(--safe-r));
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-ico {
  width: 22px;
  height: 22px;
  margin-bottom: 1px;
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-no {
  font-size: 1.06rem;
  line-height: 1;
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-en {
  margin-top: 3px;
  font-size: 0.52rem;
  letter-spacing: 0.1em;
}

#hud.hud--compact[data-mode='ride'] .hb-voice {
  width: var(--c-vo);
  height: var(--c-vo);
  bottom: calc(var(--c-vo-y) + var(--safe-b));
  background: linear-gradient(180deg, rgba(20, 42, 62, 0.82), rgba(9, 20, 33, 0.88));
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='whoa'] {
  left: calc(var(--c-vo-x) + var(--safe-l));
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='onby'] {
  right: calc(var(--c-vo-x) + var(--safe-r));
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-ico {
  width: 18px;
  height: 18px;
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-no {
  margin-top: 1px;
  font-size: 0.66rem;
  line-height: 1;
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-en {
  display: none;
}

/* key chips (keyboards only; touch screens hide them): small, on the outer top edge */
#hud.hud--compact[data-mode='ride'] .ride-steer .hb-key {
  top: -5px;
  bottom: auto;
  height: 16px;
  min-width: 0;
  padding: 0 4px;
  font-size: 0.54rem;
  background: #0a1622;
  transform: none;
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='left'] .hb-key,
#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='whoa'] .hb-key {
  left: -3px;
  right: auto;
}

#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='right'] .hb-key,
#hud.hud--compact[data-mode='ride'] .ride-steer [data-id='onby'] .hb-key {
  right: -3px;
  left: auto;
}

/* the press pips: four paws round the rim, on the side that faces the middle of the screen */
#hud.hud--compact[data-mode='ride'] .ride-steer .hb-paws {
  position: absolute;
  inset: 0;
  display: block;
  height: auto;
  margin: 0;
  pointer-events: none;
}

#hud.hud--compact[data-mode='ride'] .ride-steer .hb-paws i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  padding: 1.5px;
  border-radius: 50%;
  background: #0b1826;
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-paws i {
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  padding: 1px;
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-paws i:nth-child(1) {
  translate: calc((var(--c-th) / 2 - 3px) * 0.342) calc((var(--c-th) / 2 - 3px) * -0.94);
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-paws i:nth-child(2) {
  translate: calc((var(--c-th) / 2 - 3px) * 0.743) calc((var(--c-th) / 2 - 3px) * -0.669);
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-paws i:nth-child(3) {
  translate: calc((var(--c-th) / 2 - 3px) * 0.97) calc((var(--c-th) / 2 - 3px) * -0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-steer .hb-paws i:nth-child(4) {
  translate: calc((var(--c-th) / 2 - 3px) * 0.97) calc((var(--c-th) / 2 - 3px) * 0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-paws i:nth-child(1) {
  translate: calc((var(--c-vo) / 2 - 2px) * 0.342) calc((var(--c-vo) / 2 - 2px) * -0.94);
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-paws i:nth-child(2) {
  translate: calc((var(--c-vo) / 2 - 2px) * 0.743) calc((var(--c-vo) / 2 - 2px) * -0.669);
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-paws i:nth-child(3) {
  translate: calc((var(--c-vo) / 2 - 2px) * 0.97) calc((var(--c-vo) / 2 - 2px) * -0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-voice .hb-paws i:nth-child(4) {
  translate: calc((var(--c-vo) / 2 - 2px) * 0.97) calc((var(--c-vo) / 2 - 2px) * 0.242);
}

/* (Gee! and On by! on the right: mirrored) */
#hud.hud--compact[data-mode='ride'] .hb-steer-r .hb-paws i,
#hud.hud--compact[data-mode='ride'] .hb-voice-r .hb-paws i {
  scale: -1 1;
}

#hud.hud--compact[data-mode='ride'] .hb-steer-r .hb-paws i:nth-child(1) {
  translate: calc((var(--c-th) / 2 - 3px) * -0.342) calc((var(--c-th) / 2 - 3px) * -0.94);
}

#hud.hud--compact[data-mode='ride'] .hb-steer-r .hb-paws i:nth-child(2) {
  translate: calc((var(--c-th) / 2 - 3px) * -0.743) calc((var(--c-th) / 2 - 3px) * -0.669);
}

#hud.hud--compact[data-mode='ride'] .hb-steer-r .hb-paws i:nth-child(3) {
  translate: calc((var(--c-th) / 2 - 3px) * -0.97) calc((var(--c-th) / 2 - 3px) * -0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-steer-r .hb-paws i:nth-child(4) {
  translate: calc((var(--c-th) / 2 - 3px) * -0.97) calc((var(--c-th) / 2 - 3px) * 0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-voice-r .hb-paws i:nth-child(1) {
  translate: calc((var(--c-vo) / 2 - 2px) * -0.342) calc((var(--c-vo) / 2 - 2px) * -0.94);
}

#hud.hud--compact[data-mode='ride'] .hb-voice-r .hb-paws i:nth-child(2) {
  translate: calc((var(--c-vo) / 2 - 2px) * -0.743) calc((var(--c-vo) / 2 - 2px) * -0.669);
}

#hud.hud--compact[data-mode='ride'] .hb-voice-r .hb-paws i:nth-child(3) {
  translate: calc((var(--c-vo) / 2 - 2px) * -0.97) calc((var(--c-vo) / 2 - 2px) * -0.242);
}

#hud.hud--compact[data-mode='ride'] .hb-voice-r .hb-paws i:nth-child(4) {
  translate: calc((var(--c-vo) / 2 - 2px) * -0.97) calc((var(--c-vo) / 2 - 2px) * 0.242);
}

/* ---- the brake: a slim horizontal slider between the thumbs (drag; a tap jumps there; S / W) ---- */
#hud.hud--compact[data-mode='ride'] .ride-brake {
  left: 50%;
  right: auto;
  bottom: calc(var(--c-bk-y) + var(--safe-b));
  translate: -50% 0;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: min(340px, calc(100vw - 2 * (var(--c-th-x) + var(--c-th) + 10px) - var(--safe-l) - var(--safe-r)));
  height: 44px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='ride'] .rb-label b {
  font-size: 0.8rem;
}

#hud.hud--compact[data-mode='ride'] .rb-slider {
  flex: 1;
  width: auto;
  height: 44px;
  margin: 0;
  border-radius: 0;
  container-type: inline-size;
  cursor: ew-resize;
}

#hud.hud--compact[data-mode='ride'] .rb-rail {
  left: 0;
  right: 0;
  top: 50%;
  bottom: auto;
  width: auto;
  height: 8px;
  translate: 0 -50%;
  border-radius: 99px;
  background: rgba(176, 228, 255, 0.18);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

#hud.hud--compact[data-mode='ride'] .rb-fill {
  inset: 0;
  width: auto;
  height: auto;
  transform-origin: left center;
  transform: scaleX(var(--b));
  background: linear-gradient(90deg, var(--amber), var(--amber-2));
  transition: transform 0.08s linear;
}

#hud.hud--compact[data-mode='ride'] .rb-ticks,
#hud.hud--compact[data-mode='ride'] .rb-grip,
#hud.hud--compact[data-mode='ride'] .rb-claw,
#hud.hud--compact[data-mode='ride'] .rb-value,
#hud.hud--compact[data-mode='ride'] .rb-keys {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .rb-bar {
  left: 0;
  right: auto;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  transform: translateX(calc(var(--b) * (100cqw - 24px)));
  background: linear-gradient(180deg, #f6f9fc, #c8d3df);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

#hud.hud--compact[data-mode='ride'] .ride-brake.is-on .rb-bar {
  background: linear-gradient(180deg, #fff4de, #ffc47c);
  border-color: rgba(255, 236, 200, 0.95);
}

/* ---- the actions: ONE pill above the brake (+ at most one smaller pill above it) ---- */
#hud.hud--compact[data-mode='ride'] .ride-actions {
  left: 50%;
  right: auto;
  bottom: calc(var(--c-act-y) + var(--safe-b));
  translate: -50% 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px - var(--safe-l) - var(--safe-r));
}

#hud.hud--compact[data-mode='ride'] .ra-ctx,
#hud.hud--compact[data-mode='ride'] .ra-main {
  display: contents;
}

/* (folded away at once: no fade-out that would keep a third pill on screen for a moment) */
#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-folded {
  display: none !important;
  transition: none !important;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second {
  order: 1;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-primary {
  order: 2;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb {
  justify-content: center;
  gap: 9px;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  height: 50px;
  padding: 0 22px 0 16px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb .hb-ico {
  width: 24px;
  height: 24px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb-ringed .hb-ico,
#hud.hud--compact[data-mode='ride'] .ride-actions .hb-help .hb-ico {
  width: 30px;
  height: 30px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb .hb-no {
  font-size: 1.1rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb .hb-en {
  margin-top: 1px;
  font-size: 0.54rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-primary .hb-en:not(:empty) {
  display: block;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb .hb-key {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb-lean {
  padding-bottom: 0;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb-risk {
  left: 22px;
  right: 22px;
  bottom: 4px;
  height: 3px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second {
  gap: 7px;
  height: 44px;
  padding: 0 16px 0 12px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second .hb-no {
  font-size: 0.92rem;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second .hb-en,
#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second .hb-risk {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb.is-second .hb-ico {
  width: 20px;
  height: 20px;
}

#hud.hud--compact[data-mode='ride'] .ride-actions .hb-ringed.is-second .hb-ico,
#hud.hud--compact[data-mode='ride'] .ride-actions .hb-help.is-second .hb-ico {
  width: 26px;
  height: 26px;
}

/* Skip (the arrival cut-scene): a quiet pill in the corner */
#hud.hud--compact[data-mode='ride'] .ride-skip {
  right: calc(var(--c-edge) + var(--safe-r));
  bottom: calc(var(--c-edge) + var(--safe-b));
}

#hud.hud--compact[data-mode='ride'] .hb-skip {
  min-height: 44px;
  padding: 0 18px 0 12px;
}

/* ---- Spotted! card: compact, never over the thumb buttons ---- */
@media (orientation: portrait) {
  /* (upright: just above the bottom controls — hud.js measures them — clear of the horizon) */
  #hud.hud--compact[data-mode='ride'] .hud-spots {
    top: auto;
    left: max(calc(var(--c-edge) + var(--safe-l)), calc(50% - 186px));
    right: auto;
    bottom: var(--spot-bottom, calc(260px + var(--safe-b)));
    width: min(372px, calc(100vw - 2 * var(--c-edge) - var(--safe-l) - var(--safe-r)));
  }

  /* (slimmer: the animal's picture beside the name and Dau's line, no foot line — the "New!" tag in
     the kicker says it is new — so it fits between the dog team and the controls more often) */
  #hud.hud--compact[data-mode='ride'] .hud-spot {
    grid-template-rows: auto auto;
    gap: 3px 8px;
    padding: 6px 8px 7px 10px;
  }

  #hud.hud--compact[data-mode='ride'] .spc-thumb {
    grid-row: 1 / 3;
    align-self: stretch;
    min-height: 0;
  }

  #hud.hud--compact[data-mode='ride'] .spc-id {
    grid-column: 2;
  }

  #hud.hud--compact[data-mode='ride'] .spc-foot {
    display: none;
  }
}

@media (orientation: landscape) {
  /* (on its side: at the right, above On by!, clear of the action pills in the middle) */
  #hud.hud--compact[data-mode='ride'] .hud-spots {
    top: auto;
    left: auto;
    right: calc(var(--c-edge) + var(--safe-r));
    bottom: calc(var(--c-vo-y) + var(--c-vo) + 16px + var(--safe-b));
    width: min(300px, 36vw);
  }
}

/* ---- the command banner (Haw! accepted…): smaller, under the alert line ---- */
#hud.hud--compact[data-mode='ride'] .hud-banner {
  top: max(34%, calc(150px + var(--safe-t)));
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 8px 18px 8px 10px;
  border-radius: 16px;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='ride'] .hud-banner .hbn-ico {
  width: 26px;
  height: 26px;
}

#hud.hud--compact[data-mode='ride'] .hud-banner b {
  font-size: 1.05rem;
}

#hud.hud--compact[data-mode='ride'] .hud-banner small {
  font-size: 0.7rem;
}

@media (orientation: landscape) {
  #hud.hud--compact[data-mode='ride'] .hud-banner {
    top: max(38%, calc(140px + var(--safe-t)));
  }
}

#hud.hud--compact[data-mode='ride'] .hud-toasts {
  top: calc(var(--c-top) + 102px + var(--safe-t));
  width: min(420px, calc(100vw - 24px));
}

/* ---- the ⋯ menu: sound, graphics, the time, and the calls for the dogs ---- */
.hud-menu {
  position: absolute;
  z-index: 9;
  top: calc(var(--c-top, 12px) + 52px + var(--safe-t));
  right: calc(var(--c-edge, 12px) + var(--safe-r));
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(280px, calc(100vw - 24px));
  max-height: calc(100% - 76px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  padding: 4px 8px 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid var(--edge-hi);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: menu-in 0.2s ease-out backwards;
  will-change: transform;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

.hm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 8px;
}

.hm-head b {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* (the ride waits while the menu is open: a small "Paused" chip says so) */
.hm-paused {
  display: none;
  align-items: center;
  gap: 4px;
  margin: 0 auto 0 10px;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  background: rgba(255, 190, 85, 0.16);
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hm-paused svg {
  width: 12px;
  height: 12px;
}

.hud-menu.is-paused .hm-paused {
  display: inline-flex;
}

.hm-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.hm-close span {
  display: grid;
  width: 18px;
  height: 18px;
}

.hm-close svg,
.hm-ico svg,
.hm-hico svg {
  width: 100%;
  height: 100%;
}

.hm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: rgba(3, 10, 18, 0.35);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.hm-time {
  cursor: default;
}

.hm-row:focus-visible,
.hm-close:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

.hm-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 10px;
  background: rgba(176, 228, 255, 0.1);
  color: var(--aurora);
}

.hm-txt {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.hm-txt b {
  font-size: 0.95rem;
  font-weight: 900;
}

.hm-txt small {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-2);
}

.hm-switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: rgba(176, 228, 255, 0.2);
  transition: background 0.2s ease;
}

.hm-switch i {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e8eef5;
  transition: transform 0.2s ease;
}

.hm-sound.is-on .hm-switch {
  background: var(--aurora-2);
}

.hm-sound.is-on .hm-switch i {
  transform: translateX(18px);
}

.hm-sound:not(.is-on) .hm-ico {
  color: var(--ink-3);
}

.hm-seg {
  display: flex;
  flex: none;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--edge-hi);
}

.hm-seg i {
  padding: 4px 6px;
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 900;
  color: var(--ink-3);
}

.hm-gfx:not(.is-low) .hm-hi,
.hm-gfx.is-low .hm-lo {
  background: var(--aurora);
  color: var(--aurora-ink);
}

.hm-gfx.is-armed {
  border-color: rgba(255, 190, 85, 0.75);
}

.hm-gfx.is-armed small {
  color: var(--amber);
}

.hm-t {
  font-size: 1.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hm-help h3 {
  margin: 6px 4px 6px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hm-help ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-help li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(3, 10, 18, 0.35);
}

.hm-hico {
  display: grid;
  grid-row: 1 / 3;
  width: 22px;
  height: 22px;
  color: var(--aurora);
}

.hm-hico.hm-whoa {
  color: var(--amber);
}

.hm-hico.hm-onby {
  color: var(--teal);
}

.hm-help li b {
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.1;
}

.hm-help li span:last-child {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink-2);
}

/* (phones on their side: two columns, so the menu fits without scrolling) */
@media (max-height: 500px) and (orientation: landscape) {
  .hud-menu {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
    column-gap: 10px;
    width: min(540px, calc(100vw - 24px));
  }

  .hm-head {
    grid-column: 1 / -1;
  }

  .hm-sound,
  .hm-gfx,
  .hm-time {
    grid-column: 1;
  }

  .hm-help {
    grid-column: 2;
    grid-row: 2 / span 3;
    padding-top: 0;
  }

  .hm-help h3 {
    margin-top: 0;
  }

  .hm-help li {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-menu,
  #hud.hud--compact[data-mode='ride'] .rt-rows {
    animation: none;
  }
}

/* ===========================================================================
 * Simplified phone and tablet controls (v5): the other screens in the same spirit
 * ---------------------------------------------------------------------------
 * The yard and the hut yard, packing and the camp (ARCHITECTURE "Other modes on phones"). Like the
 * compact ride: a slim top bar (a small pill top-left, the Book and the ⋯ menu top-right; the sound
 * button lives in the ⋯ menu), one-line hints, and small round or pill buttons in the corners, so the
 * dogs and the scene keep the middle of the screen. Only #hud.hud--compact gets any of this.
 * =========================================================================== */

/* ---- the top bar's right end: the Book (with its 3/16 badge) and the ⋯ menu ---- */
#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-mute {
  display: none;
  transition: none;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-bookbtn {
  top: calc(var(--c-top) + 1px + var(--safe-t));
  right: calc(var(--c-edge) + 50px + var(--safe-r));
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-bookbtn .hb-ico {
  width: 22px;
  height: 22px;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-bookbtn::before {
  content: none;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-bookbtn .bkb-count {
  left: auto;
  right: -6px;
  top: -6px;
  min-width: 0;
  height: 16px;
  padding: 0 4px;
  font-size: 0.56rem;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-more {
  display: grid;
  position: absolute;
  z-index: 7;
  top: calc(var(--c-top) + 1px + var(--safe-t));
  right: calc(var(--c-edge) + var(--safe-r));
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
  place-items: center;
  will-change: transform;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-more .hb-ico {
  width: 22px;
  height: 22px;
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-more.is-open {
  border-color: rgba(99, 243, 184, 0.75);
  box-shadow: 0 0 0 3px rgba(99, 243, 184, 0.25), var(--shadow);
}

#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-more .hb-key,
#hud.hud--compact:is([data-mode='yard'], [data-mode='pack'], [data-mode='camp']) .hud-bookbtn .hb-key {
  display: none;
}

/* (the ⋯ menu away from the trail: no trail time; the calls for the dogs only in the yards) */
#hud.hud--compact:not([data-mode='ride']) .hm-time,
#hud.hud--compact:is([data-mode='pack'], [data-mode='camp']) .hm-help {
  display: none;
}

/* ((v6 map polish) the user: "no need to repeat buttons available on the screen all the time". On the
   trail the ⋯ menu leaves out what never leaves the screen there: the four calls' tiles (Haw! Gee!
   Stooo! Yip yip! are its thumb buttons, with the same icons; the Trail tip stays) and the time where
   the stats pill shows it ("15 km/h · 5:12", 600 px wide and up). Dau's map has no row: the compass is
   its button. The yards keep the calls: no call buttons there.) */
#hud.hud--compact[data-mode='ride'] .hm-help h3,
#hud.hud--compact[data-mode='ride'] .hm-help li:not(.hm-trail) {
  display: none;
}

@media (min-width: 600px) {
  #hud.hud--compact[data-mode='ride'] .hm-time {
    display: none;
  }
}

/* (so, on the trail, a phone on its side has three rows left: one column, as upright) */
@media (max-height: 500px) and (orientation: landscape) {
  #hud.hud--compact[data-mode='ride'] .hud-menu {
    display: flex;
    width: min(300px, calc(100vw - 24px));
  }
}

/* ---- Dau's bubble: a small one under the top bar ---- */
#hud.hud--compact:not([data-mode='ride']) .hud-say {
  gap: 8px;
}

#hud.hud--compact:not([data-mode='ride']) .hs-dau {
  width: 40px;
  height: 40px;
  border-width: 2px;
}

#hud.hud--compact:not([data-mode='ride']) .hs-text {
  margin-top: 2px;
  padding: 6px 12px 7px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.25;
}

#hud.hud--compact:not([data-mode='ride']) .hud-say.is-long .hs-text {
  font-size: 0.8rem;
}

#hud.hud--compact:not([data-mode='ride']) .hs-text::before {
  top: 10px;
}

#hud.hud--compact:not([data-mode='ride']) .hs-who {
  display: none;
}

/* ===================================================================== the yard (and the hut yard) */
/* Dau's face in the roster chip, as in the ride's stats pill */
#hud.hud--compact[data-mode='yard'] .hud-portrait {
  left: calc(var(--c-edge) + 4px + var(--safe-l));
  top: calc(var(--c-top) + 4px + var(--safe-t));
  z-index: 4;
  width: 38px;
  height: 38px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(99, 243, 184, 0.5), 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* ---- the roster: a "Dogs 5/12 · Tied ✓" chip; a tap opens the harness spots below it ---- */
#hud.hud--compact[data-mode='yard'] .yard-panel {
  z-index: 3;
  left: calc(var(--c-edge) + var(--safe-l));
  right: auto;
  top: calc(var(--c-top) + var(--safe-t));
  width: auto;
  height: 46px;
  padding: 0 8px 0 52px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='yard'] .yp-head {
  height: 100%;
  gap: 8px;
  justify-content: flex-start;
}

#hud.hud--compact[data-mode='yard'] .yp-count {
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
}

#hud.hud--compact[data-mode='yard'] .yp-k {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

#hud.hud--compact[data-mode='yard'] .yp-n {
  margin: 0;
  font-size: 1.2rem;
}

#hud.hud--compact[data-mode='yard'] .yp-en,
#hud.hud--compact[data-mode='yard'] .yp-tie-txt small,
#hud.hud--compact[data-mode='yard'] .yp-sled {
  display: none;
}

/* the tie state: plain text after a dot, amber until the sled is tied, then green */
#hud.hud--compact[data-mode='yard'] .yp-tie {
  gap: 4px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

#hud.hud--compact[data-mode='yard'] .yp-tie::before {
  content: '·';
  margin-right: 2px;
  color: var(--ink-3);
  font-weight: 900;
}

#hud.hud--compact[data-mode='yard'] .yp-tie-ico {
  width: 18px;
  height: 18px;
}

#hud.hud--compact[data-mode='yard'] .yp-tie-txt b {
  font-size: 0.86rem;
}

/* the chevron; the whole chip is its button (::before covers the pill) */
#hud.hud--compact[data-mode='yard'] .yp-toggle {
  position: static;
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0 0 0 -2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(3, 10, 18, 0.35);
  color: var(--ink);
  cursor: pointer;
}

#hud.hud--compact[data-mode='yard'] .yp-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='yard'] .yp-toggle:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

#hud.hud--compact[data-mode='yard'] .yp-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

#hud.hud--compact[data-mode='yard'] .yard-panel.expanded .yp-toggle svg {
  transform: rotate(180deg);
}

#hud.hud--compact[data-mode='yard'] .yp-toggle .hb-key {
  display: none;
}

/* the dogs on the gangline: a thin twelve-pip line along the bottom of the chip */
#hud.hud--compact[data-mode='yard'] .yp-meter {
  position: absolute;
  left: 52px;
  right: 18px;
  bottom: 5px;
  margin: 0;
  gap: 2px;
  pointer-events: none;
}

#hud.hud--compact[data-mode='yard'] .yp-meter i {
  height: 3px;
  border-radius: 2px;
}

#hud.hud--compact[data-mode='yard'] .yp-meter i.min::after {
  top: -2px;
  bottom: -2px;
  width: 1.5px;
}

/* the harness spots: a card below the chip (it floats over the snow: the dogs keep their places) */
#hud.hud--compact[data-mode='yard'] .yard-panel:not(.expanded) .yp-rows {
  display: none;
}

#hud.hud--compact[data-mode='yard'] .yard-panel.expanded .yp-rows {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: min(280px, calc(100vw - 2 * var(--c-edge) - var(--safe-l) - var(--safe-r)));
  /* (clear of the Show names button in the bottom-left corner; it scrolls when that is too short) */
  max-height: calc(100vh - 2 * var(--c-top) - 46px - 6px - 68px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  gap: 4px;
  padding: 8px 10px 8px 8px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid var(--edge-hi);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: menu-in 0.2s ease-out backwards;
}

/* (held upright the open card covers the hint line: no ghost of it through the card or past its edge) */
@media (orientation: portrait) {
  #hud.hud--compact[data-mode='yard'] .yard-panel.expanded ~ .yard-actions .ya-hint {
    visibility: hidden;
  }
}

#hud.hud--compact[data-mode='yard'] .yp-row {
  grid-template-columns: 48px 1fr 2px 1fr;
}

#hud.hud--compact[data-mode='yard'] .yp-slot {
  height: 44px;
  border-radius: 12px;
  font-size: 0.86rem;
}

/* ---- the hint: one short line under the top bar (a tap shows the whole hint for a moment) ---- */
#hud.hud--compact[data-mode='yard'] .ya-hint {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  top: calc(var(--c-top) + 52px + var(--safe-t));
  width: fit-content;
  margin: 0 auto;
  display: grid;
  place-items: center;
  max-width: calc(100vw - 2 * var(--c-edge) - var(--safe-l) - var(--safe-r));
  min-height: 44px;
  padding: 4px 0;
  background: none;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
}

/* ((L2 polish) no hint (the dogs are saying it themselves): no empty pill either) */
#hud.hud--compact[data-mode='yard'] .ya-hint.empty {
  display: none;
}

#hud.hud--compact[data-mode='yard'] .ya-hint::before {
  content: '';
  position: absolute;
  inset: 4px 0;
  z-index: -1;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid rgba(255, 190, 85, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* (the whole hint stays readable to screen readers; the short line is for the eyes) */
#hud.hud--compact[data-mode='yard'] .ya-hint:not(.is-open) b {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#hud.hud--compact[data-mode='yard'] .ya-hint small {
  display: none;
}

#hud.hud--compact[data-mode='yard'] .ya-short {
  display: block;
  max-width: 100%;
  padding: 0 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.2;
  color: var(--amber);
}

#hud.hud--compact[data-mode='yard'] .ya-hint.is-open .ya-short {
  display: none;
}

#hud.hud--compact[data-mode='yard'] .ya-hint.is-open b {
  display: block;
  max-width: min(420px, calc(100vw - 2 * var(--c-edge) - 28px));
  padding: 6px 14px;
  font-size: 0.86rem;
  line-height: 1.3;
  text-align: center;
}

/* ---- Tie / Step on: pills in the bottom-right corner; Show names: a round button bottom-left ---- */
/* (no layer of its own: the hint inside it is placed on the screen, under the top bar; the buttons
   get the layer) */
#hud.hud--compact[data-mode='yard'] .yard-actions {
  will-change: auto;
  left: auto;
  right: calc(var(--c-edge) + var(--safe-r));
  bottom: calc(var(--c-edge) + var(--safe-b));
  width: auto;
  align-items: flex-end;
  gap: 8px;
}

#hud.hud--compact[data-mode='yard'] .ya-btns {
  will-change: transform;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

#hud.hud--compact[data-mode='yard'] .ya-btns .hb {
  flex: none;
  width: auto;
  max-width: calc(100vw - 2 * var(--c-edge) - 74px - var(--safe-l) - var(--safe-r));
  min-width: 0;
  min-height: 50px;
  height: 50px;
  gap: 8px;
  padding: 0 20px 0 14px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='yard'] .ya-btns .hb .hb-txt {
  padding: 0;
}

#hud.hud--compact[data-mode='yard'] .ya-btns .hb .hb-no {
  font-size: 1rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='yard'] .ya-btns .hb .hb-en,
#hud.hud--compact[data-mode='yard'] .ya-btns .hb .hb-key {
  display: none;
}

#hud.hud--compact[data-mode='yard'] .ya-btns .hb-ico {
  width: 24px;
  height: 24px;
}

#hud.hud--compact[data-mode='yard'] .hb-names.is-compact {
  left: calc(var(--c-edge) + var(--safe-l));
  top: auto;
  bottom: calc(var(--c-edge) + var(--safe-b));
  width: 58px;
  height: 58px;
  flex-direction: column;
  gap: 1px;
}

#hud.hud--compact[data-mode='yard'] .hb-names.is-compact .hb-ico {
  width: 22px;
  height: 22px;
  margin-top: -6px;
}

/* (the caption inside the button, over the little on/off switch on its rim) */
#hud.hud--compact[data-mode='yard'] .hb-names.is-compact::before {
  position: static;
  order: 1;
  translate: none;
  padding: 0;
  background: none;
  font-size: 0.6rem;
  line-height: 1;
}

#hud.hud--compact[data-mode='yard'] .hb-names.is-compact .hb-key {
  display: none;
}

/* ---- the dog card: docked under the top bar on phones held upright ---- */
#hud.hud--compact[data-mode='yard'] .hud-dogcard.docked {
  top: calc(var(--c-top) + 56px + var(--safe-t));
}

/* ---- Spotted! cards in the yard: under the top bar, on the right ---- */
#hud.hud--compact[data-mode='yard'] .hud-spots {
  top: calc(var(--c-top) + 104px + var(--safe-t));
  left: auto;
  right: calc(var(--c-edge) + var(--safe-r));
  bottom: auto;
  width: min(320px, calc(100vw - 2 * var(--c-edge) - var(--safe-l) - var(--safe-r)));
}

/* (tablets: a little more to hold on to) */
@media (min-width: 700px) and (min-height: 700px) {
  #hud.hud--compact[data-mode='yard'] .ya-btns .hb {
    min-height: 54px;
    height: 54px;
  }

  #hud.hud--compact[data-mode='yard'] .hb-names.is-compact {
    width: 62px;
    height: 62px;
  }
}

/* (the smallest phones: the chip drops its "DOGS" word and the rope icon) */
@media (max-width: 380px) {
  #hud.hud--compact[data-mode='yard'] .yp-k,
  #hud.hud--compact[data-mode='yard'] .yp-tie-ico {
    display: none;
  }
}

/* ======================================================================= packing (Level 2) */
/* ---- the sled bag: a slim bar along the top (must-haves, the space in the bag, the weight) ---- */
#hud.hud--compact[data-mode='pack'] .pack-side {
  display: contents;
}

#hud.hud--compact[data-mode='pack'] .pack-bag {
  position: absolute;
  top: calc(var(--c-top) + var(--safe-t));
  left: calc(var(--c-edge) + var(--safe-l));
  right: calc(var(--c-edge) + 102px + var(--safe-r));
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  will-change: transform;
}

#hud.hud--compact[data-mode='pack'] .pb-head {
  display: contents;
}

#hud.hud--compact[data-mode='pack'] .pb-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

#hud.hud--compact[data-mode='pack'] .pb-tt,
#hud.hud--compact[data-mode='pack'] .pb-ess small,
#hud.hud--compact[data-mode='pack'] .pb-ml,
#hud.hud--compact[data-mode='pack'] .pb-actions {
  display: none;
}

#hud.hud--compact[data-mode='pack'] .pb-ess {
  flex: none;
  margin: 0;
  padding: 2px 8px 2px 3px;
}

#hud.hud--compact[data-mode='pack'] .pb-essn {
  font-size: 0.84rem;
}

#hud.hud--compact[data-mode='pack'] .pb-space {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 6px;
}

#hud.hud--compact[data-mode='pack'] .pb-slots {
  grid-column: 1;
  grid-row: 1;
  height: 22px;
  border-radius: 7px;
}

#hud.hud--compact[data-mode='pack'] .pb-segs,
#hud.hud--compact[data-mode='pack'] .pb-ticks {
  inset: 2px;
}

#hud.hud--compact[data-mode='pack'] .pb-seg {
  padding: 1px;
  border-radius: 5px;
}

#hud.hud--compact[data-mode='pack'] .pb-seg svg,
#hud.hud--compact[data-mode='pack'] .pb-seg img {
  width: 14px;
  height: 14px;
}

#hud.hud--compact[data-mode='pack'] .pb-mv,
#hud.hud--compact[data-mode='pack'] .pb-wv {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.74rem;
  white-space: nowrap;
}

/* (phones: the bag's segments show the space; the number comes back on wider screens) */
#hud.hud--compact[data-mode='pack'] .pb-mv {
  display: none;
}

#hud.hud--compact[data-mode='pack'] .pb-weight {
  flex: none;
  display: block;
}

/* the weight: a thin line along the bottom of the bar */
#hud.hud--compact[data-mode='pack'] .pb-wbar {
  position: absolute;
  left: 46px;
  right: 18px;
  bottom: 4px;
  height: 3px;
  border: 0;
  pointer-events: none;
}

/* (wider screens: the words come back) */
@media (min-width: 600px) {
  #hud.hud--compact[data-mode='pack'] .pb-tt {
    display: block;
    flex: none;
    font-size: 0.92rem;
  }

  #hud.hud--compact[data-mode='pack'] .pb-ess small {
    display: inline;
  }

  #hud.hud--compact[data-mode='pack'] .pb-mv {
    display: block;
  }
}

@media (max-width: 380px) {
  #hud.hud--compact[data-mode='pack'] .pack-bag {
    gap: 6px;
    padding: 0 10px 0 6px;
  }

  #hud.hud--compact[data-mode='pack'] .pb-ico {
    display: none;
  }

  #hud.hud--compact[data-mode='pack'] .pb-wbar {
    left: 16px;
  }
}

/* ---- the supplies: a bottom sheet (drag its handle or its header up and down, or tap them) ---- */
#hud.hud--compact[data-mode='pack'] .sec-pack {
  --sh-peek: 66px;
  --sh-open: max(156px, min(36vh, 340px));
  --sh-tall: max(196px, 66vh);
  --sheet-h: var(--sh-open);
}

#hud.hud--compact[data-mode='pack'] .sec-pack.sh-peek {
  --sheet-h: var(--sh-peek);
}

#hud.hud--compact[data-mode='pack'] .sec-pack.sh-tall {
  --sheet-h: var(--sh-tall);
}

#hud.hud--compact[data-mode='pack'] .sec-pack.sh-drag {
  --sheet-h: var(--sh-drag, var(--sh-open));
}

#hud.hud--compact[data-mode='pack'] .pack-shelf {
  top: auto;
  left: calc(var(--c-edge) + var(--safe-l));
  right: calc(var(--c-edge) + var(--safe-r));
  bottom: 0;
  width: auto;
  height: calc(var(--sheet-h) + var(--safe-b));
  padding: 0 6px var(--safe-b) 8px;
  border-radius: 22px 22px 0 0;
  border-bottom: 0;
  overflow: hidden;
  transition: height 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  will-change: transform;
}

#hud.hud--compact[data-mode='pack'] .sec-pack.sh-drag .pack-shelf {
  transition: none;
}

/* (the sheet takes its own taps and drags: nothing falls through to the porch behind it) */
#hud.hud--compact[data-mode='pack'] .pack-shelf {
  pointer-events: auto;
}

#hud.hud--compact[data-mode='pack'] .ps-handle {
  display: grid;
  place-items: center;
  flex: none;
  height: 20px;
  margin: 0 -6px 0 -8px;
  cursor: grab;
  touch-action: none;
}

#hud.hud--compact[data-mode='pack'] .ps-handle i {
  display: block;
  width: 42px;
  height: 5px;
  border-radius: 3px;
  background: rgba(214, 246, 255, 0.42);
}

#hud.hud--compact[data-mode='pack'] .ps-head {
  flex: none;
  min-height: 44px;
  gap: 8px;
  padding: 0 2px 2px 2px;
  cursor: grab;
  touch-action: none;
}

#hud.hud--compact[data-mode='pack'] .ps-ico {
  width: 28px;
  height: 28px;
}

/* (the title over its one instruction, which may wrap: it is never cut short) */
#hud.hud--compact[data-mode='pack'] .ps-tt {
  min-width: 0;
  line-height: 1.15;
}

#hud.hud--compact[data-mode='pack'] .ps-tt b {
  display: block;
  font-size: 1rem;
}

#hud.hud--compact[data-mode='pack'] .ps-tt small {
  display: block;
  margin-top: 1px;
}

/* "Ready to go": the pill at the right end of the sheet's header */
#hud.hud--compact[data-mode='pack'] .ps-head .hb {
  flex: none;
  margin-left: auto;
  width: auto;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  gap: 6px;
  padding: 0 16px 0 10px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='pack'] .ps-head .hb .hb-no {
  font-size: 0.92rem;
}

#hud.hud--compact[data-mode='pack'] .ps-head .hb .hb-en,
#hud.hud--compact[data-mode='pack'] .ps-head .hb .hb-key {
  display: none;
}

#hud.hud--compact[data-mode='pack'] .ps-head .hb .hb-ico {
  width: 20px;
  height: 20px;
}

#hud.hud--compact[data-mode='pack'] .ps-scroll {
  flex: 1 1 auto;
}

#hud.hud--compact[data-mode='pack'] .ps-gh {
  margin: 4px 2px 5px;
}

#hud.hud--compact[data-mode='pack'] .ps-grid {
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
}

#hud.hud--compact[data-mode='pack'] .ps-item {
  min-height: 82px;
  padding: 5px 3px 4px;
}

#hud.hud--compact[data-mode='pack'] .psi-pic {
  width: 38px;
  height: 38px;
}

/* ---- the info card: just above the sheet ---- */
#hud.hud--compact[data-mode='pack'] .pack-info {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(var(--sheet-h) + 8px + var(--safe-b));
  translate: -50% 0;
  width: min(420px, calc(100vw - 2 * var(--c-edge) - var(--safe-l) - var(--safe-r)));
  padding: 8px 12px 7px;
  border-radius: 18px;
  transition: bottom 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

#hud.hud--compact[data-mode='pack'] .sec-pack.sh-drag .pack-info {
  transition: none;
}

#hud.hud--compact[data-mode='pack'] .pi-pic {
  width: 44px;
  height: 44px;
}

#hud.hud--compact[data-mode='pack'] .pi-tip {
  margin-top: 5px;
}

#hud.hud--compact[data-mode='pack'] .pi-dau {
  width: 30px;
  height: 30px;
}

#hud.hud--compact[data-mode='pack'] .pi-hint {
  margin-top: 3px;
}

/* (on its side: the sheet is a column on the left, up to the bag bar; the porch keeps the right) */
@media (orientation: landscape) {
  #hud.hud--compact[data-mode='pack'] .sec-pack {
    --sh-open: max(126px, calc(100vh - 70px));
    --sh-tall: var(--sh-open);
  }

  #hud.hud--compact[data-mode='pack'] .pack-shelf {
    right: auto;
    width: min(460px, calc(50vw - 2 * var(--c-edge)));
  }

  /* (the info card: small, in the bottom-right corner of the porch, clear of Dau's bubble at the top) */
  #hud.hud--compact[data-mode='pack'] .pack-info {
    left: auto;
    right: calc(var(--c-edge) + var(--safe-r));
    bottom: calc(var(--c-edge) + var(--safe-b));
    translate: none;
    width: min(260px, calc(50vw - 3 * var(--c-edge)));
  }

  #hud.hud--compact[data-mode='pack'] .pi-detail,
  #hud.hud--compact[data-mode='pack'] .pi-dau {
    display: none;
  }

  #hud.hud--compact[data-mode='pack'] .ps-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 5px;
  }

  #hud.hud--compact[data-mode='pack'] .ps-item {
    min-height: 76px;
  }

  #hud.hud--compact[data-mode='pack'] .psi-pic {
    width: 34px;
    height: 34px;
  }
}

/* ================================================================== the camp (Level 2) */
/* ---- the step card: a top sheet — the step, the title and Dau's tip; a tap opens the fun fact
   and the checklist below it (over the scene; a tap anywhere else or the next step folds them) ---- */
#hud.hud--compact[data-mode='camp'] .camp-card {
  left: calc(var(--c-edge) + var(--safe-l));
  right: calc(var(--c-edge) + var(--safe-r));
  top: calc(var(--c-top) + var(--safe-t));
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 9px 12px 10px;
  border-radius: 20px;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
}

/* (room for the Book and the ⋯ button over the card's top-right corner: the step line and the title
   flow round it) */
#hud.hud--compact[data-mode='camp'] .camp-card::before {
  content: '';
  float: right;
  width: 92px;
  height: 38px;
  margin-right: -8px;
}

#hud.hud--compact[data-mode='camp'] .cc-head {
  gap: 6px;
  justify-content: flex-start;
  font-size: 0.64rem;
}

#hud.hud--compact[data-mode='camp'] .cc-dots {
  gap: 3px;
}

#hud.hud--compact[data-mode='camp'] .cc-dots i {
  width: 7px;
  height: 7px;
}

#hud.hud--compact[data-mode='camp'] .cc-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin: -4px 0 -4px auto;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: rgba(3, 10, 18, 0.4);
  color: var(--ink);
  cursor: pointer;
}

#hud.hud--compact[data-mode='camp'] .cc-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-toggle svg {
  transform: rotate(180deg);
}

#hud.hud--compact[data-mode='camp'] .cc-toggle:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

#hud.hud--compact[data-mode='camp'] .cc-title {
  margin-top: 4px;
  font-size: 1.12rem;
}

#hud.hud--compact[data-mode='camp'] .cc-tip {
  gap: 8px;
  margin-top: 6px;
}

#hud.hud--compact[data-mode='camp'] .cc-dau {
  width: 32px;
  height: 32px;
}

#hud.hud--compact[data-mode='camp'] .cc-tipt {
  font-size: 0.8rem;
}

#hud.hud--compact[data-mode='camp'] .cc-note {
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 0.76rem;
}

#hud.hud--compact[data-mode='camp'] .camp-card:not(.is-open) .cc-more {
  display: none;
}

#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-more {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: block;
  max-height: 52vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--glass-solid-a), var(--glass-solid-b));
  border: 1px solid var(--edge-hi);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: menu-in 0.2s ease-out backwards;
  cursor: pointer;
}

/* (more steps below the fold — a phone on its side: a fade and a small chevron along the bottom) */
#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-more.more-below::after {
  content: '';
  position: sticky;
  bottom: -10px;
  display: block;
  height: 34px;
  margin: -34px -12px -10px;
  border-radius: 0 0 18px 18px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d6f6ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") center 12px / 18px 18px no-repeat,
    linear-gradient(180deg, transparent, var(--glass-solid-b) 62%);
  pointer-events: none;
}

#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-more.more-above::before {
  content: '';
  position: sticky;
  z-index: 1;
  top: -8px;
  display: block;
  height: 34px;
  margin: -8px -12px -26px;
  border-radius: 18px 18px 0 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d6f6ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 14.5l6-6 6 6'/%3E%3C/svg%3E") center 2px / 16px 16px no-repeat,
    linear-gradient(0deg, transparent, var(--glass-solid-a) 55%);
  pointer-events: none;
}

#hud.hud--compact[data-mode='camp'] .cc-fact {
  margin-top: 0;
  padding: 6px 9px;
}

#hud.hud--compact[data-mode='camp'] .cc-fact p {
  font-size: 0.78rem;
}

/* (v6) the folded card's one-line teaser for Dau's lesson (a tap on the card opens it); the lesson and
   "What we brought" come first in the fold-out */
#hud.hud--compact[data-mode='camp'] .cc-teaser {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 3px 8px 3px 6px;
  border-radius: 10px;
  background: rgba(99, 243, 184, 0.1);
  border: 1px solid rgba(99, 243, 184, 0.3);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
}

#hud.hud--compact[data-mode='camp'] .cc-teico,
#hud.hud--compact[data-mode='camp'] .cc-tego {
  display: grid;
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--aurora);
}

#hud.hud--compact[data-mode='camp'] .cc-teaset {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#hud.hud--compact[data-mode='camp'] .cc-tego svg {
  transition: transform 0.2s ease;
}

#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-tego svg {
  transform: rotate(90deg);
}

/* (upright, Dau's bubble sits under the card, on the fold-out's lesson: it steps back while that is
   open (hud.js setCampOpen: .is-tucked); on its side the bubble sits beside the card and stays) */
#hud.hud--compact[data-mode='camp'] .hud-say.is-tucked {
  /* (display, not only visibility: her portrait's expression layers set their own visibility) */
  display: none !important;
  visibility: hidden;
}

#hud.hud--compact[data-mode='camp'] .cc-learn,
#hud.hud--compact[data-mode='camp'] .cc-kit {
  margin: 0 0 8px;
  padding: 6px 9px 7px;
}

#hud.hud--compact[data-mode='camp'] .cc-lt,
#hud.hud--compact[data-mode='camp'] .cc-kt {
  font-size: 0.78rem;
}

#hud.hud--compact[data-mode='camp'] .cc-ll li,
#hud.hud--compact[data-mode='camp'] .cc-kl li {
  font-size: 0.76rem;
}

#hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-list {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
}

#hud.hud--compact[data-mode='camp'] .cc-list li {
  font-size: 0.78rem;
}

#hud.hud--compact[data-mode='camp'] .cl-mk {
  width: 18px;
  height: 18px;
}

/* ---- the step's interaction: a short hint, the spot list as small pills, ONE action pill ---- */
#hud.hud--compact[data-mode='camp'] .camp-act {
  left: calc(var(--c-edge) + var(--safe-l));
  right: calc(var(--c-edge) + var(--safe-r));
  bottom: calc(var(--c-edge) + var(--safe-b));
  gap: 8px;
}

#hud.hud--compact[data-mode='camp'] .ca-hint {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: min(440px, 100%);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  line-height: 1.25;
}

#hud.hud--compact[data-mode='camp'] .ca-hint.empty {
  display: none;
}

/* (short screens, while the spots are offered: the hint only repeats Dau's tip in the card, so the
   scene gets its room and the numbered spot markers stay in view) */
@media (max-height: 700px) {
  #hud.hud--compact[data-mode='camp'] .camp-act.has-choices .ca-hint {
    display: none;
  }
}

#hud.hud--compact[data-mode='camp'] .ca-prog {
  width: min(240px, 70%);
  height: 8px;
}

#hud.hud--compact[data-mode='camp'] .ca-choices {
  width: auto;
  max-width: min(560px, 100%);
  gap: 6px;
}

#hud.hud--compact[data-mode='camp'] .ca-choice {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  gap: 6px;
  padding: 3px 14px 3px 5px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='camp'] .cac-n {
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
}

#hud.hud--compact[data-mode='camp'] .cac-t {
  min-width: 0;
}

#hud.hud--compact[data-mode='camp'] .cac-t b {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* (what a spot is like: only on the chosen one; Dau says it too) */
#hud.hud--compact[data-mode='camp'] .cac-t small {
  display: none;
  font-size: 0.64rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='camp'] .ca-choice.is-on .cac-t small {
  display: block;
}

#hud.hud--compact[data-mode='camp'] .ca-choice .hb-key {
  display: none;
}

#hud.hud--compact[data-mode='camp'] .ca-btns {
  width: auto;
  max-width: 100%;
}

#hud.hud--compact[data-mode='camp'] .ca-btns .hb {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 52px;
  height: 52px;
  gap: 8px;
  padding: 0 24px 0 16px;
  border-radius: 999px;
}

#hud.hud--compact[data-mode='camp'] .ca-btns .hb .hb-no {
  font-size: 1.08rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='camp'] .ca-btns .hb .hb-en {
  margin-top: 1px;
  font-size: 0.56rem;
  white-space: nowrap;
}

#hud.hud--compact[data-mode='camp'] .ca-btns .hb .hb-key {
  display: none;
}

#hud.hud--compact[data-mode='camp'] .ca-btns .hb .hb-ico {
  width: 24px;
  height: 24px;
}

/* (tablets held upright: a card of a comfortable reading width, clear of the Book and the ⋯ button) */
@media (orientation: portrait) and (min-width: 700px) {
  #hud.hud--compact[data-mode='camp'] .camp-card {
    right: auto;
    width: min(560px, calc(100vw - 2 * var(--c-edge) - 110px));
  }

  #hud.hud--compact[data-mode='camp'] .camp-card::before {
    content: none;
  }
}

/* (on its side: the card on the left, the interaction in the room right of it) */
@media (orientation: landscape) {
  #hud.hud--compact[data-mode='camp'] .camp-card {
    right: auto;
    width: min(340px, 42vw);
  }

  #hud.hud--compact[data-mode='camp'] .camp-card::before {
    content: none;
  }

  #hud.hud--compact[data-mode='camp'] .camp-act {
    left: calc(min(340px, 42vw) + 2 * var(--c-edge) + var(--safe-l));
  }

  #hud.hud--compact[data-mode='camp'] .camp-card.is-open .cc-more {
    max-height: calc(100vh - 190px);
  }
}

/* ========================================================= title and win on the smallest phones */
/* (360 px wide: the sound button no longer sits on "HUSKIES", and "Play again" keeps its whole word
   beside the second button on the win card) */
@media (max-width: 380px) {
  #hud.hud--compact[data-mode='title'] .ht-portrait {
    width: 76px;
    height: 76px;
  }

  #hud.hud--compact[data-mode='title'] .ht-name {
    font-size: 2rem;
  }

  #hud.hud--compact[data-mode='title'] .hud-mute {
    top: calc(8px + var(--safe-t));
    right: calc(8px + var(--safe-r));
    width: 44px;
    height: 44px;
    min-width: 0;
    min-height: 0;
  }

  #hud.hud--compact[data-mode='title'] .hud-mute .hb-ico {
    width: 22px;
    height: 22px;
  }

  #hud.hud--compact .hw-actions.two {
    gap: 8px;
  }

  #hud.hud--compact .hw-actions.two .hb {
    gap: 6px;
    padding-left: 10px;
    padding-right: 12px;
  }

  #hud.hud--compact .hw-actions.two .hb-ico {
    width: 22px;
    height: 22px;
  }

  #hud.hud--compact .hw-actions.two .hb-big .hb-no {
    font-size: 1.04rem;
  }

  #hud.hud--compact .hw-actions.two .hw-second .hb-no {
    font-size: 0.92rem;
  }
}

/* ===========================================================================
 * v6 WP1: Dau's ride voice, and trail or free roam
 * ---------------------------------------------------------------------------
 * hud.js placeRideSay() puts her bubble in the ride (phones upright: under the reserved alert
 * slot; on their side: small, top left; desktop: the band between the stats and the compass);
 * the trail chip's "Free roam" state; the ⋯ menu's trail row.
 * =========================================================================== */

/* "Free roam": off every trail for a while — a slate chip with a dashed edge and a paw */
.rc-trail.is-roam {
  color: #dbe5f1;
  background: linear-gradient(180deg, rgba(46, 60, 80, 0.9), rgba(25, 35, 50, 0.94));
  border: 1px dashed rgba(190, 210, 232, 0.6);
}

.q-low .rc-trail.is-roam {
  background: linear-gradient(180deg, #2b3a4e, #1b2636);
}

.rc-trail.is-roam .rc-tico {
  color: #c4d3e4;
}

.rc-trail.is-roam .rc-on {
  display: none;
}

/* the desktop trail chip shares the stats–compass band with Dau's bubble: it steps back while she talks */
.hud-root.say-over-chip:not(.hud--compact)[data-mode='ride'] .rc-trail {
  visibility: hidden;
}

/* the compact ride's toasts step down under her bubble while she talks */
#hud.hud--compact[data-mode='ride'].say-on .hud-toasts {
  top: calc(var(--say-b, 180px) + 8px + var(--safe-t));
}

/* her bubble in the compact ride */
#hud.hud--compact[data-mode='ride'] .hud-say {
  gap: 8px;
}

#hud.hud--compact[data-mode='ride'] .hs-dau {
  width: 44px;
  height: 44px;
  border-width: 2px;
}

#hud.hud--compact[data-mode='ride'] .hs-text {
  margin-top: 2px;
  padding: 6px 12px 8px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.25;
}

#hud.hud--compact[data-mode='ride'] .hs-text::before {
  top: 12px;
}

/* (a phone on its side: a small bubble top left — a small face, no name line — above the horizon) */
#hud.hud--compact[data-mode='ride'] .hud-say.is-mini {
  gap: 6px;
  align-items: center;
}

#hud.hud--compact[data-mode='ride'] .hud-say.is-mini .hs-dau {
  width: 32px;
  height: 32px;
}

#hud.hud--compact[data-mode='ride'] .hud-say.is-mini .hs-text {
  margin: 0;
  padding: 5px 10px 6px;
  font-size: 0.8rem;
  line-height: 1.22;
}

#hud.hud--compact[data-mode='ride'] .hud-say.is-mini .hs-who {
  display: none;
}

#hud.hud--compact[data-mode='ride'] .hud-say.is-mini .hs-text::before {
  top: 50%;
  margin-top: -6px;
  left: -6px;
  border-width: 6px 6px 6px 0;
}

/* the ⋯ menu: the trail row spans both columns */
.hm-help li.hm-trail {
  grid-column: 1 / -1;
}

.hm-help li.hm-trail .hm-hico {
  color: var(--aurora);
}

/* the title's Level 1 how-to has a seventh row (trail or free roam): on laptops (not tall) the rows sit
   a little closer, so the title still fits without scrolling at 1280×800 */
@media (min-width: 641px) and (min-height: 501px) and (max-height: 900px) {
  .ht-howto {
    margin-top: 10px;
    padding: 9px 14px;
    gap: 4px;
  }

  .ht-howto b {
    font-size: 0.94rem;
    line-height: 1.15;
  }

  .ht-howto small {
    margin-top: 0;
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .ht-howto .ht-ico {
    width: 28px;
    height: 28px;
  }
}

/* ============================================ v6 WP2: the shared ride systems */
/* ---- a Spotted! card held back too long (rideCards.js) comes as a small chip where the cards slide
   in, plus the Book badge. Not a button: it never takes a tap. ---- */
.hud-spot-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 8px;
  max-width: 100%;
  padding: 6px 15px 6px 7px;
  border-radius: 999px;
  color: var(--ink);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22, 46, 68, 0.95), rgba(8, 19, 32, 0.95));
  border: 1.5px solid var(--rc-edge);
  box-shadow: 0 0 18px var(--rc-bg), 0 8px 22px rgba(0, 0, 0, 0.45);
  animation: spot-in 0.5s cubic-bezier(0.2, 1.25, 0.35, 1) backwards;
}

.hud-spot-chip.leaving {
  animation: spot-out 0.32s ease-in forwards;
}

.hsc-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--rc);
  background: var(--rc-bg);
}

.hsc-ico svg {
  width: 18px;
  height: 18px;
}

.hsc-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.hsc-txt b {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsc-txt small {
  font-size: 0.72rem;
  color: var(--ink-2);
}

/* ---- projected markers (ui/rideMarker.js): a ring + label on a point in the world, an edge arrow
   when it is off the screen. pointer-events none throughout: the spotter's HUD test sees through. ---- */
.hud-marks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hud-marks.off,
.mk.off {
  display: none;
}

.mk {
  --mk-c: #ffd27a;
  --mk-glow: rgba(255, 210, 122, 0.45);
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
}

.mk.tone-landmark {
  --mk-c: #fff0cc;
  --mk-glow: rgba(255, 240, 204, 0.4);
}

.mk.tone-info {
  --mk-c: var(--aurora);
  --mk-glow: rgba(99, 243, 184, 0.4);
}

.mk-ring {
  position: absolute;
  left: calc(var(--mk-size) / -2);
  top: calc(var(--mk-size) / -2);
  width: var(--mk-size);
  height: var(--mk-size);
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid var(--mk-c);
  box-shadow: 0 0 0 2px rgba(5, 13, 22, 0.5), 0 0 16px var(--mk-glow), inset 0 0 12px var(--mk-glow);
  animation: mk-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) backwards, mk-pulse 1.6s ease-in-out 0.45s infinite;
}

.mk-arrow {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  box-sizing: border-box;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--mk-c);
  background: rgba(8, 19, 32, 0.82);
  border: 2px solid var(--mk-c);
  box-shadow: 0 0 14px var(--mk-glow), 0 6px 16px rgba(0, 0, 0, 0.45);
  animation: mk-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.mk-arrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mk-c);
}

.mk-arrow:has(.mk-ico)::before {
  display: none;
}

.mk-rot {
  position: absolute;
  inset: -15px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.mk-rot svg {
  width: 15px;
  height: 15px;
  filter: drop-shadow(0 0 3px rgba(5, 13, 22, 0.9));
}

.mk-ico {
  display: grid;
  place-items: center;
}

.mk-ico svg {
  width: 22px;
  height: 22px;
}

.mk:not(.is-ring) .mk-ring,
.mk:not(.is-edge) .mk-arrow {
  display: none;
}

.mk-label {
  position: absolute;
  left: 0;
  top: calc(var(--mk-size) / 2 + 6px);
  transform: translateX(-50%);
  padding: 3px 10px 4px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 800;
  font-size: 0.84rem;
  line-height: 1.15;
  color: var(--ink);
  background: rgba(8, 19, 32, 0.84);
  border: 1px solid var(--mk-c);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mk.no-label .mk-label {
  display: none;
}

/* ((v6 fix) a ring near the screen's edge: its label slides inward to stay on the screen, rideMarker.js;
   and up over the ring / sideways when a HUD control sits under it) */
.mk.is-ring .mk-label {
  left: var(--mk-lx, 0px);
  top: calc(var(--mk-size) / 2 + 6px + var(--mk-ly, 0px));
}

.mk.is-edge .mk-label {
  top: -13px;
  transform: none;
}

.mk.edge-l .mk-label {
  left: 30px;
}

.mk.edge-r .mk-label {
  left: auto;
  right: 30px;
}

.mk.edge-t .mk-label {
  top: 30px;
  transform: translateX(-50%);
}

.mk.edge-b .mk-label {
  top: auto;
  bottom: 30px;
  transform: translateX(-50%);
}

@keyframes mk-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes mk-pulse {
  50% {
    transform: scale(1.07);
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mk-ring,
  .mk-arrow,
  .hud-spot-chip {
    animation: none;
  }
}

/* ---------------------------------------------- (v6 WP3) trail moments */
/* The brake band: green on the slider where the brake holds the moment's target speed — the slot
   the bar sits in while its centre is between lo and hi (desktop: the vertical bar; it reaches
   8 px past the bar on each side and 4 px above and below, so the green shows round it); the bar
   glows green inside it, the band pulses while the brake is outside it. */
.rb-band {
  position: absolute;
  left: -8px;
  right: -8px;
  top: calc(var(--bb0, 0) * (var(--rb-h) - 26px) - 5px);
  height: calc((var(--bb1, 0) - var(--bb0, 0)) * (var(--rb-h) - 26px) + 36px);
  border-radius: 12px;
  border: 2px solid #8ff0b8;
  background: rgba(86, 214, 140, 0.38);
  box-shadow: 0 0 14px rgba(86, 214, 140, 0.7);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    top 0.3s linear,
    height 0.3s linear,
    left 0.3s linear,
    width 0.3s linear;
}

.ride-brake.has-band .rb-band {
  opacity: 1;
  animation: rb-band 1s ease-in-out infinite;
}

.ride-brake.has-band.in-band .rb-band {
  animation: none;
  background: rgba(86, 214, 140, 0.5);
}

.ride-brake.has-band.in-band .rb-bar {
  box-shadow:
    0 0 0 3px rgba(132, 240, 178, 0.95),
    0 5px 12px rgba(0, 0, 0, 0.55);
}

@keyframes rb-band {
  50% {
    opacity: 0.6;
  }
}

/* phones: the slim horizontal slider (the knob, 24 px, has its centre at 12 px + b · (width − 24 px)):
   the slot the knob sits in, 5 px round it */
#hud.hud--compact[data-mode='ride'] .rb-band {
  left: calc(var(--bb0, 0) * (100cqw - 24px) - 5px);
  right: auto;
  top: 50%;
  width: calc((var(--bb1, 0) - var(--bb0, 0)) * (100cqw - 24px) + 34px);
  height: 34px;
  translate: 0 -50%;
  border-radius: 99px;
}

/* Duck! "×3": the branches of a cluster still ahead */
.hb-count {
  display: none;
  position: absolute;
  top: -9px;
  right: -7px;
  min-width: 30px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: #ffd27a;
  color: #1b2633;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.hb-duck.has-count .hb-count {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .ride-brake.has-band .rb-band {
    animation: none;
  }
}

/* =====================================================================================
   v6 M2: Dau's map in the HUD (src/ui/mapUi.js) — the Map button, the compass's dog-ear,
   the full sheet. Ride only, hidden until the player asks for it. ((v6 map polish) the Map
   button and the compass unfold the sheet at once: M2's small in-ride card is gone.)
   ===================================================================================== */

/* ---- the Map button (computers): round, under the Book ---- */
.hud-mapbtn {
  position: absolute;
  z-index: 7;
  top: calc(var(--gap) + 136px + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
  will-change: transform;
}

.hud-mapbtn .hb-ico {
  width: 28px;
  height: 28px;
  color: #f3e6c8;
}

.hud-mapbtn.is-calling {
  --ring: rgba(255, 211, 110, 0.95);
}

.hud-mapbtn.is-calling::after {
  animation: ring 1.4s ease-out infinite;
}

#hud.hud--compact .hud-mapbtn {
  display: none !important;
}

/* ---- the compass is the Map button too (a tap anywhere on it); phones: a folded paper corner ---- */
.rc-mapbtn {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* (the whole pill, its 1 px edge too: a 44 px target; the small phones' clipped pill lets that edge through) */
#hud.hud--compact[data-mode='ride'] .rc-mapbtn {
  inset: -1px;
  border-radius: inherit;
}

@media (max-width: 479.98px) {
  #hud.hud--compact[data-mode='ride'] .ride-compass.has-map {
    overflow: clip;
    overflow-clip-margin: 1px;
  }
}

.rc-mapbtn:focus-visible {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
}

@media (hover: hover) {
  .rc-mapbtn:hover {
    background: rgba(236, 224, 196, 0.07);
  }
}

.rc-dogear {
  display: none;
}

/* (the pill's top right corner squared off and turned down: a corner of paper — "there's a map in here") */
#hud.hud--compact[data-mode='ride'] .ride-compass.has-map {
  border-top-right-radius: 7px;
}

#hud.hud--compact[data-mode='ride'] .rc-dogear {
  display: block;
  position: absolute;
  z-index: 2;
  top: -1px;
  right: -1px;
  width: 15px;
  height: 15px;
  border-bottom-left-radius: 4px;
  pointer-events: none;
  background: linear-gradient(225deg, rgba(3, 10, 18, 0.9) 0 47%, #f1e5c6 50%, #d9c79c 100%);
  box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.45);
}

#hud.hud--compact[data-mode='ride'] .ride-compass.map-calling {
  --ring: rgba(255, 211, 110, 0.95);
  border-color: rgba(255, 211, 110, 0.85);
  animation: map-call 1.2s ease-in-out infinite;
}

@keyframes map-call {
  50% {
    box-shadow: 0 0 0 4px rgba(255, 211, 110, 0.35), var(--shadow);
  }
}

/* (Dau's words on the sheet pop in like this) */
@keyframes mc-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.9);
  }
}

/* ---- the sheet: Dau's paper map over the dimmed, paused game ---- */
.hud-mapsheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.ms-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 80% at 50% 45%, rgba(3, 10, 18, 0.66), rgba(2, 6, 11, 0.86));
  animation: hud-in 0.3s ease-out backwards;
}

.ms-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(100vw - 24px - var(--safe-l) - var(--safe-r));
  height: calc(100% - 24px - var(--safe-t) - var(--safe-b));
  max-width: 1160px;
  max-height: 900px;
  border-radius: 10px;
  overflow: hidden;
  color: #2a2118;
  background: #ece0c4;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(80, 60, 30, 0.4), inset 0 0 0 2px rgba(255, 250, 235, 0.5);
  transform-origin: 50% 0;
}

.ms-paper.is-unfolding {
  animation: ms-unfold 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
}

.ms-paper.is-unfolding.is-quick {
  animation: ms-fade 0.15s ease-out backwards;
}

@keyframes ms-unfold {
  from {
    opacity: 0.2;
    transform: perspective(1200px) rotateX(-70deg) scaleY(0.4);
  }
  60% {
    opacity: 1;
  }
}

@keyframes ms-fade {
  from {
    opacity: 0;
  }
}

.ms-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 0 0 12px;
  border-bottom: 1px solid rgba(80, 60, 30, 0.25);
  background: linear-gradient(180deg, #f3e8cd, #e6d8b4);
}

.ms-ico {
  display: grid;
  flex: none;
  width: 24px;
  height: 24px;
  color: #a63a24;
}

.ms-ico svg,
.ms-close svg,
.ms-zoom svg,
.ms-paused svg,
.ms-dau svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ms-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  color: #2a2118;
  white-space: nowrap;
}

.ms-paused {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: rgba(166, 95, 50, 0.16);
  color: #8a4a20;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ms-paused svg {
  width: 11px;
  height: 11px;
}

.ms-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  color: #4a3a28;
  cursor: pointer;
}

.ms-close span {
  display: grid;
  width: 18px;
  height: 18px;
}

.ms-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ms-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.ms-canvas:active {
  cursor: grabbing;
}

.ms-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-weight: 900;
  color: #6a5236;
  background: #ece0c4;
}

.ms-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ms-zoom button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid rgba(80, 60, 30, 0.4);
  background: rgba(250, 244, 228, 0.94);
  color: #3a2c1c;
  box-shadow: 0 3px 8px rgba(60, 40, 20, 0.25);
  cursor: pointer;
  touch-action: manipulation;
}

.ms-close:focus-visible,
.ms-zoom button:focus-visible,
.ms-pill:focus-visible {
  outline: 3px solid #c8231b;
  outline-offset: 2px;
}

.ms-pill {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-b));
  translate: -50% 0;
  min-height: 52px;
  transition: opacity 0.25s ease;
}

.ms-pill.is-waiting {
  opacity: 0;
  pointer-events: none;
}

.ms-say {
  position: absolute;
  left: 10px;
  bottom: calc(76px + var(--safe-b));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(460px, calc(100% - 20px));
  padding: 6px 12px 6px 6px;
  border-radius: 16px;
  color: #2a2118;
  background: rgba(255, 252, 244, 0.96);
  border: 1px solid rgba(80, 60, 30, 0.35);
  box-shadow: 0 6px 16px rgba(60, 40, 20, 0.3);
  animation: mc-in 0.3s ease-out backwards;
}

.ms-dau {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #233a52;
}

.ms-say p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.ms-say b {
  display: block;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8231b;
}

@media (prefers-reduced-motion: reduce) {
  .ms-say,
  .ms-backdrop {
    animation: none;
  }

  #hud.hud--compact[data-mode='ride'] .ride-compass.map-calling {
    animation: none;
  }
}

/* (v6 L2) the Level 2 card's numbers (hud.js win2HTML: Time, Distance, Dogs, Sled load; (v6 fix) the
   trail moments moved up into the ride's row, .hwc-tm): one row of equal tiles; five go 3 + 2 unless the row is wide enough for all five
   (a container query: the card is narrow docked beside the scene on a wide screen and on a phone held
   upright, wide on a phone on its side or in a smaller window). 12 grid columns don't split in five. */
.hw-stats2 {
  display: flex;
  flex-wrap: wrap;
  container-type: inline-size;
}

.hw-stats2 .hw-tile {
  flex: 1 1 0;
  min-width: 0;
}

.hw-stats2.five .hw-tile {
  flex-basis: calc((100% - 16px) / 3 - 1px);
}

@container (min-width: 560px) {
  .hw-stats2.five .hw-tile {
    flex-basis: 0;
  }
}

/* ((v6 fix) four tiles (the trail moments went up into the ride's row): 2 + 2 where one row is too
   narrow for "1.1 km" to stay on one line — a phone held upright) */
@container (max-width: 379.98px) {
  .hw-stats2:not(.five) .hw-tile {
    flex-basis: calc((100% - 8px) / 2 - 1px);
  }
}

/* v7 shared */
/*
 * (v7 WP0, both lanes) .hb-ring: a progress ring on a button (lane A: the Yip yip! energy ring;
 * lane B: the camp's hold ring on campAct). Drawn on ::before, not ::after (.hb::after is the
 * urge ring, above), as a 3 px band inside the button's box that follows its border-radius
 * (the button must be positioned, as .hb is). Set from JS:
 *   --ring    the filled part, a number 0..1 (clockwise from 12 o'clock; the rest is a faint track)
 *   --ring-c  its colour (default: the urge ring's amber)
 * The fill eases between values through --hb-ring-a; no transition under prefers-reduced-motion.
 * --ring is also the urge ring's colour on ::after: on a ringed button ::after takes --ring-c
 * instead (a more specific ::after colour, e.g. .hb-snack.urge::after, still wins).
 * Not for buttons that already draw on ::before (.hud-bookbtn, .hb-names.is-compact).
 */
@property --hb-ring-a {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

.hb-ring::before {
  --hb-ring-a: var(--ring, 0);
  content: '';
  position: absolute;
  inset: 0;
  padding: 3px;
  border-radius: inherit;
  background: conic-gradient(
    var(--ring-c, rgba(255, 190, 85, 0.85)) calc(clamp(0, var(--hb-ring-a), 1) * 1turn),
    rgba(255, 255, 255, 0.14) 0
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  transition: --hb-ring-a 0.18s linear;
}

:where(.hb-ring)::after {
  --ring: var(--ring-c, rgba(255, 190, 85, 0.85));
}

@media (prefers-reduced-motion: reduce) {
  .hb-ring::before {
    transition: none;
  }
}
/* end v7 shared */

/* v7 lane A */
/* (A2) Stop, then hook. The armed snow hook ("Hook ready") waits for the team to stop: a dark lantern
   pill with a dashed amber ring inside its box (no layout shift), not hot (no pulse). */
.hb.hb-amber.is-armed {
  background: linear-gradient(180deg, #4b3315, #33210a);
  border-color: rgba(255, 204, 128, 0.55);
  color: #ffe2aa;
  outline: 2px dashed rgba(255, 196, 108, 0.95);
  outline-offset: -5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.hb.hb-amber.is-armed .hb-en {
  color: rgba(255, 226, 170, 0.82);
}

.hb.hb-amber.is-armed .hb-key {
  color: #ffe2aa;
  background: rgba(255, 226, 170, 0.12);
  border-color: rgba(255, 226, 170, 0.4);
}

/* (A2) moving, the pill's "Stooo! first" is for desktop: on phones the alert line says it ("Tangled!
   Stooo! first"), one text, not two */
#hud.hud--compact[data-mode='ride'] .ride-actions .hb.hb-amber.is-stopfirst.is-primary .hb-en:not(:empty) {
  display: none;
}

/* (A2, Dau's C13) stopped without the snow hook, a step-off waiting: "Snow hook first" is the one next
   step — a brighter amber pill (it pulses with the shared .urge ring). */
.hb.hb-amber.is-first {
  background: linear-gradient(180deg, #ffd27a, #f0a73a);
  border-color: rgba(255, 236, 190, 0.9);
  color: #2c1a04;
}

.hb.hb-amber.is-first .hb-en {
  color: rgba(44, 26, 4, 0.78);
}

/* (A2, C13) H / F / B pressed before the hook is set: the hook pill flashes (three quick glows) */
.hb.hb-amber.is-flash {
  animation: a2-hook-flash 0.34s ease-out 3;
}

@keyframes a2-hook-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 214, 120, 0.95), 0 6px 18px rgba(0, 0, 0, 0.42);
  }
  45% {
    box-shadow: 0 0 0 5px rgba(255, 214, 120, 0.85), 0 6px 18px rgba(0, 0, 0, 0.42);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 214, 120, 0), 0 6px 18px rgba(0, 0, 0, 0.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb.hb-amber.is-flash {
    animation: none;
    box-shadow: 0 0 0 3px rgba(255, 214, 120, 0.95), 0 6px 18px rgba(0, 0, 0, 0.42);
  }
}
/* (A3) Yip yip! is a burst of speed. The team's energy is a 3 px ring inside the button (the shared
   .hb-ring utility, --ring 0..1 written by the HUD only when the rounded % changes) in the button's
   accent colour, amber below 50 %, red below 35 % (data-energy). The old .hb-ring rule for the SVG
   rings (position: absolute; inset: 0) must not move the button itself: */
.hb.hb-voice.hb-yip.hb-ring {
  position: relative;
  inset: auto;
}

.hb.hb-yip {
  --ring-c: rgba(65, 216, 208, 0.95);
}

#hud.hud--compact[data-mode='ride'] .ride-steer .hb.hb-voice.hb-yip.hb-ring {
  position: absolute;
  top: auto;
  left: auto;
}

.hb.hb-yip[data-energy='mid'] {
  --ring-c: rgba(255, 190, 85, 0.95);
}

.hb.hb-yip[data-energy='low'] {
  --ring-c: rgba(255, 92, 63, 0.95);
}

/* (the moose's pulse stays amber, as before: the ring utility would colour it like the energy) */
.hb.hb-yip::after {
  --ring: rgba(255, 190, 85, 0.85);
}

/* a burst under way: the button lights up teal and glows (a slow pulse; steady with reduced motion) */
.hb.hb-yip.is-boost,
#hud.hud--compact[data-mode='ride'] .hb-voice.hb-yip.is-boost {
  border-color: rgba(120, 240, 232, 0.95);
  background: linear-gradient(180deg, rgba(34, 128, 124, 0.94), rgba(12, 62, 66, 0.95));
  animation: a3-yip-boost 0.9s ease-in-out infinite alternate;
}

@keyframes a3-yip-boost {
  from {
    box-shadow: 0 0 0 0 rgba(65, 216, 208, 0.25), 0 0 14px rgba(65, 216, 208, 0.25), var(--shadow);
  }
  to {
    box-shadow: 0 0 0 3px rgba(65, 216, 208, 0.45), 0 0 26px rgba(65, 216, 208, 0.5), var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb.hb-yip.is-boost,
  #hud.hud--compact[data-mode='ride'] .hb-voice.hb-yip.is-boost {
    animation: none;
    box-shadow: var(--shadow);
  }
}

/* too tired (or hungry) for a burst: "zzz" inside the box, top left; the label dims */
.hb-yip .hb-zzz {
  position: absolute;
  top: 4px;
  left: 7px;
  display: none;
  font-size: 0.66rem;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #ffb3a3;
  pointer-events: none;
}

.hb-yip.is-tired .hb-zzz {
  display: block;
}

.hb-yip.is-tired .hb-ico,
.hb-yip.is-tired .hb-no {
  opacity: 0.62;
}

#hud.hud--compact[data-mode='ride'] .hb-yip .hb-zzz {
  top: 6px;
  left: 50%;
  translate: -50% 0;
  font-size: 0.56rem;
}

/* the banner for a Yip yip! the dogs can't answer ("not now — brake!", "too tired to speed up") */
.hud-banner.to-no {
  border-color: rgba(255, 190, 85, 0.7);
  background: linear-gradient(180deg, rgba(72, 50, 18, 0.92), rgba(40, 26, 8, 0.94));
  box-shadow: 0 0 34px rgba(255, 190, 85, 0.25), var(--shadow);
}

.hud-banner.to-no .hbn-ico {
  color: var(--amber);
}

.hud-banner.to-no small {
  color: rgba(255, 232, 196, 0.86);
}

/* (A4) A trustworthy brake. A tap on "Brake" or its % lets the brake off (never while a band shows or on
   a steep downhill: the label shakes amber instead). Phones: the label is a 44 × 44 px target inside the
   pill (it reaches into the pill's left padding, never past it). */
.rb-label,
.rb-value {
  pointer-events: auto; /* (the HUD's panels let taps through to the scene; these two take them) */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

#hud.hud--compact[data-mode='ride'] .rb-label {
  flex: none;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: -8px;
  margin-right: -4px;
}

.ride-brake.is-locked .rb-label b,
.ride-brake.is-locked .rb-value {
  color: var(--amber);
}

/* The band moved: a chevron at its edge points the way for 1.5 s (data-bb-move, --bb-move). Computers'
   vertical slider (brake grows downward): ▼ at the band's lower edge = more brake, ▲ at its upper edge
   = less. Phones' horizontal slider (brake grows to the right): ▶ at its right edge = more, ◀ at its
   left edge = less. Kept inside the slider; three soft blinks (still with reduced motion). */
.rb-chev {
  position: absolute;
  z-index: 2;
  display: none;
  width: 18px;
  height: 11px;
  left: 50%;
  translate: -50% 0;
  background: #eafff2;
  filter: drop-shadow(0 0 4px rgba(86, 214, 140, 0.95)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.ride-brake.has-band[data-bb-move] .rb-chev {
  display: block;
  animation: a4-chev 0.5s ease-in-out 3;
}

.ride-brake[data-bb-move='more'] .rb-chev {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  top: clamp(0px, calc(var(--bb1, 0) * (var(--rb-h) - 26px) + 25px), calc(var(--rb-h) - 11px));
}

.ride-brake[data-bb-move='less'] .rb-chev {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  top: clamp(0px, calc(var(--bb0, 0) * (var(--rb-h) - 26px) - 5px), calc(var(--rb-h) - 11px));
}

#hud.hud--compact[data-mode='ride'] .rb-chev {
  width: 11px;
  height: 18px;
  top: 50%;
  translate: 0 -50%;
}

#hud.hud--compact[data-mode='ride'] .ride-brake[data-bb-move='more'] .rb-chev {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  left: clamp(0px, calc(var(--bb1, 0) * (100cqw - 24px) + 24px), calc(100cqw - 11px));
}

#hud.hud--compact[data-mode='ride'] .ride-brake[data-bb-move='less'] .rb-chev {
  clip-path: polygon(100% 0, 100% 100%, 0 50%);
  left: clamp(0px, calc(var(--bb0, 0) * (100cqw - 24px) - 5px), calc(100cqw - 11px));
}

@keyframes a4-chev {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ride-brake.has-band[data-bb-move] .rb-chev {
    animation: none;
  }
}

/* (v7 panel fix, round 3) "Ease off the brake!" (attention urge 'ease'): the brake pulses (.urge) and a chevron by the knob
   points the "less" way — computers' vertical slider ▲, phones' horizontal one ◀ — until the brake is let off */
.ride-brake.is-ease .rb-chev {
  display: block;
  animation: a4-chev 0.5s ease-in-out infinite;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  top: clamp(0px, calc(var(--b, 0) * (var(--rb-h) - 26px) - 5px), calc(var(--rb-h) - 11px));
}

#hud.hud--compact[data-mode='ride'] .ride-brake.is-ease .rb-chev {
  clip-path: polygon(100% 0, 100% 100%, 0 50%);
  top: 50%;
  left: clamp(0px, calc(var(--b, 0) * (100cqw - 24px) - 5px), calc(100cqw - 11px));
}

@media (prefers-reduced-motion: reduce) {
  .ride-brake.is-ease .rb-chev {
    animation: none;
  }
}

/* (A5, Dau's C17) the Level 1 card's ride note for a lost team, under the sub-title: warm, quiet, one line
   ("Lost the team once: phew, that could have ended badly!"); shown on every screen size (the sub-title's
   <small> line hides on short screens, this one stays) */
.hud-win .hw-lost {
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 3px solid var(--amber);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--amber);
}

#hud.hud--compact .hud-win .hw-lost {
  margin-top: 4px;
  font-size: 0.78rem;
}

/* (A7) Push! is a tap rhythm: the bank (its seconds of help) is a 3 px ring inside the pill (the shared .hb-ring
   utility, --ring 0..1 written only when the rounded % changes) — amber, aurora green in a good rhythm. The old SVG
   .hb-ring rule (position: absolute; inset: 0) must not move the pill itself. Out of breath ("catch your breath")
   it dims; a tap then wiggles it (hud.js shake). */
.hb.hb-pushring.hb-ring {
  position: relative;
  inset: auto;
}

.hb.hb-pushring {
  --ring-c: rgba(255, 214, 120, 0.95);
}

.hb.hb-pushring.is-rhythm {
  --ring-c: rgba(99, 243, 184, 0.98);
  border-color: rgba(99, 243, 184, 0.75);
}

.hb.hb-pushring.is-tired {
  opacity: 0.62;
  filter: saturate(0.45);
}

.hb.hb-pushring.is-tired::before {
  opacity: 0.35;
}

.hb.hb-pushring.is-down {
  transform: translateY(2px) scale(0.98);
}

/* (A7) Haw!/Gee! (and Stooo! / Yip yip!): while a call is under way, the most presses this team can need show as
   outlined paws ("●●○": keep calling) — data-pips-max from the ride (the junction cap at a junction, else the
   leaders' maxNeeded); the filled paws (data-pips) are the presses so far. No outlines before the first press or
   once the leaders took the call. */
.hb[data-pips-max='1'][data-pips]:not([data-pips='0']):not(.is-accepted) .hb-paws i:nth-child(-n + 1),
.hb[data-pips-max='2'][data-pips]:not([data-pips='0']):not(.is-accepted) .hb-paws i:nth-child(-n + 2),
.hb[data-pips-max='3'][data-pips]:not([data-pips='0']):not(.is-accepted) .hb-paws i:nth-child(-n + 3),
.hb[data-pips-max='4'][data-pips]:not([data-pips='0']):not(.is-accepted) .hb-paws i:nth-child(-n + 4) {
  opacity: 0.75;
  transform: none;
}

.hb[data-pips-max][data-pips]:not([data-pips='0']):not(.is-accepted) .hb-paws i g {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
}

.hb[data-pips-max][data-pips]:not([data-pips='0']) .hb-paws i svg {
  overflow: visible;
}

/* (the presses so far: filled, full strength — as specific as the outline rules above, and after them) */
.hb[data-pips-max][data-pips][data-pips='1']:not(.is-accepted) .hb-paws i:nth-child(-n + 1),
.hb[data-pips-max][data-pips][data-pips='2']:not(.is-accepted) .hb-paws i:nth-child(-n + 2),
.hb[data-pips-max][data-pips][data-pips='3']:not(.is-accepted) .hb-paws i:nth-child(-n + 3),
.hb[data-pips-max][data-pips][data-pips='4']:not(.is-accepted) .hb-paws i:nth-child(-n + 4) {
  opacity: 1;
}

.hb[data-pips-max][data-pips][data-pips='1']:not(.is-accepted) .hb-paws i:nth-child(-n + 1) g,
.hb[data-pips-max][data-pips][data-pips='2']:not(.is-accepted) .hb-paws i:nth-child(-n + 2) g,
.hb[data-pips-max][data-pips][data-pips='3']:not(.is-accepted) .hb-paws i:nth-child(-n + 3) g,
.hb[data-pips-max][data-pips][data-pips='4']:not(.is-accepted) .hb-paws i:nth-child(-n + 4) g {
  fill: currentColor;
  stroke: none;
}

/* (A7) a press ignored for cmdNoStack s after an accepted call: the filled paws blink once */
.hb.is-nostack .hb-paws i {
  animation: a7-nostack 0.36s ease-out 1;
}

@keyframes a7-nostack {
  40% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb.is-nostack .hb-paws i {
    animation: none;
  }
}

/* (A8) The Level 1 card's stars (ride.md §7.3): the star row under the heading (.hw-rate, in .hw-head as its own grid
   row under the portrait and the names), "n of 3 stars" and a row each (✓ / ✗). Phones (compact): the stars, "n of 3"
   and one line — the first row not earned (else the moments row). Phones on their side: the row sits in the names'
   column under the sub-title, on one line. The trail moments' tile is gone (the moments row says "Trail moments 3/4"). */
.hud-win .hw-head.has-rate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  row-gap: 14px;
  align-items: center;
}

.hud-win .hw-head.has-rate > .hw-portrait {
  grid-column: 1;
  grid-row: 1;
}

.hud-win .hw-head.has-rate > .hw-names {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.hud-win .hw-head.has-rate > .hw-rate {
  grid-column: 1 / -1;
  grid-row: 2;
}

.hw-rate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(3, 10, 18, 0.38);
  border: 1px solid rgba(255, 211, 110, 0.24);
}

.hwr-sum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hwr-stars i {
  width: 26px;
  height: 26px;
}

.hwr-stars i.on {
  animation: star-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
  animation-delay: 0.35s;
}

.hwr-stars i.on:nth-child(2) {
  animation-delay: 0.45s;
}

.hwr-stars i.on:nth-child(3) {
  animation-delay: 0.55s;
}

.hwr-n {
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
  color: #ffd36e;
}

.hwr-rows {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hwr-row,
.hwr-why {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.25;
}

.hwr-row.no .hwr-t,
.hwr-why.no .hwr-t {
  color: var(--ink-2);
}

.hwr-t {
  min-width: 0;
}

.hwr-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.hwr-ico svg {
  width: 12px;
  height: 12px;
}

.hwr-row.ok .hwr-ico,
.hwr-why.ok .hwr-ico {
  color: #0b1826;
  background: var(--aurora);
}

.hwr-row.no .hwr-ico,
.hwr-why.no .hwr-ico {
  color: #ffd0c2;
  background: rgba(255, 122, 92, 0.3);
}

.hwr-why {
  display: none;
}

.hwr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* phones (compact): the stars and "n of 3" on one line, the one reason under them (≤ 32 characters: one line) */
#hud.hud--compact .hw-rate {
  grid-template-columns: minmax(0, 1fr);
  row-gap: 4px;
  padding: 8px 12px;
}

#hud.hud--compact .hwr-sum {
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
}

#hud.hud--compact .hwr-stars i {
  width: 22px;
  height: 22px;
}

#hud.hud--compact .hwr-n {
  font-size: 0.84rem;
}

/* (v7 panel fix) phones show every reason too, compactly (one reason alone hid the others: Bjørg saw only "Trail
   moments 2/4", Ingrid only "Lost the team once") */
#hud.hud--compact .hwr-rows {
  gap: 1px;
}

#hud.hud--compact .hwr-row {
  gap: 6px;
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: nowrap;
}

#hud.hud--compact .hwr-row .hwr-ico {
  width: 15px;
  height: 15px;
}

#hud.hud--compact .hwr-row .hwr-ico svg {
  width: 10px;
  height: 10px;
}

#hud.hud--compact .hwr-why {
  display: none;
}

/* phones on their side: in the names' column under the sub-title, all on one line */
@media (max-height: 500px) and (min-width: 641px) {
  .hud-win .hw-head.has-rate {
    row-gap: 6px;
  }

  .hud-win .hw-head.has-rate > .hw-portrait {
    grid-row: 1 / span 2;
  }

  .hud-win .hw-head.has-rate > .hw-rate {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }

  #hud.hud--compact .hw-rate,
  .hw-rate {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px;
  }

  #hud.hud--compact .hwr-stars i,
  .hwr-stars i {
    width: 20px;
    height: 20px;
  }

  /* (v7 panel fix) every reason, side by side (wrapping) beside the stars */
  #hud.hud--compact .hwr-rows,
  .hwr-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 0 10px;
  }

  #hud.hud--compact .hwr-row,
  .hwr-row {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hwr-stars i.on {
    animation: none;
  }
}

/* (A8, the user's request) "Try it for real": a quiet note at the end of the win card, under its button row (after
   the sticky buttons: never over one). Real links: the e-mail (mailto:) and the site (a new tab); 44 px tall on touch
   screens, a focus ring for the keyboard. */
.hud-win .hw-real {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 190, 85, 0.06);
  border: 1px dashed rgba(255, 190, 85, 0.3);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink-2);
}

.hud-win .hw-real[hidden] {
  display: none;
}

/* (v7 panel fix) lifted into the card's body under its stars where it shows without scrolling (hud.js placeRealNote) */
.hud-win .hw-body > .hw-real.is-high {
  margin: 12px 0 0;
}

/* (v7 panel fix) a link never breaks, nor away from the word after it */
.hwreal-g,
.hw-real a {
  white-space: nowrap;
}

.hwreal-ico {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--amber);
}

.hwreal-ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hw-real a {
  border-radius: 6px;
  color: var(--amber);
  font-weight: 850;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.hw-real a:hover {
  color: #ffe3a6;
}

.hw-real a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* touch screens: each link a 44 px tall target — (v7 panel fix) the sentence first, then the two links (each with the
   word after it) as a row that wraps between them, not inside the sentence: Priya's phone stranded a link on each
   44 px line */
@media (hover: none) and (pointer: coarse) {
  .hwreal-t {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    min-width: 0;
  }

  .hwreal-g {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* (the "?" right after the site, no gap) */
  .hwreal-g:last-child {
    gap: 1px;
  }

  /* (a soft chip shows the 44 px target, so the taller row reads as two links, not as a gap) */
  .hw-real a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 8px;
    border-radius: 10px;
    background: rgba(255, 190, 85, 0.1);
  }

  .hwreal-ico {
    margin-top: 0;
  }
}

@media (max-height: 500px) and (min-width: 641px) {
  .hud-win .hw-real {
    margin-top: 12px;
    padding: 6px 12px;
  }
}

/* (A10) "One thing at a time". The talk slot (the compact ride held upright, 360×640 too): Dau's bubble OR one
   toast, in the same place just under the alert line (--talk-top: the top of her bubble, hud.js talkTop()). A phone
   on its side keeps the toasts where they were (her mini bubble sits at the top left), one at a time. */
@media (orientation: portrait) {
  #hud.hud--compact[data-mode='ride'] .hud-toasts,
  #hud.hud--compact[data-mode='ride'].say-on .hud-toasts {
    top: var(--talk-top, calc(var(--c-top) + 102px + var(--safe-t)));
  }
}

/* (A10) Dau's own stop ("Dau is stopping the team…"): a calm slate line, no hot glow — she has it in hand */
.ride-alert.info {
  border-color: rgba(176, 200, 228, 0.42);
}

.ride-alert.info .ra-ico {
  background: rgba(176, 200, 228, 0.16);
  color: #c9d8ea;
}

/* (A10) computers fold the contextual pills too while the ride needs the player now (act): only the focus's pill
   (their keys still work) */
.sec-ride.is-attn .ra-ctx > .hb.is-folded {
  display: none !important;
  transition: none !important;
}

/* (A10) Stooo! pulses when it is the one thing to press (an armed snow hook on the flat: stop the team) — the shared
   urge ring, amber-red; reduced motion keeps the static ring (the shared .hb.urge rule) */
#hud [data-id='whoa'].urge::after {
  --ring: rgba(255, 150, 58, 0.9);
  animation-duration: 1.1s;
}
/* end v7 lane A */

/* v7 lane B */
/* (B1) The yard roster's rows are named by the team (src/dogs/wheel.js rowRole: the front filled row Lead,
   the last one Wheel): Lead stays amber wherever it is, an empty row is a dimmed "·", and with no dog
   harnessed yet the old row names show dimmed as a guide. */
.yp-row:first-child .yp-label:not(.is-lead) b {
  color: var(--ink);
}
.yp-row .yp-label.is-lead b {
  color: var(--amber);
}
.yp-label.is-wheel b {
  color: #cfe9ff;
}
.yp-label.is-guide b,
.yp-label.is-empty b {
  opacity: 0.42;
}
.yp-label.is-empty b {
  font-weight: 700;
}

/* (B2) The camp's step button can be held (stamping, the canvas, the snow wall, chopping): a long press
   must never select text, raise the phone's callout or scroll; on a step that holds the shared .hb-ring
   (a ring of the step's progress, --ring) sits inside the pill, and the pill sinks a little while held.
   The old .hb-ring rule for the SVG rings (position: absolute; inset: 0) must not move the pill. */
#hud .ca-btns .hb[data-id='campAct'] {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#hud .ca-btns .hb[data-id='campAct'].hb-ring {
  position: relative;
  inset: auto;
  --ring-c: rgba(140, 228, 255, 0.95);
}

#hud .ca-btns .hb[data-id='campAct'].is-hold.is-down {
  transform: translateY(1px) scale(0.975);
  filter: brightness(1.12);
  border-color: rgba(160, 236, 255, 0.95);
}

/* (held while the camp is busy: the pill stays pressable underneath so its release is seen; it looks waiting) */
#hud .ca-btns .hb[data-id='campAct'].is-wait {
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  #hud .ca-btns .hb[data-id='campAct'].is-hold.is-down {
    transform: none;
  }
}

/* (B3) The camp's questions: the answer pills pulse once as they come up (a question clears the presses
   kept for later; the step button reads "Ask Dau…" for askLock, then "Ask Dau") */
#hud .ca-choice.is-pulse {
  animation: camp-q-pulse 0.9s ease-out 1 both;
}

@keyframes camp-q-pulse {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(140, 228, 255, 0.75);
  }
  45% {
    transform: scale(1.04);
    box-shadow: 0 0 0 7px rgba(140, 228, 255, 0.28);
  }
  100% {
    transform: none;
    box-shadow: 0 0 0 12px rgba(140, 228, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #hud .ca-choice.is-pulse {
    animation: none;
  }
}

/* (B3) Level 2's card: the rows behind a category's stars (✓ / ✗, rideStars.js / campStars.js). On a
   computer they stand in for the category's one-line note; a phone keeps the note (the first row not
   earned) and hides the rows. */
.hud-win .hwc-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 10px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

/* (a computer: with rows the categories go one to a line, so a row never breaks in the middle) */
#hud:not(.hud--compact) .hud-win .hw-cats.has-rows {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.hud-win .hw-cat.has-rows .hwc-txt small {
  display: none;
}

.hud-win .hwc-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink-2);
}

.hud-win .hwc-row.ok {
  color: var(--ink);
}

.hud-win .hwc-rico {
  display: grid;
  place-items: center;
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.hud-win .hwc-rico svg {
  width: 9px;
  height: 9px;
}

.hud-win .hwc-row.ok .hwc-rico {
  color: #0b1826;
  background: var(--aurora);
}

.hud-win .hwc-row.no .hwc-rico {
  color: #ffd0c2;
  background: rgba(255, 122, 92, 0.3);
}

.hud-win .hwc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#hud.hud--compact .hud-win .hwc-rows {
  display: none;
}

#hud.hud--compact .hud-win .hw-cat.has-rows .hwc-txt small {
  display: block;
}
/* end v7 lane B */

/* (v7 fix) the camp card's Dau tip steps back while her bubble says the same thing (Q1: one Dau text at a time) */
#hud .camp-card .cc-tip.is-empty {
  display: none;
}
