/* ===== Автопрезентация (tour.js): подсветка, курсор, карточка ведущего, слайды ===== */
.tr-root {
  --tr-glass: rgba(26, 17, 11, .82);
  --tr-glass-2: rgba(255, 240, 220, .06);
  --tr-line: rgba(246, 234, 214, .14);
  --tr-ink: #f7ecdc;
  --tr-muted: rgba(247, 236, 220, .68);
  --tr-gold: #e2ac64;
  --tr-gold-2: #c27a36;
  --tr-dim: rgba(14, 9, 6, .6);
  --tr-dim-2: rgba(14, 9, 6, .82);
  --tr-ease: cubic-bezier(.65, 0, .35, 1);
  --tr-sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tr-serif: 'Onest', 'Manrope', system-ui, sans-serif;
  position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  font: 15px/1.5 var(--tr-sans); color: var(--tr-ink);
}
.tr-root *, .tr-root *::before, .tr-root *::after { box-sizing: border-box; }
/* панель «Демо» не мешает показу; уведомления видны поверх затемнения */
body.tr-on #present-root { display: none; }
body.tr-on #toasts { z-index: 1003; }

/* ---------- подсветка ---------- */
.tr-spot {
  position: fixed; left: 50%; top: 50%; width: 0; height: 0; border-radius: 16px;
  box-shadow: 0 0 0 2px rgba(226, 172, 100, .9), 0 0 36px 6px rgba(0, 0, 0, .45), 0 0 0 200vmax var(--tr-dim);
  transition: left .6s var(--tr-ease), top .6s var(--tr-ease), width .6s var(--tr-ease), height .6s var(--tr-ease), border-radius .6s, box-shadow .5s;
}
.tr-spot::after {
  content: ''; position: absolute; inset: -6px; border-radius: inherit;
  border: 2px solid rgba(226, 172, 100, .55);
  animation: trPulse 2.2s ease-in-out infinite;
}
.tr-spot.empty { box-shadow: 0 0 0 200vmax rgba(14, 9, 6, .38); }
.tr-spot.empty::after { display: none; }
.tr-spot.dark { box-shadow: 0 0 0 200vmax var(--tr-dim-2); }
@keyframes trPulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.012); opacity: .25; }
}

/* ---------- курсор ---------- */
.tr-cursor {
  position: fixed; left: 0; top: 0; z-index: 2; width: 26px; height: 26px; margin: -3px 0 0 -4px;
  opacity: 0; transition: transform .65s var(--tr-ease), opacity .3s;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
}
.tr-cursor.on { opacity: 1; }
.tr-cursor svg { display: block; }
.tr-cursor i {
  position: absolute; left: 4px; top: 3px; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 2px solid var(--tr-gold); opacity: 0; pointer-events: none;
}
.tr-cursor.press i { animation: trRipple .55s ease-out; }
.tr-cursor.press svg { animation: trTap .25s ease-out; }
@keyframes trRipple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes trTap { 50% { transform: scale(.82); } }

