.fox-guide-layer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  color: #fff7e9;
}

.fox-guide-mask {
  position: fixed;
  z-index: 9000;
  background: rgba(9, 7, 5, .76);
  pointer-events: auto;
  transition: inset .24s ease, width .24s ease, height .24s ease, top .24s ease, left .24s ease;
  backdrop-filter: blur(1.5px);
}

.fox-guide-target {
  position: relative !important;
  z-index: 9001 !important;
  border-radius: 5px;
  outline: 2px solid rgba(232, 183, 100, .98) !important;
  outline-offset: 6px;
  box-shadow: 0 0 0 7px rgba(232, 183, 100, .12), 0 0 34px rgba(224, 149, 57, .42) !important;
}

.fox-guide-arrow {
  position: fixed;
  inset: 0;
  z-index: 9002;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  pointer-events: none;
}

.fox-guide-arrow[hidden] { display: none; }

.fox-guide-arrow path[data-arrow-path] {
  fill: none;
  stroke: #edb55d;
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .7));
}

.fox-guide-arrow marker path { fill: #edb55d; }

.fox-guide-bubble {
  position: fixed;
  z-index: 9003;
  width: min(560px, calc(100vw - 28px));
  min-height: 224px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 4px;
  padding: 18px 20px 18px 10px;
  border: 1px solid rgba(232, 187, 119, .64);
  border-radius: 14px 4px 14px 4px;
  outline: none;
  background:
    linear-gradient(135deg, rgba(58, 39, 25, .99), rgba(23, 19, 16, .99) 58%, rgba(16, 21, 20, .99)),
    #1a1613;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .62), inset 0 1px rgba(255, 244, 221, .09);
  pointer-events: auto;
  transition: left .24s ease, top .24s ease, transform .24s ease;
}

.fox-guide-bubble::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(232, 187, 119, .11);
  border-radius: 9px 2px 9px 2px;
  pointer-events: none;
}

.fox-guide-bubble.is-modal {
  width: min(610px, calc(100vw - 28px));
  min-height: 270px;
  grid-template-columns: 170px minmax(0, 1fr);
  padding: 26px 28px 24px 10px;
  transition: none;
}

.fox-guide-layer[data-step="welcome"] .fox-guide-mask,
.fox-guide-layer[data-step="finish"] .fox-guide-mask { transition: none; }

.fox-guide-close {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #cdbb9f;
  font-size: 1.25rem;
}

.fox-guide-character {
  min-height: 176px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.fox-guide-fox {
  --fox-scale: .72;
  width: 138px;
  height: 150px;
  display: block;
  flex: 0 0 auto;
  background-image: url("../assets/fox-guide/spritesheet.webp");
  background-repeat: no-repeat;
  background-size: 1106px 1647px;
  background-position: -138px 0;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .38));
  animation: fox-guide-idle 3.4s steps(1) infinite;
}

.fox-guide-bubble.is-modal .fox-guide-fox {
  width: 166px;
  height: 180px;
  background-size: 1327px 1976px;
  background-position: -166px 0;
}

.fox-guide-fox[data-fox-pose="wave"] { background-position: -138px -450px; animation: fox-guide-wave 1.8s steps(1) infinite; }
.fox-guide-bubble.is-modal .fox-guide-fox[data-fox-pose="wave"] { background-position: -166px -540px; }
.fox-guide-fox[data-fox-pose="review"] { background-position: -414px -1200px; animation: fox-guide-review 2.8s steps(1) infinite; }
.fox-guide-bubble.is-modal .fox-guide-fox[data-fox-pose="review"] { background-position: -497px -1440px; }
.fox-guide-fox[data-fox-pose="success"] { background-position: -552px -600px; animation: fox-guide-success 1.4s steps(1) infinite; }
.fox-guide-bubble.is-modal .fox-guide-fox[data-fox-pose="success"] { background-position: -663px -720px; }
.fox-guide-bubble.is-modal .fox-guide-fox { animation: none; }
.fox-guide-fox[data-fox-pose="error"] { background-position: -276px -750px; animation: none; }
.fox-guide-fox[data-fox-pose="point-left"] { background-position: -690px -1350px; animation: none; }
.fox-guide-fox[data-fox-pose="point-right"] { background-position: -690px -1500px; animation: none; }

@keyframes fox-guide-idle {
  0%, 100% { background-position: -138px 0; }
  32% { background-position: -276px 0; }
  38% { background-position: -414px 0; }
  44% { background-position: -552px 0; }
  52% { background-position: -690px 0; }
}

@keyframes fox-guide-wave {
  0%, 100% { background-position: 0 -450px; }
  33% { background-position: -138px -450px; }
  66% { background-position: -276px -450px; }
}

@keyframes fox-guide-review {
  0%, 100% { background-position: 0 -1200px; }
  35% { background-position: -138px -1200px; }
  70% { background-position: -414px -1200px; }
}

@keyframes fox-guide-success {
  0%, 100% { background-position: 0 -600px; }
  28% { background-position: -138px -600px; }
  52% { background-position: -276px -600px; }
  76% { background-position: -552px -600px; }
}

.fox-guide-copy {
  align-self: center;
  min-width: 0;
  padding: 8px 4px 4px 0;
}

