/* 52 Карты судьбы — Design System (light theme, Golos Text).
   Source of truth: /tmp/design_pack/52-design-system/project/ui_kits/telegram-mini-app/tokens.css */

@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

:root {
  --font-sans: "Golos Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;

  --bg: #FBFBFC;
  --bg-soft: #F6F6F8;
  --panel: #F2F2F4;
  --card: #FFFFFF;
  --hairline: #E6E6EA;
  --divider: #ECECEF;

  --fg-1: #0E0E10;
  --fg-2: #5C5C63;
  --fg-3: #8A8A92;
  --fg-4: #B6B6BD;

  --suit-red: #E04E45;
  --accent-red: #E04E45;
  --selected: #2C81F2;
  --accent: #2C81F2;
  --accent-soft: rgba(44, 129, 242, 0.08);

  --error-bg: rgba(224, 78, 69, 0.12);
  --error-fg: #E04E45;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(14, 14, 16, 0.04);
  --shadow-md: 0 2px 8px rgba(14, 14, 16, 0.06), 0 1px 2px rgba(14, 14, 16, 0.04);
  --shadow-lg: 0 8px 24px rgba(14, 14, 16, 0.08), 0 2px 6px rgba(14, 14, 16, 0.04);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  --container-max: 480px;
  --page-pad-x: 20px;
  --page-pad-y: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  word-break: normal;
}

#app { min-height: 100vh; max-width: var(--container-max); margin: 0 auto; padding: var(--page-pad-y) var(--page-pad-x); }

