/* Онбординг-тур «Отзывы МВК». Токены берутся из styles.css приложения. */
.tour-root { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
.tour-root[hidden] { display: none; }

/* Четыре блокирующие панели вокруг выреза: клики вне подсвеченного элемента не доходят до приложения. */
.tour-block { position: fixed; pointer-events: auto; background: transparent; }
.tour-block.full { inset: 0; }

/* Затемнение рисует сам вырез тенью, поэтому фокус можно плавно двигать между шагами. */
.tour-spot {
  position: fixed; top: 0; left: 0; width: 0; height: 0; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 100vmax rgb(31 32 36 / 58%);
  opacity: 0;
  transition: top .34s cubic-bezier(.3,.7,.2,1), left .34s cubic-bezier(.3,.7,.2,1), width .34s cubic-bezier(.3,.7,.2,1), height .34s cubic-bezier(.3,.7,.2,1), opacity .24s ease, border-radius .34s ease;
}
.tour-spot.on { opacity: 1; }
.tour-spot.dim-only { box-shadow: 0 0 0 100vmax rgb(31 32 36 / 58%); }
.tour-spot::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 92%), 0 0 0 5px rgb(109 74 239 / 55%);
  opacity: 0;
}
.tour-spot.on::after { opacity: 1; }
.tour-spot.pulse::after { animation: tour-ring .9s cubic-bezier(.2,.7,.2,1) 1; }
@keyframes tour-ring {
  0% { box-shadow: 0 0 0 2px rgb(255 255 255 / 92%), 0 0 0 0 rgb(109 74 239 / 60%); }
  60% { box-shadow: 0 0 0 2px rgb(255 255 255 / 92%), 0 0 0 16px rgb(109 74 239 / 0%); }
  100% { box-shadow: 0 0 0 2px rgb(255 255 255 / 92%), 0 0 0 5px rgb(109 74 239 / 55%); }
}
.tour-spot.first { transition: opacity .28s ease; }

