.bekani-help {
  --help-edge: max(1rem, env(safe-area-inset-right));
  --help-bottom: max(.75rem, env(safe-area-inset-bottom));
  position: fixed;
  z-index: 70;
  inset: auto var(--help-edge) var(--help-bottom) auto;
  width: max-content;
  max-width: calc(100vw - 2 * var(--help-edge));
  color: var(--navy);
  font-family: var(--sans);
}

.intro-playing .bekani-help { visibility: hidden; }
.bekani-help [hidden] { display: none; }
.bekani-help button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.help-robot {
  --help-art-width: clamp(8.25rem, 13vw, 11.75rem);
  position: relative;
  display: grid;
  justify-items: center;
  min-width: 5rem;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 1rem;
}

/* The existing portrait is cropped here to show just the face above the pill. */
.help-robot[aria-expanded="false"]::before {
  content: "";
  position: absolute;
  inset: auto 0 calc(100% - 17px);
  margin-inline: auto;
  width: 74px;
  height: 53px;
  border-radius: 47% 47% 24% 24%;
  background: url("help/welcome.webp") -46px -53px / 172px auto no-repeat;
  filter: drop-shadow(0 3px 5px #03204840);
  pointer-events: none;
  opacity: 0;
  transform: translateY(37px) rotate(5deg);
  transform-origin: center bottom;
  transition: transform 520ms cubic-bezier(.22, 1, .36, 1), opacity 260ms ease;
}

.help-robot[data-peeking][aria-expanded="false"]::before {
  opacity: 1;
  transform: translateY(0) rotate(-3deg);
}

.help-robot[data-nearby][aria-expanded="false"]::before,
.help-robot[aria-expanded="false"]:focus-visible::before {
  opacity: 1;
  transform: translateY(-14px) rotate(0);
}

.help-art { position: relative; display: none; width: var(--help-art-width); aspect-ratio: 5 / 6; }
.help-robot[aria-expanded="true"] .help-art {
  display: block;
  transform-origin: center bottom;
  animation: help-robot-reveal 440ms cubic-bezier(.22, 1, .36, 1) both;
}
.help-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 9px #03204846);
}

.help-bubble { display: none; }
.bekani-help:not([data-language="fr"]) .help-art img { clip-path: inset(34% -12px -12px); }
.bekani-help:not([data-language="fr"]) .help-bubble {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 3% 0 auto;
  min-height: 27%;
  padding: .35rem .5rem;
  border: 2px solid var(--blue);
  border-radius: 1rem;
  background: var(--white);
  font-size: clamp(.7rem, 1vw, .9rem);
  font-weight: 700;
  line-height: 1.18;
  text-wrap: balance;
}

.help-label {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 5rem;
  min-height: 44px;
  padding: .35rem .9rem;
  border: 1px solid #ffffff90;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: .8rem;
  font-weight: 700;
}

.help-panel, .help-progress {
  background: var(--white);
  border: 1px solid #c4d7ea;
  border-radius: 1.1rem;
  box-shadow: 0 12px 36px #0e224939;
}

.help-panel {
  position: absolute;
  inset: auto calc(100% + .7rem) 0 auto;
  width: min(18.5rem, calc(100vw - 2 * var(--help-edge)));
  padding: .85rem;
  animation: help-enter 160ms ease-out both;
}

.help-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; }
.help-head h2 { margin: 0; font-size: 1rem; line-height: 1.25; font-weight: 700; }
.help-close {
  flex: 0 0 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-radius: .6rem;
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1;
}
.help-actions { display: grid; gap: .3rem; }
.help-actions a, .help-progress button, .help-progress a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .45rem .7rem;
  border-radius: .65rem;
  background: #eef5fd;
  color: var(--navy);
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.2;
}