/* ---------- карточка ведущего ---------- */
.tr-card {
  position: fixed; left: 0; top: 0; z-index: 1; width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  pointer-events: auto; color: var(--tr-ink);
  background: linear-gradient(160deg, rgba(58, 38, 24, .55), rgba(20, 13, 8, .2)), var(--tr-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.25); backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid var(--tr-line); border-radius: 22px; padding: 16px 18px 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 240, 220, .08);
  opacity: 0; transition: left .6s var(--tr-ease), top .6s var(--tr-ease), width .45s var(--tr-ease), opacity .3s;
}
.tr-card.show { opacity: 1; }
.tr-card:focus { outline: none; }
.tr-card [hidden] { display: none !important; }
.tr-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tr-chip {
  font: 800 10.5px/1 var(--tr-sans); letter-spacing: .1em; text-transform: uppercase;
  color: #2a1a0e; background: linear-gradient(135deg, var(--tr-gold), var(--tr-gold-2)); padding: 6px 10px; border-radius: 99px; white-space: nowrap;
}
.tr-role { font-size: 12px; color: var(--tr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-count { margin-left: auto; font: 700 13px/1 var(--tr-sans); color: var(--tr-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-x {
  flex: none; width: 32px; height: 32px; border: 1px solid var(--tr-line); border-radius: 50%;
  background: var(--tr-glass-2); color: var(--tr-ink); display: grid; place-items: center; cursor: pointer;
}
.tr-x:hover { background: rgba(255, 240, 220, .14); }
.tr-progress { height: 3px; border-radius: 99px; background: rgba(255, 240, 220, .12); margin: 12px 0 12px; overflow: hidden; flex: none; }
.tr-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--tr-gold-2), var(--tr-gold)); border-radius: inherit; transition: width .5s var(--tr-ease); }
.tr-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 240, 220, .25) transparent; }
.tr-body.tr-swap { animation: trText .45s ease both; }
@keyframes trText { from { opacity: 0; transform: translateY(6px); } }
.tr-card h3 { font: 700 23px/1.15 var(--tr-serif); margin: 0 0 6px; letter-spacing: -.02em; color: #fff7ea; }
.tr-card p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--tr-muted); }
.tr-slide-ic:empty { display: none; }
.tr-slide-ic {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 2px 0 12px;
  color: #2a1a0e; background: linear-gradient(135deg, var(--tr-gold), var(--tr-gold-2));
  box-shadow: 0 10px 24px -10px rgba(226, 172, 100, .7);
  animation: trPop .5s ease both;
}
@keyframes trPop { from { transform: scale(.6) rotate(-10deg); opacity: 0; } }
.tr-extra:empty { display: none; }
.tr-extra { margin-top: 12px; }
.tr-note {
  font-size: 13px !important; color: #ffd9a0 !important;
  background: rgba(226, 172, 100, .12); border: 1px solid rgba(226, 172, 100, .3); border-radius: 12px; padding: 8px 10px;
}

/* статус: таймер автопоказа или «выполняю действие» */
.tr-status { display: flex; align-items: center; gap: 10px; margin-top: 12px; min-height: 16px; flex: none; }
.tr-busy { display: none; align-items: center; gap: 8px; font-size: 12.5px; color: var(--tr-muted); }
.tr-busy::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 240, 220, .2); border-top-color: var(--tr-gold); animation: trSpin .8s linear infinite;
}
.tr-card.busy .tr-busy { display: inline-flex; }
.tr-card.busy .tr-timer { display: none; }
.tr-timer { flex: 1; height: 2px; border-radius: 99px; background: rgba(255, 240, 220, .1); overflow: hidden; }
.tr-timer i { display: block; height: 100%; width: 0; background: rgba(226, 172, 100, .8); }
.tr-card.paused .tr-timer i { background: rgba(255, 240, 220, .3); }
.tr-card.slide .tr-status { margin-top: 14px; }
@keyframes trSpin { to { transform: rotate(360deg); } }

