/* Вид дерева. Цвета, шрифты и размеры - из дизайн-системы макета design/drevo.pen.
   Все размеры в rem: «Крупный» текст в настройках увеличивает страницу целиком. */

@font-face { font-family: "PT Serif"; font-weight: 400; font-display: swap;
  src: url(fonts/ptserif-400-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "PT Serif"; font-weight: 400; font-display: swap;
  src: url(fonts/ptserif-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "PT Serif"; font-weight: 700; font-display: swap;
  src: url(fonts/ptserif-700-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "PT Serif"; font-weight: 700; font-display: swap;
  src: url(fonts/ptserif-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap;
  src: url(fonts/manrope-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 400 700; font-display: swap;
  src: url(fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #EDE5D4;
  --surface: #F7F2E7;
  --line: #C4B79F;
  --ink: #2B241C;
  --ink-2: #645A4D;
  --accent: #544A3F;
  --ask: #7A5729;
  --ask-soft: #EFE3CC;
  --paper-2: #E2D8C4;
  --connector: #A39580;
  --head: #645A4D;
  --head-deep: #544A3F;
  --on-head: #F7F2E7;
  --on-head-2: #E2D8C4;
  --shadow: #2B241C26;
  --link: #4A6558;
  --photo-empty: #E0D5C1;
  --serif: "PT Serif", Georgia, serif;
  --sans: "Manrope", -apple-system, "Helvetica Neue", sans-serif;
}

html { font-size: 100%; }
html[data-size="large"] { font-size: 112.5%; }

* { box-sizing: border-box; }

/* корень страницы не прокручивается и не оттягивается пружиной: прокручиваются холст, панель и листы
   (правила веб-приложения на телефоне; дерево-на-маке.md, «Раскладка телефона», «Основа страницы») */
html, body { overflow: hidden; overscroll-behavior: none; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;   /* высота по видимой части окна: на телефоне панели браузера её меняют */
  display: flex;
  flex-direction: column;
  background: var(--head);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
}

button { font: inherit; color: inherit; }

/* --- шапка страницы --- */

.top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 2rem 1.25rem;
  color: var(--on-head);
}
/* узкая шапка ужимает название многоточием и поля справа до их наименьшей ширины, кнопки не наезжают на название */
.top-text { flex: 1 1 auto; min-width: 8rem; }
.top h1 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.875rem; line-height: 1.2; }
.top p { margin: 0.25rem 0 0; color: var(--on-head-2); font-size: 0.9375rem; }
.top h1, .top p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.head-btn {
  width: 2.75rem; height: 2.75rem; flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--head-deep); color: var(--on-head);
  cursor: pointer;
}
.head-btn svg { width: 1.25rem; height: 1.25rem; }
/* «Новое · N» и «Ссылки» в шапке общего дерева на пути входа Романа (К2.4): открывают экраны админки */
.news-btn {
  height: 2.75rem; flex: none; display: flex; align-items: center; gap: 0.5rem;
  padding: 0 1.125rem; border: none; border-radius: 1.375rem;
  background: var(--head-deep); color: var(--on-head); font-size: 1rem; font-weight: 600;
  cursor: pointer;
}
.news-btn[hidden] { display: none; }
.news-btn svg { width: 1.25rem; height: 1.25rem; }
/* число без слова «Новое» - на телефоне и в шапке средней ширины, где слова не встают */
.news-count { display: none; }
.news-count:empty { display: none !important; }

/* --- поиск «Найти человека»: поле в шапке компьютера (К2.4), список под полем; на телефоне - лупа и лист --- */

.find { position: relative; flex: 0 1 16.25rem; min-width: 10rem; }
.find[hidden] { display: none; }
.find-input {
  width: 100%; height: 2.875rem; padding: 0 1rem 0 2.625rem;
  border: 1px solid var(--line); border-radius: 0.5rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23645A4D' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 0.875rem center;
  color: var(--ink); font: inherit; font-size: 1rem;
  appearance: none;
}
.find-input::placeholder { color: var(--ink-2); opacity: 1; }
.find-input:focus { outline: 2px solid var(--on-head); outline-offset: 1px; }
.find-input::-webkit-search-cancel-button { display: none; }
.find-drop {
  position: absolute; z-index: 16; top: calc(100% + 0.5rem); left: 0;
  width: 26rem; max-height: calc(100vh - 8rem); max-height: calc(100dvh - 8rem); overflow-y: auto;
  padding: 0.5rem 1.25rem 0.75rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 1rem;
  box-shadow: 0 0.75rem 2.5rem var(--shadow);
}
.find-drop[hidden] { display: none; }
.find-count { margin: 0.5rem 0 0.25rem; }
.find-empty { margin: 0.75rem 0; font-size: 1rem; color: var(--ink-2); }
.family-row.find-row .row-sub { font-size: 0.9375rem; line-height: 1.35; color: var(--ink-2); }
.family-row.find-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.zoom-find { display: none !important; }

/* --- переключатель «Так видят родные»: на закладке Мака и в шапке дерева после входа Романа --- */

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex: 0 1 auto; min-width: min-content; }
.views-box { position: relative; flex: 0 1 19.5rem; min-width: 11rem; display: flex; }
.views-box[hidden] { display: none; }
.views-label { display: none; }
.views {
  height: 2.75rem;
  padding: 0 2.25rem 0 1rem;
  border: none; border-radius: 1.375rem;
  background: var(--head-deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23F7F2E7' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 1rem center;
  color: var(--on-head);
  font: inherit; font-size: 0.9375rem;
  appearance: none;
  cursor: pointer;
}
/* ширина постоянная - переключатель не прыгает от выбора; выбрана страница - охра вместо полосы над деревом.
   Узкая шапка ужимает его, а не выталкивает кнопки за край */
.views { width: 100%; min-width: 0; text-overflow: ellipsis; }
.views.as-family { background-color: var(--ask); }

/* шапка средней ширины (окно компьютера уже 1100 точек): у «Новое» и «Ссылки» - значок и число, без слов */
@media (max-width: 1099.98px) {
  #news-label, .news-btn .btn-text { display: none; }
  .news-count { display: inline; }
  .news-btn { padding: 0 0.75rem; }
}

/* --- настройки --- */

.settings {
  position: fixed; z-index: 10;
  top: 5.25rem; right: 1.5rem;
  width: 23.75rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 2px 6px var(--shadow);
}
.settings[hidden] { display: none; }
.settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.settings h2 { margin: 0 0 1rem; font-family: var(--serif); font-size: 1.5rem; }
/* крестик настроек - только на телефоне: на компьютере их закрывает и щелчок мимо */
.settings-close { display: none; }
.settings-label { margin: 0 0 0.5rem; font-size: 1rem; }
.segmented { display: flex; gap: 0.5rem; }
.segmented button {
  height: 3rem; padding: 0 1.25rem;
  border: 1px solid var(--line); border-radius: 1.5rem;
  background: transparent; cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-head); }

/* --- лист под шапкой: холст и панель --- */

.sheet {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
  border-radius: 1.5rem 1.5rem 0 0;
  overflow: hidden;
}

/* холст двигает только свой сдвиг (tree.js): clip, а не hidden - браузер не прокрутит его сам к карточке, получившей
   фокус у края экрана, иначе сдвиг и место карточки разошлись бы и подвод холста к человеку промахивался (30.11) */
.canvas {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  overflow: clip;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.canvas.dragging { cursor: grabbing; }

.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.world.gliding { transition: transform 0.35s ease; }
.lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.lines path { fill: none; stroke: var(--connector); stroke-width: 1.5; }

.message {
  position: absolute; z-index: 2; left: 1.5rem; bottom: 1.5rem; right: 5.5rem;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem;
  margin: 0; padding: 0.75rem 1rem;
  background: var(--paper-2); border-radius: 0.625rem;
  font-size: 0.9375rem; line-height: 1.45; color: var(--ink);
}
.message[hidden] { display: none; }
/* полоса загрузки дерева на месте пустого холста (дерево-на-маке.md, «Раскладка телефона», «Полоса загрузки»):
   строка и под ней полоса, если сервер назвал размер; плашка одна и та же, пока спрашиваем, качаем и отпираем */
.loading {
  position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(22rem, calc(100% - 2rem)); box-sizing: border-box;
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--paper-2); border-radius: 0.625rem;
  font-size: 1rem; line-height: 1.45; color: var(--ink);
}
.loading[hidden], .loading-bar[hidden] { display: none; }
.loading-text { margin: 0; }
.loading-bar { height: 0.5rem; border-radius: 0.25rem; background: var(--bg); overflow: hidden; }
.loading-fill { display: block; width: 0; height: 100%; background: var(--accent); }
/* «Обновить страницу» у сообщений, которые просят обновить страницу (решение 30.11, п. 14; кусок под Т2.4):
   у значка на «Домой» нет строки браузера, а страница не оттягивается пружиной */
.reload-btn { height: 3rem; font-size: 1rem; }
.message .reload-btn { align-self: stretch; }
/* под текстом ошибки в окне или на экране админки - своей строкой, шириной по надписи */
.form-problem .reload-btn, .adm-status .reload-btn { width: fit-content; margin-top: 0.75rem; }
.form-problem + .reload-btn { align-self: flex-start; }

/* карточка на холсте */
.card {
  position: absolute;
  width: 9.375rem;
  display: flex; flex-direction: column; gap: 0.125rem;
  padding: 0.875rem 0.5rem 0.625rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 2px 6px var(--shadow);
  cursor: pointer;
}
.card .name { font-family: var(--serif); font-weight: 700; font-size: 1rem; line-height: 1.2; }
.card .years, .card .note { font-size: 0.875rem; color: var(--ink-2); line-height: 1.35; }
.card .note {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
/* счётчик вопросов (К2.1): нажатие открывает «О человеке» с раскрытыми вопросами (К3.1а) */
.card .count { margin-top: 0.25rem; font-size: 0.875rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
.card .count:hover { text-decoration: underline; }
.label.ask { color: var(--ask); }

/* пустая клетка: без заливки и тени */
.card.slot { background: transparent; box-shadow: none; }
.card.slot .name { font-weight: 400; color: var(--ink-2); }
/* гипотеза - рамка охрой (рамка 2 px, отступ меньше на 1 px - размер тот же) */
.card.hypothesis { border: 2px solid var(--ask); padding: calc(0.875rem - 1px) calc(0.5rem - 1px) calc(0.625rem - 1px); }
/* свой добавленный «на проверке»: рамка охрой 1.5 и «на проверке» со значком вместо счётчика вопросов
   (дизайн-система, «На проверке»; макет, К4.5) */
.card.added { border: 1.5px solid var(--ask); padding: calc(0.875rem - 0.5px) calc(0.5rem - 0.5px) calc(0.625rem - 0.5px); }
.card .review { display: flex; gap: 0.25rem; align-items: center; margin-top: 0.25rem; font-size: 0.875rem; line-height: 1.35; color: var(--ask); }
.card .review svg { width: 0.875rem; height: 0.875rem; flex: none; }
/* выбранная карточка на дереве одна */
.card.selected {
  border: 2px solid var(--accent); background: var(--paper-2);
  padding: calc(0.875rem - 1px) calc(0.5rem - 1px) calc(0.625rem - 1px);
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* карточка с портретом: снимок 138 × 138 сверху без своей рамки (компонент «Карточка человека») */
.card.with-portrait { padding: 0.375rem 0.375rem 0.625rem; }
.card.with-portrait > span:not(.portrait) { padding: 0 0.125rem; }
.card.with-portrait.selected, .card.with-portrait.hypothesis {
  padding: calc(0.375rem - 1px) calc(0.375rem - 1px) calc(0.625rem - 1px);
}
.card .portrait {
  width: 8.625rem; height: 8.625rem; flex: none;
  margin-bottom: 0.5rem;
  border-radius: 0.375rem; overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
}
.card .portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* знак пары */
.sign {
  position: absolute;
  width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-2);
  pointer-events: none;
}
.sign svg { width: 0.875rem; height: 0.875rem; }

.zoom {
  position: absolute; z-index: 2;
  top: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.icon-btn {
  width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { width: 1.25rem; height: 1.25rem; }

/* --- карточка справа --- */

.panel {
  width: 30rem;
  flex: none;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 2.5rem;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.panel[hidden] { display: none; }

.card-head { position: relative; padding-right: 3.5rem; margin-bottom: 1.25rem; }
.card-head.with-portrait { display: flex; gap: 1rem; align-items: flex-start; }
.head-portrait {
  width: 7rem; height: 7rem; flex: none;
  padding: 0; border: none; border-radius: 0.5rem; overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
}
.head-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.head-text { min-width: 0; }
.card-head .close { position: absolute; top: 0; right: 0; }
.card-head p { margin: 0; }
.relation { font-size: 0.9375rem; color: var(--ink-2); line-height: 1.45; }
.labels { display: flex; gap: 0.75rem; margin-top: 0.25rem !important; }
.card-name { margin: 0.25rem 0 0; font-family: var(--serif); font-weight: 700; font-size: 1.75rem; line-height: 1.15; }
.card-name.unknown { font-weight: 400; color: var(--ink-2); }
.maiden, .header-line { font-size: 0.9375rem; color: var(--ink-2); line-height: 1.45; margin-top: 0.25rem !important; }

.tabs {
  display: flex; gap: 0.125rem;
  padding: 0.1875rem;
  margin-bottom: 1.5rem;
  background: var(--paper-2);
  border-radius: 1.5rem;
}
.tab {
  flex: 1; height: 2.625rem;
  border: none; border-radius: 1.3125rem;
  background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.tab.on { background: var(--surface); color: var(--ink); font-weight: 600; }
.tab b { margin-left: 0.25rem; font-weight: 700; color: var(--ink); }

/* «Фото»: по два в ряд, подпись под снимком */
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.75rem; }
.photo-tile {
  display: flex; flex-direction: column; gap: 0.375rem;
  padding: 0; text-align: left;
  background: none; border: none; cursor: zoom-in;
}
.tile-img {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden;
  background: var(--paper-2);
}
.tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-caption { font-size: 0.9375rem; line-height: 1.35; color: var(--ink-2); }

.section {
  margin: 0 0 0.75rem;
  font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-2);
}
.facts { list-style: none; margin: 0 0 1.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.facts li { position: relative; padding-left: 1rem; font-size: 1.0625rem; line-height: 1.45; }
.facts li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--ink-2);
}
.facts li.gap { color: var(--ink-2); }
.only-us { display: block; margin-top: 0.125rem; font-size: 0.875rem; color: var(--ink-2); }
/* значок главного источника справа от строки (компоненты «Факт с источником», «Знак источника»,
   «Подсказка источника» макета): лист - документ, снимок - снимок, фигурки - слова родных */
.facts li.with-source { display: flex; gap: 0.625rem; align-items: flex-start; }
.fact-text { flex: 1; min-width: 0; }
.source-mark {
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5625rem; padding: 0; border: 0; border-radius: 0.25rem;
  background: none; color: var(--link); cursor: pointer;
}
span.source-mark { cursor: default; }
.source-mark svg { width: 1.0625rem; height: 1.0625rem; }
.source-mark:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
/* подпись при наведении - только там, где есть мышь: на телефоне «наведение» съело бы первое нажатие на значок
   документа; значок родных показывает подпись по нажатию (hint-on; решение 30.11, «Раскладка телефона») */
@media (hover: hover) {
  .source-mark:hover::after { content: attr(data-hint); }
}
.source-mark:focus-visible::after, .source-mark.hint-on::after { content: attr(data-hint); }
.source-mark:focus-visible::after, .source-mark.hint-on::after, .source-mark:hover::after {
  position: absolute; right: 0; bottom: calc(100% + 0.25rem); z-index: 3;
  width: max-content; max-width: 18rem; padding: 0.375rem 0.625rem; border-radius: 0.375rem;
  background: var(--ink); color: var(--on-head);
  font-size: 0.875rem; font-weight: 400; line-height: 1.35; text-align: left; white-space: normal;
  pointer-events: none;
}
/* ссылка на историю под строкой (компонент «Ссылка на историю»): книга, название и годы, стрелка */
.history-link {
  display: flex; align-items: center; gap: 0.375rem; width: fit-content;
  margin-top: 0.25rem; padding: 0.125rem 0; border: none; background: none;
  font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.375; text-align: left;
  color: var(--link); cursor: pointer;
}
.history-link svg { flex: none; width: 1.125rem; height: 1.125rem; }
.history-link svg:last-child { width: 1rem; height: 1rem; }
.history-link:hover span { text-decoration: underline; }

.note-plate {
  display: flex; gap: 0.625rem;
  padding: 0.875rem;
  background: var(--paper-2);
  border-radius: 0.625rem;
  color: var(--ink);
}
.note-plate > svg { width: 1.25rem; height: 1.25rem; flex: none; color: var(--ink-2); }
.note-plate p { margin: 0 0 0.25rem; font-size: 0.9375rem; line-height: 1.45; }
.note-plate p:last-child { margin-bottom: 0; }
.note-plate .note-title { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }

/* строка «N вопросов» и вопросы тихой подсказкой с номерами под ней (К3.1, К3.1а; компонент «Вопрос в списке»);
   на закладке Мака - без рамки, под фактами (К2.5) */
.asked-block { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.75rem; }
.asked-toggle {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0; margin: -0.25rem 0;
  background: none; border: none;
  color: var(--link); font: inherit; font-size: 0.9375rem; font-weight: 600;
  cursor: pointer;
}
.asked-toggle svg { width: 1.125rem; height: 1.125rem; }
.asked-toggle:hover span { text-decoration: underline; }
.asked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.asked[hidden] { display: none; }
.asked li { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.125rem 0; }
.asked-n { flex: none; min-width: 0.875rem; font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); }
.asked-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.asked-text p { margin: 0; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }
.asked-text .asked-hint { display: flex; gap: 0.375rem; font-size: 0.875rem; }
.asked-hint svg { width: 1rem; height: 1rem; flex: none; margin-top: 0.125rem; }
.viewer-block { margin-top: 2rem; }

.group { margin: 1.25rem 0 0.25rem; font-size: 0.9375rem; font-weight: 400; color: var(--ink-2); }
.group:first-child { margin-top: 0; }
.divorce { margin: 0.5rem 0 0; font-size: 1rem; color: var(--ink-2); }

.family-row {
  width: 100%;
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.5625rem 0.125rem;
  text-align: left;
  background: none;
  border: none; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.family-row .letter {
  width: 2.875rem; height: 2.875rem; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0.375rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink-2);
}
.family-row .letter.face { overflow: hidden; border: none; }
.family-row .letter.face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.family-row .row-name { flex: 1; font-family: var(--serif); font-weight: 700; font-size: 1.0625rem; line-height: 1.25; }
.family-row svg { width: 1.25rem; height: 1.25rem; flex: none; color: var(--ink-2); }
/* своё добавленное на «Семье»: рамка буквы охрой, под именем «на проверке · добавили вы» (дизайн-система) */
.family-row.added .letter { border: 1.5px solid var(--ask); }
.family-row .row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.family-row .row-note { font-size: 0.9375rem; font-weight: 600; line-height: 1.35; color: var(--ask); }
/* плашка «на проверке» под шапкой своего добавленного: подложка охры, «Исправить» охрой, а не цветом ссылки */
.review-plate {
  display: flex; gap: 0.625rem; align-items: flex-start; margin: 0 0 1rem; padding: 0.875rem;
  border-radius: 0.625rem; background: var(--ask-soft); color: var(--ask);
}
.review-plate > svg { width: 1.25rem; height: 1.25rem; flex: none; margin-top: 0.125rem; }
.review-plate p { margin: 0 0 0.375rem; font-size: 0.9375rem; line-height: 1.45; }
.review-edit { padding: 0; border: none; background: none; color: var(--ask); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; }
.review-edit:hover { text-decoration: underline; }
.added-text { margin: 0 0 1.25rem; font-size: 1rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
/* «Удалить» внизу «Исправить» */
.form-delete { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.link-btn.delete-link { display: inline-flex; gap: 0.375rem; align-items: center; align-self: flex-start; color: #9E2B20; }
.delete-link svg, .btn-danger svg { width: 1.125rem; height: 1.125rem; }
.delete-warn { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--ink); }
.delete-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn-danger {
  height: 3rem; display: inline-flex; gap: 0.5rem; align-items: center; justify-content: center; padding: 0 1.25rem;
  border: none; border-radius: 1.5rem; background: #9E2B20; color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.delete-buttons .btn-second { height: 3rem; font-size: 1rem; }

/* --- окно истории (К3.12): по центру поверх страницы, около 70 знаков в строке, длинная история прокручивается
   внутри; окно документа (z-index 20) открывается поверх него --- */

.history-shade {
  position: fixed; inset: 0; z-index: 15;
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1rem;
  background: #2B241C73;   /* --ink, 45 % - затемнение макета */
}
.history-shade[hidden] { display: none; }
.history {
  width: 45rem; max-width: 100%; max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 1.75rem;
  padding: 2.25rem 2.5rem 2.5rem;
  border-radius: 1rem;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 0.75rem 2.5rem var(--shadow);
}
.history:focus { outline: none; }
.history-head { display: flex; gap: 1rem; align-items: flex-start; }
.history-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.375rem; }
.history-heading > * { margin: 0; }
.history-kind { font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.history-title { font-family: var(--serif); font-weight: 700; font-size: 2rem; line-height: 1.3; }
.history-years { font-size: 1rem; line-height: 1.4; color: var(--ink-2); }
.history-about { padding-top: 0.375rem; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }
.history-about .link { font-weight: 600; }
.history-text { display: flex; flex-direction: column; gap: 1.25rem; }
.history-par { display: flex; gap: 1rem; align-items: flex-start; }
.history-par-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.history-par-text p { margin: 0; font-size: 1.0625rem; line-height: 1.6; }
.history-quote {
  margin: 0; padding: 0.125rem 0 0.125rem 1rem;
  border-left: 2px solid var(--line);
  font-family: var(--serif); font-style: italic; font-size: 1.0625rem; line-height: 1.5;
}
.history-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

/* --- снимок большим окном (К3.6, К3.7, К3.8) --- */

body.viewer-open { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) 30rem;
  background: var(--ink);
}
.viewer[hidden] { display: none; }
.viewer.bare { grid-template-columns: minmax(0, 1fr); }
.viewer.bare .viewer-side { display: none; }
.viewer:focus { outline: none; }
.bare-close { display: none !important; }
.viewer.bare .bare-close { display: grid !important; }

.stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; color: var(--on-head); }
.stage-top {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8125rem 2rem 0.8125rem 2rem;
}
.counter { font-size: 1rem; }
.stage-tools { display: flex; align-items: center; gap: 0.625rem; }
.pill-btn {
  height: 2.875rem; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 0.625rem;
  border: none; border-radius: 1.4375rem;
  background: var(--accent); color: var(--on-head);
  font-size: 1rem; font-weight: 500; cursor: pointer;
}
.pill-btn svg, .round-btn svg { width: 1.25rem; height: 1.25rem; }
.round-btn {
  width: 2.875rem; height: 2.875rem;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--accent); color: var(--on-head); cursor: pointer;
}
.percent { min-width: 0; font-size: 1rem; }
.percent:empty { display: none; }

/* снимок со стрелками: стрелки - посередине снимка, а не всего окна с лентой */
.frame-box { position: relative; flex: 1; min-height: 0; display: flex; }
.frame {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0 6.5rem;
  overflow: hidden;
  touch-action: none;   /* пальцы на снимке - листание и щипок окна, а не прокрутка и увеличение страницы */
}
.frame.zoomed { cursor: grab; }
/* название и кнопка описания под снимком - только на телефоне: на компьютере это колонка справа */
.stage-info { display: none; }
.picture {
  display: block; max-width: 100%; max-height: 100%;
  transform-origin: center; user-select: none;
}

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 3.5rem; height: 3.5rem;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--accent); color: var(--on-head); cursor: pointer;
}
.nav svg { width: 1.5rem; height: 1.5rem; }
.nav.prev { left: 1.5rem; }
.nav.next { right: 1.5rem; }
.nav[hidden], .ribbon[hidden] { display: none; }

.ribbon {
  flex: none; display: flex; justify-content: center; gap: 0.625rem;
  padding: 1.5rem 2rem 1.5rem; overflow-x: auto;
}
.thumb {
  width: 4rem; height: 4rem; flex: none; padding: 0;
  border: 2px solid transparent; border-radius: 0.375rem; overflow: hidden;
  background: var(--paper-2); cursor: pointer; opacity: 0.8;
}
.thumb.on { border-color: var(--on-head); opacity: 1; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* без описания через 3 секунды без движения прячутся кнопки, лента и курсор */
.viewer.idle .stage-top, .viewer.idle .nav, .viewer.idle .ribbon { opacity: 0; pointer-events: none; }
.viewer.idle { cursor: none; }
.stage-top, .nav, .ribbon { transition: opacity 0.3s ease; }

.viewer-side {
  position: relative; overflow-y: auto;
  padding: 1.5rem 1.5rem 2.5rem;
  background: var(--surface); color: var(--ink);
}
.viewer-side .close { position: absolute; top: 1.5rem; right: 1.5rem; }
.viewer-side .labels { margin: 0.25rem 0 0; }
.eyebrow { margin: 0.5rem 3.5rem 0 0; font-size: 0.9375rem; color: var(--ink-2); }
.viewer-title { margin: 0.25rem 3.5rem 0 0; font-family: var(--serif); font-weight: 700; font-size: 1.75rem; line-height: 1.15; }
.viewer-date { margin: 0.375rem 0 0; font-size: 0.9375rem; color: var(--ink-2); }
.viewer-section { margin-top: 2rem; margin-bottom: 0.375rem; }
.viewer-source { margin: 0 0 0.75rem; font-size: 0.9375rem; color: var(--ink-2); }

.scheme {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1rem; margin-bottom: 0.5rem;
  background: var(--paper-2); border-radius: 0.5rem;
}
.scheme-row { display: flex; gap: 0.75rem; }
.seat {
  width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  font-size: 0.8125rem; color: var(--ink-2);
}

.row-label { margin: 1.25rem 0 0.375rem; font-size: 0.9375rem; color: var(--ink-2); }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.seat-line { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: baseline; font-size: 1.0625rem; line-height: 1.4; }
.seat-n { font-size: 0.9375rem; color: var(--ink); }
.group-box { border-left: 2px solid var(--line); padding-left: 0.75rem; display: flex; flex-direction: column; gap: 0.375rem; }
.seat-note { margin: 0; font-size: 0.9375rem; color: var(--ink-2); }
.seat-note.inline { margin-left: 0.625rem; }
.plain { color: var(--ink); }
.link {
  padding: 0; border: none; background: none;
  font: inherit; text-align: left; color: var(--link); cursor: pointer;
}
.link:hover { text-decoration: underline; }
.also { margin: 1.25rem 0 0; font-size: 1.0625rem; line-height: 1.45; }
.written { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 1.0625rem; line-height: 1.4; }
.viewer-note { margin-top: 2rem; }

/* --- запись на странице по ключу ссылки (шаг 5 плана): поле рассказа (К3.1, «Т3.1 · состояния поля рассказа»), «Кто вы?» (К1.1, К1.2),
   «Ссылка не открывается» (К1.4), «Кто отвечает» в настройках (К2.3) --- */

.label.me { color: var(--link); }

/* блок рассказа на «О человеке» (К3.1) и блок заметки в окне снимка (К3.6, К3.8): рамка показывает, что это ввод,
   а не текст карточки; под полем - только подпись состояния, пояснения - во всплывашке по «?» (К3.1б) */
.story-block {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1rem; margin-bottom: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 0.625rem;
}
.block-head { position: relative; display: flex; gap: 0.75rem; align-items: flex-start; }
.invite { flex: 1; margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.1875rem; line-height: 1.3; }
.help-btn {
  flex: none; display: grid; place-items: center;
  width: 2rem; height: 2rem; margin: -0.25rem -0.375rem 0 0; padding: 0;
  background: none; border: none; border-radius: 50%;
  color: var(--ink-2); cursor: pointer;
}
.help-btn svg { width: 1.25rem; height: 1.25rem; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--ink); }
.help-pop {
  position: absolute; top: calc(100% + 0.25rem); right: 0; z-index: 5;
  width: 20rem; max-width: 100%;
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(43, 36, 28, 0.15);
}
.help-pop[hidden] { display: none; }
.help-pop p { margin: 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }

.story { display: flex; flex-direction: column; }
.story-text {
  width: 100%; min-height: 8rem; resize: vertical;
  padding: 0.75rem 0.875rem;
  background: #FAF6EE;
  border: 1px solid var(--line); border-radius: 0.5rem;
  color: var(--ink);
  font: inherit; font-size: 1.0625rem; line-height: 1.45;
}
.story-text::placeholder { color: var(--ink-2); opacity: 0.8; }
.story-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.story-status { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }
/* пустая подпись места не занимает, но остаётся на странице: экранный диктор объявит первое «Не сохранилось»
   (проверка решения после кода, 13.11) */
.story-status:not(:empty) { margin-top: 0.625rem; }
.story-status svg { width: 1.25rem; height: 1.25rem; flex: none; }
/* «Сохранено» и «Получено» - сигнал, тот же зелёный, что у ссылок (макет, дизайн-система) */
.story-status.saved, .story-status.received { color: var(--link); }
.story-status.network, .story-status.server { color: var(--ask); }
.story-status.refused, .story-status.storage { color: #9E2B20; }
.story-off { display: flex; gap: 0.5rem; margin: 0; font-size: 0.9375rem; line-height: 1.45; color: #9E2B20; }
.story-off svg { width: 1.25rem; height: 1.25rem; flex: none; }

.who { margin-top: 1.25rem; }
.who-line { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: 1.0625rem; }
.who-note { margin: 0.375rem 0 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }
.link-btn { padding: 0; border: none; background: none; color: var(--link); font-weight: 600; cursor: pointer; }
/* замеры экрана (diag.js) - временно, для проверки на телефоне; нажатия проходят сквозь окошко */
.diag-line { margin-top: 1.25rem; }
.diag {
  position: fixed; z-index: 100; left: 0; top: 0; margin: 0; padding: 0.375rem 0.5rem;
  max-width: calc(100vw - 1rem); pointer-events: none; white-space: pre-wrap;
  background: #000000B3; color: #FFFFFF; font: 11px/1.35 ui-monospace, Menlo, monospace;
}
.link-btn:hover { text-decoration: underline; }

/* экраны входа - поверх страницы, на цвете шапки, колонка по центру */
body.entering > .top, body.entering > .sheet, body.entering > .settings,
body.entering > .history-shade, body.entering > .shade, body.entering > .find-shade { display: none !important; }
/* колонка по центру окна; выше окна - от верха и прокручивается: при align-items: center верх длинной колонки (окно
   входа на телефоне) уходил за край и не прокручивался, а поля автоматом центрируют только при свободном месте */
.entry { flex: 1; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; padding: 3rem 1.5rem; }
.entry[hidden] { display: none; }
.entry-column { width: 35rem; max-width: 100%; margin: auto 0; display: flex; flex-direction: column; gap: 2rem; }
.entry-cover { display: flex; flex-direction: column; gap: 0.875rem; padding: 0 0.5rem; color: var(--on-head); }
.entry-cover p, .entry-cover h1 { margin: 0; }
.entry-mark { font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-head-2); }
.entry-title { font-family: var(--serif); font-weight: 700; font-size: 3rem; line-height: 1.1; }
.entry-subtitle { font-size: 1.1875rem; font-weight: 600; color: var(--on-head-2); }
.entry-intro { font-size: 1.1875rem; line-height: 1.5; color: var(--on-head-2); }
.entry-back {
  align-self: flex-start; display: flex; align-items: center; gap: 0.25rem;
  padding: 0; border: none; background: none; color: var(--on-head-2); font-size: 1rem; cursor: pointer;
}
.entry-back svg { width: 1.25rem; height: 1.25rem; }
.entry-sheet { display: flex; flex-direction: column; gap: 1rem; padding: 1.75rem; background: var(--bg); border-radius: 1.5rem; }
.entry-question { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.375rem; line-height: 1.25; }
.entry-note { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--ink-2); }
.entry-small { margin: 0; font-size: 0.875rem; line-height: 1.45; color: var(--ink-2); }
.entry-forward { display: flex; gap: 0.75rem; margin: 0.5rem 0 0; font-size: 1rem; line-height: 1.45; color: var(--ink-2); }
.entry-forward svg { width: 1.375rem; height: 1.375rem; flex: none; }
.btn-main, .btn-second {
  height: 3.5rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.25rem; border-radius: 1.75rem; font-size: 1.125rem; font-weight: 600; cursor: pointer;
}
.btn-main { border: none; background: var(--accent); color: var(--on-head); }
.btn-main:disabled { opacity: 0.45; cursor: default; }
.btn-second { border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); }
.btn-main svg, .btn-second svg { width: 1.25rem; height: 1.25rem; }
.who-list { display: flex; flex-direction: column; gap: 0.125rem; }
.who-row {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.625rem 0.75rem; border: none; border-radius: 0.625rem;
  background: transparent; text-align: left; cursor: pointer;
}
.who-row[aria-checked="true"] { background: var(--paper-2); }
.who-row .letter {
  width: 2.875rem; height: 2.875rem; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0.375rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink-2);
}
.who-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.who-name { font-family: var(--serif); font-weight: 700; font-size: 1.0625rem; }
.who-relation { font-size: 0.9375rem; color: var(--ink-2); }
.who-mark { width: 1.375rem; height: 1.375rem; flex: none; border: 1.5px solid var(--ink-2); border-radius: 50%; display: grid; place-items: center; }
.who-row[aria-checked="true"] .who-mark::after { content: ""; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--ink-2); }

