/* Guided help tour shared by home guest/member screens. */
.zhelp-target {
  scroll-margin: 110px;
}
.zhelp-target.zhelp-target-active {
  isolation: isolate;
  border-radius: 24px;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, .16),
    0 0 0 3px rgba(255, 255, 255, .96),
    0 0 0 9px rgba(23, 179, 159, .18);
  filter: none !important;
}

/* Compact optional help launcher. It intentionally avoids overriding page
   layout and can be dismissed by the user. */
.zhelp-fab {
  position: fixed;
  inset: auto max(12px, env(safe-area-inset-right)) calc(78px + env(safe-area-inset-bottom)) auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #17B39F 0%, #243B6B 100%);
  box-shadow: 0 12px 26px rgba(36, 59, 107, .18);
  font-size: 1rem;
  line-height: 1;
  font-weight: 950;
  cursor: pointer;
  z-index: 1160;
  opacity: .86;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.zhelp-fab:hover { transform: translateY(-2px); opacity: 1; }
.zhelp-fab:focus-visible { outline: 3px solid rgba(23, 179, 159, .32); outline-offset: 3px; }
.zhelp-fab[hidden] { display: none !important; }
.zhelp-fab-close {
  position: fixed;
  inset: auto max(8px, env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) auto;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #64748B;
  font-size: .92rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1161;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}
.zhelp-fab-close[hidden] { display: none !important; }

.zhelp-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.zhelp-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.zhelp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 26, .24);
  backdrop-filter: none;
}
.zhelp-spotlight {
  position: fixed;
  border-radius: 24px;
  background: rgba(255, 255, 255, .02);
  box-shadow:
    0 18px 46px rgba(15, 23, 42, .14),
    0 0 0 2px rgba(255, 255, 255, .94),
    0 0 0 8px rgba(23, 179, 159, .18);
  pointer-events: none;
  z-index: 20001;
  transition: top .22s ease, right .22s ease, bottom .22s ease, left .22s ease, width .22s ease, height .22s ease;
}
.zhelp-popover {
  position: fixed;
  z-index: 20020;
  width: min(330px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  max-height: calc(100svh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.99) 0%, rgba(248,250,252,.98) 100%);
  border: 1px solid rgba(226, 232, 240, .98);
  box-shadow: 0 24px 58px rgba(15, 23, 42, .24);
  padding: 14px;
  color: #0F172A;
  direction: rtl;
  text-align: right;
  transition: top .22s ease, right .22s ease, bottom .22s ease, left .22s ease;
}
.zhelp-popover::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(255,255,255,.99);
  transform: rotate(45deg);
  box-shadow: -1px -1px 0 rgba(226, 232, 240, .95);
}
.zhelp-popover[data-placement="bottom"]::before { top: -8px; right: 38px; }
.zhelp-popover[data-placement="top"]::before { bottom: -8px; right: 38px; box-shadow: 1px 1px 0 rgba(226, 232, 240, .95); }
.zhelp-popover[data-placement="left"]::before { right: -8px; top: 34px; box-shadow: 1px -1px 0 rgba(226, 232, 240, .95); }
.zhelp-popover[data-placement="right"]::before { left: -8px; top: 34px; box-shadow: -1px 1px 0 rgba(226, 232, 240, .95); }
.zhelp-popover.is-detached::before { display: none; }
.zhelp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.zhelp-step-badge {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #17B39F, #243B6B);
  box-shadow: 0 10px 22px rgba(36, 59, 107, .20);
  font-size: .94rem;
  font-weight: 950;
}
.zhelp-title-wrap { min-width: 0; flex: 1 1 auto; }
.zhelp-title {
  margin: 0;
  color: #1D325C;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 950;
  letter-spacing: -.01em;
}
.zhelp-count {
  margin-top: 2px;
  color: #64748B;
  font-size: .72rem;
  font-weight: 850;
}
.zhelp-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 13px;
  background: #fff;
  color: #64748B;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.zhelp-body {
  margin: 0;
  color: #475569;
  font-size: .86rem;
  line-height: 1.85;
  font-weight: 760;
  overflow: auto;
  overscroll-behavior: contain;
  max-height: min(34vh, 260px);
  padding-inline-end: 2px;
}
.zhelp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(248,250,252,0), rgba(248,250,252,.99) 32%);
}
.zhelp-btn {
  min-height: 40px;
  border-radius: 15px;
  padding: 0 14px;
  border: 1px solid rgba(226, 232, 240, .98);
  background: #fff;
  color: #0F172A;
  font-size: .82rem;
  font-weight: 950;
  cursor: pointer;
}
.zhelp-btn-primary {
  flex: 1 1 auto;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #17B39F, #0F8F74);
  box-shadow: 0 12px 24px rgba(15, 143, 116, .20);
}
.zhelp-btn-ghost { color: #64748B; }
.zhelp-btn[disabled] { opacity: .45; cursor: not-allowed; }
.zhelp-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 12px;
  direction: ltr;
}
.zhelp-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, .28);
}
.zhelp-dot.is-active {
  width: 18px;
  background: #17B39F;
}


