/* Обучение по системе — `web/js/tour.js`.

   Затемнение — тенью «окна» (`.tour__hole`): прозрачный прямоугольник вокруг
   нужного элемента и тень на весь экран вокруг него. Одна тень, а не четыре
   полосы, — окно скругляется и едет от шага к шагу одним переходом. Сам
   экран под затемнением не нажимается (`.tour` ловит указатель): обучение
   показывает, а не даёт случайно нажать «Удалить» посреди рассказа. */
.tour {
  position: fixed; inset: 0; z-index: 400;
  opacity: 0; transition: opacity .2s ease;
}
.tour.is-open { opacity: 1; }

.tour__hole {
  position: fixed; pointer-events: none;
  box-shadow: 0 0 0 9999px rgb(6 6 12 / .66);
  transition: left .32s cubic-bezier(.2, .8, .2, 1), top .32s cubic-bezier(.2, .8, .2, 1),
              width .32s cubic-bezier(.2, .8, .2, 1), height .32s cubic-bezier(.2, .8, .2, 1),
              border-radius .32s ease, opacity .2s ease;
}
/* Цели на экране нет — окна нет, затемнение ровное, карточка посередине. */
.tour.is-free .tour__hole {
  left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important;
}

/* Рамка вокруг окна — светится и «дышит», по ней бежит блик.

   Роман 09.10.2026: «выделения слабые… хотелось бы, чтобы более явно
   подсвечивался элемент — может, через дышащий градиент или глоу». Прежде
   окно обводила одна линия в два пикселя цвета акцента — на тёмной теме она
   терялась рядом с такими же фиолетовыми кнопками.

   Три слоя, и движутся только дешёвые: сама рамка — ровная светлая линия;
   `::after` — широкое свечение, у которого меняется лишь прозрачность
   (дыхание, 2,4 с); `::before` — тонкий градиент по контуру, который
   вращается (блик бежит по кругу). При каждом шаге рамка ещё и вспыхивает
   (`is-flash`) — глаз сразу ловит, куда переехало окно. */