.help-actions a:hover, .help-actions a:focus-visible, .help-close:hover { background: #dae9fc; }
.bekani-help :is(a, button):focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.help-progress { width: min(21rem, calc(100vw - 2 * var(--help-edge))); padding: .8rem; }
.help-progress p { min-height: 1.5em; font-size: .92rem; font-weight: 700; }
.help-progress > div { display: flex; gap: .5rem; margin-top: .45rem; }
.help-progress button { border: 0; background: var(--navy); color: var(--white); }
.help-progress a { justify-content: center; }

@keyframes help-robot-reveal {
  from { opacity: 0; transform: translateY(28px) scale(.9); }
  to { opacity: 1; transform: none; }
}
@keyframes help-enter { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 580px) {
  .bekani-help { --help-edge: max(.65rem, env(safe-area-inset-right)); }
  .help-robot { --help-art-width: clamp(6.6rem, 31vw, 8rem); }
  .help-panel { inset: auto 0 calc(100% + .45rem) auto; max-height: 52svh; overflow: auto; }
  body:has(#cart-bar:not([hidden])) .bekani-help { --help-bottom: max(5.1rem, calc(env(safe-area-inset-bottom) + 4.35rem)); }
}

@media (max-height: 500px) {
  .help-robot { --help-art-width: min(7rem, 25svh); }
  .help-panel { max-height: 65svh; overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .help-panel, .help-robot[aria-expanded="true"] .help-art { animation: none; }
  .help-robot[aria-expanded="false"]::before {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .help-robot[data-nearby][aria-expanded="false"]::before,
  .help-robot[aria-expanded="false"]:focus-visible::before { transform: none; }
}

.help-return { width: min(16.5rem, calc(100vw - 2 * var(--help-edge))); }
.help-return p { font-weight: 700; line-height: 1.3; }
.help-return > div { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.help-return button {
  min-height: 44px;
  padding: .4rem .65rem;
  border: 0;
  border-radius: .6rem;
  background: #eef5fd;
  color: var(--navy);
  font-size: .86rem;
  font-weight: 650;
}
.help-return .help-return-yes { background: var(--navy); color: var(--white); }

.help-lift {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(18rem, 80vw);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-soft);
}
.help-lift::backdrop { background: #081325d6; }
.help-lift-cabin {
  position: relative;
  isolation: isolate;
  height: min(25rem, 76svh);
  display: grid;
  justify-items: center;
  overflow: hidden;
  border: 2px solid #b49a6d;
  border-radius: 14px;
  background: linear-gradient(120deg, #0b1629, #263852 55%, #101b31);
  box-shadow: inset 0 0 22px #050b15;
}
.help-lift-indicator {
  align-self: start;
  margin-top: .65rem;
  padding: .1rem .75rem;
  border: 1px solid #ab9266;
  border-radius: 4px;
  background: #111a2b;
  font-size: 1.15rem;
  line-height: 1.25;
}
.help-lift-cabin img {
  position: absolute;
  bottom: 3%;
  width: 66%;
  max-height: 96%;
  object-fit: contain;
  clip-path: inset(29% 0 0);
  animation: help-lift-step 390ms cubic-bezier(.2,.7,.25,1) both;
}
.help-lift-door {
  position: absolute;
  inset: 2.55rem auto 0 0;
  width: calc(50% + 1px);
  border: 1px solid #52627a;
  background: linear-gradient(100deg, #5d7088, #a9b7c6 52%, #718399);
  box-shadow: inset 0 0 18px #30435c;
  --door-open: -101%;
  animation: help-lift-doors 1400ms cubic-bezier(.65,0,.35,1) both;
}
.help-lift-door:last-child { inset-inline: auto 0; --door-open: 101%; }
@keyframes help-lift-step {
  from { transform: translateX(-75%) scale(1.12); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes help-lift-doors {
  0%, 26%, 100% { transform: translateX(var(--door-open)); }
  47%, 65% { transform: translateX(0); }
}
.help-actions .help-lookup-trigger,
.help-lookup button {
  display: block;
  min-height: 44px;
  padding: .45rem .7rem;
  border-radius: .65rem;
  border: 0;
  background: var(--navy);
  color: #fff;
  text-align: start;
  font-size: .88rem;
  font-weight: 650;
}
.help-lookup { display: grid; gap: .55rem; }
.help-lookup form { display: grid; gap: .35rem; }
.help-lookup label, .help-lookup p { font-size: .85rem; line-height: 1.4; }
.help-lookup input { min-height: 44px; min-width: 0; width: 100%; padding: .45rem .65rem; border: 1px solid #bacbde; border-radius: .45rem; font: inherit; }
.help-lookup .help-lookup-back { background: #eef5fd; color: var(--navy); }
.help-lookup p:empty { display: none; }
.help-lookup-results { list-style: none; display: grid; gap: .25rem; }
.help-lookup-results a { display: block; padding: .45rem .55rem; overflow-wrap: anywhere; border-bottom: 1px solid #d9e3ee; font-size: .82rem; }
.help-lookup-results small { display: block; color: #55627a; }
.bekani-help .help-panel { max-height: min(70svh, 600px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 580px) {
  .bekani-help .help-panel { max-height: 52svh; }
}