/* кнопки */
.tr-nav { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex: none; }
.tr-nav [data-tr="next"] { margin-left: auto; }
.tr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 99px; border: 1px solid var(--tr-line); background: var(--tr-glass-2); color: var(--tr-ink);
  font: 700 14px/1 var(--tr-sans); cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .2s, box-shadow .2s, border-color .2s;
}
.tr-btn:hover { background: rgba(255, 240, 220, .14); }
.tr-btn:active { transform: translateY(1px); }
.tr-btn:disabled { opacity: .35; cursor: default; }
.tr-btn.icon { width: 40px; padding: 0; }
.tr-btn.primary {
  color: #24160c; border-color: transparent;
  background: linear-gradient(135deg, #f0c27f, var(--tr-gold) 45%, var(--tr-gold-2));
  box-shadow: 0 10px 24px -12px rgba(226, 172, 100, .9);
}
.tr-btn.primary:hover { box-shadow: 0 14px 30px -12px rgba(226, 172, 100, 1); background: linear-gradient(135deg, #f6cd90, #e8b673 45%, #cd8642); }
.tr-btn.ghost { background: transparent; }
.tr-btn:focus-visible, .tr-x:focus-visible { outline: 2px solid var(--tr-gold); outline-offset: 2px; }
.tr-keys { font-size: 11px; color: var(--tr-muted); white-space: nowrap; }
.tr-root kbd {
  font: 700 10.5px/1 var(--tr-sans); padding: 3px 6px; border-radius: 6px; color: var(--tr-ink);
  background: rgba(255, 240, 220, .08); border: 1px solid var(--tr-line);
}
.tr-ic { flex: none; }

/* ---------- слайды ---------- */
.tr-card.slide { width: min(760px, calc(100vw - 32px)); padding: 24px 28px 18px; border-radius: 26px; }
.tr-card.slide h3 { font-size: clamp(26px, 3vw, 36px); }
.tr-card.slide > .tr-body > p { font-size: 15.5px; }
.tr-card.confirm { width: min(560px, calc(100vw - 32px)); }
.tr-lead { color: var(--tr-ink) !important; font-size: 15.5px !important; }
.tr-hint { margin-top: 14px; font-size: 12px; color: var(--tr-muted); }
.tr-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; color: var(--tr-muted); }
.tr-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tr-meta span:first-child { color: var(--tr-gold); font-weight: 700; }

.tr-chapters { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr-chapters li {
  display: grid; grid-template-columns: 34px 1fr; gap: 0 10px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: var(--tr-glass-2); border: 1px solid rgba(255, 240, 220, .07);
  animation: trText .5s ease both;
}
.tr-chapters li:nth-child(2) { animation-delay: .05s; } .tr-chapters li:nth-child(3) { animation-delay: .1s; }
.tr-chapters li:nth-child(4) { animation-delay: .15s; } .tr-chapters li:nth-child(5) { animation-delay: .2s; } .tr-chapters li:nth-child(6) { animation-delay: .25s; }
.tr-chapters i, .tr-tiles i {
  grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--tr-gold); background: rgba(226, 172, 100, .12); font-style: normal;
}
.tr-chapters b { font-size: 14px; color: #fff7ea; }
.tr-chapters span { font-size: 12.5px; color: var(--tr-muted); line-height: 1.35; }

/* было → стало */
.tr-cmp { display: grid; gap: 6px; }
.tr-cmp-h, .tr-cmp-r { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 8px; align-items: stretch; }
.tr-cmp-h b { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 0 10px; }
.tr-cmp-h b:nth-child(2) { color: var(--tr-muted); }
.tr-cmp-h b:nth-child(3) { color: var(--tr-gold); }
.tr-cmp-r { animation: trText .45s ease both; animation-delay: var(--d, 0s); }
.tr-cmp-r span { font-weight: 800; font-size: 13px; align-self: center; color: #fff7ea; }
.tr-cmp-r p { margin: 0; padding: 9px 11px; border-radius: 12px; font-size: 13px !important; line-height: 1.4 !important; }
.tr-cmp-r .was { background: rgba(255, 240, 220, .04); color: rgba(247, 236, 220, .55) !important; text-decoration: line-through rgba(247, 236, 220, .3); }
.tr-cmp-r .now { background: rgba(226, 172, 100, .1); color: var(--tr-ink) !important; font-weight: 600; box-shadow: inset 3px 0 0 var(--tr-gold); }

/* плитки: выгоды и чек-лист */
.tr-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tr-tiles > div {
  display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-content: start;
  padding: 12px; border-radius: 16px; background: var(--tr-glass-2); border: 1px solid rgba(255, 240, 220, .07);
  animation: trText .5s ease both; animation-delay: var(--d, 0s);
}
.tr-tiles b { font-size: 14px; color: #fff7ea; line-height: 1.3; }
.tr-tiles small { font-size: 12.5px; color: var(--tr-muted); line-height: 1.4; }
.tr-check { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* калькулятор роста */
.tr-roi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.tr-roi label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--tr-muted); }
/* селектор усилен: глобальные стили полей приложения не должны перекрашивать поля тура */
.tr-root .tr-roi input[name] {
  box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; height: 42px; min-height: 42px; margin: 0;
  padding: 0 12px; border-radius: 12px; font: 700 16px/1 var(--tr-sans) !important;
  color: #fff7ea !important; background: rgba(255, 240, 220, .07) !important; border: 1px solid var(--tr-line) !important;
  box-shadow: none !important; -webkit-appearance: none; appearance: none;
}
.tr-root .tr-roi input[name]:focus { outline: 2px solid var(--tr-gold); outline-offset: 1px; border-color: transparent !important; }
.tr-roi-wrap { overflow-x: auto; }
.tr-roi-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-roi-t th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--tr-muted); padding: 4px 6px; font-weight: 800; }
.tr-roi-t td { padding: 7px 6px; border-top: 1px solid rgba(255, 240, 220, .08); color: var(--tr-ink); }
.tr-roi-t .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-roi-t td.num:last-child { color: var(--tr-gold); font-weight: 800; }
.tr-roi-total { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tr-roi-total > div { padding: 10px 12px; border-radius: 14px; display: grid; gap: 2px; background: linear-gradient(140deg, rgba(226, 172, 100, .2), rgba(194, 122, 54, .08)); border: 1px solid rgba(226, 172, 100, .25); }
.tr-roi-total small { color: var(--tr-muted); font-size: 11px; font-weight: 700; }
.tr-roi-total b { font: 800 17px/1.2 var(--tr-sans); color: #ffe3b5; font-variant-numeric: tabular-nums; }
.tr-fine { margin-top: 10px !important; font-size: 11.5px !important; line-height: 1.45 !important; }

/* финал */
.tr-plan { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: trp; }
.tr-plan li {
  counter-increment: trp; display: grid; grid-template-columns: 34px 1fr; gap: 0 12px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: var(--tr-glass-2); animation: trText .5s ease both;
}
.tr-plan li::before {
  content: counter(trp); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 800 14px/1 var(--tr-sans); color: #24160c; background: linear-gradient(135deg, var(--tr-gold), var(--tr-gold-2));
}
.tr-plan b { font-size: 14px; color: #fff7ea; }
.tr-plan span { font-size: 12.5px; color: var(--tr-muted); }
.tr-cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- телефон ---------- */
@media (max-width: 720px) {
  .tr-card {
    left: 12px !important; right: 12px; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto; max-height: 46vh; padding: 12px 14px 10px; border-radius: 20px;
  }
  .tr-card h3 { font-size: 20px; }
  .tr-card p { font-size: 13.5px; }
  .tr-card.slide, .tr-card.confirm {
    width: auto; top: 12px !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-height: none; padding: 16px;
  }
  .tr-card.confirm { top: auto !important; }
  .tr-card.slide h3 { font-size: 26px; }
  .tr-keys, .tr-hint { display: none; }
  .tr-nav { margin-top: 10px; }
  .tr-nav .tr-btn { min-height: 38px; padding: 0 14px; }
  .tr-nav .tr-btn.icon { width: 38px; padding: 0; }
  .tr-progress { margin: 10px 0; }
  .tr-chapters, .tr-tiles, .tr-check { grid-template-columns: 1fr; }
  .tr-cmp-h, .tr-cmp-r { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tr-cmp-h span, .tr-cmp-r span { grid-column: 1 / -1; }
  .tr-cmp-r span { margin-top: 4px; }
  .tr-roi, .tr-roi-total { grid-template-columns: 1fr; }
  .tr-roi-t { font-size: 12px; }
  .tr-cta .tr-btn { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .tr-role { display: none; }
}

/* ---------- без анимаций ---------- */
@media (prefers-reduced-motion: reduce) {
  .tr-spot, .tr-card, .tr-cursor, .tr-progress i, .tr-btn { transition: none !important; }
  .tr-spot::after, .tr-body.tr-swap, .tr-slide-ic, .tr-chapters li, .tr-cmp-r, .tr-tiles > div, .tr-plan li,
  .tr-cursor.press i, .tr-cursor.press svg, .tr-busy::before { animation: none !important; }
}

/* Слайды «Что исправлено» и «Скорость» */
.tr-fixes .tr-cmp-r p { font-size: 12.5px !important; padding: 7px 10px; }
.tr-cmp-r .was.bug { text-decoration: none; color: rgba(255, 196, 180, .82) !important; background: rgba(176, 57, 45, .12); box-shadow: inset 3px 0 0 rgba(224, 110, 90, .7); }
.tr-note { display: block; margin-top: 10px; font-size: 12px; color: var(--tr-muted); line-height: 1.45; }
.tr-speed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tr-speed > div { padding: 14px 16px; border-radius: 14px; background: rgba(255, 240, 220, .05); border: 1px solid rgba(255, 240, 220, .1); animation: trText .45s ease both; animation-delay: var(--d, 0s); }
.tr-speed small { color: var(--tr-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tr-speed p { margin: 6px 0 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tr-speed s { color: rgba(255, 196, 180, .7); font: 600 18px/1 'JetBrains Mono', monospace; }
.tr-speed b { color: var(--tr-gold); font: 700 28px/1 'JetBrains Mono', monospace; }
@media (max-width: 720px) { .tr-speed { grid-template-columns: 1fr; } }