@property --tour-turn { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.tour__ring {
  position: fixed; pointer-events: none;
  box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--accent) 70%, white),
              0 0 14px 2px color-mix(in oklab, var(--accent) 55%, transparent);
  transition: left .32s cubic-bezier(.2, .8, .2, 1), top .32s cubic-bezier(.2, .8, .2, 1),
              width .32s cubic-bezier(.2, .8, .2, 1), height .32s cubic-bezier(.2, .8, .2, 1),
              border-radius .32s ease, opacity .2s ease;
}
.tour__ring::after {
  content: ''; position: absolute; inset: -3px; border-radius: inherit;
  box-shadow: 0 0 26px 8px color-mix(in oklab, var(--accent) 60%, transparent),
              0 0 60px 18px color-mix(in oklab, var(--accent) 22%, transparent);
  animation: tour-breathe 2.4s ease-in-out infinite;
}
.tour__ring::before {
  content: ''; position: absolute; inset: -3px; border-radius: inherit; padding: 3px;
  background: conic-gradient(from var(--tour-turn),
    transparent 0 58%, color-mix(in oklab, var(--accent) 60%, white) 76%,
    #fff 82%, color-mix(in oklab, var(--accent) 80%, transparent) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: tour-turn 3.2s linear infinite;
}
.tour__ring.is-flash { animation: tour-flash .7s ease-out; }
.tour.is-free .tour__ring { opacity: 0; }

/* Шторка перехода (`veil` в tour.js): тем же цветом, что и затемнение, — на
   время смены раздела окно закрыто, экран ровно тёмный, рамка погашена.
   Окно под шторкой переезжает без перехода, и, когда она поднимается, оно
   уже стоит на новой цели — глаз не видит, как оно ползёт через экран. */
.tour__veil {
  position: fixed; inset: 0; pointer-events: none;
  background: rgb(6 6 12 / .66);
  opacity: 0; transition: opacity .18s ease;
}
.tour.is-dark .tour__veil { opacity: 1; }
.tour.is-dark .tour__ring { opacity: 0; }
.tour.is-dark .tour__hole, .tour.is-dark .tour__ring { transition: none; }

@keyframes tour-breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes tour-turn { to { --tour-turn: 360deg; } }
@keyframes tour-flash {
  from { box-shadow: 0 0 0 1.5px #fff, 0 0 0 0 color-mix(in oklab, var(--accent) 80%, transparent); }
  to { box-shadow: 0 0 0 1.5px color-mix(in oklab, var(--accent) 70%, white),
                   0 0 0 18px color-mix(in oklab, var(--accent) 0%, transparent); }
}

.tour__tip {
  position: fixed; width: min(360px, calc(100vw - 24px));
  padding: 16px 18px 14px;
  border-radius: 16px;
  /* Сплошная, без стекла: на телефоне карточка ложится прямо на текст
     раздела, и сквозь полупрозрачную он читался поверх подсказки. */
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgb(0 0 0 / .45);
  color: var(--text);
  transition: left .32s cubic-bezier(.2, .8, .2, 1), top .32s cubic-bezier(.2, .8, .2, 1), opacity .15s ease;
}
.tour.is-moving .tour__tip { opacity: .55; }

.tour__head { display: flex; align-items: center; justify-content: space-between; }
.tour__count { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tour__close {
  display: grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px 0 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.tour__close:hover { background: var(--surface-2); color: var(--text); }

.tour__bar { height: 3px; margin: 8px 0 12px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tour__bar i {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: var(--accent); transition: width .32s ease;
}

.tour__title { font-size: 16px; font-weight: 650; line-height: 1.3; margin-bottom: 6px; }
.tour__text { font-size: 13.5px; line-height: 1.5; color: var(--text-soft); }
.tour__text p { margin: 0 0 6px; }
.tour__text p:last-child { margin-bottom: 0; }
.tour__text b { color: var(--text); font-weight: 600; }

.tour__acts { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.tour__skip {
  border: 0; padding: 4px 0; background: none; cursor: pointer;
  color: var(--text-faint); font: inherit; font-size: 12.5px;
}
.tour__skip:hover { color: var(--text); text-decoration: underline; }
.tour__skip[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tour__hole, .tour__ring, .tour__tip, .tour__bar i { transition: none; }
  .tour__ring::after, .tour__ring::before, .tour__ring.is-flash { animation: none; }
}

/* ---------- подсказка «где это» для практики (`coach` в tour.js) ----------

   Та же рамка, что у обучения, но без затемнения и мимо указателя: нажимать
   подсвеченное человек должен сам. */
.coach { position: fixed; inset: 0; z-index: 390; pointer-events: none; }
.coach .tour__ring {
  transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease;
}
.coach__tip {
  position: fixed; max-width: min(300px, calc(100vw - 24px));
  padding: 9px 12px; border-radius: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid color-mix(in oklab, var(--accent) 55%, var(--border));
  box-shadow: 0 12px 32px rgb(0 0 0 / .4);
  font-size: 13px; line-height: 1.45;
}

/* ---------- практика: окно заданий (`practice.js`) ----------

   Справа внизу, поверх раздела, но под окнами форм: форма «+ Сделка» должна
   ложиться на него, а не наоборот. Полоса вдоль верхнего края — знак режима:
   по ней из любого раздела видно, что работа идёт в учебной копии. */
body.is-practice::before {
  content: ''; position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 381;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 40%, #f5b84a), var(--accent));
  pointer-events: none;
}

.practice {
  position: fixed; right: 16px; bottom: 16px; z-index: 120;
  width: 340px; max-height: calc(100vh - 110px); overflow: auto;
  padding: 12px 14px 14px; border-radius: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--border));
  box-shadow: 0 18px 50px rgb(0 0 0 / .45),
              0 0 24px color-mix(in oklab, var(--accent) 22%, transparent);
}
.practice.is-folded { width: auto; padding-bottom: 12px; }

.practice__head { display: flex; align-items: center; gap: 8px; }
/* Окно тянется за шапку (`makeDraggable` в practice.js) — на столе; на
   телефоне оно во всю ширину, и тащить его некуда. `touch-action` снят, чтобы
   перо и сенсорный экран ноутбука тащили окно, а не прокручивали страницу. */
@media (min-width: 821px) {
  .practice__head { cursor: grab; touch-action: none; user-select: none; }
  .practice.is-dragging, .practice.is-dragging .practice__head { cursor: grabbing; }
  .practice.is-dragging { box-shadow: 0 24px 60px rgb(0 0 0 / .55),
                                      0 0 28px color-mix(in oklab, var(--accent) 30%, transparent); }
}
.practice__badge {
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; letter-spacing: .02em;
  color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 55%, #f5b84a));
}
.practice__count { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.practice__fold {
  display: grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px -4px 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.practice__fold:hover { background: var(--surface-2); color: var(--text); }
.practice__chevron { display: grid; transition: transform .2s ease; }
.practice.is-folded .practice__chevron { transform: rotate(180deg); }

.practice__bar { height: 3px; margin: 10px 0 0; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.practice__bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.practice.is-folded .practice__bar { width: 120px; }

.practice__note { margin: 10px 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--text-soft); }
.practice__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.practice__quest {
  display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start;
  padding: 6px 6px; border-radius: 10px;
}
.practice__quest.is-current { background: color-mix(in oklab, var(--accent) 12%, transparent); }
.practice__mark {
  display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--border-strong, var(--border)); color: #fff;
}
.practice__quest.is-current .practice__mark { border-color: var(--accent); }
.practice__quest.is-done .practice__mark { background: var(--accent); border-color: var(--accent); }
.practice__name { font-size: 13.5px; line-height: 1.35; }
.practice__quest.is-done .practice__name { color: var(--text-faint); }
.practice__quest.is-current .practice__name { font-weight: 600; }
.practice__hint { margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--text-soft); }
.practice__where { margin-top: 8px; }
.practice__stop { width: 100%; margin-top: 10px; }

@media (max-width: 820px) {
  .practice { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); width: auto;
              max-height: 58vh; }
  .practice.is-folded { left: 12px; right: auto; }
}
.tour__extra[hidden] { display: none; }