/* Soft delayed nudge: a temporary guide layer that does not change page layout. */
.zhelp-nudge {
  position: fixed;
  inset: auto max(14px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) auto;
  z-index: 1170;
  width: min(336px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 11px 12px;
  border-radius: 20px;
  direction: rtl;
  text-align: right;
  color: #0F172A;
  background:
    radial-gradient(circle at 12% 0%, rgba(23, 179, 159, .13), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.99) 0%, rgba(248,250,252,.98) 100%);
  border: 1px solid rgba(23, 179, 159, .32);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .20), 0 0 0 4px rgba(23, 179, 159, .08);
  opacity: 0;
  transform: translateY(14px) scale(.985);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.zhelp-nudge[hidden] { display: none !important; }

.zhelp-nudge::before {
  content: "";
  position: absolute;
  inset-block: 12px;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #17B39F, #2563EB);
  box-shadow: 0 0 18px rgba(23, 179, 159, .34);
}
body.pwa-install-card-visible .zhelp-nudge {
  bottom: calc(var(--pwa-install-card-clearance, 190px) + env(safe-area-inset-bottom));
}
body.pwa-install-card-visible .zhelp-fab {
  bottom: calc(var(--pwa-install-card-clearance, 190px) + 58px + env(safe-area-inset-bottom));
}
body.pwa-install-card-visible .zhelp-fab-close {
  bottom: calc(var(--pwa-install-card-clearance, 190px) + 90px + env(safe-area-inset-bottom));
}
.zhelp-nudge.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}
.zhelp-nudge-icon {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #17B39F, #243B6B);
  box-shadow: 0 9px 18px rgba(36, 59, 107, .20);
  font-size: .92rem;
  font-weight: 950;
}
.zhelp-nudge-copy { min-width: 0; padding-inline-end: 22px; }
.zhelp-nudge-copy strong {
  display: block;
  color: #1D325C;
  font-size: .9rem;
  line-height: 1.45;
  font-weight: 950;
  letter-spacing: -.01em;
}
.zhelp-nudge-copy p {
  margin: 2px 0 0;
  color: #475569;
  font-size: .74rem;
  line-height: 1.62;
  font-weight: 760;
}
.zhelp-nudge-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 1px;
}
.zhelp-nudge-btn,
.zhelp-nudge-link {
  min-height: 34px;
  border-radius: 13px;
  padding: 0 11px;
  border: 1px solid rgba(226, 232, 240, .98);
  background: rgba(255,255,255,.96);
  color: #0F172A;
  font-size: .74rem;
  font-weight: 950;
  cursor: pointer;
}
.zhelp-nudge-btn-primary {
  flex: 1 1 auto;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #17B39F, #0F8F74);
  box-shadow: 0 10px 20px rgba(15, 143, 116, .22);
}
.zhelp-nudge-link {
  min-height: 30px;
  padding-inline: 5px;
  border: 0;
  background: transparent;
  color: #64748B;
  font-size: .74rem;
}
.zhelp-nudge-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 11px;
  background: rgba(255,255,255,.92);
  color: #64748B;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