.screen { animation: fadein 180ms ease-out both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Type ===== */
h1, h1.t-h1 { font-size: 22px; line-height: 28px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.005em; color: var(--fg-1); }
.t-display { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg-1); margin: 0; }
.t-lead, .lead { color: var(--fg-3); margin: 0 0 28px; font-size: 14px; }
.t-card-name, .card-name {
  font-size: 19px; line-height: 24px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--fg-1);
  overflow-wrap: break-word;
}
.t-subtitle { font-size: 17px; line-height: 24px; font-weight: 500; color: var(--fg-1); margin: 0 0 8px; text-wrap: pretty; }
.t-user { font-size: 17px; line-height: 22px; font-weight: 500; color: var(--fg-1); }
.t-body { font-size: 16px; line-height: 24px; color: var(--fg-1); margin: 0; white-space: pre-line; text-wrap: pretty; overflow-wrap: break-word; }
.t-sub { font-size: 13px; line-height: 18px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.t-label { font-size: 12px; line-height: 14px; font-weight: 500; letter-spacing: 0.08em; color: var(--fg-3); text-transform: uppercase; }
.t-planet { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: 0.06em; color: var(--fg-3); text-transform: uppercase; }
.t-date { font-size: 11px; line-height: 1.3; color: var(--fg-3); font-variant-numeric: tabular-nums; text-align: center; }

/* ===== User header (profile switcher) ===== */
.user-header {
  position: relative;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}
.user-header .profile-trigger { padding: 4px 0; min-height: 40px; }
.profile-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.profile-info {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.profile-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--fg-2);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  transition: transform 220ms var(--ease-out), background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.profile-trigger:hover .profile-chevron { background: var(--hairline); }
.user-header.open .profile-chevron {
  transform: rotate(180deg);
}
.profile-menu {
  position: absolute;
  top: calc(100% - 8px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
  animation: slidein 220ms var(--ease-out) both;
}
.profile-menu-item {
  width: 100%;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--fg-1);
  transition: background 0.1s;
}
.profile-menu-item:hover { background: var(--panel); }
.profile-menu-item.active { background: var(--panel); }
.profile-menu-item .pm-name { font-size: 15px; font-weight: 500; }
.profile-menu-item .pm-birth { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.profile-menu-item .pm-edit {
  font-size: 13px; color: var(--fg-3);
  background: transparent; border: none;
  cursor: pointer;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-menu-item .pm-edit:hover { color: var(--fg-1); }
.profile-menu-item .pm-delete {
  font-size: 11px; color: var(--fg-3);
  background: transparent; border: none;
  cursor: pointer;
  width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-menu-item .pm-delete-placeholder {
  /* Невидимый плейсхолдер той же ширины — чтобы мини-чипы у self были выровнены с остальными */
  cursor: default;
  pointer-events: none;
}
.profile-menu-item .pm-row { display: flex; align-items: center; gap: 8px; }
.profile-menu-item .pm-row .pm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-mini-cards { display: inline-flex; gap: 4px; flex-shrink: 0; }
.mini-card {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 5px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--card);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--fg-1);
}
.mini-card.red { color: var(--suit-red); }
.mini-card .mc-rank { font-size: 11px; }
.mini-card .mc-suit { font-size: 11px; }
.profile-menu-item.active .pm-name::after {
  content: "  ✓"; color: var(--fg-3); font-weight: 400;
}
.profile-add {
  margin-top: 6px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px dashed var(--hairline);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--fg-2);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.profile-add:hover { background: var(--panel); color: var(--fg-1); border-color: var(--fg-3); }

/* ===== Section panel ===== */
.section {
  background: var(--panel);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.section-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; line-height: 14px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 16px;
}
.section-label .emoji { font-size: 16px; }

.card-row {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* ===== Card chip (playing-card glyph) ===== */
.card-chip {
  flex-shrink: 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FCFCFD 100%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  display: flex; flex-direction: row;
  align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
  color: var(--fg-1);
  box-shadow: var(--shadow-md);
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.card-chip.red { color: var(--suit-red); }
.card-chip.lg { width: 80px; height: 88px; gap: 3px; border-radius: 16px; }
.card-chip.lg .rank { font-size: 28px; font-weight: 600; line-height: 1; }
.card-chip.lg .suit { font-size: 28px; line-height: 1; }
.card-chip.md { width: 68px; height: 76px; gap: 2px; }
.card-chip.md .rank { font-size: 22px; font-weight: 500; line-height: 1; }
.card-chip.md .suit { font-size: 22px; line-height: 1; }
.card-chip.sm { width: 52px; height: 56px; gap: 2px; }
.card-chip.sm .rank { font-size: 18px; font-weight: 500; line-height: 1; }
.card-chip.sm .suit { font-size: 18px; line-height: 1; }

/* ===== Section collapsible (вся секция сворачивается, КР+КПУ) ===== */
.section-collapsible {
  /* Наследует стили .section */
}
.section-collapsible > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0; /* в свёрнутом — нет отступа снизу */
  min-height: 36px;
}
.section-collapsible > summary::-webkit-details-marker { display: none; }
.section-collapsible[open] > summary { margin-bottom: 16px; }
/* Заголовок секции — точно тот же стиль, что и .section-label */
.section-collapsible .section-title {
  font-size: 12px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  flex: 1;
  min-width: 0;
}
.section-collapsible .section-mini-card { display: inline-flex; gap: 8px; flex-shrink: 0; }
/* Мини-чип в шапке КР/КПУ — в стиле карт из «Периодов года» (без рамки, крупно) */
.section-mini-card .mini-card {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  gap: 1px;
}
.section-mini-card .mini-card .mc-rank,
.section-mini-card .mini-card .mc-suit { font-size: 18px; }
/* Универсальный крупный chevron — применяется ко всем раскрывашкам */
.section-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--fg-2);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  transition: transform 220ms var(--ease-out), background 0.15s, color 0.15s;
  flex-shrink: 0;
}
/* Прицеливаемся ТОЛЬКО на chevron прямого summary,
   чтобы не задевать вложенные details (жизненный набор и др.). */
.section-collapsible > summary > .section-chevron { background: var(--card); }
.section-collapsible:hover > summary > .section-chevron { background: var(--hairline); }
.section-collapsible[open] > summary > .section-chevron {
  transform: rotate(180deg);
}
/* В развёрнутом виде мини-чип в шапке скрываем, чтобы не дублировать большую иконку */
.section-collapsible[open] .section-mini-card { display: none; }
/* Плавное появление содержимого секции при открытии */
.section-collapsible[open] > summary ~ * {
  animation: slidein 220ms var(--ease-out) both;
}
@keyframes slidein {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* Подзаголовок и разделитель внутри объединённой секции «Карта рождения + КПУ» */
.subsection-label {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}
.subsection-divider {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--hairline) 18%, var(--hairline) 82%, transparent 100%);
  margin: 22px 0;
}

