/* ============================================
   IKIGAI — Чек-лист «Автопилот контент-фабрики»
   Движок и токены — от чек-листа Дней 2-3 (ikigai-content-factory-days23),
   ранги — от чек-листа покупки сервера (server-buy-checklist).
   Своё здесь: лестница уровней, смета сервисов, карточки маршрута.
   ============================================ */

:root {
  --white: #FFFFFF;
  --bg: #FFFFFF;
  --bg-alt: #F8F7FF;
  --bg-dark: #0F0D1A;
  --bg-dark-card: #1A1730;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --text-on-dark: #E5E7EB;
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --accent-light: #EDE9FE;
  --lime: #84CC16;
  --lime-light: #ECFCCB;
  --lime-dark: #4D7C0F;
  --amber: #F59E0B;
  --amber-light: #FEF3C7;
  --amber-dark: #92400E;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --danger-dark: #991B1B;
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-sm: 8px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-accent: 0 4px 24px rgba(124, 58, 237, 0.2);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.28s;

  --toc-width: 252px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ---------- Шапка ---------- */

.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner { max-width: 780px; margin: 0 auto; padding: 14px 20px; }
.header__top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.header__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header__logo { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; }
.header__title { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.header__sub { font-size: 12px; color: var(--text-light); }

.timer {
  background: var(--accent); color: #fff; border: 0;
  padding: 7px 16px; border-radius: 100px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.timer:hover { background: var(--accent-hover); transform: translateY(-1px); }
.timer.running { background: var(--danger); }
.timer:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* прогресс */
.progress { margin-top: 12px; }
.progress__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-muted); }
.progress__percent { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.progress__track { height: 6px; margin-top: 6px; border-radius: 100px; background: var(--border-light); overflow: hidden; }
.progress__fill { height: 100%; width: 0; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--lime)); transition: width var(--duration) var(--ease); }

/* ранг ведущего */
.rank {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 14px;
  background: linear-gradient(135deg, var(--bg-dark-card) 0%, #2D1B69 100%);
  border-radius: 12px;
}
.rank__icon { font-size: 22px; line-height: 1; }
.rank__info { flex: 1; min-width: 0; }
.rank__title { font-size: 13px; font-weight: 700; color: var(--text-on-dark); }
.rank__sub { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.rank__next { font-size: 11px; font-weight: 500; color: #C4B5FD; text-align: right; }

/* ---------- TOC ---------- */

/* Отступ считается от реальной высоты шапки: в ней три этажа (заголовок,
   прогресс, ранг), и при top:96px первая группа меню уезжала под неё. */
.toc {
  position: fixed; top: 198px; left: 20px; width: var(--toc-width);
  max-height: calc(100vh - 222px); overflow-y: auto;
  padding: 14px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.toc__title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-light); padding: 2px 8px 10px; }
.toc__group-label { font-size: 11px; font-weight: 700; color: var(--accent); padding: 12px 8px 6px; }
.toc__group:first-of-type .toc__group-label { padding-top: 2px; }
.toc__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  text-decoration: none; color: var(--text);
  border-left: 3px solid transparent;
  transition: background var(--duration) var(--ease);
}
.toc__link:hover { background: var(--bg-alt); }
.toc__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toc__link.active { background: var(--accent-light); border-left-color: var(--accent); }
.toc__num {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--border-light); color: var(--text-muted);
}
.toc__link.active .toc__num { background: var(--accent); color: #fff; }
.toc__link.complete .toc__num { background: var(--lime-light); color: var(--lime-dark); }
.toc__name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.3; }
.toc__count { flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-light); }
.toc__link.complete .toc__count { color: var(--lime-dark); }

@media (max-width: 1200px) { .toc { display: none; } }
@media (min-width: 1201px) { .wrap, .header__inner { margin-left: calc(var(--toc-width) + 56px); margin-right: 20px; } }

/* ---------- Разделители дней ---------- */