/* --- новый родственник (шаг 6 плана): «Добавить родственника» на «Семье» (К3.4), форма (К4.1), «Спасибо» (К4.2),
   «Вы знаете, кто это?» на карточке пустой клетки (К4.6), «Меня нет в списке» (К1.3) --- */

.add-relative { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.625rem; }
.add-note { margin: 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }

.add-form, .add-done, .self-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-back {
  align-self: flex-start; display: flex; align-items: center; gap: 0.25rem;
  padding: 0; border: none; background: none; color: var(--ink-2); font-size: 1rem; cursor: pointer;
}
.form-back svg { width: 1.25rem; height: 1.25rem; }
.form-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.75rem; line-height: 1.15; }
.form-intro { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--ink-2); }
.form-block { display: flex; flex-direction: column; gap: 0.625rem; }
.form-block[hidden], .form-pair[hidden], .field[hidden], .self-form[hidden] { display: none; }
.form-pair { display: flex; flex-direction: column; gap: 1.25rem; }
.form-problem { margin: 0; font-size: 0.9375rem; line-height: 1.4; color: #9E2B20; }
.form-problem:empty { display: none; }
.form-note { margin: 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field-label { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.35; color: var(--ink); }
.field-input, .search-input {
  width: 100%; height: 3.5rem; padding: 0 1rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.5rem;
  color: var(--ink); font: inherit; font-size: 1.125rem;
}
.field-input::placeholder, .search-input::placeholder { color: var(--ink-2); opacity: 0.8; }
.field-input:focus, .search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* общее поле «Что ещё знаете» (решение 12.11, п. 7): подсказка текстом над полем, поле - как у рассказа */
.field-hint { margin-top: -0.25rem; font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }
.field-text {
  width: 100%; min-height: 8rem; resize: vertical; padding: 0.75rem 1rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.5rem;
  color: var(--ink); font: inherit; font-size: 1.125rem; line-height: 1.45;
}
.field-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.words { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.word {
  height: 2.875rem; padding: 0 1.125rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 1.4375rem;
  color: var(--ink); font-size: 1.0625rem; cursor: pointer;
}
.word[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-head); }
.word:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chosen {
  display: flex; align-items: center; gap: 0.875rem; padding: 0.625rem 0.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0.625rem;
}
.chosen .letter, .who-self .letter {
  width: 2.875rem; height: 2.875rem; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0.375rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink-2);
}
.who-self .letter { background: var(--paper-2); border: none; }
.who-self .letter svg { width: 1.375rem; height: 1.375rem; }
.who-self-name { font-size: 1.0625rem; }

.add-done { padding-top: 1rem; }
.done-mark { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--paper-2); color: var(--link); }
.done-mark svg { width: 1.75rem; height: 1.75rem; }