/* Внутренний "Что это за раздел?" — мелкая ссылка-аккордеон */
.inline-explainer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--hairline);
}
.inline-explainer > summary {
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.inline-explainer > summary::-webkit-details-marker { display: none; }
.inline-explainer:hover > summary { color: var(--fg-1); }

/* ===== Section explainer (раскрывашка в заголовке раздела) ===== */
.section-explainer {
  margin-bottom: 14px;
}
.section-explainer > summary.section-label {
  list-style: none;
  cursor: pointer;
  user-select: none;
  /* Иконка ? уезжает в конец строки */
  justify-content: flex-start;
  position: relative;
  padding-right: 28px;  /* место под ? */
}
.section-explainer > summary.section-label::-webkit-details-marker { display: none; }
.section-explainer .explainer-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--fg-3);
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.section-explainer:hover .explainer-icon {
  color: var(--fg-1);
  border-color: var(--fg-1);
}
.section-explainer[open] .explainer-icon {
  background: var(--fg-1);
  color: #fff;
  border-color: var(--fg-1);
}
.explainer-body {
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--fg-2);
  line-height: 22px;
}

/* ===== KPU divider — отделяет блок «по КР» от «по КПУ» ===== */
.kpu-divider {
  position: relative; text-align: center;
  margin: 32px 0 16px;
}
.kpu-divider::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--hairline);
}
.kpu-divider-label {
  position: relative;
  display: inline-block;
  padding: 0 12px;
  background: var(--bg);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3);
}
.kpu-divider-info {
  position: relative;
  margin-left: 4px;
  background: var(--bg);
}
.info-popover ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}
.info-popover li { margin: 2px 0; }
.info-popover p { margin: 6px 0; }
.info-popover p:first-child { margin-top: 0; }
.info-popover p:last-child { margin-bottom: 0; }

/* «О картах судьбы»: список с эмодзи без буллетов */
.info-popover ul.about-list {
  list-style: none;
  margin: 6px 0 8px;
  padding: 0;
}
.info-popover ul.about-list li {
  margin: 4px 0;
  padding-left: 0;
}

