/* --- Гайд: затемнення, вікно, маркер на цифрах, картка «Навіщо / Як» ------------------------ */
:root {
  --gid-dim: rgba(24, 21, 16, 0.64);
  --gid-marker: rgba(255, 207, 51, 0.42);
  --gid-marker-edge: #c98a00;
  --gid-z: 1000;
}

.gid { position: fixed; inset: 0; z-index: var(--gid-z); pointer-events: none; }
.gid-catch { position: absolute; inset: 0; pointer-events: auto; }
.gid-hole {
  position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 200vmax var(--gid-dim);
  transition: left 0.32s var(--ease), top 0.32s var(--ease), width 0.32s var(--ease), height 0.32s var(--ease);
}

/* Маркер: смуга, як від текстовиділювача, що проводять зліва направо; номер — той самий у картці. */
.gid-rings { position: fixed; inset: 0; pointer-events: none; }
.gid-ring {
  position: fixed; border-radius: 4px;
  background: var(--gid-marker); mix-blend-mode: multiply;
  box-shadow: inset 0 -2px 0 var(--gid-marker-edge);
  transform-origin: left center;
}
.gid-rings.in .gid-ring { animation: gid-sweep 0.5s var(--ease) both; }
.gid-rings.in .gid-ring:nth-child(2) { animation-delay: 0.12s; }
.gid-rings.in .gid-ring:nth-child(3) { animation-delay: 0.24s; }
.gid-ring .gid-num { position: absolute; top: -12px; right: -12px; width: 19px; height: 19px; font-size: 10.5px; mix-blend-mode: normal; }
@keyframes gid-sweep { from { transform: scaleX(0); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }

.gid-num {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink-strong); color: #ffd84d;
  font: 700 11px/1 var(--sans); font-style: normal;
  box-shadow: 0 0 0 2px #fff;
}

.gid-card {
  position: fixed; width: min(392px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 20px 22px 16px; border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.12);
  pointer-events: auto; outline: none;
  transition: left 0.32s var(--ease), top 0.32s var(--ease);
}
.gid-card.in { animation: gid-in 0.28s var(--ease) both; }
@keyframes gid-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gid-count { margin: 0 0 6px; font: 600 12px/1.4 var(--sans); color: var(--muted); }
.gid-card h2 { margin: 0 0 10px; font: 500 23px/1.2 var(--serif); letter-spacing: -0.01em; color: var(--ink-strong); }
.gid-label {
  display: block; margin: 0 0 4px;
  font: 700 11px/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gid-marker-edge);
}
.gid-why { margin: 0 0 14px; font-size: 14.5px; line-height: 1.55; }

.gid-ways ul, .gid-look ol { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 8px; }
.gid-ways li { padding: 6px 0 6px 12px; border-left: 2px solid var(--gid-marker-edge); }
.gid-if { display: block; font-weight: 650; color: var(--ink-strong); font-size: 14px; line-height: 1.4; }
.gid-if::before { content: "Якщо "; font-weight: 400; color: var(--muted); }
.gid-then { display: block; font-size: 14px; line-height: 1.45; }
.gid-then::before { content: "тоді "; color: var(--muted); }

.gid-look li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.gid-look li > span { display: grid; gap: 2px; }
.gid-value {
  justify-self: start; padding: 0 4px; border-radius: 3px;
  background: var(--gid-marker); box-shadow: inset 0 -2px 0 var(--gid-marker-edge);
  font: 600 13px/1.5 var(--sans); color: var(--ink-strong); quotes: "«" "»";
}

.gid-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.gid-nav-go { display: flex; gap: 8px; }
.gid-nav button { min-height: 40px; }
.gid-skip { color: var(--muted); }

/* Телефон: картка — нижня панель, вікно — над нею. */
.gid.sheet .gid-card {
  left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 54vh;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(12px + env(safe-area-inset-bottom));
}
.gid.sheet .gid-card h2 { font-size: 20px; }

/* Кнопка гайду: завжди під рукою в куті; підсвічена, коли для екрана є непереглянутий гайд. */
.gid-open {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font: 600 14px/1 var(--sans); color: var(--ink-strong); cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.gid-open:hover { border-color: var(--gid-marker-edge); background: #fffaf0; }
.gid-open:focus-visible, .gid-inline:focus-visible { outline: 2px solid var(--gid-marker-edge); outline-offset: 2px; }
.gid-open svg { width: 18px; height: 18px; flex: none; }
.gid-open.fresh, .gid-inline.fresh { border-color: var(--gid-marker-edge); background: #fff6d6; }
.gid-open.fresh::after, .gid-inline.fresh::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gid-marker-edge);
  animation: gid-pulse 1.6s ease-in-out infinite;
}
.gid-inline { display: inline-flex; align-items: center; gap: 6px; }
@keyframes gid-pulse { 50% { opacity: 0.25; } }
html.gid-on .gid-open { display: none; }
@media (max-width: 760px) {
  .gid-open { right: 12px; bottom: 12px; padding: 0 14px; }
  .gid-open:not(.fresh) .gid-open-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gid-hole, .gid-card { transition: none; }
  .gid-card.in, .gid-rings.in .gid-ring, .gid-open.fresh::after, .gid-inline.fresh::after { animation: none; }
}
.gid-nav-out { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
