:root {
  --bg: #F6F4F0;
  --card: #FFFFFF;
  --ink: #15233E;
  --muted: #4D5C71;
  --line: #DAE0E7;
  --blue: #345BBE;
  --violet: #7439A0;
  --earth: #08746F;
  --soft: #EAF0FF;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.4; }

.site-header { padding: 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.site-header h1 { margin: 0 0 12px; font-size: 1.35rem; color: var(--blue); letter-spacing: 0.02em; }

.date-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-form label { font-weight: 600; flex: 0 0 auto; }
.date-form input[type="text"] { flex: 1 1 160px; min-width: 140px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; background: var(--bg); color: var(--ink); }
.date-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.date-form button { flex: 0 0 auto; padding: 10px 18px; background: var(--blue); color: #fff;
  border: 0; border-radius: 10px; font-size: 1rem; cursor: pointer; }
.date-form button:active { transform: translateY(1px); }
.hint { flex: 1 0 100%; margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.hint.error { color: #B5341E; }

.sections-nav { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.section-tab { white-space: nowrap; padding: 8px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  color: var(--ink); font-size: 0.95rem; }
.section-tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.dev-token-form[hidden] { display: none !important; }
.dev-token-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line);
  border-radius: 12px; background: var(--bg); }
.dev-token-form label { font-weight: 600; font-size: 0.95rem; }
.dev-token-form input[type="password"] { flex: 1 1 180px; min-width: 140px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.95rem; background: var(--card); color: var(--ink); }
.dev-token-form button { padding: 9px 14px; border: 0; background: var(--muted);
  color: #fff; border-radius: 10px; font-size: 0.95rem; cursor: pointer; }

.action-status { align-self: center; color: var(--muted); font-size: 0.9rem; }

.free-cta { display: inline-block; margin: 0 0 12px; padding: 6px 12px;
  background: var(--soft); color: var(--blue); border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; }

.reveal { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }

.content { padding: 16px; display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.card > p { margin: 0 0 12px; color: var(--muted); }
.card img { display: block; width: 100%; height: auto; border-radius: 12px;
  margin-bottom: 12px; background: var(--bg); min-height: 60px; }
.card img.loading { outline: 2px dashed var(--line); outline-offset: -2px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.actions a, .actions button { padding: 10px 14px; background: var(--violet); color: #fff;
  text-decoration: none; border: 0; border-radius: 10px; font-size: 1rem;
  cursor: pointer; display: inline-block; }
.actions a:active { transform: translateY(1px); }
.actions a.disabled { background: var(--muted); pointer-events: none; opacity: 0.85; }
.actions .dev-badge { align-self: center; padding: 4px 8px; font-size: 0.85rem;
  background: var(--soft); color: var(--blue); border-radius: 999px; }

.input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.input-row input, .input-row select { flex: 1 1 160px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 1rem;
  background: var(--bg); color: var(--ink); }
.input-row .pair-label { flex: 0 0 100%; font-weight: 600; margin-top: 4px;
  color: var(--muted); font-size: 0.9rem; }

.pair-calc { margin-top: 16px; }
.pair-table { width: 100%; border-collapse: collapse; margin: 12px 0;
  font-size: 0.95rem; }
.pair-table th, .pair-table td { border: 1px solid var(--line);
  padding: 6px 8px; text-align: center; }
.pair-table th { background: var(--bg); color: var(--muted); font-weight: 600; }
.pair-table tr:first-child th { background: var(--card); color: var(--ink); }
.pair-table tr:first-child th:first-child { background: var(--card); }
.pair-table td:first-child { text-align: left; }
.pair-cross { margin: 6px 0; color: var(--muted); }
.pair-energy { font-weight: 700; color: var(--violet); margin: 4px 0 0; }

.pair-rhombus-wrap { margin: 16px 0 20px; }
.pair-rhombus-title { margin: 0 0 8px; font-size: 1.05rem; color: var(--ink); }
.pair-rhombus { display: block; width: 100%; max-width: 420px;
  height: auto; margin: 0 auto; }
.pair-rhombus-caption { margin: 8px 0 2px; color: var(--muted);
  text-align: center; font-size: 0.95rem; }
.pair-rhombus-energy { margin: 2px 0 0; text-align: center;
  color: var(--violet); font-weight: 700; font-size: 1.05rem; }

.soul-numbers-slot { margin: 16px 0 12px; }
.soul-numbers-wrap { margin: 0; }
.soul-numbers-title { margin: 0 0 8px; font-size: 1.05rem; color: var(--ink); }
.soul-numbers { display: block; width: 100%; max-width: 420px;
  height: auto; margin: 0 auto; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px; }

.job-numbers-slot { margin: 16px 0 12px; }
.job-numbers-wrap { margin: 0; }
.job-numbers-title { margin: 0 0 8px; font-size: 1.05rem; color: var(--ink); }
.job-numbers-image { display: block; width: 100%; max-width: 100%;
  height: auto; margin: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg); }

/* Канал материализации желаний: схема тора (бабочка) + ловушка паутины. */
.channel-slot { margin: 12px 0 8px; }
.channel-wrap { margin: 0; }
.channel-title { margin: 0 0 10px; font-size: 1.05rem; color: var(--ink); }
.channel-scheme { display: block; width: 100%; max-width: 360px;
  height: auto; margin: 0 auto; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px; }

.pair-reading-slot { margin-top: 20px; }
.pair-reading { margin: 0; padding: 16px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; }
.pair-reading-title { margin: 0; font-size: 1.1rem; color: var(--ink); }
.pair-reading-subtitle { margin: 2px 0 14px; color: var(--muted);
  font-weight: 600; }
.pair-reading-section { margin: 18px 0 6px; font-size: 1.02rem;
  color: var(--blue); }
.pair-reading-subsection { margin: 12px 0 4px; font-size: 0.98rem;
  color: var(--violet); font-weight: 600; }
.pair-reading-body { margin: 6px 0; color: var(--ink);
  line-height: 1.5; }
.input-row input:focus, .input-row select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

.placeholder { color: var(--muted); font-style: italic; }
.error-row { color: #B5341E; margin: 0 0 12px; }

.site-footer { padding: 16px; text-align: center; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 480px) {
  .site-header h1 { font-size: 1.15rem; }
  .date-form label { flex: 1 0 100%; }
  .date-form button { flex: 1 1 auto; }
  .card h2 { font-size: 1.05rem; }
}

/* На мобильном раскладываем разделы столбиком — чтобы не приходилось
   листать пальцем горизонтально. На широких экранах остаётся прежний
   горизонтальный ряд со скроллом. */
@media (max-width: 640px) {
  .sections-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: visible;
    gap: 6px;
    padding: 10px 12px;
  }
  .section-tab {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    white-space: normal;
  }
}

/* --- Платёжные действия и модалки ------------------------------------ */
.paid-actions { margin-top: 16px; }
.paid-actions .actions { margin-top: 0; }
.paid-actions .note { margin: 6px 0 0; font-size: 0.85rem; }
.paid-actions .ok { color: #1E6B2A; font-weight: 600; margin: 0 0 8px; }
.paid-actions .buy-btn { font-weight: 600; }

.restore-link { color: var(--muted); font-size: 0.85rem;
                border-bottom: 1px dotted var(--muted); text-decoration: none; }
.restore-link:hover { color: #192942; border-bottom-color: #192942; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(21, 35, 62, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.modal {
  background: white; border-radius: 12px; padding: 20px 22px;
  max-width: 420px; width: 100%;
  max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: 0 10px 30px rgba(21, 35, 62, 0.25);
}
.modal h3 { margin: 0 0 10px; font-size: 1.1rem; }
.modal label { display: block; margin: 10px 0 4px; font-weight: 600;
               font-size: 0.9rem; }
.modal input[type=email], .modal input[type=password] {
  width: 100%; box-sizing: border-box; padding: 9px 10px;
  border: 1px solid #C3CDDA; border-radius: 6px; font-size: 1rem;
}
.modal .actions { margin-top: 14px; display: flex; gap: 8px; }
.modal .actions button.secondary {
  background: transparent; color: #192942; border: 1px solid #C3CDDA;
}
.modal .action-status { margin-top: 10px; min-height: 1em; color: var(--muted); }

/* --- Вводный видеоблок ----------------------------------------------- */
.intro-video {
  max-width: 720px; margin: 14px auto 26px; padding: 0 16px;
  text-align: center;
}
.intro-video-title {
  margin: 0 0 12px; font-size: 1.1rem; font-weight: 600;
  color: #192942; letter-spacing: 0.01em;
}
/* Адаптивная «рамка» 16:9: сохраняет пропорции на любом экране, не
   даёт видео растянуться и ломает вёрстку. На мобильных — на всю
   ширину (минус 16px отступов из родителя), на десктопе — до 720px. */
.intro-video-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #000; border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(21, 35, 62, 0.15);
}
.intro-video-frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}
.intro-video-actions { margin: 14px 0 0; }
.intro-skip {
  display: inline-block; padding: 8px 18px;
  border: 1px solid #192942; border-radius: 6px;
  color: #192942; text-decoration: none; font-weight: 600;
  background: transparent; font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.intro-skip:hover { background: #192942; color: white; }
html { scroll-behavior: smooth; }

/* --- Вход с безлимитом (внизу страницы, под промо-блоком курса) ------ */
.login-slot {
  display: block; text-align: center;
  margin: 18px auto 6px; padding: 0 16px;
  font-size: 0.85rem; color: var(--muted, #6B7A8C);
}
.login-link {
  color: var(--muted, #6B7A8C); text-decoration: none;
  border-bottom: 1px dotted var(--muted, #6B7A8C);
}
.login-link:hover { color: #192942; border-bottom-color: #192942; }
.login-info { font-size: 0.85rem; }
.logout-link {
  color: var(--muted, #6B7A8C); border-bottom: 1px dotted var(--muted, #6B7A8C);
  text-decoration: none;
}
.logout-link:hover { color: #192942; border-bottom-color: #192942; }

/* --- Промо курса под расчётами --------------------------------------- */
.course-promo {
  max-width: 720px; margin: 24px auto 8px; padding: 18px 20px;
  background: #F6F9FC; border: 1px solid #DDE6EE; border-radius: 12px;
  text-align: center;
}
.course-promo p {
  margin: 0 0 12px; font-size: 1rem; color: #192942;
}
.course-promo-btn {
  display: inline-block; padding: .6em 1.2em;
  background: #192942; color: #fff;
  border-radius: 6px; text-decoration: none; font-weight: 600;
}
.course-promo-btn:hover { background: #2a3b5a; }