/* Разделитель между блоками текста «О картах судьбы» */
.info-popover .about-divider {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

/* Масти с символом и описанием */
.info-popover ul.about-suits li {
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-popover .suit-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-popover .suit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  color: var(--fg-1);
}
.info-popover .suit-icon.red { color: #c0392b; }
.info-popover .suit-desc {
  display: block;
  color: var(--fg-2);
  font-size: 12.5px;
  margin-left: 26px;
  line-height: 1.4;
}

/* Номиналы — компактная двухколонная сетка */
.info-popover ul.about-ranks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 2px;
  margin: 6px 0 8px;
}
.info-popover ul.about-ranks li { margin: 2px 0; }

/* Пример */
.info-popover .about-example {
  margin-top: 10px;
}

/* ===== Age bar (внутри развёрнутой секции «Карта года») ===== */
.age-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.age-bar-label {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

/* ===== Age selector в section-label ===== */
.age-selector {
  margin-left: auto;
  background: var(--card);
  border: 1px solid var(--hairline);
  color: var(--fg-1);
  border-radius: var(--r-pill);
  padding: 6px 14px 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s;
}
.age-selector:hover { border-color: var(--fg-2); background: var(--bg); }

/* ===== Planet summary (общее описание планеты периода) ===== */
.planet-summary {
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin: 0 0 14px;
}
.planet-summary-label {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.planet-summary .t-body {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 22px;
}

/* ===== Hidden task (sub-row under main card) ===== */
.hidden-task {
  display: flex; align-items: center; gap: 14px;
  margin-top: 16px; padding: 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.hidden-task .ht-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hidden-task .ht-label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: var(--fg-3); text-transform: uppercase; }
.hidden-task .ht-name {
  font-size: 15px; line-height: 20px; font-weight: 500; color: var(--fg-1);
  overflow-wrap: break-word;
}

/* ===== Year matrix — компактный список строк (1 период = 1 строка) ===== */
.year-grid {
  display: flex; flex-direction: column;
  gap: 0;
}
.cell {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  padding: 12px 8px;
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 120ms var(--ease-out), padding 120ms var(--ease-out);
  font-family: inherit;
  text-align: left;
  width: 100%;
  position: relative;
}
.cell:first-child { padding-top: 6px; }
.cell:last-child { border-bottom: none; padding-bottom: 6px; }
.cell:hover { background: var(--card); }
.cell:active { background: var(--card); }
.cell.selected {
  background: var(--card);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-sm);
  border-bottom-color: transparent;
  padding-left: 12px;
  padding-right: 12px;
}
.cell.selected + .cell { border-top: 1px solid var(--hairline); }
.cell.selected .planet { color: var(--accent); }
.cell .planet {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--fg-3); text-transform: uppercase;
  text-align: left;
}
.cell .cell-cards {
  display: flex; align-items: baseline; justify-content: flex-start;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.cell .cell-card {
  display: inline-flex; align-items: baseline; gap: 1px;
  font-size: 18px; font-weight: 500; line-height: 1;
  color: var(--fg-1);
}
.cell .cell-card.red { color: var(--suit-red); }
.cell .cell-card-extra {
  font-size: 13px;
  opacity: 0.65;
}
.cell .dates {
  font-size: 11px; line-height: 1.3; color: var(--fg-3);
  font-variant-numeric: tabular-nums; text-align: right;
  white-space: nowrap;
}

/* ===== Pluto row ===== */
.pluto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pluto-cell {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.pluto-cell .name { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: var(--fg-3); text-transform: uppercase; }
.pluto-cell .rank-row { display: flex; align-items: center; gap: 2px; font-size: 22px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; color: var(--fg-1); }
.pluto-cell.red .rank-row { color: var(--suit-red); }

.pluto-descriptions { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.pluto-descriptions .pluto-block-label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: var(--fg-3); text-transform: uppercase; margin-bottom: 4px; }

/* ===== Referral ===== */
.referral-lead {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0 auto 12px;
  text-align: center;
  max-width: 340px;
  white-space: normal;
  text-wrap: pretty;
}
.referral-free-wrap {
  text-align: center;
  margin: 0 0 4px;
}
.referral-free {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.referral-stats {
  display: flex;
  justify-content: center;
  margin: 20px 0 16px;
}
.referral-count {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.referral-count-num {
  font-size: 36px; font-weight: 600; line-height: 1;
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}
.referral-count-label {
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3);
}
.referral-link {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--fg-2);
  word-break: break-all;
  text-align: center;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.referral-actions {
  display: flex; flex-direction: column; gap: 8px;
}
.referral-actions .btn-ghost { width: 100%; }
.referral-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--fg-1);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  animation: fadein 180ms ease-out both;
}

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  border-radius: var(--r-md);
  padding: 14px 20px;
  transition: opacity 0.15s, transform 0.05s, background 0.15s, box-shadow 0.15s;
  background: transparent;
  color: inherit;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  width: 100%;
  background: var(--fg-1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 14, 16, 0.18), 0 1px 2px rgba(14, 14, 16, 0.08);
}
.btn-primary:hover { background: #1c1c20; box-shadow: 0 6px 18px rgba(14, 14, 16, 0.22), 0 1px 2px rgba(14, 14, 16, 0.08); }
.btn-primary:active { box-shadow: 0 2px 6px rgba(14, 14, 16, 0.14); }
.btn-ghost {
  background: var(--card);
  color: var(--fg-1);
  border: 1px solid var(--hairline);
  padding: 12px 24px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--panel); border-color: var(--fg-3); }

.actions { margin-top: 24px; display: flex; justify-content: center; padding-bottom: 24px; }

/* ===== Form ===== */
.field { display: block; margin-bottom: 20px; }
.field-label { display: block; font-size: 13px; color: var(--fg-3); margin-bottom: 8px; font-weight: 500; }
.field input {
  width: 100%;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--fg-1);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.field input:hover { border-color: var(--fg-3); }
.field input:focus { border-color: var(--fg-1); background: var(--bg); box-shadow: 0 0 0 3px rgba(14, 14, 16, 0.08); }
.privacy { color: var(--fg-3); font-size: 12px; line-height: 1.5; margin: 0 0 20px; }
.form-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--error-bg);
  color: var(--error-fg);
  border-radius: var(--r-sm);
  font-size: 13px;
}

/* ===== Zodiac choice (для пограничных дат) ===== */
.zodiac-choice {
  margin-bottom: 20px;
  padding: 14px;
  background: var(--panel);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
}
.zodiac-choice-label {
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 10px;
  line-height: 1.4;
}
.zodiac-choice-buttons {
  display: flex;
  gap: 8px;
}
.zodiac-option {
  flex: 1;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--hairline);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.zodiac-option:hover { border-color: var(--fg-3); }