.self-form { padding: 0.25rem 0.25rem 0.5rem 0.75rem; }
.search {
  display: flex; align-items: center; gap: 0.5rem; position: relative;
}
.search svg { position: absolute; left: 0.875rem; width: 1.125rem; height: 1.125rem; color: var(--ink-2); pointer-events: none; }
.search-input { padding-left: 2.625rem; height: 2.875rem; font-size: 1rem; border-width: 1px; }
.pick-list { display: flex; flex-direction: column; max-height: 16rem; overflow-y: auto; }
.pick-row {
  display: flex; flex-direction: column; gap: 0.125rem; align-items: flex-start;
  padding: 0.5rem 0.75rem; border: none; border-bottom: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer;
}
.pick-row:hover { background: var(--surface); }

/* --- снимок от родных (шаг 7 плана): окно «Прислать снимок или документ» (К3.9) с состояниями, «Исправить
   описание» (К3.9а), «Вы прислали» на вкладке «Фото» (К3.3) --- */

.photos-empty { margin: 0 0 1rem; font-size: 1rem; color: var(--ink-2); }

.sent-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.sent-tile { display: flex; gap: 0.875rem; align-items: flex-start; }
.sent-img {
  width: 7rem; aspect-ratio: 4 / 3; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden; background: var(--paper-2); color: var(--ink-2);
}
.sent-img svg { width: 1.5rem; height: 1.5rem; }
.sent-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sent-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; }
.sent-desc {
  margin: 0; font-size: 0.9375rem; line-height: 1.4; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sent-desc.empty { color: var(--ink-2); }
.sent-status { display: flex; gap: 0.375rem; align-items: flex-start; margin: 0; font-size: 0.875rem; font-weight: 600; line-height: 1.35; color: var(--ask); }
.sent-status svg { width: 1rem; height: 1rem; flex: none; margin-top: 0.1rem; }
.sent-status.received { color: var(--link); }
.sent-status.refused { color: #9E2B20; }

.upload-input { display: none; }
.upload {
  position: fixed; inset: 0; z-index: 25;
  display: grid; grid-template-columns: minmax(0, 1fr) 30rem;
  background: var(--ink);
}
.upload[hidden] { display: none; }
.upload:focus { outline: none; }
.upload-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 1.5rem 2rem 2rem; color: var(--on-head); }
.upload-top { flex: none; display: flex; align-items: center; gap: 0.625rem; margin: 0; font-size: 1.0625rem; }
.upload-top svg { width: 1.25rem; height: 1.25rem; flex: none; }
.slots { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 2rem; padding-top: 1.5rem; }
/* снимок шириной с картинку: подпись под ним не шире её (width: 0 и min-width: 100% - подпись ширину не задаёт).
   Только внутри .slots: голый .slot цеплял пустые клетки холста (класс «card slot») - max-width: 100% сжимал
   клетку при замере до ширины отступов, и соседняя карточка вставала на неё (13.11) */
.slots > .slot { flex: 0 1 auto; min-width: 0; max-width: 100%; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.slots.two .slot { max-width: calc(50% - 1rem); }
.slot-holder { display: flex; justify-content: center; }
.slot-picture {
  display: block; align-self: center; max-width: 100%; max-height: calc(100vh - 11rem); width: auto; height: auto;
  border-radius: 0.25rem;
}
.slot-wait { width: 20rem; max-width: 100%; aspect-ratio: 4 / 3; border-radius: 0.25rem; background: #F7F2E714; }
/* подпись файла - сразу под картинкой (макет К3.9) */
.slot-caption { width: 0; min-width: 100%; display: flex; align-items: baseline; gap: 0.625rem; font-size: 1rem; }
.slot-caption b { flex: none; font-weight: 600; }
.slot-caption.center { width: auto; justify-content: center; white-space: nowrap; color: var(--on-head-2); font-size: 0.9375rem; }
.slot-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9375rem; color: var(--on-head-2); }
.slot-action {
  flex: none; display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0; border: none; background: none; color: var(--on-head); font-size: 1rem; font-weight: 600; cursor: pointer;
}
.slot-action svg { width: 1.125rem; height: 1.125rem; }
.slot-action:hover { text-decoration: underline; }
/* снимок, который браузер не показывает, и файл, который не снимок (лист «К3.9 · состояния окна отправки») */
.slot-box {
  display: flex; flex-direction: column; gap: 0.625rem; width: 24rem; max-width: 100%;
  padding: 1.5rem; border: 1px solid #F7F2E733; border-radius: 0.5rem; color: var(--on-head);
}
.slot-box > svg { width: 2rem; height: 2rem; }
.box-title { margin: 0; font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.box-text { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--on-head-2); }
.box-actions { display: flex; gap: 1.25rem; margin: 0.25rem 0 0; }

.upload-side {
  position: relative; overflow-y: auto; display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.5rem 1.5rem 2.5rem; background: var(--surface); color: var(--ink);
}
.upload-side .close { position: absolute; top: 1.5rem; right: 1.5rem; }
.upload-title { margin: 0.25rem 3.5rem 0 0; font-family: var(--serif); font-weight: 700; font-size: 1.75rem; line-height: 1.15; }
.upload-plate .letter.face { overflow: hidden; border: none; }
.upload-plate .letter.face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upload-text:disabled { background: var(--paper-2); color: var(--ink-2); }
.back-offer { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; border-radius: 0.625rem; background: var(--paper-2); }
.back-offer p { margin: 0; font-size: 0.9375rem; line-height: 1.45; }
.upload-failure {
  display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; padding: 0.75rem 1rem;
  border-radius: 0.5rem; background: #F2DCD6; color: #9E2B20; font-size: 0.9375rem; line-height: 1.4;
}
.upload-failure[hidden] { display: none; }
.upload-failure svg { width: 1.25rem; height: 1.25rem; flex: none; }
.btn-main.sending svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-sending { display: flex; gap: 0.5rem; align-items: flex-start; }
.upload-sending svg { width: 1.125rem; height: 1.125rem; flex: none; }
.upload-ask { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; border-radius: 0.625rem; background: var(--ask-soft); }
.upload-ask p { margin: 0; font-size: 1rem; line-height: 1.45; }
.upload-ask .delete-buttons > * { flex: 1; }
.form-ask[hidden] { display: none; }   /* «Вернуться к карточке? Набранное пропадёт» в форме родственника */
.upload-done { display: flex; flex-direction: column; gap: 1rem; }
.upload-done-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.5rem; line-height: 1.2; }

/* --- путь входа Романа /admin (admin.js): окно входа К1.5-К1.6, сообщение К1.8; в шапке дерева «Новое · N» с точкой
   ошибки выдачи и «Ссылки»; админка - экраны во всё окно поверх дерева: «Новое от родных» К2.6, «Ссылки» К2.7, окно
   новой ссылки К2.8-К2.9; «Мои входы» в настройках (кусок под К2.3) --- */

.news-dot { width: 0.625rem; height: 0.625rem; flex: none; border-radius: 50%; background: #C8452F; box-shadow: 0 0 0 1.5px var(--on-head); }
.news-dot[hidden] { display: none; }

.sessions { margin-top: 1.25rem; }
.sessions-list { margin: 0 0 0.625rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.25rem; font-size: 1rem; }
.sessions-note { margin: 0.375rem 0 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }

/* экран админки: шапка как у дерева, лист со скруглённым верхом, колонка по центру; под ним дерево как было */
.adm-screen { position: fixed; inset: 0; z-index: 14; display: flex; flex-direction: column; background: var(--head); }
.adm-screen[hidden] { display: none; }
.adm-sheet { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); border-radius: 1.5rem 1.5rem 0 0; }
.adm-body { max-width: 75rem; margin: 0 auto; padding: 2.5rem 2rem 3rem; display: flex; flex-direction: column; gap: 1.75rem; }
.adm-body.narrow { max-width: 55rem; }
.adm-foot { max-width: 47.5rem; }

/* «Новое от родных» (К2.6, Т2.6; решение 30.11, п. 19): карточка на страницу с подложкой, по три в ряд, на узком
   экране - друг под другом. Главное число - крупно и зелёным; цвета по смыслу: красный - сломалось, нужно действие;
   охра - ждёт, делать ничего не надо; зелёный - получено */
.adm-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.5rem; align-items: start; }
.adm-card {
  display: flex; flex-direction: column; gap: 0.875rem;
  padding: 1.25rem 1.25rem 1.5rem; background: var(--surface); border-radius: 1rem;
}
.adm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.adm-card-name { min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.adm-block-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.375rem; line-height: 1.2; }
.adm-block-sub { margin: 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }
.adm-fresh { flex: none; margin: 0; display: flex; flex-direction: column; align-items: flex-end; color: var(--link); }
.adm-fresh-n { font-family: var(--serif); font-weight: 700; font-size: 2.5rem; line-height: 1; }
.adm-fresh-label { font-size: 0.8125rem; font-weight: 700; line-height: 1.3; }
.adm-problem {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.875rem;
  padding: 1rem; border-radius: 0.625rem; background: #F2DCD6; color: #9E2B20;
}
.adm-problem-item { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.25rem 0.625rem; }
.adm-problem-item svg { width: 1.25rem; height: 1.25rem; margin-top: 0.0625rem; }
.adm-problem-title { margin: 0; font-size: 0.9375rem; font-weight: 700; line-height: 1.4; }
.adm-problem-text { grid-column: 2; margin: 0; font-size: 0.9375rem; line-height: 1.45; }
.adm-problem .btn-second { background: transparent; }
.adm-kinds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.adm-kinds li { display: flex; align-items: center; gap: 0.625rem; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.adm-kinds svg { width: 1.25rem; height: 1.25rem; flex: none; color: var(--ink-2); }
.adm-grey { display: flex; flex-direction: column; gap: 0.25rem; }
.adm-grey p, .adm-none { margin: 0; font-size: 0.875rem; line-height: 1.45; color: var(--ink-2); }
.adm-none { font-size: 0.9375rem; color: var(--ink); }
.adm-waiting { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.45; color: var(--ask); }
.adm-waiting svg { width: 1.125rem; height: 1.125rem; flex: none; margin-top: 0.125rem; }
/* подпись экрана админки: в шапке телефона строка одна - короткая (Т2.6, Т2.7) */
.sub-short { display: none; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.375rem; }
.adm-actions > * { flex: 0 1 auto; }
a.btn-main, a.btn-second, a.form-back { text-decoration: none; }
.btn-main.adm-small, .btn-second.adm-small { height: 2.75rem; padding: 0 1rem; font-size: 1rem; }
.adm-note { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); }

