/* ═══════════════════════════════════════
   WOBAZI — In-app help sheet + "?" buttons (app/help.js)
   Bottom sheet on phones, centred panel from 768px. Everything is under #wz-help or .wz-help-q.
   Tokens from app/style.css: --gold, --bg-card, --text, --muted.
═══════════════════════════════════════ */

#wz-help { position: fixed; inset: 0; z-index: 2500; }
#wz-help[hidden] { display: none; }
#wz-help .wzh-backdrop { position: absolute; inset: 0; opacity: 0; transition: opacity 0.2s; } /* dim and corners: "Sheets" in public/css/system.css */
#wz-help.is-open .wzh-backdrop { opacity: 1; }

#wz-help .wzh-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  top: max(52px, calc(env(safe-area-inset-top, 0px) + 30px));
  display: flex; flex-direction: column;
  background: var(--bg-card, #0f0f1c); color: var(--text, #f0f0ff);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid rgb(var(--tint) / 0.08); border-bottom: 0;
  transform: translateY(100%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none; overflow: hidden;
  font-family: Outfit, 'Noto Sans SC', 'Noto Sans Thai', sans-serif;
}
#wz-help.is-open .wzh-sheet { transform: translateY(0); }
@media (min-width: 768px) {
  #wz-help .wzh-sheet {
    left: 50%; right: auto; top: 50%; bottom: auto; width: min(560px, calc(100vw - 48px));
    height: min(860px, calc(100vh - 64px)); border-bottom: 1px solid rgb(var(--tint) / 0.08);
    transform: translate(-50%, -46%); opacity: 0; transition: transform 0.2s, opacity 0.2s;
  }
  #wz-help.is-open .wzh-sheet { transform: translate(-50%, -50%); opacity: 1; }
}
#wz-help .wzh-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* header */
#wz-help .wzh-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; padding: 10px 8px; border-bottom: 1px solid rgb(var(--tint) / 0.07); }
#wz-help .wzh-head h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wz-help .wzh-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: rgb(var(--tint) / 0.75); cursor: pointer; }
@media (hover: hover) { #wz-help .wzh-icon:hover { background: rgb(var(--tint) / 0.06); color: var(--text, #f0f0ff); } }
#wz-help .wzh-icon-spacer { width: 44px; }

#wz-help .wzh-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 24px; display: grid; gap: 16px; align-content: start; }

/* list */
#wz-help .wzh-lead { margin: 0; font-size: 15px; line-height: 1.5; color: rgb(var(--tint) / 0.75); }
#wz-help .wzh-path { margin: -8px 0 0; font-size: 13px; color: var(--muted, rgba(240,240,255,0.45)); }
#wz-help .wzh-path strong { color: var(--gold, #f0c040); font-weight: 600; }
#wz-help .wzh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#wz-help .wzh-row {
  width: 100%; display: grid; grid-template-columns: 30px 1fr 18px; gap: 12px; align-items: center; text-align: left;
  padding: 14px; border-radius: 14px; border: 1px solid rgb(var(--tint) / 0.08); background: var(--surface-2);
  color: inherit; font: inherit; cursor: pointer;
}
@media (hover: hover) { #wz-help .wzh-row:hover { border-color: rgba(240, 192, 64, 0.4); } }
#wz-help .wzh-n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(240, 192, 64, 0.5); color: var(--gold, #f0c040); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
#wz-help .wzh-row-text { display: grid; gap: 3px; min-width: 0; }
#wz-help .wzh-row-text strong { font-size: 15px; font-weight: 600; }
#wz-help .wzh-feature { color: var(--gold, #f0c040); }
#wz-help .wzh-hook { font-size: 13px; line-height: 1.4; color: rgb(var(--tint) / 0.62); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#wz-help .wzh-row-text small { font-size: 12px; color: var(--muted, rgba(240,240,255,0.45)); }
#wz-help .wzh-chev { color: rgb(var(--tint) / 0.35); }
#wz-help .wzh-foot { margin: 0; text-align: center; }
#wz-help .wzh-link { color: var(--gold, #f0c040); font-size: 14px; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
#wz-help .wzh-status { margin: 24px 0; text-align: center; color: rgb(var(--tint) / 0.7); }
#wz-help .wzh-spinner { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(240, 192, 64, 0.25); border-top-color: var(--gold, #f0c040); animation: wzh-spin 0.8s linear infinite; }
@keyframes wzh-spin { to { transform: rotate(360deg); } }

/* one tutorial */
#wz-help .wzh-progress { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted, rgba(240,240,255,0.5)); font-variant-numeric: tabular-nums; }
#wz-help .wzh-dots { display: flex; gap: 4px; }
#wz-help .wzh-dot { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
#wz-help .wzh-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--tint) / 0.2); }
#wz-help .wzh-dot.is-done::before { background: rgba(240, 192, 64, 0.5); }
#wz-help .wzh-dot.is-on::before { background: var(--gold, #f0c040); width: 18px; border-radius: 4px; }
/* The phone shot shrinks to the height left under the step text, so text, shot and buttons fit. */
#wz-help .wzh-shot { margin: 0; justify-self: center; width: min(100%, 260px, calc((100dvh - 470px) * 375 / 812)); min-width: 150px; }
#wz-help .wzh-shot.is-wide { width: 100%; }
#wz-help .wzh-shot img { display: block; width: 100%; height: auto; border-radius: 18px; border: 1px solid rgba(240, 240, 255, 0.1); background: #07070f; aspect-ratio: 375 / 812; }
#wz-help .wzh-shot.is-wide img { border-radius: 12px; aspect-ratio: 1440 / 900; }
#wz-help .wzh-step h3 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.25; }
#wz-help .wzh-step p { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: rgb(var(--tint) / 0.78); }
#wz-help .wzh-step .wzh-lock { font-size: 13px; color: var(--muted, rgba(240,240,255,0.55)); }
#wz-help .wzh-example { margin: -8px 0 0; text-align: center; font-size: 12px; color: var(--muted, rgba(240,240,255,0.4)); }
#wz-help .wzh-end { display: grid; gap: 12px; justify-items: start; }
#wz-help .wzh-video { width: 100%; }
#wz-help .wzh-video summary { cursor: pointer; color: var(--gold, #f0c040); font-size: 14px; list-style: none; }
#wz-help .wzh-video summary::-webkit-details-marker { display: none; }
#wz-help .wzh-video video { margin-top: 10px; width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }

#wz-help .wzh-nav {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgb(var(--tint) / 0.07);
}
#wz-help .wzh-btn { min-height: 48px; border-radius: 14px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; padding: 0 14px; }
#wz-help .wzh-btn-ghost { background: transparent; color: var(--text, #f0f0ff); border: 1px solid rgb(var(--tint) / 0.16); }
#wz-help .wzh-btn-ghost:disabled { opacity: 0.35; cursor: default; }
#wz-help .wzh-btn-gold { background: linear-gradient(135deg, #f0c040, #e08020); color: var(--on-gold); border: 0; }