.zodiac-option.active {
  border-color: var(--fg-1);
  background: var(--fg-1);
  color: #fff;
}

/* ===== Loading ===== */
.loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 80px 0; color: var(--fg-3); }
.loading p { font-size: 14px; }
.spinner { width: 36px; height: 36px; border: 2px solid var(--hairline); border-top-color: var(--fg-1); border-radius: 50%; animation: spin 700ms cubic-bezier(0.45, 0, 0.55, 1) infinite; }

/* ===== Error screen ===== */
#screen-error h1 { color: var(--error-fg); }
#screen-error p { color: var(--fg-3); margin: 12px 0 20px; }

/* ===== Жизненный набор (12 ролей) ===== */
.life-spread-section { margin-top: 16px; }
.life-spread-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-height: 36px;
}
.life-spread-summary::-webkit-details-marker { display: none; }
.life-spread-summary .section-chevron {
  margin-left: auto;
}
.life-spread-section[open] .life-spread-summary > .section-chevron {
  transform: rotate(180deg);
}
.life-spread-section:hover .life-spread-summary > .section-chevron {
  background: var(--hairline);
}
.life-spread-lead {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0 16px;
  white-space: normal;
  text-align: left;
}
.life-spread-list { display: flex; flex-direction: column; gap: 6px; }

.life-row {
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--bg);
  overflow: hidden;
}
.life-row[open] { background: var(--bg-soft, #fafafa); }
.life-row-summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: 22px 1fr auto 28px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 14px;
  min-height: 44px;
}
.life-row-summary::-webkit-details-marker { display: none; }
.life-row-summary .section-chevron {
  width: 24px;
  height: 24px;
  font-size: 13px;
  background: transparent;
}
.life-row[open] > .life-row-summary > .section-chevron {
  transform: rotate(180deg);
}
.life-row:hover > .life-row-summary > .section-chevron {
  background: var(--panel);
}
.life-glyph { font-size: 16px; text-align: center; color: var(--fg-2); }
.life-role { font-weight: 500; color: var(--fg-1); }
.life-card {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-weight: 600;
  font-size: 15px;
  color: var(--fg-1);
}
.life-card.red { color: var(--accent-red, #c33); }
.life-card .lc-rank { font-weight: 700; }
.life-card .lc-suit { font-size: 14px; }

.life-row-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--hairline);
}
.life-role-summary { color: var(--fg-3); font-size: 12px; margin: 10px 0 6px; font-style: italic; }
.life-description { color: var(--fg-1); font-size: 14px; margin: 0; line-height: 1.5; }

/* ===== Inline info-button («?» рядом с подзаголовком) ===== */
.subsection-label { display: inline-flex; align-items: center; gap: 8px; }
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg-3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.05s;
}
.info-btn:hover { border-color: var(--fg-2); color: var(--fg-1); background: var(--card); }
.info-btn:active { transform: scale(0.95); }
.info-btn.active {
  background: var(--fg-1);
  border-color: var(--fg-1);
  color: #fff;
}
.info-popover {
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

/* ===== Расширенный портрет Солнца внутри Жизненного набора ===== */
.life-full {
  margin-top: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg);
}
.life-full[open] { background: var(--bg-soft, #fafafa); }
.life-full-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  min-height: 44px;
}
.life-full-summary::-webkit-details-marker { display: none; }
.life-full-summary .section-chevron {
  margin-left: auto;
  width: 24px;
  height: 24px;
  font-size: 13px;
  background: transparent;
}
.life-full[open] > .life-full-summary > .section-chevron {
  transform: rotate(180deg);
}
.life-full:hover > .life-full-summary > .section-chevron {
  background: var(--panel);
}
.life-full-title { flex: 1; }
.life-full-text {
  margin: 0;
  padding: 0 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-1);
  white-space: pre-wrap;
}

