/* Новогодняя ярмарка — «Краткое обучение»: кнопка в шапке «Как это работает» и пошаговый тур с подсветкой.
   Подключать после how.css. Разметка и логика — game.js (div.nyf-tour внутри #nyFairGame).
   Затемнение — огромная тень у «выреза» .nyf-tour-hole; клики по странице ловит прозрачный .nyf-tour-catch
   (на интерактивных шагах в нём вырезано окно clip-path — клики проходят только в подсвеченный элемент). */

/* ---------- кнопка запуска ---------- */
#nyFairGame .nyf-how-head { position: relative; align-items: center; }
#nyFairGame .nyf-tour-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 18px 7px 7px; border-radius: 999px; text-align: left; color: #fff6e6;
  background: linear-gradient(180deg, rgba(255, 246, 230, .12), rgba(255, 246, 230, .04)); box-shadow: inset 0 0 0 1px rgba(226, 184, 102, .7), 0 6px 16px rgba(3, 18, 12, .35);
  transition: background .2s, box-shadow .2s; }
#nyFairGame .nyf-tour-btn:hover { background: linear-gradient(180deg, rgba(255, 246, 230, .2), rgba(255, 246, 230, .08)); box-shadow: inset 0 0 0 1px #e2b866, 0 8px 20px rgba(3, 18, 12, .45); }
#nyFairGame .nyf-tour-btn-ic { position: relative; flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #4a1a06;
  background: linear-gradient(180deg, #f8e2a8, #e2b866 60%, #c98d2e); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 3px 8px rgba(0, 0, 0, .3); }
#nyFairGame .nyf-tour-btn-ic::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(248, 226, 168, .55); animation: nyfTourPing 2.6s ease-out infinite; }
#nyFairGame .nyf-tour-btn-ic svg { width: 18px; height: 18px; margin-left: 2px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; }
#nyFairGame .nyf-tour-btn-t { display: flex; flex-direction: column; font-size: 15px; font-weight: 800; line-height: 1.2; color: #f8e2a8; white-space: nowrap; }
#nyFairGame .nyf-tour-btn-t small { font-size: 12.5px; font-weight: 600; color: rgba(255, 240, 215, .78); }
@keyframes nyfTourPing { 0% { opacity: .9; transform: scale(.9); } 70%, 100% { opacity: 0; transform: scale(1.35); } }

/* ---------- слой тура ---------- */
#nyFairGame .nyf-tour { position: fixed; inset: 0; z-index: 10005; opacity: 0; transition: opacity .25s; pointer-events: none; }
#nyFairGame .nyf-tour.nyf-vis { opacity: 1; }
#nyFairGame .nyf-tour-catch { position: absolute; inset: 0; pointer-events: auto; }
#nyFairGame .nyf-tour-hole { position: fixed; left: 0; top: 0; width: 0; height: 0; border-radius: 20px; pointer-events: none;
  box-shadow: 0 0 0 2px #e2b866, 0 0 0 7px rgba(248, 226, 168, .22), 0 0 34px 8px rgba(248, 226, 168, .35), 0 0 0 200vmax rgba(5, 22, 16, .76);
  transition: opacity .2s; }
#nyFairGame .nyf-tour-hole.nyf-off { box-shadow: 0 0 0 200vmax rgba(5, 22, 16, .76); }
#nyFairGame .nyf-tour-hole::after { content: ''; position: absolute; inset: -2px; border-radius: inherit; box-shadow: 0 0 0 2px rgba(248, 226, 168, .8); animation: nyfTourGlow 2.2s ease-in-out infinite; }
#nyFairGame .nyf-tour-hole.nyf-off::after { display: none; }
@keyframes nyfTourGlow { 50% { box-shadow: 0 0 0 6px rgba(248, 226, 168, 0); } }

/* ---------- карточка-подсказка ---------- */
#nyFairGame .nyf-tour-card { position: fixed; left: 0; top: 0; width: 360px; max-width: calc(100vw - 24px); padding: 16px 18px 16px; border-radius: 20px;
  color: #0f2f25; background: linear-gradient(180deg, #fffaf0, #fff6e6 60%, #f8ecd2); box-shadow: inset 0 0 0 1px #e2b866, inset 0 0 0 4px #fffaf0, inset 0 0 0 5px rgba(226, 184, 102, .45), 0 18px 40px rgba(0, 12, 8, .5);
  transition: opacity .2s, transform .2s; pointer-events: auto; }
#nyFairGame .nyf-tour.nyf-tour-moving .nyf-tour-card { opacity: 0; transform: translateY(6px); }
#nyFairGame .nyf-tour-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#nyFairGame .nyf-tour-n { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; color: #fff6e6; background: #b3262d; font-variant-numeric: tabular-nums; }
#nyFairGame .nyf-tour-skip { padding: 6px 2px; font-size: 13.5px; font-weight: 700; color: #6b5233; text-decoration: underline dotted; text-underline-offset: 3px; }
#nyFairGame .nyf-tour-skip:hover { color: #b3262d; }
#nyFairGame .nyf-tour-t { margin: 10px 0 0; font: 800 22px/1.2 var(--script); color: #0f2f25; }
#nyFairGame .nyf-tour-d { margin-top: 6px; font-size: 15px; line-height: 1.42; color: #3d2a17; }
/* пробный режим и действие шага */
#nyFairGame .nyf-tour-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.25;
  color: #6b4a14; background: rgba(226, 184, 102, .2); box-shadow: inset 0 0 0 1px rgba(185, 138, 58, .45); }