body.zhelp-nudge-visible .zhelp-fab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.96);
}

body.zhelp-lock {
  overflow: hidden;
}

@media (max-width: 560px) {
  .zhelp-fab {
    inset-inline-end: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: 38px;
    height: 38px;
    font-size: .98rem;
  }
  .zhelp-fab-close {
    inset-inline-end: 8px;
    bottom: calc(106px + env(safe-area-inset-bottom));
  }
  .zhelp-popover {
    width: min(318px, calc(100vw - 24px));
    border-radius: 22px;
    padding: 13px;
    max-height: calc(100vh - 20px);
    max-height: calc(100svh - 20px);
  }
  .zhelp-body {
    font-size: .82rem;
    line-height: 1.78;
    max-height: min(32vh, 230px);
  }

  .zhelp-nudge {
    inset-inline: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: auto;
    border-radius: 20px;
    padding: 10px 11px;
  }
  .zhelp-nudge-copy strong { font-size: .88rem; }
  .zhelp-nudge-copy p { font-size: .74rem; line-height: 1.58; }
  .zhelp-nudge-actions { gap: 6px; }
  .zhelp-nudge-btn { min-height: 33px; padding-inline: 10px; }
  .zhelp-nudge-link { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .zhelp-overlay,
  .zhelp-spotlight,
  .zhelp-popover,
  .zhelp-nudge,
  .zhelp-fab { transition: none !important; }
}

/* Lesson pages use compact stacked areas with their own stacking contexts.
   While the guided tour is open, loosen those contexts so the active target
   remains clear instead of sitting under the soft overlay. */
body.zhelp-lock .lesson-mobile-page,
body.zhelp-lock .lesson-layout,
body.zhelp-lock .lesson-stage-top,
body.zhelp-lock .lesson-stage-bottom,
body.zhelp-lock .lesson-player-shell,
body.zhelp-lock .lesson-panel {
  isolation: auto !important;
}
body.zhelp-lock .lesson-stage-top,
body.zhelp-lock .lesson-stage-bottom,
body.zhelp-lock .lesson-player-shell {
  z-index: auto !important;
}
body.zhelp-lock .lesson-progress-strip.zhelp-target-active,
body.zhelp-lock .lesson-media-block.zhelp-target-active,
body.zhelp-lock .transcript-list.zhelp-target-active,
body.zhelp-lock .vocab-card.zhelp-target-active,
body.zhelp-lock .lesson-practice-cta-wrap.zhelp-target-active,
body.zhelp-lock .lesson-practice-cta.zhelp-target-active {
  border-radius: 20px;
}
body.zhelp-lock .vocab-card.zhelp-target-active {
  overflow: visible;
}

/* Intro card for lesson learning path: a little stronger than normal tips,
   but still keeps the page visible behind it. */
.zhelp-popover.is-intro {
  width: min(380px, calc(100vw - 28px));
  border-radius: 28px;
  border-color: rgba(23, 179, 159, .24);
  box-shadow: 0 28px 70px rgba(15, 23, 42, .28), 0 0 0 8px rgba(23, 179, 159, .08);
}
.zhelp-popover.is-intro::before { display: none; }
.zhelp-popover.is-intro .zhelp-step-badge {
  background: linear-gradient(135deg, #2563EB, #17B39F);
}
.zhelp-popover.is-intro .zhelp-title {
  font-size: 1.05rem;
}
.zhelp-popover.is-intro .zhelp-body {
  color: #334155;
  line-height: 1.9;
}
.zhelp-popover.is-intro .zhelp-dots { display: none; }
.zhelp-popover.is-intro .zhelp-btn-primary {
  min-height: 44px;
  background: linear-gradient(135deg, #2563EB, #17B39F);
}
.zhelp-popover.is-intro ~ .zhelp-spotlight,
.zhelp-popover.is-intro + .zhelp-spotlight {
  display: none;
}
.zhelp-overlay.is-open .zhelp-popover.is-intro ~ .zhelp-spotlight { display: none; }
.zhelp-popover.is-intro[data-placement="intro"]::before { display: none; }
.zhelp-popover.is-intro .zhelp-btn-ghost { display: none; }

/* The lesson tour often highlights a single transcript sentence. Keep it crisp. */
body.zhelp-lock .transcript-segment.zhelp-target-active {
  border-radius: 18px;
  background: rgba(255, 255, 255, .98);
}
body.zhelp-lock .lesson-grammar-card.zhelp-target-active {
  border-radius: 22px;
  overflow: visible;
}

/* Leitner review pages: keep the focused review card readable above the soft overlay. */
body.zhelp-lock .leitner-home,
body.zhelp-lock .leitner-session,
body.zhelp-lock .leitner-card,
body.zhelp-lock .leitner-home-hero,
body.zhelp-lock .leitner-home-mode-grid,
body.zhelp-lock .leitner-home-boxes,
body.zhelp-lock .leitner-home-filters,
body.zhelp-lock .leitner-word-card,
body.zhelp-lock .leitner-mini-card,
body.zhelp-lock .leitner-meta-grid,
body.zhelp-lock .leitner-answer,
body.zhelp-lock .leitner-feedback-grid {
  isolation: auto !important;
}
body.zhelp-lock .leitner-home-hero.zhelp-target-active,
body.zhelp-lock .leitner-home-mode-grid.zhelp-target-active,
body.zhelp-lock .leitner-home-boxes.zhelp-target-active,
body.zhelp-lock .leitner-home-filters.zhelp-target-active,
body.zhelp-lock .leitner-word-card.zhelp-target-active,
body.zhelp-lock .leitner-mini-guide.zhelp-target-active,
body.zhelp-lock .leitner-mini-choices.zhelp-target-active,
body.zhelp-lock .leitner-mini-text-input.zhelp-target-active,
body.zhelp-lock .leitner-meta-grid.zhelp-target-active,
body.zhelp-lock .leitner-reveal-btn.zhelp-target-active,
body.zhelp-lock .leitner-answer.zhelp-target-active,
body.zhelp-lock .leitner-feedback-grid.zhelp-target-active,
body.zhelp-lock .leitner-submit-btn.zhelp-target-active {
  border-radius: 22px;
}
body.zhelp-lock .leitner-feedback-grid.zhelp-target-active {
  position: relative !important;
  bottom: auto !important;
}
body.zhelp-lock .leitner-answer.zhelp-target-active {
  overflow: visible;
}

/* Dictionary and practice help tours: keep the highlighted card crisp without
   making the rest of the page unreadable. */
body.zhelp-lock .dictionary-main-page,
body.zhelp-lock .dictionary-search-card,
body.zhelp-lock .dictionary-result-card,
body.zhelp-lock .dictionary-result-actions,
body.zhelp-lock .practice-mobile,
body.zhelp-lock .practice-shell,
body.zhelp-lock .practice-compact-header,
body.zhelp-lock .practice-slide,
body.zhelp-lock .practice-content-stack,
body.zhelp-lock .choice-grid,
body.zhelp-lock .practice-input-shell,
body.zhelp-lock .oral-self-score,
body.zhelp-lock .practice-footer {
  isolation: auto !important;
}
body.zhelp-lock .dictionary-search-card.zhelp-target-active,
body.zhelp-lock .dictionary-result-card.zhelp-target-active,
body.zhelp-lock .dictionary-result-actions.zhelp-target-active,
body.zhelp-lock .practice-compact-header.zhelp-target-active,
body.zhelp-lock .practice-slide.zhelp-target-active,
body.zhelp-lock .choice-grid.zhelp-target-active,
body.zhelp-lock .practice-input-shell.zhelp-target-active,
body.zhelp-lock .oral-self-score.zhelp-target-active,
body.zhelp-lock .practice-footer.zhelp-target-active {
  border-radius: 22px;
}
body.zhelp-lock .practice-footer.zhelp-target-active {
  position: relative !important;
  bottom: auto !important;
}
body.zhelp-lock .practice-slide.zhelp-target-active,
body.zhelp-lock .dictionary-result-card.zhelp-target-active {
  overflow: visible;
}

/* Placement/account pages: keep their highlighted cards above the soft overlay
   without making the whole page feel blocked. */
body.zhelp-lock .placement-shell,
body.zhelp-lock .placement-screen,
body.zhelp-lock .pl-test-form,
body.zhelp-lock .account-mobile-shell {
  isolation: auto !important;
}
body.zhelp-lock .placement-shell .zhelp-target-active,
body.zhelp-lock .account-mobile-shell .zhelp-target-active {
  overflow: visible;
}
body.zhelp-lock .placement-shell .pl-btn.zhelp-target-active,
body.zhelp-lock .placement-shell .placement-nav.zhelp-target-active,
body.zhelp-lock .account-mobile-shell .account-stats-grid.zhelp-target-active,
body.zhelp-lock .account-mobile-shell .account-links-card.zhelp-target-active {
  border-radius: 22px;
}


@media (max-width: 560px) {
  body.pwa-install-card-visible .zhelp-nudge {
    bottom: calc(var(--pwa-install-card-clearance, 226px) + env(safe-area-inset-bottom));
  }
  body.pwa-install-card-visible .zhelp-fab {
    bottom: calc(var(--pwa-install-card-clearance, 226px) + 50px + env(safe-area-inset-bottom));
  }
}

/* Stage 2: keep the optional guide prompt compact and above the mobile bottom nav. */
.zhelp-nudge {
  inset-inline-end: max(12px, env(safe-area-inset-right));
  bottom: calc(104px + env(safe-area-inset-bottom));
  width: min(304px, calc(100vw - 24px));
  gap: 6px 8px;
  padding: 9px 10px;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16), 0 0 0 3px rgba(23, 179, 159, .06);
}
.zhelp-nudge::before {
  inset-block: 10px;
  width: 3px;
}
.zhelp-nudge-icon {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  font-size: .82rem;
}
.zhelp-nudge-copy { padding-inline-end: 20px; }
.zhelp-nudge-copy strong { font-size: .84rem; line-height: 1.4; }
.zhelp-nudge-copy p { font-size: .70rem; line-height: 1.5; }
.zhelp-nudge-actions {
  gap: 5px;
  flex-wrap: nowrap;
}
.zhelp-nudge-btn,
.zhelp-nudge-link {
  min-height: 30px;
  border-radius: 12px;
  padding: 0 9px;
  font-size: .70rem;
}
.zhelp-nudge-close {
  top: 7px;
  inset-inline-end: 7px;
  width: 24px;
  height: 24px;
  border-radius: 10px;
}
body.pwa-install-card-visible .zhelp-nudge {
  bottom: calc(var(--pwa-install-card-clearance, 190px) + 14px + env(safe-area-inset-bottom));
}
.zhelp-nudge--lesson_detail {
  border-color: rgba(37, 99, 235, .28);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18), 0 0 0 4px rgba(37, 99, 235, .07);
}
.zhelp-nudge--lesson_detail .zhelp-nudge-icon {
  background: linear-gradient(135deg, #2563EB, #17B39F);
}
.zhelp-nudge--lesson_detail .zhelp-nudge-btn-primary {
  background: linear-gradient(135deg, #2563EB, #17B39F);
  box-shadow: 0 10px 20px rgba(37, 99, 235, .18);
}

@media (max-width: 560px) {
  .zhelp-nudge {
    inset-inline: 12px;
    bottom: calc(104px + env(safe-area-inset-bottom));
    width: auto;
    padding: 9px 10px;
    border-radius: 18px;
  }
  .zhelp-nudge-copy strong { font-size: .83rem; }
  .zhelp-nudge-copy p { font-size: .69rem; line-height: 1.48; }
  .zhelp-nudge-btn { min-height: 30px; padding-inline: 9px; }
  .zhelp-nudge-link { display: none; }
  body.pwa-install-card-visible .zhelp-nudge {
    bottom: calc(var(--pwa-install-card-clearance, 210px) + 12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .zhelp-nudge {
    grid-template-columns: 1fr;
  }
  .zhelp-nudge-icon { display: none; }
  .zhelp-nudge-copy { padding-inline-end: 22px; }
}