#wz-help button:focus-visible, #wz-help a:focus-visible, #wz-help summary:focus-visible { outline: 2px solid var(--gold, #f0c040); outline-offset: 2px; }

/* "?" beside a section heading. Where the heading already has its ⓘ (::after, margin-left: auto),
   the "?" takes the auto margin and the ⓘ sits just after it. */
.wz-help-q {
  margin-left: auto; align-self: center; flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; padding: 0;
  border: 1px solid rgba(240, 192, 64, 0.45); background: rgba(240, 192, 64, 0.08); color: var(--gold, #f0c040);
  font: 700 13px/1 Outfit, sans-serif; cursor: pointer;
}
@media (hover: hover) { .wz-help-q:hover { background: rgba(240, 192, 64, 0.18); } }
.wz-help-q:focus-visible { outline: 2px solid var(--gold, #f0c040); outline-offset: 2px; }
.section-head[data-tip]:has(.wz-help-q)::after { margin-left: 8px; }
/* A bigger tap target without a bigger circle. */
.wz-help-q { position: relative; }
.wz-help-q::before { content: ''; position: absolute; inset: -9px; }

html.wz-help-open, html.wz-help-open body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  #wz-help .wzh-sheet, #wz-help .wzh-backdrop { transition: none; }
  #wz-help .wzh-spinner { animation-duration: 2s; }
}