/* Поповер */
.tour-pop {
  position: fixed; top: 0; left: 0; width: 340px; max-width: calc(100vw - 24px); pointer-events: auto;
  border: 1px solid var(--line-soft); border-radius: 18px; background: #fff; color: var(--ink);
  box-shadow: 0 22px 54px rgb(31 32 36 / 26%), 0 2px 8px rgb(31 32 36 / 8%);
  padding: 18px 18px 16px; opacity: 0; transform: translateY(6px);
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.7,.2,1), top .34s cubic-bezier(.3,.7,.2,1), left .34s cubic-bezier(.3,.7,.2,1);
}
.tour-pop.on { opacity: 1; transform: none; }
.tour-pop.instant { transition: opacity .22s ease, transform .22s cubic-bezier(.2,.7,.2,1); }
.tour-pop.center { width: 420px; padding: 26px 26px 22px; border-radius: 22px; }
.tour-pop-inner { transition: opacity .16s ease; }
.tour-pop-inner.swap { opacity: 0; }
.tour-count { display: block; margin-bottom: 9px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.tour-pop h2 { margin: 0 0 8px; color: var(--ink); font-size: 17px; font-weight: 650; line-height: 1.25; }
.tour-pop.center h2 { font-size: 21px; }
.tour-pop p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.tour-progress { display: flex; gap: 3px; margin: 0 0 14px; }
.tour-progress i { flex: 1; height: 3px; border-radius: 3px; background: #e6e3dc; transition: background .3s ease; }
.tour-progress i.done { background: #b9a9f5; }
.tour-progress i.now { background: var(--violet); }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.tour-actions .tour-skip { margin-right: auto; }
.tour-btn {
  min-height: 38px; border: 1px solid transparent; border-radius: 12px; padding: 0 15px; font-size: 13px; font-weight: 650; cursor: pointer;
  background: #eae8e2; color: #3b3a42; transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tour-btn:hover { background: #e1dfd7; }
.tour-btn.primary { background: var(--violet); color: #fff; }
.tour-btn.primary:hover { background: #5b3ae0; }
.tour-btn.link { min-height: 34px; padding: 0 4px; background: transparent; color: var(--muted); font-weight: 500; }
.tour-btn.link:hover { background: transparent; color: var(--ink); text-decoration: underline; }
.tour-btn:active { transform: translateY(1px); }
.tour-btn:disabled { cursor: not-allowed; opacity: .42; }
.tour-btn:focus-visible, .tour-help:focus-visible, .tour-x:focus-visible {
  outline: 0; border-color: #8c73dc !important; box-shadow: 0 0 0 4px rgb(109 74 239 / 18%);
}
.tour-x {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.tour-x:hover { background: #f1efe9; color: var(--ink); }
.tour-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* Заголовок и счетчик шагов не заходят под крестик */
.tour-pop h2, .tour-count { padding-right: 34px; }
.tour-progress { margin-right: 34px; }

/* Хвост-указатель поповера */
.tour-tail { position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border: 1px solid var(--line-soft); }
.tour-pop[data-side="right"] .tour-tail { left: -8px; border-right: 0; border-top: 0; }
.tour-pop[data-side="left"] .tour-tail { right: -8px; border-left: 0; border-bottom: 0; }
.tour-pop[data-side="bottom"] .tour-tail { top: -8px; border-right: 0; border-bottom: 0; }
.tour-pop[data-side="top"] .tour-tail { bottom: -8px; border-left: 0; border-top: 0; }
.tour-pop[data-side="none"] .tour-tail, .tour-pop.sheet .tour-tail, .tour-pop.center .tour-tail { display: none; }

/* Кнопка «Как пользоваться» */
.tour-help {
  display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: #5f5e67; font-size: 12.5px; text-align: left; cursor: pointer;
}
.tour-help:hover { background: #edebe6; color: var(--ink); }
.tour-help-mark {
  display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: #e4e0fa; color: #553bb1; font-size: 12px; font-weight: 700;
}
.rail-collapsed .tour-help { justify-content: center; padding: 8px 0; }
.rail-collapsed .tour-help > span:not(.tour-help-mark) { display: none; }
.tour-help-profile { width: 100%; margin-top: 10px; }

/* Учебная карточка отзыва */
.tour-sandbox { position: relative; }
.tour-sandbox-pill {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 12px; padding: 5px 11px; border-radius: 999px; background: #eeeafd; color: #553bb1; font-size: 12px; font-weight: 650;
}
.tour-sandbox .review-copy { margin-top: 15px; }
.tour-sandbox [data-tour-target] { scroll-margin: 90px; }
.tour-hidden { display: none !important; }
.tour-sandbox .answer-state { margin-top: 14px; }
.tour-sandbox .answer-state.sent, .tour-sandbox .answer-state.published { background: #fff; border: 1px solid var(--line); }
.tour-legend { display: grid; gap: 8px; margin-top: 14px; }
.tour-legend-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: 14px; background: #fff;
  opacity: 0; transform: translateY(6px); transition: opacity .34s ease, transform .34s ease, border-color .3s ease, background .3s ease;
}
.tour-legend.show .tour-legend-row { opacity: 1; transform: none; }
.tour-legend.show .tour-legend-row:nth-child(2) { transition-delay: .18s; }
.tour-legend.show .tour-legend-row:nth-child(3) { transition-delay: .36s; }
.tour-legend.show .tour-legend-row:nth-child(4) { transition-delay: .54s; }
.tour-legend.show .tour-legend-row:nth-child(5) { transition-delay: .72s; }
.tour-legend-row b { font-size: 13px; }
.tour-legend-row small { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.4; }
.tour-legend-row .reply-check { margin: 0; font-size: 15px; }
.tour-legend-row.error b, .tour-legend-row.error .reply-check { color: var(--red); }
.tour-legend-row.error { border-color: #efb4bb; background: #fff8f8; }
.tour-legend-row.published .reply-check { color: var(--green); }

/* Приветствие и финал стоят поверх затемнения без выреза */
.tour-root.plain .tour-spot { width: 0 !important; height: 0 !important; box-shadow: 0 0 0 100vmax rgb(31 32 36 / 58%); }

.tour-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 2100; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 13px; background: #1f2024; color: #fbfaf8;
  font-size: 13px; transform: translate(-50%, 8px); opacity: 0; transition: opacity .22s ease, transform .22s ease; pointer-events: none;
}
.tour-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Телефон: поповер становится нижней панелью */
@media (max-width: 899px) {
  .tour-help { display: none; }
  .tour-help-profile { display: flex; min-height: 44px; font-size: 14px; }
  .tour-toast { z-index: 2100; }
  .tour-pop, .tour-pop.center { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; max-height: 52vh; overflow: auto; padding: 16px 16px 14px; border-radius: 20px; }
  .tour-pop.center { top: 50% !important; bottom: auto; max-height: none; transform: translateY(-50%); padding: 24px 20px 20px; }
  .tour-pop.center.on { transform: translateY(-50%); }
  .tour-pop.sheet { transform: translateY(14px); }
  .tour-pop.sheet.on { transform: none; }
  .tour-pop h2 { font-size: 16px; }
  .tour-pop p { font-size: 14px; }
  .tour-btn { min-height: 44px; }
  .tour-btn.link { min-height: 44px; }
  .tour-actions { gap: 6px; }
  .tour-x { top: 4px; right: 4px; width: 44px; height: 44px; }
  .tour-pop h2, .tour-count { padding-right: 46px; }
  .tour-progress { margin-right: 46px; }
  .tour-x svg { width: 16px; height: 16px; }

  /* Учебная карточка на телефоне: настоящий отзыв не открываем, рабочую область показывает класс на body */
  body.tour-sandbox-open .app:not(.overview-app) > .workspace { display: block; }
  body.tour-sandbox-open .app:not(.overview-app) > .feed { display: none; }
  .tour-toast { bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-pop, .tour-pop-inner, .tour-legend-row, .tour-progress i, .tour-toast { transition: none !important; }
  .tour-spot.pulse::after { animation: none; }
}
.tour-legend[hidden] { display: none; }

/* Розовая подсветка фразы в тексте шага: цвета розовых отзывов из styles.css (.review-low-critical: фон #fff0f2, рамка #e9adb5, текст #ab3346). */
.tour-pop mark.tour-pink { border-radius: 5px; background: #fff0f2; box-shadow: 0 0 0 1px #e9adb5; color: #ab3346; padding: 1px 4px; font-weight: 600; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