.fox-guide-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-right: 30px;
  color: #e7b460;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.fox-guide-meta strong {
  color: #c7b59c;
  font-size: .58rem;
  letter-spacing: .08em;
  white-space: nowrap;
}

.fox-guide-copy h2 {
  margin: 10px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.28rem, 2.2vw, 1.75rem);
  font-weight: 500;
  line-height: 1.12;
}

.fox-guide-copy > p,
.fox-guide-confirm p {
  margin: 0;
  color: #ddceb9;
  font-size: .78rem;
  line-height: 1.58;
}

.fox-guide-waiting {
  margin-top: 9px !important;
  color: #f0bc68 !important;
  font-size: .68rem !important;
}

.fox-guide-waiting::before { content: "●"; margin-right: 7px; animation: fox-guide-pulse 1.1s ease-in-out infinite; }

@keyframes fox-guide-pulse { 50% { opacity: .28; } }

.fox-guide-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 16px;
}

.fox-guide-actions button {
  min-height: 36px;
  padding: .55rem .76rem;
  border-radius: 3px;
  font-size: .68rem;
}

.fox-guide-primary,
.fox-guide-command {
  border-color: #d9a656;
  background: linear-gradient(180deg, #d7a153, #9a682f);
  color: #17100a;
  font-weight: 800;
  box-shadow: 0 5px 15px rgba(183, 116, 39, .25);
}

.fox-guide-command { margin-left: auto; background: linear-gradient(180deg, #f0c171, #bc7c35); }
.fox-guide-actions .fox-guide-command:hover,
.fox-guide-actions .fox-guide-primary:hover { background: linear-gradient(180deg, #f4cb82, #bd7e36); color: #17100a; }
.fox-guide-primary:disabled { background: rgba(82, 68, 52, .8); color: #9f927e; box-shadow: none; }
.fox-guide-secondary { border-color: rgba(224, 188, 134, .28); background: rgba(34, 29, 25, .88); color: #d8c9b4; }

.fox-guide-confirm {
  grid-column: 1 / -1;
  align-self: center;
  max-width: 410px;
  margin: auto;
  padding: 28px;
  text-align: center;
}

.fox-guide-confirm strong { display: block; margin-bottom: 9px; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.fox-guide-confirm > div { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }

.fox-context-helper {
  position: fixed;
  right: 18px;
  bottom: 98px;
  z-index: 120;
  width: min(390px, calc(100vw - 30px));
  min-height: 96px;
  display: grid;
  grid-template-columns: 76px 1fr 24px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 2px;
  border: 1px solid rgba(226, 184, 117, .47);
  border-radius: 10px 3px 10px 3px;
  background: rgba(29, 23, 19, .98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity .22s ease, transform .22s ease;
}

.fox-context-helper.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.fox-context-helper .fox-guide-fox { width: 69px; height: 75px; background-size: 553px 824px; background-position: -69px 0; animation: none; }
.fox-context-helper .fox-guide-fox[data-fox-pose="success"] { background-position: -276px -300px; }
.fox-context-helper .fox-guide-fox[data-fox-pose="error"] { background-position: -138px -375px; }
.fox-context-helper .fox-guide-fox[data-fox-pose="review"] { background-position: -207px -600px; }
.fox-context-helper p { margin: 0; color: #e3d4bf; font-size: .7rem; line-height: 1.45; }
.fox-context-helper button { align-self: start; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: #c8b69d; }

.help-menu-wrap { position: relative; }
.topbar { position: relative; z-index: 50; }
.help-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 40;
  width: 220px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(24, 20, 17, .99);
  box-shadow: var(--shadow);
}
.help-menu button { width: 100%; border: 0; background: transparent; text-align: left; font-size: .68rem; }
.help-menu button + button { margin-top: 3px; color: var(--cream-muted); }

@media (max-width: 720px) {
  .fox-guide-bubble,
  .fox-guide-bubble.is-modal {
    width: calc(100vw - 20px);
    min-height: 0;
    grid-template-columns: 82px minmax(0, 1fr);
    padding: 12px 14px 12px 2px;
  }
  .fox-guide-character { min-height: 116px; }
  .fox-guide-fox,
  .fox-guide-bubble.is-modal .fox-guide-fox { width: 83px; height: 90px; background-size: 664px 988px; }
  .fox-guide-fox[data-fox-pose="wave"],
  .fox-guide-bubble.is-modal .fox-guide-fox[data-fox-pose="wave"] { background-position: -83px -270px; }
  .fox-guide-copy { padding-top: 18px; }
  .fox-guide-copy h2 { font-size: 1.15rem; }
  .fox-guide-copy > p { font-size: .7rem; }
  .fox-guide-actions { flex-wrap: wrap; }
  .fox-guide-command { order: -1; width: 100%; }
  .fox-context-helper { bottom: 14px; }
}

@media (max-width: 900px) {
  .top-actions #helpMenuBtn { display: inline-flex; }
  .top-actions .help-menu button { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .fox-guide-mask,
  .fox-guide-bubble,
  .fox-context-helper { transition: none; }
  .fox-guide-fox,
  .fox-guide-waiting::before { animation: none !important; }
}