.day {
  margin: 32px 0 18px; padding: 18px 22px; border-radius: 14px;
  display: flex; align-items: center; gap: 14px;
}
.day--start { background: linear-gradient(135deg, #FFF7ED 0%, var(--lime-light) 100%); border: 1px solid var(--lime); }
.day--end { background: linear-gradient(135deg, #1F1B3A 0%, #2D1B69 100%); }
.day__icon { font-size: 34px; line-height: 1; }
.day__title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.day--end .day__title { color: var(--white); }
.day__sub { font-size: 13px; margin-top: 2px; }
.day--start .day__sub { color: var(--lime-dark); }
.day--end .day__sub { color: #C4B5FD; }

/* ---------- Блоки и шаги ---------- */

.block { margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.block__header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; cursor: pointer; user-select: none;
  background: var(--bg-alt);
  transition: background var(--duration) var(--ease);
}
.block__header:hover { background: var(--accent-light); }
.block__num {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}
.block__text { flex: 1; min-width: 0; }
.block__title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.block__time { font-size: 12px; color: var(--text-light); margin-top: 1px; }
.block__badge {
  flex-shrink: 0; padding: 4px 10px; border-radius: 100px;
  background: var(--border-light); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}
.block__badge.complete { background: var(--lime-light); color: var(--lime-dark); }
.block__body { display: none; padding: 6px 18px 18px; }
.block.open .block__body { display: block; }

.step { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--border-light); }
.step:first-child { border-top: 0; }
.step__check {
  width: 26px; height: 26px; flex-shrink: 0; margin-top: 2px;
  border: 2px solid var(--border); border-radius: 8px;
  background: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: transparent;
  transition: all var(--duration) var(--ease);
}
.step__check:hover { border-color: var(--accent); }
.step__check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.step__check.done { background: var(--lime); border-color: var(--lime); color: #fff; }
.step__check.done::after { content: '✓'; }
.step__body { flex: 1; min-width: 0; }
.step__title { font-size: 15px; font-weight: 700; }
.step.completed .step__title { color: var(--text-muted); text-decoration: line-through; }
.step__text { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.step__text strong { color: var(--text); }
.step__text ul { margin: 6px 0 0 18px; }
.step__text li { margin-bottom: 3px; }
.step__optional { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 100px; background: var(--accent-light); color: var(--accent); font-size: 11px; font-weight: 700; vertical-align: middle; }

/* зачем этот шаг вообще нужен — самая частая потеря в чек-листах */
.say {
  margin-top: 10px; padding: 10px 14px;
  background: var(--accent-light); border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  font-size: 13px; line-height: 1.55; color: #5B21B6;
}
.say::before { content: 'Зачем: '; font-weight: 700; }

/* грабля / предупреждение */
.warn {
  margin-top: 10px; padding: 10px 14px;
  background: var(--amber-light); border-left: 3px solid var(--amber);
  border-radius: 0 12px 12px 0;
  font-size: 13px; line-height: 1.55; color: var(--amber-dark);
}
.warn::before { content: '⚠ '; font-weight: 700; }
.warn--hard { background: var(--danger-light); border-left-color: var(--danger); color: var(--danger-dark); }

/* команда с копированием */
.cmd { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-dark); }
.cmd__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--bg-dark-card); }
.cmd__label { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-light); letter-spacing: 0.04em; }
.cmd__copy {
  border: 0; padding: 5px 12px; border-radius: 100px;
  background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.cmd__copy:hover { background: var(--accent-hover); }
.cmd__copy:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.cmd__copy.copied { background: var(--lime); }
.cmd__code {
  display: block; padding: 12px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
  color: #C4B5FD; white-space: pre-wrap; word-break: break-word;
}
/* что произойдёт после вставки промпта — иначе человек копирует вслепую */
.cmd__after {
  margin-top: 8px; padding-left: 12px;
  border-left: 2px solid var(--border);
  font-size: 13px; line-height: 1.55; color: var(--text-muted);
}
.cmd__after b { color: var(--text); }
.cmd__after::before { content: '→ '; color: var(--accent); font-weight: 700; }

/* справочник — НЕ промпт: копировать нечего, это словарь для чтения */
.ref { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-alt); }
.ref__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 9px 14px; background: var(--accent-light); border-bottom: 1px solid var(--border);
}
.ref__label { font-size: 13px; font-weight: 700; color: var(--accent-hover); }
.ref__hint { font-size: 11px; color: var(--text-muted); }
.ref__body { padding: 12px 14px; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.ref__body table { width: 100%; border-collapse: collapse; }
.ref__body th, .ref__body td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-light); }
.ref__body th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); font-weight: 700; }
.ref__body td:first-child { font-weight: 600; white-space: nowrap; }
.ref__body code { font-family: var(--font-mono); font-size: 12px; background: var(--accent-light); padding: 1px 5px; border-radius: 4px; color: var(--accent-hover); }
.ref__group { margin-top: 10px; }
.ref__group:first-child { margin-top: 0; }
.ref__group-name { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--accent); text-transform: uppercase; }
.ref__group ul { margin: 4px 0 0 0; padding-left: 0; list-style: none; }
.ref__group li { padding: 2px 0; }
.ref__group li b { font-weight: 700; }
.ref__scroll { overflow-x: auto; }