/* ===== Лайки контента (👍/👎) — приглушённый чёрно-белый стиль ===== */
.feedback-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 12px;
  background: transparent;
  border-top: 1px solid var(--divider);
  border-radius: 0;
  box-shadow: none;
}
.feedback-q {
  flex: 1;
  font-size: 12px;
  color: var(--fg-3);
}
.feedback-btn {
  width: 32px;
  height: 28px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-sm);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, filter 0.15s;
  font-family: inherit;
  padding: 0;
  /* Эмодзи в чёрно-белом */
  filter: grayscale(1) opacity(0.55);
}
.feedback-btn:hover { filter: grayscale(1) opacity(0.85); background: var(--panel); }
.feedback-btn:active { transform: scale(0.96); }
.feedback-btn.active {
  filter: grayscale(1) opacity(1);
  background: var(--panel);
  border-color: var(--fg-3);
}

/* ===== Иконки в карточке профиля (📤 share, 🔔 subscribe) ===== */
.profile-menu-item .pm-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.profile-menu-item .pm-action {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.profile-menu-item .pm-action:hover { background: var(--panel); color: var(--fg-1); }
.profile-menu-item .pm-action.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(44, 129, 242, 0.32);
}
.profile-menu-item .pm-action.active:hover {
  background: #1e6cd9;
}

/* Легенда-пояснение в шапке меню профилей */
.profile-menu-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--panel);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.4;
}
.profile-menu-legend .pml-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-menu-legend .pml-icon {
  width: 22px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Поиск по списку профилей — показываем когда профилей много */
.profile-menu-search {
  padding: 8px 10px;
  margin-bottom: 4px;
}
.profile-menu-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  color: var(--fg-1);
  outline: none;
  transition: border-color 0.15s;
}
.profile-menu-search input:focus { border-color: var(--fg-2); }
.profile-menu-search input::placeholder { color: var(--fg-3); }
.profile-menu-empty {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-3);
}

/* ===== Ключевые слова периода ===== */
.t-keywords {
  position: relative;
  margin: 10px 0 14px;
  padding: 10px 14px 10px 38px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
}
.t-keywords::before {
  content: "✦";
  position: absolute;
  left: 14px;
  top: 11px;
  color: var(--accent);
  font-size: 13px;
  font-style: normal;
  line-height: 1;
}
.t-body { white-space: pre-wrap; }

