/* ============================================
   IKIGAI — Сценарий Дней 2-3 «Контент-фабрика»
   Токены — от чек-листа Дня 1 (ikigai-content-factory-prep),
   приёмы ведущего (реплики, тайминги, ранги, TOC) — от checklist-zoom.
   ============================================ */

: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; font-style: italic;
}
.say::before { content: 'Сказать: '; font-weight: 700; font-style: normal; }

/* грабля / предупреждение */
.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;
}

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

.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; }
}