/* ---------- Часть, которая откроется позже ----------
   Не «замок» с недоступным содержимым, а честный анонс: обещанное приезжает
   по той же ссылке, искать вторую страницу не нужно. Пунктирная рамка отличает
   его от обычных блоков — видно, что это не то, что делают сегодня. */

.locked {
  margin: 22px 0 4px; padding: 22px;
  border: 2px dashed rgba(124, 58, 237, .35); border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(124, 58, 237, .06) 0%, rgba(45, 27, 105, .06) 100%);
  text-align: center;
}
.locked__icon { font-size: 34px; }
.locked__title { margin-top: 6px; font-size: 18px; font-weight: 800; color: var(--text); }
.locked__text { margin: 8px auto 0; max-width: 620px; font-size: 14px; line-height: 1.6; color: var(--text-muted); text-align: left; }

/* ---------- Лестница уровней ----------
   Четыре ступени автоматизации на одном экране. Смысл картинки в том, что
   ступени не равны по цене: первые две бесплатны и работают сразу, четвёртая
   требует сервера и второго кошелька. Кто этого не видит — покупает сервер
   на первой неделе и не понимает, зачем. */

.tiers { display: grid; gap: 10px; margin-top: 12px; }
.tier {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--white);
}
.tier--now { border-color: var(--lime); background: linear-gradient(135deg, #FBFEF5 0%, var(--lime-light) 100%); }
.tier--paid { border-color: var(--amber); background: var(--amber-light); }
.tier__num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}
.tier--now .tier__num { background: var(--lime-dark); }
.tier--paid .tier__num { background: var(--amber-dark); }
.tier__body { flex: 1; min-width: 0; }
.tier__title { font-size: 14.5px; font-weight: 700; }
.tier__text { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.tier__cost {
  display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 100px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--border-light); color: var(--text-muted);
}
.tier--now .tier__cost { background: var(--lime); color: #fff; }
.tier--paid .tier__cost { background: var(--amber-dark); color: #fff; }

/* ---------- Ссылки на соседние чек-листы ---------- */

.route { display: grid; gap: 10px; margin-top: 12px; }
.route__card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--white);
  text-decoration: none; color: inherit;
  transition: border-color var(--duration) var(--ease), transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.route__card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.route__card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.route__icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.route__name { font-size: 14.5px; font-weight: 700; }
.route__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.route__arrow { margin-left: auto; color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ---------- Смета ----------
   Цена и обязательность — два разных вопроса, и путать их дорого. Колонка
   «обязателен» здесь важнее колонки с суммой. */

.price { margin-top: 12px; overflow-x: auto; }
.price table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.price th, .price td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-light); }
.price th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); font-weight: 700; }
.price td:first-child { font-weight: 700; white-space: nowrap; }
.price .tag {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.price .tag--must { background: var(--danger-light); color: var(--danger-dark); }
.price .tag--auto { background: var(--accent-light); color: var(--accent-hover); }
.price .tag--opt  { background: var(--border-light); color: var(--text-muted); }

/* ---------- Схемы ---------- */

.scheme { margin: 18px 0; }
.scheme img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-dark);
}
.scheme figcaption {
  margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--text-muted);
}

/* ---------- Финал ---------- */

.done-card {
  display: none; margin: 28px 0;
  padding: 26px; border-radius: var(--radius-xl); text-align: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #2D1B69 100%);
}
.done-card.visible { display: block; }
.done-card__icon { font-size: 42px; }
.done-card__title { margin-top: 8px; font-size: 20px; font-weight: 800; color: var(--white); }
.done-card__sub { margin-top: 6px; font-size: 14px; color: #C4B5FD; }

.footer { margin: 32px 0 60px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.footer__count { font-size: 13px; color: var(--text-muted); }
.footer__count strong { font-family: var(--font-mono); color: var(--text); }
.footer__reset { border: 1px solid var(--border); background: var(--white); color: var(--text-muted); padding: 7px 14px; border-radius: 100px; font-size: 13px; cursor: pointer; }
.footer__reset:hover { border-color: var(--danger); color: var(--danger); }

@media (max-width: 640px) {
  .header__sub { display: none; }
  .block__header { padding: 14px; gap: 10px; }
  .step { gap: 10px; }
  .day { flex-direction: column; align-items: flex-start; text-align: left; }
}
