/* Шрифты лежат на нашем сервере (public/fonts): никаких обращений к Google и CDN.
   Статические начертания, урезанные до латиницы и кириллицы: в PDF они встраиваются как обычные TrueType. */
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-400.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-500.woff') format('woff'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-600.woff') format('woff'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-700.woff') format('woff'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('fonts/caveat-500.woff') format('woff'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('fonts/caveat-700.woff') format('woff'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('fonts/playfair-500-italic.woff') format('woff'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('fonts/playfair-600-italic.woff') format('woff'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('fonts/playfair-700-italic.woff') format('woff'); font-weight: 700; font-style: italic; font-display: swap; }

/* Альбом Лизы — визуальный язык из холста: пастель, металлическое золото, сливовый текст */
:root {
  --pink: #F8C8DC; --blue: #BFDDF5; --butter: #FBEFA8; --lav: #DCCEF5; --mint: #C9EBD9; --cream: #FFF8EC;
  --plum: #3A2030; --plum-soft: #6E5563; --line: #EBD9DF; --mute-bg: #F3E6EA; --mute-line: #D9C4CC;
  --ok: #2F6B4F; --alert-bg: #FFF1F5; --alert-line: #E7A9BF;
  --gold: linear-gradient(135deg,#F5DF9A 0%,#D4AE55 38%,#9C7426 62%,#E4C46E 84%,#B98F38 100%);
  --serif: 'Playfair Display', Georgia, serif;
  --hand: Caveat, 'Comic Sans MS', cursive;
  --sans: Manrope, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--plum); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--plum); }
