/* Фотопомянник — стили приложения. Спокойный минимализм, фото — главное. */

/* Manrope — со своего сервера (не с Google: 152-ФЗ). Переменный шрифт: все начертания 200–800 в одном файле */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/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-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/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: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #ECEFF4;
  --line: #DDE1E8;
  --text: #191D24;
  --muted: #5F6672;
  --faint: #8B919C;
  --accent: #27467E;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E9F4;
  --accent-soft-ink: #27467E;
  --warn-bg: #F3EADB;
  --warn-ink: #4A3816;
  --danger: #9B3B2F;
  --sky: #A9C3EA;       /* голубой — выключенный переключатель «Особенно трудно» */
  --coral: #EE7A5F;     /* коралловый — «Особенно трудно» */
  --coral-soft: #FCE9E3;
  --ph: #E2E6EC;
  --ph-ink: #A3ABB8;
  --shadow: 0 1px 2px rgba(25, 29, 36, .06), 0 8px 24px rgba(25, 29, 36, .08);
  --radius: 16px;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --fs: 1;   /* множитель всех размеров шрифта; «Крупный текст» в профиле — 1.2 */
  color-scheme: light;
}

/* Тёмная тема: системная, и всегда — в режиме листания */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1218;
    --surface: #171B22;
    --surface-2: #212631;
    --line: #2A303B;
    --text: #F6F7F9;
    --muted: #9AA3B2;
    --faint: #6C7484;
    --accent: #8FAEE0;
    --accent-ink: #0E1A30;
    --accent-soft: #1A2436;
    --accent-soft-ink: #AFC4EA;
    --warn-bg: #3A3020;
    --warn-ink: #EBD9B4;
    --danger: #E08B7E;
    --sky: #3F5F91;
    --coral: #F08A6F;
    --coral-soft: #3A2620;
    --ph: #232934;
    --ph-ink: #4C5566;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"], .pray {
  --bg: #0F1218;
  --surface: #171B22;
  --surface-2: #212631;
  --line: #2A303B;
  --text: #F6F7F9;
  --muted: #9AA3B2;
  --faint: #6C7484;
  --accent: #8FAEE0;
  --accent-ink: #0E1A30;
  --accent-soft: #1A2436;
  --accent-soft-ink: #AFC4EA;
  --sky: #3F5F91;
  --coral: #F08A6F;
  --coral-soft: #3A2620;
  --ph: #232934;
  --ph-ink: #4C5566;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root.big-text { --fs: 1.2; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: calc(16px * var(--fs));
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
img { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { min-height: 100%; }

/* Колонка приложения: на телефоне во всю ширину, на компьютере — по центру */
.screen {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.screen-body {
  flex: 1;
  padding: calc(20px + var(--safe-top)) 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.has-nav .screen-body { padding-bottom: calc(96px + var(--safe-bottom)); }

/* Шапки */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px;
}
.topbar-title { font-size: calc(16px * var(--fs)); font-weight: 600; text-align: center; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wordmark { margin: 0; line-height: 0; }
.wordmark .logo { width: 66%; max-width: 360px; margin: 0 auto; }   /* на главной — две трети ширины экрана, по центру */
.logo { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.brand-link {
  display: inline-flex; align-items: center; gap: 10px; align-self: center; min-height: 44px;
  color: var(--muted); font-size: calc(13px * var(--fs)); font-weight: 600; text-decoration: none;
}
.brand-link:hover span { text-decoration: underline; }
.h1 { margin: 0; font-size: calc(26px * var(--fs)); font-weight: 700; letter-spacing: -0.02em; }
.section-title { font-size: calc(18px * var(--fs)); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: calc(13px * var(--fs)); }

/* Кнопки */
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn.plain { border: none; background: none; }
.btn {
  height: 52px; padding: 0 20px; border: none; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  font-size: calc(16px * var(--fs)); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; width: 100%;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--danger); height: 44px; }
.btn.small { height: 36px; width: auto; padding: 0 14px; border-radius: 18px; font-size: calc(14px * var(--fs)); }
.link-btn { border: none; background: none; padding: 6px 0; color: var(--muted); font-size: calc(13px * var(--fs)); font-weight: 600; text-decoration: underline; }
.pill {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  font-size: calc(14px * var(--fs)); font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}

/* Карточки и строки */
.card { background: var(--surface); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.row {
  width: 100%; min-height: 68px; border: none; border-radius: var(--radius); background: var(--surface);
  padding: 12px 16px; display: flex; align-items: center; gap: 14px; text-align: left; text-decoration: none; color: var(--text);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: calc(16px * var(--fs)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: calc(13px * var(--fs)); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Напоминание о ближайшей памятной дате */
.reminder {
  min-height: 64px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text);
  padding: 10px 14px; display: flex; align-items: center; gap: 12px; text-decoration: none;
}
.reminder.today { background: var(--accent); color: var(--accent-ink); }
.reminder-when { font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--accent-soft-ink); }
.reminder.today .reminder-when { color: inherit; opacity: .85; }
.reminder-what { font-size: calc(15px * var(--fs)); font-weight: 600; }
.date-badge {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1;
}
.date-badge b { font-size: calc(17px * var(--fs)); }
.date-badge span { font-size: calc(10px * var(--fs)); font-weight: 600; margin-top: 2px; }
.reminder.today .date-badge { background: var(--accent-ink); color: var(--accent); }

/* Фото и заглушки */
.ph {
  background: var(--ph); color: var(--ph-ink);
  display: flex; align-items: flex-end; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.ph svg { width: 78%; height: auto; }
.thumb { width: 72px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.thumb img, .tile-photo img, .photo-box img { width: 100%; height: 100%; object-fit: cover; }
.avatar { width: 40px; height: 40px; border-radius: 20px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatars { display: flex; }
.avatars .avatar { width: 34px; height: 34px; border: 2px solid var(--surface); }
.avatars .avatar + .avatar { margin-left: -12px; }

.progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* Сетка людей в списке */
.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { border: none; background: none; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); min-width: 0; }
.tile-photo { aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; width: 100%; }
.tile-name { font-size: calc(14px * var(--fs)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-caption { font-size: calc(12px * var(--fs)); color: var(--muted); margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-add .tile-photo { background: var(--surface); border: 1.5px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* Формы */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field-label { font-size: calc(13px * var(--fs)); font-weight: 600; color: var(--muted); }
.input {
  height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: 0 14px; font-size: calc(16px * var(--fs)); width: 100%; min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { font-size: calc(12px * var(--fs)); color: var(--muted); }
.note-preview { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; font-size: calc(15px * var(--fs)); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: calc(14px * var(--fs)); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg button { height: 40px; border: none; border-radius: 9px; background: none; color: var(--muted); font-size: calc(14px * var(--fs)); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: calc(14px * var(--fs)); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-error { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px; font-size: calc(14px * var(--fs)); }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 12px 14px; font-size: calc(13px * var(--fs)); line-height: 1.45; }
/* «Нет интернета — показано сохранённое»: маленькая пилюля сверху, не мешает нажимать */
.net-badge { position: fixed; top: calc(var(--safe-top, 0px) + 6px); left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: calc(12px * var(--fs));
  opacity: .88; pointer-events: none; white-space: nowrap; }
.net-badge[hidden] { display: none; }

.photo-box { width: 200px; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; margin: 0 auto; }
.photo-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.sticky-actions {
  position: sticky; bottom: 0; margin: 0 -20px -24px; padding: 12px 20px calc(20px + var(--safe-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}

/* Установка на экран «Домой» */
.install-card {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 40px 14px 14px; display: flex; align-items: center; gap: 12px;
}
.install-icon { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; }
.install-close { position: absolute; top: 2px; right: 2px; width: 36px; height: 36px; color: var(--faint); }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.install-steps li { display: flex; gap: 14px; align-items: flex-start; }
.install-step-icon {
  position: relative; width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface); color: var(--accent); display: flex; align-items: center; justify-content: center;
}
.install-step-num {
  position: absolute; top: -6px; left: -6px; width: 20px; height: 20px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: calc(11px * var(--fs)); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.install-result { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }

/* Подсказка свайпа в листалке */
.swipe-hint {
  position: absolute; inset: 0; z-index: 5; border-radius: 24px; background: rgba(14, 20, 19, .96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  color: #F6F7F9; text-align: center; padding: 24px; animation: fade .25s;
}
.swipe-hint .hand { animation: swipe-hand 1.6s ease-in-out infinite; }
.swipe-hint b { font-size: calc(18px * var(--fs)); font-weight: 600; }
.swipe-hint span { font-size: calc(14px * var(--fs)); opacity: .85; max-width: 260px; }
@keyframes swipe-hand {
  0% { transform: translateX(50px) rotate(-8deg); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translateX(-60px) rotate(-14deg); opacity: 1; }
  100% { transform: translateX(-60px) rotate(-14deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .swipe-hint .hand { animation: none; } }

/* Подсказка-карточка внутри экрана */
.hint-card { position: relative; background: var(--accent-soft); border-radius: var(--radius); padding: 16px 44px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.hint-card .icon-btn { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; color: var(--accent-soft-ink); }
.hint-card .btn { align-self: flex-start; }

/* Выбор тарифа */
.plan-option {
  width: 100%; min-height: 64px; padding: 12px 16px; border-radius: 14px; text-align: left;
  border: 1.5px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 12px;
}
.plan-option[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Переключатель-ссылки (Альбом | Записки) */
.seg-link {
  height: 40px; border-radius: 9px; color: var(--muted); font-size: calc(14px * var(--fs)); font-weight: 500; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
}
.seg-link[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }

/* Записки в храм */
.note-row { padding: 6px 0; display: flex; align-items: flex-start; gap: 12px; }
.note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.note-pick { width: 22px; height: 22px; margin: 9px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.note-row.off .note-main { opacity: .4; }
.note-row.off .note-input { text-decoration: line-through; }
.note-input {
  border: none; background: none; padding: 6px 0; font-size: calc(16px * var(--fs)); font-weight: 500; width: 100%;
  border-bottom: 1px dashed transparent;
}
.note-input:focus { outline: none; border-bottom-color: var(--accent); }

/* Плашка «Памятные дни в телефоне» */
.cal-banner { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }

/* Печать: предпросмотр страницы */
.print-preview { background: var(--surface-2); border-radius: 20px; padding: 24px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.page-canvas { background: #FFFFFF; box-shadow: 0 1px 2px rgba(25, 29, 36, .08), 0 8px 24px rgba(25, 29, 36, .12); }
.print-preview .between { width: 100%; max-width: 300px; }
.has-nav .sticky-actions { bottom: calc(64px + var(--safe-bottom)); margin-bottom: -12px; padding-bottom: 12px; }
.icon-btn:disabled { opacity: .3; cursor: default; }
select.input { appearance: auto; }

/* Нижняя навигация */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.nav-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 64px; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: calc(12px * min(var(--fs), 1.1)); font-weight: 500; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* Календарь */
.month { background: var(--surface); border-radius: 20px; padding: 14px 10px; box-shadow: var(--shadow); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.month-head { font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.day { height: 44px; border: none; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.day-num { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: calc(14px * var(--fs)); }
.day.church .day-num { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.day.today .day-num { box-shadow: inset 0 0 0 1.5px var(--text); }
.day.has .day-num { font-weight: 700; }
.day-dot { width: 4px; height: 4px; border-radius: 2px; }
.day.has .day-dot { background: var(--accent); }
.day[aria-pressed="true"] .day-num { background: var(--text); color: var(--bg); }
.day:disabled { cursor: default; }

/* Листание */
.pray {
  position: fixed; inset: 0; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; overscroll-behavior: none; touch-action: none;
}
.pray-inner {
  flex: 1; width: 100%; max-width: 520px; margin: 0 auto; min-height: 0;
  padding: calc(12px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.pray-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pray-top .icon-btn { background: var(--surface); border: none; }
.pray-count { min-width: 44px; text-align: right; font-size: calc(14px * var(--fs)); color: var(--muted); font-variant-numeric: tabular-nums; }
.pray .progress { height: 3px; }
.pray .progress > div { background: var(--text); }
.deck { position: relative; flex: 1; min-height: 0; margin-top: 8px; }
.deck-card {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  will-change: transform; user-select: none; -webkit-user-select: none;
}
.deck-card.behind { transform: scale(.94) translateY(-14px); opacity: .5; pointer-events: none; }
.deck-card.behind > :not(.deck-photo):not(.deck-quote),
.deck-card.behind .deck-quote > * { visibility: hidden; }

/* Цитата в листалке */
.deck-quote {
  flex: 1; min-height: 0; margin: 0; border-radius: 24px; background: var(--surface);
  padding: 32px 28px; display: flex; flex-direction: column; gap: 20px; overflow: auto;
  /* Блок прокручивается (длинная цитата) — без этого браузер забирал любой жест себе и свайп не работал.
     Браузеру — только вертикальная прокрутка, горизонтальный свайп — листанию (как у карточки молитвы) */
  touch-action: pan-y;
}
/* По центру — отступами «auto», а не justify-content: center: при центровке длинная цитата уходила верхом
   за край, и туда нельзя было прокрутить. Так короткая стоит по центру, а длинная начинается сверху и листается вниз */
.deck-quote > :first-child { margin-top: auto; }
.deck-quote > :last-child { margin-bottom: auto; }
.quote-mark { font-family: Georgia, "Times New Roman", serif; font-size: 72px; line-height: 1; height: 36px; color: var(--accent); }
.quote-text { margin: 0; font-size: calc(22px * var(--fs)); line-height: 1.5; white-space: pre-line; }
.quote-text.m { font-size: calc(19px * var(--fs)); }
.quote-text.s { font-size: calc(17px * var(--fs)); }
.quote-text.xs { font-size: calc(16px * var(--fs)); line-height: 1.45; }
.quote-author { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: calc(15px * var(--fs)); line-height: 1.35; }
.quote-avatar {
  border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, "Times New Roman", serif; font-size: 28px; line-height: 1;
}
.quote-avatar img { width: 100%; height: 100%; object-fit: cover; }
.quote-avatar span { transform: translateY(18%); }
.deck-photo { flex: 1; min-height: 0; border-radius: 24px; overflow: hidden; background: var(--ph); position: relative; }
.deck-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.deck-photo .ph { position: absolute; inset: 0; }
.deck-photo .ph svg { width: 60%; max-width: 260px; }
.deck-name { font-size: calc(34px * var(--fs)); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.deck-meta { font-size: calc(16px * var(--fs)); color: var(--muted); }
/* Пояснение — всегда одной строкой (иначе фото становится ниже). Не влезает — медленно прокручивается
   туда и обратно с паузами по краям (класс marquee и --shift ставит pray.js) */
.deck-caption { font-size: calc(17px * var(--fs)); color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-caption.marquee { text-overflow: clip; }
.deck-caption.marquee > span { display: inline-block; animation: caption-scroll var(--dur, 8s) ease-in-out 1s infinite alternate; }
@keyframes caption-scroll { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--shift, 0)); } }
@media (prefers-reduced-motion: reduce) {
  .deck-caption.marquee { text-overflow: ellipsis; }
  .deck-caption.marquee > span { display: inline; animation: none; }
}
.pray-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.round { width: 56px; height: 56px; border-radius: 28px; border: 1px solid var(--line); background: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.round.solid { background: var(--text); color: var(--bg); border: none; }
.round:disabled { opacity: .3; }
.pray-hint { font-size: calc(13px * var(--fs)); color: var(--faint); text-align: center; }
.pray-end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 0 12px; }

/* Нижний лист (диалоги) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(14, 20, 19, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
.sheet {
  width: 100%; max-width: 520px; background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px;
  max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  animation: rise .2s ease-out;
}
.sheet-title { font-size: calc(18px * var(--fs)); font-weight: 700; }
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* Кадрирование */
.cropper { position: fixed; inset: 0; z-index: 60; background: #0A0D12; color: #F6F7F9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; touch-action: none; }
.cropper canvas { border-radius: 18px; touch-action: none; cursor: grab; max-width: 100%; }
.cropper canvas:active { cursor: grabbing; }
.cropper input[type="range"] { width: min(320px, 80vw); accent-color: #F6F7F9; }
.cropper .row-btns { display: flex; gap: 12px; width: min(360px, 100%); }
.cropper .btn.secondary { background: #212631; color: #F6F7F9; border: none; }
.cropper .btn { background: #F6F7F9; color: #0F1218; }

/* Уведомления */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom)); transform: translateX(-50%); z-index: 70;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: calc(14px * var(--fs));
  max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: rise .2s ease-out;
}

/* Вход */
.auth { max-width: 420px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: calc(48px + var(--safe-top)) 20px 32px; display: flex; flex-direction: column; gap: 24px; justify-content: center; }
.auth-logo { width: 56px; height: 56px; }

.empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Перестановка карточек в списке */
.reorder { display: flex; flex-direction: column; gap: 8px; }
.reorder-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; padding: 6px 4px 6px 6px; box-shadow: var(--shadow); position: relative; }
.reorder-row.dragging { z-index: 2; box-shadow: 0 8px 28px rgba(25, 29, 36, .22); }
.reorder-grip { width: 36px; height: 52px; display: flex; align-items: center; justify-content: center; color: var(--faint); cursor: grab; touch-action: none; flex-shrink: 0; }
.reorder-row.dragging .reorder-grip { cursor: grabbing; }
.reorder-thumb { width: 39px; height: 52px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.reorder-thumb > * { width: 100%; height: 100%; }
.reorder-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Дата тремя полями */
.date3 { display: flex; align-items: center; gap: 4px; }
.date3 .date-part { width: 3.1em; padding: 0 6px; text-align: center; flex: none; }
.date3 .date-part.y { width: 4.4em; }
.date3 .date-dot { color: var(--faint); font-weight: 600; }
/* Строка для записки — редактируемое поле */
.note-edit { display: flex; flex-direction: column; gap: 4px; }
.note-edit .note-kind { font-size: calc(13px * var(--fs)); color: var(--muted); }
.note-edit input { font-weight: 600; }

/* «Молитесь не одни» */
.together { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: calc(13px * var(--fs)); color: var(--muted); line-height: 1.45; }
.together:empty { display: none; }
.together .link-btn { padding: 4px 0; font-size: calc(12px * var(--fs)); }
.together-end { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: calc(14px * var(--fs)); color: var(--muted); text-align: center; line-height: 1.45; max-width: 320px; }
.together-home { text-align: center; font-size: calc(14px * var(--fs)); color: var(--muted); line-height: 1.45; margin-top: -6px; }
.together-home:empty { display: none; }
.together-now { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: live-pulse 2.4s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Текст молитвы */
.prayer-text { font-size: calc(18px * var(--fs)); line-height: 1.65; }
.prayer-text p { margin: 0 0 14px; }
.deck-card.prayer-card { justify-content: center; background: var(--bg); padding: 0 4px; }
.prayer-scroll { overflow-y: auto; touch-action: pan-y; max-height: 100%; padding: 8px 6px; }
.deck-card.behind .prayer-scroll { visibility: hidden; }
.prayer-card .prayer-text { font-size: calc(19px * var(--fs)); text-align: left; }
.prayer-card .prayer-title { font-size: calc(15px * var(--fs)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }

/* Именины в карточке */
.nameday-summary { display: flex; flex-direction: column; gap: 2px; font-size: calc(15px * var(--fs)); }
.nameday-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nameday-row { display: flex; align-items: center; gap: 12px; }
.nameday-label { width: 70px; }

/* Поиск по имени */
.search { position: relative; }
.search-input { padding-left: 42px; padding-right: 42px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); display: inline-flex; pointer-events: none; }
.search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border: none; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
}

/* Код подарка */
.gift-code {
  font-size: calc(22px * var(--fs)); font-weight: 700; letter-spacing: .08em; text-align: center;
  padding: 10px; border-radius: 12px; background: var(--surface-2); user-select: all; -webkit-user-select: all;
}

/* «Особенно трудно»: переключатель (выключен — голубой, включён — коралловый) и метки */
.hard-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px;
  padding: 10px 14px; border-radius: 14px; background: var(--surface); cursor: pointer;
}
.hard-toggle.on { background: var(--coral-soft); }
.hard-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hard-toggle-title { font-weight: 600; }
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; border-radius: 16px; background: var(--sky); transition: background .2s;
  pointer-events: none;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--coral); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
/* Метка на фото в списке */
.tile { position: relative; }   /* метка ложится на угол фото — оно в плитке первое */
.hard-dot {
  position: absolute; top: 8px; right: 8px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--coral);
}
/* Строка списка «Особенно трудно» на главной */
.row.hard-row { background: var(--coral-soft); }
.hard-badge {
  width: 44px; height: 44px; border-radius: 50%; background: var(--coral); color: #FFFFFF; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* Нижнее меню из шести пунктов (у священников — «Храм»): чуть мельче подписи */
.nav-6 .nav-inner { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav-6 a { font-size: calc(11px * min(var(--fs), 1.05)); letter-spacing: -0.01em; }

/* Раздел «Храм»: списки и строки имён */
.temple-kind { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-soft-ink); }
.temple-kind.repose { background: var(--surface-2); color: var(--muted); }
.temple-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; background: none; border: none; text-align: left; color: var(--text); font: inherit; }
.temple-row-name { font-weight: 600; overflow-wrap: anywhere; }
.temple-row-note { font-size: calc(12px * var(--fs)); color: var(--muted); }
.temple-count { font-size: calc(13px * var(--fs)); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.temple-count.today { color: var(--accent); font-weight: 700; }
.temple-done summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }

/* Чтение на проскомидии: страница имён без прокрутки, размер шрифта — кнопками A− / A+ */
.temple-read { --tr-fs: 28px; }
.tr-page { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: calc(var(--tr-fs) * .45); padding: 4px 2px;
  touch-action: none; user-select: none; -webkit-user-select: none; will-change: transform; }
.tr-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; flex: none; height: auto; }
.tr-row { display: flex; align-items: baseline; gap: 12px; }
.tr-main { flex: 1; min-width: 0; }
.tr-name { font-size: var(--tr-fs); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.tr-note { font-size: max(13px, calc(var(--tr-fs) * .45)); color: var(--muted); margin-top: 2px; }
.tr-count { font-size: max(13px, calc(var(--tr-fs) * .42)); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-count.today { color: var(--accent); font-weight: 700; }
.tr-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.tr-font { display: flex; gap: 8px; }
.tr-font button { min-width: 52px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; }

/* «Все списки вперемешку» на главной */
.shuffle-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-soft-ink); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; }

/* Документ сайта (соглашение, политика…) в нижнем листе приложения — см. ui.js */
.doc-sheet { line-height: 1.55; font-size: calc(15px * var(--fs)); }
.doc-sheet h2 { font-size: calc(16px * var(--fs)); margin: 18px 0 6px; }
.doc-sheet p, .doc-sheet li { margin: 0 0 8px; }
.doc-sheet ul, .doc-sheet ol { padding-left: 20px; margin: 0 0 8px; }
.doc-sheet .meta { color: var(--muted); font-size: calc(13px * var(--fs)); }
.doc-sheet mark { background: #FFE58A; color: #191D24; padding: 0 3px; border-radius: 3px; }

/* «Ещё сведения» в карточке человека — свёрнутые необязательные поля (person.js) */
.more-fields { background: var(--surface); border-radius: 16px; padding: 4px 16px; box-shadow: var(--shadow); }
.more-fields > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 12px 24px 12px 0; position: relative; }
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::after { content: ''; position: absolute; right: 4px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.more-fields[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.more-title { font-weight: 600; font-size: calc(16px * var(--fs)); }
.more-sub { color: var(--muted); font-size: calc(13px * var(--fs)); }
.more-fields > .stack { padding: 4px 0 16px; }

/* Закрытый фотопомянник участников марафона — общие стили двух приложений. */
.prayer-circle { width: 100%; min-width: 0; overflow-wrap: anywhere; }
.prayer-circle > *, .prayer-circle form, .prayer-circle .field { min-width: 0; max-width: 100%; }
.prayer-circle input[type=file] { width: 100%; min-width: 0; }
.prayer-circle .btn, .prayer-invitation .btn { height: auto; min-height: 52px; padding: 12px 16px; white-space: normal; text-align: center; }
.prayer-consent span { min-width: 0; }
.prayer-invitation p, .prayer-circle p { margin: 0; line-height: 1.55; }
.prayer-circle .card { gap: 12px; }
.prayer-card-preview { width: min(240px, 100%); aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.prayer-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.prayer-consent { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.prayer-consent input { flex-shrink: 0; margin-top: 5px; }
.prayer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.prayer-tile { border: 0; padding: 0; background: transparent; color: var(--text); display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; cursor: pointer; }
.prayer-tile img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; }
.prayer-portrait { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.prayer-portrait img { max-width: 100%; max-height: 56vh; aspect-ratio: 3 / 4; object-fit: contain; border-radius: 14px; }
.prayer-portrait figcaption { font-size: calc(26px * var(--fs)); font-weight: 600; text-align: center; }
.prayer-controls { display: flex; gap: 12px; }
.prayer-controls .btn { flex: 1; }

.prayer-circle-help summary { cursor:pointer;color:var(--accent);font-size:14px; }
.prayer-circle-help[open] > .stack { margin-top:12px; }
