/* "How to use this" picture guides (templates/_how_to.html + js/how-to.js).
   A pill button in a section; it opens a card with one drawn screen per step,
   the thing to press ringed in yellow with a finger. Bottom sheet on phones,
   centred card on wider screens. Uses the admin's brand colour (--primary). */

.hg-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid #dbe1ec;
  border-radius: 999px;
  background: #fff;
  color: var(--primary, #2563eb);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.hg-open:hover,
.hg-open:focus-visible {
  border-color: var(--primary, #2563eb);
  background: #eff4ff;
}
.h-banner-guide { margin-top: 18px; }
.hg-open-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}

html.hg-locked { overflow: hidden; }

.hg {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  isolation: isolate;
  display: grid;
  align-items: end;
  justify-items: center;
  font-family: Inter, system-ui, sans-serif;
}
.hg[hidden] { display: none; }
.hg-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(10 14 30 / .55);
}
.hg-sheet {
  position: relative;
  display: grid;
  gap: 8px;
  width: min(470px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 -10px 40px rgb(0 0 0 / .25);
  animation: hg-up .2s ease;
}
@keyframes hg-up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 700px) {
  .hg { align-items: center; }
  .hg-sheet { border-radius: 22px; }
}
.hg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
}
.hg-x {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
}
.hg-x:hover { background: #f1f5f9; color: #0f172a; }
.hg-stage .hg-picture {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, #eef2ff, #f8fafc);
}
.hg-stage h3 {
  margin: 4px 0 4px;
  font-size: 19px;
  font-weight: 800;
  color: #0f172a;
}
.hg-stage p {
  margin: 0;
  color: #475569;
  font-size: 15.5px;
  line-height: 1.55;
}
.hg-stage .hg-count {
  margin: 12px 0 0;
  color: var(--primary, #2563eb);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hg-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 6px 0;
}
.hg-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
}
.hg-dots span.active {
  width: 22px;
  background: var(--primary, #2563eb);
}
.hg-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hg-btn {
  min-height: 48px;
  border: 1px solid #dbe1ec;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.hg-btn:disabled { color: #94a3b8; cursor: default; }
.hg-btn--primary {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
}

/* ── The drawn screen ─────────────────────────────────────────────────── */
.hg-screen {
  width: min(270px, 100%);
  border: 3px solid #0f172a;
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 24px rgb(15 23 42 / .18);
  font-size: 12px;
  color: #0f172a;
}
.hg-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hg-logo {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 4px;
  background: var(--primary, #2563eb);
}
.hg-body {
  display: grid;
  gap: 8px;
  padding: 12px;
  min-height: 150px;
  align-content: start;
}
.hg-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.hg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.hg-rowbox {
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
}
.hg-card, .hg-option, .hg-button, .hg-input, .hg-select, .hg-textarea, .hg-drop, .hg-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #dbe1ec;
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
}
.hg-card, .hg-button { justify-content: center; text-align: center; }
.hg-card.is-col { flex-direction: column; gap: 5px; padding: 10px 8px; }
.hg-input, .hg-select { color: #475569; font-weight: 500; justify-content: space-between; }
.hg-textarea { min-height: 50px; align-items: flex-start; color: #64748b; font-weight: 500; }
.hg-drop {
  flex-direction: column;
  justify-content: center;
  min-height: 74px;
  border: 2px dashed #cbd5e1;
  color: #64748b;
  font-weight: 500;
  text-align: center;
}
.hg-drop i { font-size: 18px; color: var(--primary, #2563eb); }
.hg-ref {
  justify-content: center;
  border: 1.5px dashed #93c5fd;
  color: #1e40af;
  font-family: ui-monospace, monospace;
  font-weight: 800;
  letter-spacing: .12em;
}
.hg-flabel { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.hg-flabel b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 10px;
}
.hg-small { color: #64748b; font-size: 11px; }
.hg-link { color: var(--primary, #2563eb); font-weight: 700; padding: 2px 4px; }
.hg-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid #dbe1ec;
  border-radius: 8px;
  font-weight: 700;
  font-size: 11px;
}
.hg-badge { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.hg-badge.is-wait { background: #fef3c7; color: #92400e; }
.hg-badge.is-ok { background: #dcfce7; color: #166534; }
.hg-tile { display: grid; gap: 6px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 12px; }
.hg-thumb { height: 60px; border-radius: 8px; background: linear-gradient(135deg, #c7d2fe, #a5f3fc); }
.hg-result {
  display: grid;
  place-items: center;
  height: 86px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e0e7ff, #cffafe);
  color: var(--primary, #2563eb);
  font-size: 26px;
}
.hg-photo, .hg-mask, .hg-paint {
  position: relative;
  display: grid;
  place-items: center;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
}
.hg-photo { background: linear-gradient(160deg, #bfdbfe, #fde68a); }
.hg-mask, .hg-paint { background: #000; }
.hg-photo small, .hg-mask small {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3px;
  background: rgb(0 0 0 / .55);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
}
.hg-photo-obj { width: 34px; height: 44px; border-radius: 6px; background: #64748b; }
.hg-mask-obj { width: 38px; height: 48px; border-radius: 10px; background: #fff; }
.hg-brush { position: absolute; right: 34%; top: 22%; color: #fde68a; font-size: 18px; transform: rotate(-30deg); }
.hg-stroke { position: absolute; left: 30%; top: 26%; width: 40%; height: 44%; border-radius: 40% 55% 45% 50%; background: rgb(255 59 107 / .6); }
.hg-slider { flex: 1; height: 6px; margin-left: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.hg-slider span { display: block; width: 45%; height: 100%; background: var(--primary, #2563eb); }
.hg-progress { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.hg-progress span { display: block; width: 100%; height: 100%; background: var(--primary, #2563eb); }
.hg-line { display: block; height: 7px; border-radius: 999px; background: #e2e8f0; }
.hg-line.is-strong { background: #94a3b8; }

.hg-screen .is-hot {
  border-color: var(--primary, #2563eb) !important;
  background: var(--primary, #2563eb) !important;
  color: #fff !important;
}
.hg-screen .is-hot i { color: #fff !important; }
.hg-screen .is-soft {
  border-color: var(--primary, #2563eb) !important;
  background: #eff4ff !important;
  color: #1e3a8a !important;
}
.hg-screen .is-hot-line { border-color: var(--primary, #2563eb) !important; }

.hg-tap {
  position: relative;
  display: grid;
  border-radius: 12px;
  box-shadow: 0 0 0 3px #ffd166;
  animation: hg-pulse 1.6s ease-in-out infinite;
}
.hg-tap.is-wide { width: 100%; }
.hg-finger {
  position: absolute;
  right: -6px;
  bottom: -12px;
  color: #0f172a;
  font-size: 20px;
  text-shadow: 0 0 0 #ffd166, 1px 1px 0 #ffd166, -1px -1px 0 #ffd166;
  transform: rotate(-12deg);
  pointer-events: none;
}
@keyframes hg-pulse { 50% { box-shadow: 0 0 0 6px rgb(255 209 102 / .55); } }
@media (prefers-reduced-motion: reduce) {
  .hg-tap, .hg-sheet { animation: none; }
}

/* The steps live in a <template>; this is only a guard for old browsers that
   would otherwise render its contents inline. */
template.hg-steps { display: none !important; }