/* ===== Confirm modal (yes/no) ===== */
.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal__card {
  background: #fff;
  border-radius: var(--r-lg, 16px);
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  text-align: left;
}
.confirm-modal__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-1, #1a1a1d);
}
.confirm-modal__message {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg-2, #4a4a52);
}
.confirm-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.confirm-modal__actions .btn { min-width: 96px; }
.btn.btn-danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.btn.btn-danger:hover,
.btn.btn-danger:active { background: #a8322a; border-color: #a8322a; }

/* ===== Tab-bar «Личность / Отношения» ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 16px 0;
  background: #f3f3f5;
  border-radius: 12px;
}
.tab-bar .tab-btn {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-2, #6a6a72);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.tab-bar .tab-btn.active {
  background: #fff;
  color: var(--fg-1, #1a1a1d);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ===== Relations form ===== */
.rel-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.rel-slot { display: flex; flex-direction: column; gap: 8px; }
.rel-slot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2, #6a6a72);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rel-select, .rel-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid #e2e2e6;
  background: #fff;
  color: var(--fg-1, #1a1a1d);
  box-sizing: border-box;
}
.rel-manual { display: flex; flex-direction: column; gap: 8px; }
.rel-context { display: flex; gap: 8px; }
.rel-ctx-btn {
  flex: 1;
  padding: 12px 10px;
  background: #f3f3f5;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-1, #1a1a1d);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.rel-ctx-btn.active {
  background: #fff;
  border-color: var(--accent, #c0392b);
  color: var(--accent, #c0392b);
}

/* ===== Relations result ===== */
.rel-pair-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 8px;
}
.rel-pair-head .rel-party {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.rel-pair-head .rel-party-name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.rel-pair-head .rel-party-sub {
  font-size: 12px;
  color: var(--fg-2, #6a6a72);
}
.rel-pair-heart {
  font-size: 22px;
  color: var(--accent, #c0392b);
}
.rel-kratko {
  text-align: center;
  font-size: 13px;
  color: var(--fg-2, #6a6a72);
  margin: 4px 0 16px;
}
/* Связи Кэмпа — сворачиваемый блок с полными описаниями */
.rel-collapsible {
  margin: 12px 0 18px;
  border: 1px solid #ececef;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.rel-collapsible[open] { background: #fafafb; }
.rel-collapsible-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-1, #1a1a1d);
}
.rel-collapsible-summary::-webkit-details-marker { display: none; }
.rel-collapsible-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rel-collapsible-chevron { transition: transform .15s ease; color: var(--fg-2, #6a6a72); }
.rel-collapsible[open] .rel-collapsible-chevron { transform: rotate(180deg); }
.rel-collapsible-body { padding: 0 16px 14px; }
.rel-camp-info { margin: 0 16px 12px; }
.rel-link {
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--accent-soft, #fdf3f2);
  border-radius: 10px;
}
.rel-link:first-child { margin-top: 0; }
.rel-link-planet {
  font-weight: 700;
  color: var(--accent, #c0392b);
  font-size: 14px;
  margin-bottom: 6px;
}
.rel-link-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.rel-karmic-block {
  margin: 8px 0 18px;
  padding: 14px;
  background: #f7f7f9;
  border-radius: 12px;
}
.rel-karmic-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2, #6a6a72);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.rel-karmic-line {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
  color: var(--fg-1, #1a1a1d);
}
.rel-karmic-line:last-child { margin-bottom: 0; }
.rel-section { margin: 18px 0; }
.rel-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--fg-1, #1a1a1d);
}
.rel-section-text { font-size: 14px; line-height: 1.55; color: var(--fg-1, #1a1a1d); white-space: pre-wrap; }
.rel-pair-block { margin-top: 10px; padding: 12px; background: #f7f7f9; border-radius: 10px; }
.rel-pair-block-name {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--fg-2, #6a6a72); margin-bottom: 6px;
}

/* ===== Relations swiper (П1 ↔ П2) ===== */
.rel-swiper {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-top: 8px;
  gap: 0;
}
.rel-swiper::-webkit-scrollbar { display: none; }
.rel-swipe-slide {
  flex: 0 0 100%;
  min-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 12px;
  box-sizing: border-box;
  background: #f7f7f9;
  border-radius: 10px;
}
.rel-swiper > .rel-swipe-slide + .rel-swipe-slide { margin-left: 8px; }
.rel-swipe-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.rel-swipe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8d8de;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.rel-swipe-dot.active {
  background: var(--accent, #c0392b);
  transform: scale(1.2);
}
.rel-swipe-hint {
  text-align: center;
  font-size: 11px;
  color: var(--fg-2, #6a6a72);
  margin-top: 4px;
}

/* Внутри текстов разделов «Отношений» подсвечиваем маркеры
   «Высокая частота» (зелёный) и «Низкая частота» (красный). */
.rel-text-main {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--fg-1, #1a1a1d);
}
.rel-freq {
  margin-top: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: 8px;
  border-left: 3px solid;
}
.rel-freq.high {
  background: rgba(56, 161, 105, 0.08);
  border-color: #38a169;
}
.rel-freq.low {
  background: rgba(192, 57, 43, 0.08);
  border-color: #c0392b;
}
.rel-freq-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.rel-freq.high .rel-freq-lbl { color: #2f855a; }
.rel-freq.low  .rel-freq-lbl { color: #a8322a; }
.rel-freq-text { font-size: 13px; line-height: 1.5; color: var(--fg-1, #1a1a1d); }

/* Центр шапки пары: эмодзи + кнопка «поменять местами».
   Между ними оставляем заметный воздух, чтобы они не сливались. */
.rel-pair-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  padding: 0 6px;
}
.rel-pair-heart { line-height: 1; }
.rel-swap-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--hairline, #E6E6EA);
  background: #fff;
  color: var(--fg-2, #5C5C63);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: background .15s ease, color .15s ease, transform .3s ease;
}
.rel-swap-btn:hover { background: var(--panel, #F2F2F4); color: var(--fg-1, #0E0E10); }
.rel-swap-btn:active { transform: rotate(180deg); }

/* «Узнавание» периода — личное «вы», 3–5 предложений, в начале блока перед длинным портретом */
.recognition-block {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--accent-soft, rgba(44, 129, 242, 0.08));
  border-left: 3px solid var(--accent, #2C81F2);
  border-radius: var(--r-md, 14px);
}
.recognition-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #2C81F2);
  margin-bottom: 6px;
}
.recognition-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-1, #0E0E10);
  white-space: pre-wrap;
}