a:hover { color: var(--plum-soft); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }
h1[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img { max-width: 100%; }

/* ---------- Каркас экрана телефона ---------- */
.screen { position: relative; width: 100%; max-width: 440px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: 20px 24px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; overflow-x: hidden; }
.screen.has-bar { padding-bottom: calc(116px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 8px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-left: -10px; border: 0; background: transparent; border-radius: 12px; color: var(--plum); text-decoration: none; }
.back-link { display: inline-flex; align-items: center; gap: 4px; height: 44px; margin-left: -6px; font-weight: 600; font-size: 15px; text-decoration: none; }
.topbar-title { font-size: 14px; font-weight: 600; color: var(--plum-soft); white-space: nowrap; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--plum-soft); }

h1.title { margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 34px; line-height: 1.1; text-wrap: balance; }
h1.title.sm { font-size: 30px; }
.lead { margin: 12px 0 0; font-size: 16px; line-height: 1.5; color: var(--plum-soft); }
.muted { color: var(--plum-soft); }
.small { font-size: 14px; }
.xs { font-size: 13px; }
.hand { font-family: var(--hand); font-weight: 700; }
.bottom { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }

/* ---------- Кнопки ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; padding: 0 20px; border-radius: 999px; background: var(--pink); color: var(--plum); border: 2px solid var(--plum); box-shadow: 3px 3px 0 var(--plum); font: 700 17px var(--sans); text-decoration: none; transition: transform .08s, box-shadow .08s; }
.btn:hover { color: var(--plum); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--plum); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--mute-bg); color: var(--plum-soft); border-color: var(--mute-line); box-shadow: none; }
.btn-alt { background: var(--cream); }
.btn-text { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 0; background: transparent; font: 600 16px var(--sans); color: var(--plum); text-decoration: underline; text-underline-offset: 3px; }
.btn-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--plum); background: var(--cream); font: 600 14px var(--sans); color: var(--plum); text-decoration: none; white-space: nowrap; }
.link-btn { border: 0; background: transparent; padding: 8px 0; font: 600 14px var(--sans); color: var(--plum); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.file-label { position: relative; cursor: pointer; }
.file-label input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-label:focus-within { outline: 3px solid var(--plum); outline-offset: 2px; border-radius: 12px; }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: 15px; }
.input { height: 54px; width: 100%; border: 1.5px solid var(--plum); border-radius: 14px; background: #fff; padding: 0 16px; font: 500 17px var(--sans); color: var(--plum); }
.input.sm { height: 50px; font-size: 16px; padding: 0 14px; }
.input.name { height: 58px; border-width: 2px; font: 700 26px var(--hand); }
textarea.input { height: auto; padding: 12px 14px; font: 400 16px/1.5 var(--sans); resize: vertical; min-height: 140px; }
select.input { padding: 0 12px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233A2030' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.hint { font-size: 14px; color: var(--plum-soft); }
.error { font-size: 14px; font-weight: 600; color: #9B2F55; }
.req { color: var(--plum-soft); }

/* Переключатель-пилюля (язык, оригинал/перевод, вид) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1.5px solid var(--plum); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 44px; border: 0; background: transparent; font: 700 14px var(--sans); color: var(--plum); padding: 0 14px; }
.seg button[aria-pressed="true"] { background: var(--plum); color: var(--cream); }
.seg.lang button { min-width: 52px; min-height: 36px; }

/* ---------- Вход ---------- */
.hero { position: relative; height: 330px; margin-top: 8px; }
.hero .back-card { position: absolute; left: calc(50% - 125px); top: 40px; width: 206px; height: 250px; background: var(--blue); border-radius: 6px; transform: rotate(-7deg); box-shadow: 0 2px 0 rgba(58,32,48,.15); }
.hero .front-card { position: absolute; left: calc(50% - 119px); top: 30px; width: 214px; height: 262px; border: 3px solid transparent; background: linear-gradient(var(--pink), var(--pink)) padding-box, var(--gold) border-box; border-radius: 6px; transform: rotate(4deg); box-shadow: 0 3px 0 rgba(58,32,48,.18); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.hero .liza { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 46px; line-height: 1; }
.hero .age { font-family: var(--hand); font-weight: 700; font-size: 40px; line-height: 1; background: var(--gold); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: .6px var(--plum); }
.gold-tri { position: absolute; width: 34px; height: 34px; background: var(--gold); }
.gold-tri.tl { left: 0; top: 0; clip-path: polygon(0 0,100% 0,0 100%); }
.gold-tri.br { right: 0; bottom: 0; clip-path: polygon(100% 0,100% 100%,0 100%); }

/* ---------- Как это устроено ---------- */
.note-card { margin-top: 32px; background: var(--butter); border-radius: 4px 18px 6px 16px; padding: 22px 20px 20px; position: relative; transform: rotate(-1deg); }
.note-card::before { content: ''; position: absolute; top: -12px; left: 50%; margin-left: -36px; width: 72px; height: 22px; background: rgba(191,221,245,.85); transform: rotate(3deg); }
.note-card h2 { margin: 0 0 14px; font-family: var(--hand); font-weight: 700; font-size: 28px; line-height: 1; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.steps .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cream); border: 1.5px solid var(--plum); display: flex; align-items: center; justify-content: center; font: 700 14px var(--sans); }

/* ---------- Моя глава ---------- */
.progress-gems { margin-top: 10px; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.progress-gems .gems { display: flex; gap: 4px; }
.rows { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 14px; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; }
.row .thumb { position: relative; flex: none; width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; border-radius: 3px; }
.row .thumb-img { position: relative; display: block; box-shadow: 0 2px 0 rgba(58,32,48,.15); }
.row .thumb-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.row .body { flex: 1; min-width: 0; }
.row .row-title { font-size: 14px; font-weight: 700; }
.row .caption { font-family: var(--hand); font-weight: 700; font-size: 22px; line-height: 1.1; }
.row .excerpt { font-size: 14px; color: var(--plum-soft); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .actions { margin-top: 2px; display: flex; gap: 16px; }
.row .actions a, .row .actions .link-btn { font-size: 14px; font-weight: 600; padding: 8px 0; }
.status-ok { font-size: 13px; color: var(--ok); font-weight: 600; margin-top: 4px; }
.status-miss { font-size: 13px; color: #9B2F55; font-weight: 600; margin-top: 4px; }
.bar { margin-top: 6px; height: 6px; border-radius: 3px; background: var(--mute-bg); overflow: hidden; }
.bar > div { height: 6px; background: var(--plum); border-radius: 3px; transition: width .2s; }
.add-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; border: 2px dashed #C9A24A; border-radius: 16px; text-decoration: none; color: var(--plum); background: rgba(251,239,168,.35); font-weight: 700; font-size: 16px; }
.add-tile:hover { background: rgba(251,239,168,.6); color: var(--plum); }
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--alert-bg); border: 1.5px solid var(--alert-line); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.alert svg { flex: none; margin-top: 1px; }
.name-line { margin-top: 2px; display: flex; align-items: baseline; gap: 12px; }
.name-line .hand { font-size: 30px; line-height: 1; }

/* ---------- Форма воспоминания ---------- */
.photo-pick { margin-top: 10px; position: relative; min-height: 180px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--mint); border: 2px dashed rgba(58,32,48,.35); text-align: center; padding: 16px; }
.photo-pick .hand { font-size: 22px; }
.photo-have { margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-frame { position: relative; box-shadow: 0 2px 0 rgba(58,32,48,.15); background: #fff; }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.story-label { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1.2; }
.counter { font-size: 12px; color: var(--plum-soft); text-align: right; }

/* ---------- Оформление ---------- */
.decor-preview { margin: 14px auto 0; box-shadow: 0 2px 0 rgba(58,32,48,.18); border-radius: 4px; overflow: hidden; }
.swatches { display: flex; justify-content: space-between; gap: 6px; }
.swatch { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid rgba(58,32,48,.3); display: flex; align-items: center; justify-content: center; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--plum); }
.corner-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.corner-opt { height: 80px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0; border: 1.5px solid var(--line); background: #fff; }
.corner-opt[aria-pressed="true"] { border: 2px solid var(--plum); box-shadow: 2px 2px 0 var(--plum); }
.corner-opt .sample { position: relative; display: block; width: 40px; height: 30px; background: var(--blue); }
.corner-opt .sample svg { transform: scale(.7); }
.corner-opt .lbl { font: 600 12px var(--sans); }
.sec-title { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.sec-title span { font-weight: 500; color: var(--plum-soft); }

/* ---------- Готово ---------- */
.stack-hero { position: relative; height: 340px; margin-top: 40px; }

/* ---------- Альбом ---------- */
.album-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 24px calc(120px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
.album-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.album-head h1 { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 30px; line-height: 1.1; }
.album-controls { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.album-controls .seg { flex: 1 1 260px; max-width: 420px; }
.meter { margin-top: 8px; position: relative; height: 10px; border-radius: 5px; background: var(--mute-bg); max-width: 640px; }
.meter > div { height: 10px; border-radius: 5px; background: var(--pink); border: 1.5px solid var(--plum); min-width: 10px; }
.meter svg { position: absolute; top: -5px; margin-left: -10px; }
.live { margin-top: 16px; display: flex; align-items: center; gap: 10px; background: var(--plum); color: var(--cream); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.4; max-width: 640px; }
.live-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.tiles { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; } }
.tile { position: relative; min-height: 178px; border-radius: 6px; padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--plum); box-shadow: 0 2px 0 rgba(58,32,48,.15); }
a.tile:hover { color: var(--plum); transform: rotate(-1deg); }
.tile.draft { border: 2px dashed #C9A24A; box-shadow: none; }
.tile .tile-photo { position: relative; display: block; background: #fff; }
.tile .tile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tile-name { font-family: var(--hand); font-weight: 700; font-size: 24px; line-height: 1; text-align: center; overflow-wrap: anywhere; }
.tile .tile-status { font-size: 12px; font-weight: 500; }
.badge { position: absolute; top: 8px; right: 8px; background: var(--cream); border: 1.5px solid var(--plum); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.empty { margin-top: 24px; padding: 28px 20px; border: 2px dashed #C9A24A; border-radius: 16px; text-align: center; background: rgba(251,239,168,.35); }
.sticky-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 16px 24px calc(24px + env(safe-area-inset-bottom)); background: var(--cream); border-top: 1.5px solid var(--line); }
.sticky-bar .inner { max-width: 440px; margin: 0 auto; }
.view-toggle { display: none; }
@media (min-width: 760px) { .view-toggle { display: grid; } }

/* Подсказка «Поверни телефон» — только на телефоне вертикально */
.rotate-hint { display: none; margin-top: 8px; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; color: var(--plum-soft); text-decoration: none; }
@media (max-width: 759px) and (orientation: portrait) { .rotate-hint { display: flex; } .rotate-hint + .album-controls { margin-top: 6px; } }

/* ---------- Глава друга ---------- */
.friend-head { margin-top: 6px; position: relative; border-radius: 6px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; overflow: hidden; }
.friend-head h1 { margin: 0; font-family: var(--hand); font-weight: 700; font-size: 48px; line-height: 1; overflow-wrap: anywhere; }
.friend-meme { flex: none; background: #fff; padding: 5px; transform: rotate(4deg); box-shadow: 0 2px 0 rgba(58,32,48,.15); margin-right: 8px; }
.friend-meme img { display: block; width: 100%; height: 100%; object-fit: cover; }
.owner-bar { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 14px; font-size: 13px; line-height: 1.35; color: var(--plum-soft); }
.feed { margin-top: 18px; display: flex; flex-direction: column; gap: 32px; }
.feed article { display: flex; flex-direction: column; gap: 10px; }
.feed .ph-wrap { display: flex; justify-content: center; padding: 6px 4px; }
.feed .caption { margin: 4px 0 0; font-family: var(--hand); font-weight: 700; font-size: 26px; line-height: 1; }
.feed .story { margin: 0; background: #fff; padding: 14px 16px; font-size: 15px; line-height: 1.55; box-shadow: 0 2px 0 rgba(58,32,48,.12); white-space: pre-line; overflow-wrap: anywhere; }
.feed .tr-note { font-size: 12px; color: var(--plum-soft); }
.chapter-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--cream); border-top: 1.5px solid var(--line); padding: 0 12px env(safe-area-inset-bottom); }
.chapter-nav .inner { max-width: 440px; height: 84px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.chapter-nav a { display: flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 8px; text-decoration: none; font: 700 22px var(--hand); max-width: 34%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chapter-nav .dots { display: flex; gap: 6px; justify-content: center; }
.chapter-nav .dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--mute-line); }
.chapter-nav .dots span.on { width: 18px; border-radius: 4px; background: var(--plum); }
.chapter-nav .mid { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--plum-soft); }
.swipe-out-l { animation: outl .18s ease-in forwards; }
.swipe-out-r { animation: outr .18s ease-in forwards; }
@keyframes outl { to { transform: translateX(-40px); opacity: 0 } }
@keyframes outr { to { transform: translateX(40px); opacity: 0 } }

/* ---------- Выгрузка ---------- */
.checklist { margin: 24px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.4; }
.checklist li { display: flex; gap: 10px; }
.checklist svg { flex: none; margin-top: 1px; }
.note-yellow { margin-top: 16px; background: var(--butter); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.cover-row { margin-top: 16px; display: flex; gap: 14px; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--plum); }

/* ---------- Страницы альбома (768×768, масштабируются) ---------- */
.pg-wrap { position: relative; overflow: hidden; flex: none; }
.pg-scale { position: absolute; left: 0; top: 0; width: 768px; height: 768px; transform-origin: 0 0; }
.pg { position: relative; width: 768px; height: 768px; overflow: hidden; color: var(--plum); font-family: var(--sans); }

/* ---------- Альбом как книга (iPad и компьютер) ---------- */
.book-screen { min-height: 100vh; min-height: 100dvh; background: var(--mute-bg); display: flex; flex-direction: column; padding: 22px 40px 26px; }
.book-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.book-seg { background: var(--cream); grid-auto-columns: auto; }
.book-seg a, .book-seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; font: 700 14px var(--sans); color: var(--plum); text-decoration: none; }
.book-seg span[aria-current] { background: var(--plum); color: var(--cream); }
.book-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px 0; }
.book-holder { display: flex; align-items: center; justify-content: center; }
.book-single { position: relative; overflow: hidden; flex: none; }
.book-spread { position: relative; display: flex; overflow: hidden; border-radius: 4px; box-shadow: 0 10px 0 -4px #EBD9DF, 0 18px 0 -8px #DCCEF5; flex: none; }
.book-gutter { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(58,32,48,0) 0%, rgba(58,32,48,.12) 50%, rgba(58,32,48,0) 100%); pointer-events: none; }
.book-nav { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--plum); background: #fff; display: flex; align-items: center; justify-content: center; color: var(--plum); }
.book-nav:disabled { opacity: .35; }
.book-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.book-foot p { margin: 0; font-size: 15px; color: var(--plum-soft); }
.book-dots { display: flex; gap: 6px; }
.book-dots span { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--mute-line); }
.book-dots span.on { width: 20px; border-radius: 4px; background: var(--plum); }
@media (max-width: 700px) { .book-screen { padding: 16px 12px 20px; } .book-stage { gap: 8px; } }
/* Телефон горизонтально */
.book-screen.compact { position: relative; padding: 0; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.bookc-top { position: absolute; left: 0; right: 0; top: 0; height: 52px; padding: 4px calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bookc-top p { margin: 0; font-size: 13px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookc-close { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--cream); border: 1.5px solid var(--plum); }
.book-seg.sm { flex: none; }
.book-seg.sm button { min-height: 40px; font-size: 13px; padding: 0 10px; }
.bookc-stage { position: absolute; left: 0; right: 0; top: 56px; bottom: 26px; display: flex; align-items: center; justify-content: center; }
.bookc-prev, .bookc-next { position: absolute; top: 50%; margin-top: -24px; width: 48px; height: 48px; }
.bookc-prev { left: calc(14px + env(safe-area-inset-left)); }
.bookc-next { right: calc(14px + env(safe-area-inset-right)); }
.bookc-dots { position: absolute; left: 0; right: 0; bottom: 10px; justify-content: center; }

/* ---------- Печать ---------- */
.print-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--cream); border-bottom: 1.5px solid var(--line); }
.print-bar .btn { width: auto; min-height: 48px; }
.sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px 12px 60px; background: #EFE4E8; }
.sheet { position: relative; overflow: hidden; contain: strict; box-shadow: 0 2px 10px rgba(58,32,48,.15); }
.sheet .pg-scale { transform-origin: 0 0; }

@page { size: 200mm 200mm; margin: 0; }
@media print {
  html, body { background: #fff; }
  .print-bar, #toast { display: none !important; }
  .sheets { display: block; padding: 0; background: none; }
  .sheet { box-shadow: none; break-after: page; page-break-after: always; margin: 0; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Тост ---------- */
#toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: min(92vw, 420px); }
#toast .msg { background: var(--plum); color: var(--cream); padding: 12px 16px; border-radius: 14px; font-size: 14px; box-shadow: 0 4px 0 rgba(58,32,48,.2); }

.demo-flag { display: block; text-align: center; background: var(--lav); border-bottom: 1.5px solid var(--plum); padding: 6px 12px; font-size: 12px; font-weight: 700; }
.spinner-text { margin-top: 40vh; text-align: center; font-family: var(--hand); font-size: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.book-seg:has(button) { grid-auto-columns: minmax(0, 1fr); }