#nyFairGame .nyf-tour-badge[hidden] { display: none; }
#nyFairGame .nyf-tour-badge::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #b98a3a; box-shadow: 0 0 0 3px rgba(185, 138, 58, .22); }
#nyFairGame .nyf-tour-d.nyf-tour-ok { color: #1d5e3a; font-weight: 600; animation: nyfTourWin .35s ease; }
#nyFairGame .nyf-tour-d.nyf-tour-ok::before { content: '✓'; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 7px; border-radius: 50%; font-size: 12px; font-weight: 800; color: #fff; background: #2f8a55; vertical-align: 1px; }
@keyframes nyfTourWin { from { opacity: 0; transform: translateY(4px); } }
#nyFairGame .nyf-tour-act { display: flex; width: 100%; justify-content: center; min-height: 44px; margin-top: 12px; padding: 8px 16px; font-size: 15px; }
#nyFairGame .nyf-tour-act[hidden] { display: none; }
/* во время тура: перетаскиваемая игрушка и тосты — над затемнением; бирка «Высота ёлки» подсвечивается при пробном росте */
#nyFairGame.nyf-tutor .nyf-ghost { z-index: 10006; }
#nyFairGame.nyf-tutor .nyf-toasts { z-index: 10006; }
#nyFairGame .nyf-inv-hgt.nyf-tour-pulse b { animation: nyfTourPulse 1.1s ease-in-out 3; }
@keyframes nyfTourPulse { 50% { color: #b3262d; text-shadow: 0 0 18px rgba(226, 184, 102, .9); transform: scale(1.06); } }
#nyFairGame .nyf-inv-hgt.nyf-tour-pulse b { display: inline-block; transform-origin: left center; }
#nyFairGame .nyf-tour-acts { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
#nyFairGame .nyf-tour-dots { display: flex; gap: 5px; margin-right: auto; }
#nyFairGame .nyf-tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(15, 47, 37, .2); transition: width .2s, background .2s; }
#nyFairGame .nyf-tour-dots i.nyf-on { width: 18px; border-radius: 4px; background: #b98a3a; }
#nyFairGame .nyf-tour-acts .nyf-btn { min-height: 42px; padding: 8px 20px; font-size: 15px; }
#nyFairGame .nyf-tour-prev { color: #0f2f25; box-shadow: inset 0 0 0 1px rgba(15, 47, 37, .35); }
#nyFairGame .nyf-tour-prev:hover { background: rgba(15, 47, 37, .06); }
#nyFairGame .nyf-tour-next { min-width: 112px; }
#nyFairGame .nyf-tour-card button:focus-visible { outline: 2px solid #b3262d; outline-offset: 2px; }
#nyFairGame .nyf-tour-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- адаптив ---------- */
@media (max-width: 1000px) {
  #nyFairGame .nyf-how-head { flex-direction: column; gap: 14px; }
  #nyFairGame .nyf-tour-btn { position: relative; right: auto; top: auto; transform: none; }
}
/* телефон: карточка — снизу экрана во всю ширину, подсветка — над ней (game.js) */
@media (max-width: 639px) {
  #nyFairGame .nyf-tour-card { left: 10px !important; right: 10px; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; padding: 14px 16px 14px; }
  #nyFairGame .nyf-tour-t { font-size: 20px; }
  #nyFairGame .nyf-tour-d { font-size: 14.5px; }
  #nyFairGame .nyf-tour-acts .nyf-btn { min-height: 44px; }
  #nyFairGame .nyf-tour-hole { border-radius: 16px; }
  #nyFairGame .nyf-tour-badge { margin-top: 8px; }
  #nyFairGame .nyf-tour-act { margin-top: 10px; }
  #nyFairGame.nyf-tutor .nyf-toasts { display: none; } /* на телефоне внизу карточка тура — итог пишется в ней */
}
@media (prefers-reduced-motion: reduce) {
  #nyFairGame .nyf-tour, #nyFairGame .nyf-tour-card, #nyFairGame .nyf-tour-hole, #nyFairGame .nyf-tour-dots i { transition: none; }
  #nyFairGame .nyf-tour-btn-ic::after, #nyFairGame .nyf-tour-hole::after, #nyFairGame .nyf-tour-d.nyf-tour-ok, #nyFairGame .nyf-inv-hgt.nyf-tour-pulse b { animation: none; }
  #nyFairGame .nyf-tour.nyf-tour-moving .nyf-tour-card { opacity: 1; transform: none; }
}

/* после выполненного действия — мягко подсвечиваем «Далее» (без автоперехода) */
#nyFairGame .nyf-tour-card .nyf-tour-ready { animation: nyfTourReady 1.6s ease-in-out infinite; }
@keyframes nyfTourReady { 0%, 100% { box-shadow: 0 0 0 0 rgba(226, 184, 102, .0); } 50% { box-shadow: 0 0 0 6px rgba(226, 184, 102, .45); } }
@media (prefers-reduced-motion: reduce) { #nyFairGame .nyf-tour-card .nyf-tour-ready { animation: none; box-shadow: 0 0 0 3px rgba(226, 184, 102, .6); } }