/* «Ссылки»: группа страницы - название, строки ссылок через линию, в конце «Новая ссылка» во всю ширину,
   как «Добавить родственника» в конце «Семьи»: так её не спутать с «Отозвать» в строке */
/* вкладки страниц - тот же переключатель, что у карточки (К2.7); длинное название без короткого имени (tree.toml, tab)
   обрезается, а не растит вкладку: геометрия ряда постоянная */
.adm-tabs { margin-bottom: 0; max-width: 30rem; }
.adm-tabs .tab { min-width: 0; padding: 0 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-group { display: flex; flex-direction: column; scroll-margin-top: 1.5rem; }
.adm-group .adm-block-sub { margin: 0.125rem 0 0; }
.adm-group .adm-block-sub.bad { color: #9E2B20; }
.adm-links { display: flex; flex-direction: column; margin-top: 0.75rem; }
.adm-link { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.adm-link .letter {
  width: 2.875rem; height: 2.875rem; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 0.375rem;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink-2);
}
.adm-link .letter svg, .who-row .letter svg { width: 1.375rem; height: 1.375rem; }
.adm-link .who-text { min-width: 12rem; }
.adm-link.closed .who-name { color: var(--ink-2); }
.adm-link-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* «Скопировать» и «Скопировано» - одной ширины, состояние - цветом: заливка на две секунды */
.btn-second.adm-copy { min-width: 10.5rem; }
.btn-second.adm-copy.done { background: var(--accent); color: var(--on-head); }
.adm-empty { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.btn-second.adm-add { align-self: stretch; height: 3rem; margin-top: 0.625rem; font-size: 1rem; }

/* окна поверх: подтверждение и новая ссылка; на телефоне новая ссылка - лист снизу */
.adm-words { padding: 0.25rem 0.75rem 0.5rem 4.5rem; }
.adm-words[hidden] { display: none; }
.btn-main[hidden] { display: none; }
.adm-url { font-size: 1rem; }
.adm-status { margin: 0; font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }
.adm-status.bad { color: #9E2B20; }
.adm-status:empty { display: none; }
.adm-hint { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.9375rem; color: var(--ink-2); }
.adm-hint svg { width: 1.125rem; height: 1.125rem; flex: none; }
.adm-shade { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1.5rem; background: #2B241C80; }
.adm-shade[hidden] { display: none; }
.adm-dialog {
  width: 28rem; max-width: 100%; max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.875rem; padding: 1.75rem;
  background: var(--bg); border-radius: 1.25rem; box-shadow: 0 1rem 3rem var(--shadow);
}
.adm-dialog.adm-new { width: 37.5rem; }
.adm-dialog .head-text { display: flex; flex-direction: column; gap: 0.25rem; }
.adm-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.adm-dialog .field-label { margin: 0.25rem 0 0; }

/* --- поиск на телефоне: лист «Найти человека» (Т2.1 · найти человека) --- */

.find-shade {
  position: fixed; inset: 0; z-index: 13;
  display: flex; align-items: flex-end; justify-content: center;
  padding-top: calc(env(safe-area-inset-top) + 2.8125rem);
  background: #2B241C73;
}
.find-shade[hidden] { display: none; }
.find-sheet {
  width: 100%; max-width: 36rem; height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-radius: 1.5rem 1.5rem 0 0; overflow: hidden;
}
.find-sheet:focus { outline: none; }
.find-sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.25rem max(1.5rem, env(safe-area-inset-right)) 0.75rem max(1.5rem, env(safe-area-inset-left));
}
.find-sheet-title { margin: 0.25rem 0 0; font-family: var(--serif); font-weight: 700; font-size: 1.75rem; line-height: 1.2; }
.find-sheet-field { padding: 0 max(1.5rem, env(safe-area-inset-right)) 0.75rem max(1.5rem, env(safe-area-inset-left)); }
.find-sheet .find-input { height: 3.5rem; font-size: 1.0625rem; border-width: 1.5px; }
.find-sheet .find-input:focus { outline: 2px solid var(--accent); }
.find-sheet-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 max(1.5rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
}

/* полоса листа после прокрутки: имя или заголовок и крестик остаются вверху (компонент «Лист после прокрутки», Т3.1б).
   Места в потоке не занимает: высота 4rem погашена отступами, видна, когда шапку листа прокрутили */
.sheet-bar { display: none; }
.shade { display: none; }

/* === раскладка телефона: окно уже 768 точек или ниже 500 - телефон боком (phone.js, PHONE_QUERY; тест сверяет
   запрос). Та же страница, те же размеры текста и кнопок, меняется расположение (решение 30.11, пп. 1-6, 13-18).
   Отступы под вырез и полосу «Домой» - env(safe-area-inset-*): на компьютере они нулевые === */

@media (max-width: 767.98px), (max-height: 499.98px) {
  /* шапка - одна полоса постоянной высоты (Т2.1, Т2.4): название в одну строку, под ним подзаголовок или плашка
     переключателя; справа значки во всю высоту полосы */
  .top {
    display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, auto); grid-template-rows: 1.75rem 1.625rem;
    align-items: center; gap: 0.125rem 0;
    padding: max(calc(env(safe-area-inset-top) + 0.375rem), 0.75rem) max(1rem, env(safe-area-inset-right)) 0.875rem max(1rem, env(safe-area-inset-left));
  }
  .top-text, .top-actions { display: contents; }
  .top h1 { grid-area: 1 / 1; font-size: 1.375rem; line-height: 1.75rem; }
  .top p { grid-area: 2 / 1; margin: 0; line-height: 1.25rem; }
  body.with-views #subtitle { display: none; }   /* у экранов админки подпись остаётся: переключателя у них нет */
  .top-actions > * { grid-row: 1 / 3; margin-left: 0.5rem; }
  .find { display: none; }
  .views-box { grid-area: 2 / 1; justify-self: start; min-width: 0; max-width: 100%; height: 1.625rem; margin-left: 0; }
  .views-label {
    display: flex; align-items: center; gap: 0.375rem; min-width: 0;
    padding: 0 0.5rem 0 0.625rem; border-radius: 0.875rem;
    background: var(--head-deep); color: var(--on-head); font-size: 0.9375rem; line-height: 1.25rem; white-space: nowrap;
  }
  .views-label span { overflow: hidden; text-overflow: ellipsis; }
  .views-label svg { width: 1rem; height: 1rem; flex: none; }
  .views-box.as-family .views-label { background: var(--ask); }
  /* переключатель - системный список телефона: невидимый выбор поверх плашки */
  .views { position: absolute; inset: 0; height: 100%; padding: 0; opacity: 0; }
  .head-btn { width: 2.875rem; height: 2.875rem; }
  .news-btn { height: 2.875rem; padding: 0 0.625rem; gap: 0.25rem; border-radius: 1.4375rem; }
  #links { width: 2.875rem; padding: 0; justify-content: center; }
  #news-label, .news-btn .btn-text { display: none; }
  .news-count { display: inline; }

  /* холст: кнопки масштаба справа сверху, под «к корням» - лупа поиска (решение 30.11, п. 13) */
  .zoom { top: 1rem; right: max(1rem, env(safe-area-inset-right)); }
  .zoom-find { display: grid !important; }
  .message {
    left: max(1rem, env(safe-area-inset-left)); right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, calc(env(safe-area-inset-bottom) + 0.5rem));
  }

  /* лист снизу (пп. 4, 16): почти во всю высоту, над ним полоска шапки под затемнением; полоска не нажимается.
     На телефоне боком лист не шире 36rem и стоит по центру */
  .shade { position: fixed; inset: 0; z-index: 11; background: #2B241C73; }
  body.card-open .shade, body.settings-open .shade { display: block; }
  .panel {
    position: fixed; z-index: 12; top: calc(env(safe-area-inset-top) + 2.8125rem); bottom: 0; left: 0; right: 0;
    width: auto; max-width: 36rem; margin: 0 auto;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    border-left: none; border-radius: 1.5rem 1.5rem 0 0;
    overscroll-behavior: contain;
  }
  .head-portrait { width: 5.5rem; height: 5.5rem; }
  .sheet-bar {
    position: sticky; top: -1.5rem; z-index: 5; flex: none;   /* в окне истории - колонке с высотой окна - не ужимается */
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    height: 4.25rem; margin: -1.5rem calc(-1 * max(1.5rem, env(safe-area-inset-right))) -2.75rem calc(-1 * max(1.5rem, env(safe-area-inset-left)));
    padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
    background: var(--surface); border-bottom: 1px solid var(--line); border-radius: 1.5rem 1.5rem 0 0;
    visibility: hidden;
  }
  .scrolled > .sheet-bar { visibility: visible; }
  .sheet-bar-title {
    margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--serif); font-weight: 700; font-size: 1.1875rem; line-height: 1.3;
  }

  /* окно истории - тот же лист */
  .history-shade { align-items: flex-end; padding: calc(env(safe-area-inset-top) + 2.8125rem) 0 0; }
  .history {
    width: 100%; max-width: 36rem; height: 100%; max-height: none;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    border-radius: 1.5rem 1.5rem 0 0; box-shadow: none;
  }
  .history-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history > .sheet-bar { margin-bottom: calc(-2.75rem - 1.75rem); }   /* и промежуток между частями окна */

  /* настройки - короткий лист по содержимому, с крестиком */
  .settings {
    top: auto; bottom: 0; left: 0; right: 0; z-index: 13;
    width: auto; max-width: 36rem; margin: 0 auto;
    max-height: calc(100% - env(safe-area-inset-top) - 2.8125rem); overflow-y: auto; overscroll-behavior: contain;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem)) max(1.5rem, env(safe-area-inset-left));
    border: none; border-radius: 1.5rem 1.5rem 0 0; box-shadow: none;
  }
  .settings-close { display: grid; margin: -0.25rem -0.25rem 0 0; }

  /* окна админки поверх - подтверждения и «Новая ссылка» - листом снизу */
  .adm-shade { place-items: end center; padding: calc(env(safe-area-inset-top) + 2.8125rem) 0 0; }
  .adm-dialog, .adm-dialog.adm-new {
    width: 100%; max-width: 36rem; max-height: 100%;
    padding-bottom: max(1.75rem, calc(env(safe-area-inset-bottom) + 1rem));
    border-radius: 1.5rem 1.5rem 0 0;
  }
  .adm-body { padding: 1.5rem 1rem 2.5rem; }
  .adm-words { padding-left: 0.75rem; }
  .adm-screen .sub-full { display: none; }
  .adm-screen .sub-short { display: inline; }
  .adm-screen .top p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .adm-tabs { max-width: none; }
  /* строка ссылки на телефоне одна у всех (Т2.7): кому выдана, ниже даты и браузеры, ниже кнопки в один ряд */
  .adm-link { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem; padding: 1rem 0; }
  .adm-link .who-text { min-width: 0; }
  .adm-link-actions { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.625rem; }
  .btn-second.adm-copy { min-width: 0; }
  .adm-link-actions .btn-second.adm-small { padding: 0 0.625rem; gap: 0.5rem; }   /* «Открыть снова» в одну строку от 390 точек */
  .adm-dialog .adm-actions > * { flex: 1 1 10rem; }   /* «Поделиться» и «Скопировать» после выпуска - во всю ширину листа */

  /* снимок большим окном (Т3.6): снимок во весь экран, под ним название, дата и кнопка описания, внизу лента.
     Описание - лист в нижней половине, снимок над ним виден и не затемнён, верхняя полоса окна спрятана (Т3.6а);
     пишут заметку - лист во всю высоту, как любой лист с полем (Т3.6б). Кнопка «Скрыть описание» не нужна */
  .viewer { display: block; }
  .stage {
    position: absolute; inset: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .stage-top { padding: 0.75rem 1rem; }
  .stage-tools .pill-btn { display: none; }
  .viewer .bare-close { display: grid !important; }
  .frame { margin: 0; }
  .nav { width: 3rem; height: 3rem; }
  .nav.prev { left: 0.5rem; }
  .nav.next { right: 0.5rem; }
  .stage-info { flex: none; display: flex; flex-direction: column; gap: 0.25rem; padding: 1.25rem 1rem 0; }
  .stage-info-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; line-height: 1.25; }
  .stage-info-date { margin: 0; font-size: 0.9375rem; color: var(--on-head-2); }
  .stage-info-date[hidden] { display: none; }
  .describe-btn { justify-content: center; height: 3.5rem; margin-top: 1rem; border-radius: 1.75rem; font-size: 1.0625rem; }
  .ribbon { justify-content: flex-start; padding: 1rem; scrollbar-width: none; }   /* ленту листают пальцем, полоса не нужна */
  .viewer-side {
    display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    height: 57%; max-width: 36rem; margin: 0 auto;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    border-radius: 1.5rem 1.5rem 0 0; overscroll-behavior: contain;
  }
  .viewer.described .viewer-side { display: block; }
  .viewer.described .stage { bottom: calc(57% - 1.5rem); padding-bottom: 1.5rem; }
  .viewer.described .stage-top, .viewer.described .stage-info, .viewer.described .ribbon, .viewer.described .nav { display: none; }
  .viewer.writing .viewer-side { top: calc(env(safe-area-inset-top) + 2.8125rem); height: auto; }

  /* окно отправки снимка (Т3.9) - лист снизу почти во всю высоту, одна колонка: заголовок, у кого снимок, снимок
     и оборот, поле, кнопка. Полоска над листом затемнена и не нажимается: страница под окном недоступна (inert) */
  .upload {
    display: flex; align-items: flex-end; justify-content: center;
    padding-top: calc(env(safe-area-inset-top) + 2.8125rem);
    background: #2B241C73;
  }
  .upload-sheet {
    position: relative; width: 100%; max-width: 36rem; height: 100%;
    display: flex; flex-direction: column; gap: 1.25rem;
    overflow-y: auto; overscroll-behavior: contain;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    background: var(--surface); color: var(--ink);
    border-radius: 1.5rem 1.5rem 0 0;
  }
  .upload-sheet > * { flex-shrink: 0; }   /* лист прокручивается, а части не ужимаются до его высоты */
  .upload-sheet > .sheet-bar { margin-bottom: calc(-2.75rem - 1.25rem); }   /* и промежуток между частями листа */
  .upload-sheet .close { position: absolute; top: 1.5rem; right: max(1.5rem, env(safe-area-inset-right)); }
  .upload-sheet .upload-stage { padding: 0; color: var(--ink); display: flex; flex-direction: column; gap: 1rem; }
  .upload-sheet .upload-top { align-items: flex-start; font-size: 1rem; line-height: 1.45; color: var(--ink-2); }
  .upload-sheet .upload-top svg { margin-top: 0.125rem; }
  .upload-sheet .slots { flex: none; flex-direction: column; align-items: stretch; gap: 1.25rem; padding-top: 0; }
  .upload-sheet .slots.two .slot { max-width: 100%; }
  .upload-sheet .slot-picture { width: 100%; max-height: none; }
  .upload-sheet .slot-wait { width: 100%; background: var(--paper-2); }
  .upload-sheet .slot-name { color: var(--ink-2); }
  .upload-sheet .slot-action { color: var(--ink); }
  .upload-sheet .slot-caption.center { color: var(--ink-2); white-space: normal; }
  .upload-sheet .slot-box { width: auto; border-color: var(--line); color: var(--ink); }
  .upload-sheet .box-text { color: var(--ink-2); }
}

/* телефон боком: название и кнопка описания в один ряд, без ленты - снимку остаётся высота; описание - лист во всю
   высоту: в нижней половине окна высотой 390 точек почти ничего не видно */
@media (max-height: 499.98px) {
  .stage-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1rem; align-items: center; padding: 0.5rem 1rem 0.75rem; }
  .stage-info-title { grid-column: 1; }
  .stage-info-date { grid-column: 1; }
  .describe-btn { grid-column: 2; grid-row: 1 / 3; margin: 0; padding: 0 1.25rem; }
  .ribbon { display: none; }
  .viewer-side { top: calc(env(safe-area-inset-top) + 2.8125rem); height: auto; }
}
