/* Снимки (snimki.app) — стили без сборки. Палитра и сетка — из макетов «Реставрация фото — PWA».
   Светлая «бумага» для лендинга и библиотеки, тёмный нейтральный фон для студии и просмотра
   (на тёмно-сером цвета фото воспринимаются вернее). */

:root {
  --paper: #F4EFE6;
  --card: #FBF8F2;
  --line: #E2D9CA;
  --line-strong: #D6CCBB;
  --ink: #1D1A16;
  --ink-2: #3B352D;
  --muted: #6B6255;
  --accent: #B4532A;
  --accent-hover: #9C4221;
  --accent-soft: #EFE3D3;
  --accent-ink: #7A3218;
  --ok: #2F6B4F;
  --warn: #D98A1F;
  --err: #C2513A;

  --d-bg: #171512;
  --d-bg-2: #11100E;
  --d-panel: #1F1C18;
  --d-line: #2A2621;
  --d-line-2: #3A352E;
  --d-text: #EDE7DC;
  --d-muted: #A59C8E;
  --d-accent: #E39B5C;

  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 12px;
  --sidebar: 240px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* lining-nums: у Cormorant по умолчанию «старинные» цифры — 1 похожа на I, цены скачут по высоте */
body { margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
body.dark { background: var(--d-bg); color: var(--d-text); }
a { color: var(--accent-hover); }
a:hover { color: var(--accent-ink); }
body.dark a { color: var(--d-accent); }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[x-cloak], [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.dark :focus-visible { outline-color: var(--d-accent); }

.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
body.dark .muted { color: var(--d-muted); }
.sm { font-size: 14px; }
.xs { font-size: 12px; }
.bold { font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex-grow: 1; min-width: 0; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-lg { width: 26px; height: 26px; }

/* ─── Кнопки ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px;
  font-size: 15px; font-weight: 600; border: 1px solid transparent; text-decoration: none; white-space: nowrap; background: none; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-p { background: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent-hover); color: #fff; }
.btn-o { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-o:hover { border-color: var(--accent); color: var(--ink); }
.btn-d { background: #26221E; border-color: var(--d-line-2); color: var(--d-text); }
.btn-d:hover { border-color: #6B6255; color: #fff; }
body.dark .btn-p, body.dark .btn-p:hover { color: #fff; }
.ibtn { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--d-line-2); background: #26221E; color: var(--d-text);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ibtn.ghost { border-color: transparent; background: transparent; }
.chip { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--d-line-2); background: var(--d-panel); color: #CFC6B8; font-size: 13px; }
.chip.on { border-color: var(--d-accent); color: #fff; }
.kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  font-family: var(--mono); font-size: 11px; line-height: 17px; text-align: center; background: #fff; color: var(--ink-2); }
body.dark .kbd { background: transparent; border-color: #4A443B; color: #CFC6B8; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(180, 83, 42, .25); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
body.dark .spinner { border-color: rgba(227, 155, 92, .2); border-top-color: var(--d-accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Лендинг ────────────────────────────────────────────────────────────── */
.site-header { height: 72px; padding: 0 clamp(16px, 4vw, 64px); display: flex; align-items: center; gap: 32px; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo span { font-family: var(--serif); font-size: 25px; font-weight: 700; }
.logo svg { width: 28px; height: 28px; color: var(--accent); }
.site-nav { display: flex; gap: 28px; flex-grow: 1; }
.site-nav a { color: var(--ink-2); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.hero { padding: 48px clamp(16px, 4vw, 64px) 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: clamp(32px, 5vw, 72px); align-items: start; max-width: 1440px; margin: 0 auto; }
.eyebrow { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 600; }
.hero h1 { font-family: var(--serif); font-size: clamp(42px, 5.2vw, 72px); line-height: 1.02; font-weight: 600; letter-spacing: -.5px; }
.hero h1 em { color: var(--accent); }
.lead { font-size: 19px; color: #4A4238; max-width: 600px; }
.dropzone { border: 2px dashed #C9BCA6; border-radius: 18px; background: var(--card); padding: 28px; display: flex; flex-direction: column; gap: 18px; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--accent); background: #F7EBDD; }
.dz-icon { width: 60px; height: 60px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.trust { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 15px; color: var(--ink-2); }
.trust span { display: inline-flex; align-items: center; gap: 8px; }
.trust svg { color: var(--ok); }
.section { padding: 40px clamp(16px, 4vw, 64px); max-width: 1440px; margin: 0 auto; }
.section h2 { font-family: var(--serif); font-size: 44px; font-weight: 600; margin-bottom: 24px; }
.cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.cards-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.card .num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.card .price { font-family: var(--serif); font-size: 44px; font-weight: 700; line-height: 1.1; }
.card.dark { background: var(--ink); color: var(--paper); border-color: var(--ink); position: relative; }
.card.dark .muted { color: #CFC6B8; }
.badge { position: absolute; top: 18px; right: 18px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
.site-footer { border-top: 1px solid var(--line); padding: 24px clamp(16px, 4vw, 64px); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; font-size: 14px; color: var(--muted); }

/* ─── Шторка «до/после» ──────────────────────────────────────────────────── */
.compare { position: relative; overflow: hidden; border-radius: 14px; background: #2A2621; user-select: none; touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare .zoomer { position: absolute; inset: 0; transform-origin: 0 0; }
.compare .before { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.compare .divider { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.35); pointer-events: none; }
.compare .handle { position: absolute; top: 50%; left: var(--pos, 50%); width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 999px; background: #fff; color: var(--ink);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); pointer-events: none; }
.compare .tag { position: absolute; top: 14px; padding: 4px 11px; border-radius: 999px; background: rgba(20,18,15,.72); color: #F4EFE6; font-size: 13px; font-weight: 600; pointer-events: none; }
.compare .tag.l { left: 14px; } .compare .tag.r { right: 14px; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.hero-compare { aspect-ratio: 7 / 8; box-shadow: 0 30px 60px -30px rgba(60, 40, 20, .45); }
.thumbs { display: flex; gap: 8px; }
.thumbs button { padding: 0; width: 72px; height: 56px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: none; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Оболочка приложения ────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex-shrink: 0; background: var(--d-bg-2); border-right: 1px solid var(--d-line); display: flex; flex-direction: column; gap: 4px; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; color: var(--d-text); }
.sidebar .logo { color: #F4EFE6; padding: 0 8px 20px; }
.sidebar .logo span { font-size: 21px; }
.sidebar .logo svg { color: var(--d-accent); }
.nav-item { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 9px; color: #CFC6B8 !important; text-decoration: none; font-size: 15px; }
.nav-item:hover { background: var(--d-panel); color: #fff !important; }
.nav-item.on { background: #26221E; color: #fff !important; }
.nav-count { font-family: var(--mono); font-size: 12px; color: var(--d-muted); }
.nav-badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.balance-card { border: 1px solid var(--d-line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--d-bg); }
.balance-card .n { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1; }
.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
/* Студия и просмотр — рабочее место на весь экран: лента и нижняя панель всегда видны. */
@media (min-width: 1024px) {
  body.dark .shell { height: 100vh; height: 100dvh; }
  body.dark .main { height: 100%; overflow: hidden; }
}
.bottom-nav { display: none; }

/* Плашка «в работе» */
.task-watcher:empty { display: none; }
.watch { margin: 12px 24px 0; padding: 10px 14px; border-radius: 12px; display: flex; align-items: center; gap: 12px; font-size: 14px; text-decoration: none; }
.watch.active { background: var(--accent-soft); color: var(--accent-ink) !important; }
.watch.done { background: #E3EFE7; color: var(--ok) !important; }
body.dark .watch.active { background: #2B2117; color: #F0C98F !important; }
body.dark .watch.done { background: #1E2B23; color: #9FD3B2 !important; }
.watch .spinner { width: 18px; height: 18px; border-width: 2px; }

/* ─── Студия ─────────────────────────────────────────────────────────────── */
.topbar { min-height: 64px; flex-shrink: 0; padding: 10px 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--d-line); }
.studio { flex-grow: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; min-width: 0; min-height: 0; }
.crop-wrap { position: relative; max-width: 100%; overflow: hidden; background: #0E0D0B; touch-action: none; user-select: none; }
.crop-wrap img { width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.crop-rect { position: absolute; box-shadow: 0 0 0 9999px rgba(10, 9, 8, .62); outline: 1.5px solid #fff; cursor: move; }
.crop-rect .g { position: absolute; border-color: rgba(255,255,255,.35); border-style: solid; border-width: 0; pointer-events: none; }
.crop-rect .h { position: absolute; width: 22px; height: 22px; }
.crop-rect .h::after { content: ""; position: absolute; inset: 4px; border: 0 solid #fff; }
.crop-rect .h.nw { left: -8px; top: -8px; cursor: nwse-resize; } .crop-rect .h.nw::after { border-top-width: 4px; border-left-width: 4px; }
.crop-rect .h.ne { right: -8px; top: -8px; cursor: nesw-resize; } .crop-rect .h.ne::after { border-top-width: 4px; border-right-width: 4px; }
.crop-rect .h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .crop-rect .h.sw::after { border-bottom-width: 4px; border-left-width: 4px; }
.crop-rect .h.se { right: -8px; bottom: -8px; cursor: nwse-resize; } .crop-rect .h.se::after { border-bottom-width: 4px; border-right-width: 4px; }
.dims { position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 6px; background: rgba(14,13,11,.8); font-family: var(--mono); font-size: 12px; pointer-events: none; }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.tools .sep { width: 1px; height: 24px; background: var(--d-line-2); margin: 0 4px; }
.tools input[type=range] { width: 120px; accent-color: var(--d-accent); }
.panel { border-left: 1px solid var(--d-line); padding: 20px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.panel .btn { min-width: 0; padding: 0 10px; font-size: 14px; }
.panel h3 { font-size: 13px; font-weight: 600; color: var(--d-muted); text-transform: uppercase; letter-spacing: .6px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px 14px; border-radius: 11px; background: var(--d-panel); border: 1.5px solid var(--d-line-2); color: var(--d-text); }
.opt.on { background: #2B2117; border-color: var(--d-accent); }
.opt .dot { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--d-line-2); margin-top: 2px; flex-shrink: 0; }
.opt.on .dot { border-color: var(--d-accent); background: radial-gradient(circle, var(--d-accent) 0 4px, transparent 5px); }
.opt b { display: block; font-size: 15px; font-weight: 600; }
.opt small { display: block; font-size: 13px; color: var(--d-muted); line-height: 1.4; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--d-bg-2); border-radius: 10px; }
.seg button { flex: 1; height: 34px; border-radius: 8px; border: none; background: transparent; color: var(--d-muted); font-size: 14px; font-weight: 600; padding: 0 12px; }
.seg button.on { background: var(--d-line-2); color: #fff; }
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch { width: 44px; height: 26px; border-radius: 999px; border: none; background: var(--d-line-2); position: relative; padding: 0; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: left .15s; }
.switch[aria-checked=true] { background: var(--accent); }
.switch[aria-checked=true]::after { left: 21px; }
.field { width: 100%; border-radius: 10px; border: 1px solid var(--d-line-2); background: var(--d-bg-2); color: var(--d-text); padding: 10px 12px; font: inherit; font-size: 14px; resize: none; }
.film { flex-shrink: 0; border-top: 1px solid var(--d-line); padding: 14px 24px; display: flex; gap: 12px; align-items: center; overflow-x: auto; }
.film-item { position: relative; flex-shrink: 0; width: 84px; height: 84px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: #26221E; }
.film-item.on { border-color: var(--d-accent); }
.film-item img { width: 100%; height: 100%; object-fit: cover; }
.film-item .warn { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 999px; background: var(--warn); color: #11100E; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.film-item .del { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 999px; border: none; background: rgba(17,16,14,.8); color: #fff; display: none; align-items: center; justify-content: center; padding: 0; }
.film-item:hover .del, .film-item:focus-within .del { display: flex; }
.film-item .up { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(17,16,14,.6); }
.film-add { width: 84px; height: 84px; flex-shrink: 0; border-radius: 10px; border: 2px dashed var(--d-line-2); background: none; color: var(--d-muted); display: flex; align-items: center; justify-content: center; }
.note-warn { padding: 10px 12px; border-radius: 10px; background: #2B2117; border: 1px solid #5A4020; font-size: 13px; line-height: 1.4; color: #F0C98F; }
.footer-bar { flex-shrink: 0; min-height: 76px; border-top: 1px solid var(--d-line); background: var(--d-bg-2); padding: 12px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.empty-studio { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.empty-studio .dropzone { max-width: 640px; width: 100%; background: var(--d-panel); border-color: var(--d-line-2); color: var(--d-text); }
.empty-studio .dz-icon { background: #2B2117; color: var(--d-accent); }
.drop-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(17,16,14,.78); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-overlay div { padding: 40px 56px; border: 3px dashed var(--d-accent); border-radius: 24px; color: #fff; font-size: 24px; font-weight: 600; }

/* ─── Просмотр ───────────────────────────────────────────────────────────── */
.viewer { flex-grow: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.view-stage { position: relative; display: flex; align-items: center; justify-content: center; background: #1B1916; padding: 20px 20px 44px; min-height: 0; overflow: hidden; }
.view-stage .compare { border-radius: 4px; box-shadow: 0 20px 50px rgba(0,0,0,.5); max-width: 100%; }
.side-by-side { display: flex; gap: 16px; max-width: 100%; }
.side-by-side figure { margin: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; min-width: 0; }
.side-by-side .pane { overflow: hidden; border-radius: 4px; }
.side-by-side img { width: 100%; height: 100%; object-fit: cover; transform-origin: 0 0; }
.hints { position: absolute; left: 16px; bottom: 12px; font-size: 12px; color: var(--d-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dl { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #2F2A24; background: var(--d-panel); color: var(--d-text) !important; text-align: left; text-decoration: none; }
.dl:hover { border-color: #6B6255; }
.dl svg { color: var(--d-accent); width: 20px; height: 20px; flex-shrink: 0; }
.dl b { display: block; font-size: 14px; } .dl small { display: block; font-size: 12px; color: var(--d-muted); }
.upsell { border-radius: 12px; padding: 16px; background: #2B2117; border: 1px solid #4A3520; display: flex; flex-direction: column; gap: 6px; }
.upsell .t { font-family: var(--serif); font-size: 22px; font-weight: 700; color: #F4EFE6; }
.state-box { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 420px; }
.batch-bar { flex-shrink: 0; border-top: 1px solid var(--d-line); padding: 12px 16px; display: flex; align-items: center; gap: 10px; overflow-x: auto; }
.batch-bar a { position: relative; flex-shrink: 0; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: #26221E; }
.batch-bar a.on { border-color: var(--d-accent); }
.batch-bar a img { width: 100%; height: 100%; object-fit: cover; }
.batch-bar a.dim img { opacity: .35; }
.batch-bar .st { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.locked-cta { border-radius: 12px; padding: 16px; background: #2B2117; border: 1px solid var(--d-accent); display: flex; flex-direction: column; gap: 10px; }

/* ─── Библиотека ─────────────────────────────────────────────────────────── */
.lib { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 18px; }
.lib h1 { font-family: var(--serif); font-size: 40px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink) !important; }
.tile .img { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.tile .img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .img .orig { opacity: 0; transition: opacity .2s; }
.tile:hover .img .orig { opacity: 1; }
.tile .img.dim > img { opacity: .5; }
.tile .over { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.tile .over span { align-self: flex-start; font-size: 12px; font-weight: 600; background: rgba(251,248,242,.92); padding: 3px 8px; border-radius: 6px; }
.bar { height: 5px; border-radius: 999px; background: rgba(29,26,22,.2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 999px; animation: indet 1.6s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.tile .fail { position: absolute; inset: 0; background: rgba(29,26,22,.55); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 10px; font-size: 13px; }
.tile .lock { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 6px; background: rgba(29,26,22,.8); color: #fff; font-size: 12px; font-weight: 600; }
.tile b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 12px; color: var(--muted); }
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; border: 1px dashed var(--line-strong); border-radius: 16px; }

/* ─── Шторки (bottom sheet на телефоне, модалка на ПК) ──────────────────── */
dialog.sheet { border: none; padding: 0; background: var(--paper); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border-radius: 20px; box-shadow: 0 40px 80px rgba(0,0,0,.45); }
dialog.sheet::backdrop { background: rgba(29, 26, 22, .6); }
.sheet-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: calc(100vh - 48px); }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; }
.sheet-title { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.05; }
.x { width: 40px; height: 40px; border-radius: 10px; border: none; background: transparent; color: var(--ink-2); display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.x:hover { background: #EFE7DA; }
.pack { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 12px; background: #fff; border: 2px solid var(--line); text-align: left; }
.pack.on { border-color: var(--accent); }
.pack .radio { width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--line); flex-shrink: 0; }
.pack.on .radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px); }
.pack .p { font-family: var(--serif); font-size: 28px; font-weight: 700; min-width: 92px; text-align: right; }
.rec { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.summary { border-radius: 12px; background: #EFE7DA; padding: 14px 16px; font-size: 14px; color: var(--ink-2); }
.qr svg { width: 220px; height: 220px; }
.loading-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 0; text-align: center; }

.toasts { position: fixed; z-index: 70; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-size: 14px; }
.toast.error { background: #5A2419; }
.toast.success { background: #1E3B2C; }

/* ─── Страница ссылки и сообщения ────────────────────────────────────────── */
.share { max-width: 1200px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 64px); display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 1fr); gap: 56px; align-items: center; }
.share .compare { aspect-ratio: var(--ar, 3 / 4); }
.cta-dark { border-radius: 16px; background: var(--ink); color: var(--paper); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.cta-dark .t { font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1.1; }
.message { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.message h1 { font-family: var(--serif); font-size: 40px; font-weight: 600; }

/* ─── Поддержка: шторка с формой ─────────────────────────────────────────── */
.link-btn { border: none; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.nav-btn { width: 100%; border: none; background: none; text-align: left; font: inherit; }
dialog.support { width: min(520px, calc(100vw - 32px)); }
.support .sheet-head { align-items: center; }
.support .sheet-title { font-family: var(--sans); font-weight: 700; font-size: 24px; letter-spacing: -.4px; }
.support-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.input { width: 100%; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); padding: 12px 14px; font: inherit; font-size: 16px; resize: vertical; min-height: 48px;
  transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: #A89F92; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(180, 83, 42, .14); }
textarea.input { min-height: 132px; line-height: 1.45; }
.support-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink-2); }
.support-note svg { width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }
.support-err { padding: 10px 14px; border-radius: 10px; background: #F8E1DA; color: #8A2E1C; }
.support-done { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 12px 0 4px; }
.support-done .btn { margin-top: 10px; }
.support-check { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 10px rgba(47, 107, 79, .12); margin-bottom: 6px; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
body.lab .link-btn { color: #E8DFD2; }
body.lab .site-nav .link-btn { color: var(--d-muted); text-decoration: none; }
body.lab .site-nav .link-btn:hover { color: #fff; }

/* ─── Главная: тёмная «фотолаборатория» (body.lab) ─────────────────────────
   Почти чёрный фон, красный «лабораторный» свет как акцент, моно-подписи как на краю плёнки.
   Первый экран — загрузка: большая зона с метками кадрирования и живой пример «до/после». */
body.lab { --safelight: #E0492F; --safelight-soft: rgba(224, 73, 47, .14); --lab-bg: #0F0E0D; --lab-panel: #171513; --lab-line: #2A2622;
  background: var(--lab-bg); color: var(--d-text); }
body.lab .btn-p { background: var(--safelight); }
body.lab .btn-p:hover { background: #C63C24; }
body.lab .btn-o { background: transparent; border-color: var(--d-line-2); color: var(--d-text); }
body.lab .btn-o:hover { border-color: var(--safelight); color: #fff; }
body.lab .site-header { border-color: var(--lab-line); }
body.lab .logo, body.lab .logo:hover { color: var(--d-text); }
body.lab .logo svg { color: var(--safelight); }
body.lab .logo span { font-family: var(--sans); font-size: 22px; letter-spacing: -.4px; }
body.lab a { color: #E8DFD2; }
body.lab a:hover { color: #fff; }
body.lab a.btn-p, body.lab a.btn-p:hover { color: #fff; }
body.lab a.btn-d, body.lab a.btn-o { color: var(--d-text); }
body.lab .site-nav a, body.lab .nav-link { color: var(--d-muted); text-decoration: none; }
body.lab .site-nav a:hover, body.lab .nav-link:hover { color: #fff; }
body.lab .lead { color: #BDB4A7; }
body.lab .trust { color: #CFC6B8; }
body.lab .trust svg { color: var(--safelight); }
body.lab .site-footer { border-color: var(--lab-line); color: var(--d-muted); }
body.lab .section h2 { font-family: var(--sans); font-weight: 700; letter-spacing: -.8px; font-size: 40px; }

.lab-hero { max-width: 1440px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 64px) 48px; display: flex; flex-direction: column; gap: 28px; }
.lab-head { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px 48px; align-items: end; }
.lab-head .lab-tag { grid-column: 1 / -1; }
.lab-head h1 { font-size: clamp(38px, 4.6vw, 64px); line-height: 1.02; font-weight: 700; letter-spacing: -1.5px; }
.lab-head .lead { font-size: 18px; max-width: 520px; }
.lab-tag, .lab-label { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--d-muted); display: inline-flex; align-items: center; gap: 10px; }
.lab-label { color: var(--safelight); margin-bottom: 10px; }
.safelight { width: 8px; height: 8px; border-radius: 50%; background: var(--safelight); box-shadow: 0 0 0 4px var(--safelight-soft), 0 0 16px 2px rgba(224, 73, 47, .6); animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px var(--safelight-soft), 0 0 24px 6px rgba(224, 73, 47, .45); } }

.lab-stage { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.lab-drop { position: relative; min-height: 460px; border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 40px 32px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(224, 73, 47, .10), transparent 60%), var(--lab-panel); border: 1px solid var(--lab-line); transition: border-color .15s, background .15s; }
.lab-drop.drag { border-color: var(--safelight); background: radial-gradient(120% 90% at 50% 0%, rgba(224, 73, 47, .22), transparent 70%), var(--lab-panel); }
/* Метки кадрирования по углам вместо пунктирной рамки */
.lab-drop .cm { position: absolute; width: 28px; height: 28px; border: 0 solid #5A5248; pointer-events: none; }
.lab-drop .cm.tl { top: 18px; left: 18px; border-top-width: 2px; border-left-width: 2px; }
.lab-drop .cm.tr { top: 18px; right: 18px; border-top-width: 2px; border-right-width: 2px; }
.lab-drop .cm.bl { bottom: 18px; left: 18px; border-bottom-width: 2px; border-left-width: 2px; }
.lab-drop .cm.br { bottom: 18px; right: 18px; border-bottom-width: 2px; border-right-width: 2px; }
.lab-drop.drag .cm { border-color: var(--safelight); }
.lab-drop-body { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 640px; }
.lab-drop-icon { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff;
  background: var(--safelight); box-shadow: 0 0 0 10px var(--safelight-soft), 0 12px 40px -8px rgba(224, 73, 47, .7); margin-bottom: 8px; }
.lab-drop-title { font-size: clamp(22px, 2.2vw, 30px); font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.lab-drop-actions { flex-wrap: wrap; justify-content: center; margin-top: 8px; }

.lab-sample { margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
body.lab .hero-compare { aspect-ratio: auto; flex: 1; min-height: 380px; border-radius: 14px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.filmstrip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: 10px; background: #1B1917;
  /* перфорация плёнки */ background-image: radial-gradient(circle, #0F0E0D 2px, transparent 2.5px); background-size: 14px 100%; background-position: 0 -45%; }
.filmstrip button { padding: 0; border: 2px solid transparent; border-radius: 6px; background: #0F0E0D; overflow: hidden; display: flex; flex-direction: column; text-align: left; opacity: .6; transition: opacity .15s; }
.filmstrip button:hover { opacity: .9; }
.filmstrip button.on { opacity: 1; border-color: var(--safelight); }
.filmstrip img { width: 100%; height: 52px; object-fit: cover; }
.filmstrip span { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: #CFC6B8; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lab-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lab-feature { position: relative; background: var(--lab-panel); border: 1px solid var(--lab-line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.lab-feature svg { color: var(--safelight); }
.lab-feature b { font-size: 18px; }
.lab-feature .num, .lab-steps .num { font-family: var(--mono); font-size: 12px; color: var(--d-muted); }
.lab-feature .num { position: absolute; top: 22px; right: 22px; }
.lab-steps { list-style: none; margin: 16px 0 0; padding: 18px 22px; border: 1px dashed var(--lab-line); border-radius: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lab-steps li { display: flex; flex-direction: column; gap: 2px; }
.lab-steps .num { color: var(--safelight); }

body.lab .card { background: var(--lab-panel); border-color: var(--lab-line); }
body.lab .card .price { font-family: var(--sans); font-weight: 700; letter-spacing: -1px; font-size: 40px; }
body.lab .card.featured { position: relative; border-color: var(--safelight); box-shadow: 0 0 0 1px var(--safelight), 0 20px 50px -24px rgba(224, 73, 47, .55); }
body.lab .badge { background: var(--safelight); top: -11px; right: 16px; }
body.lab .kbd { background: transparent; border-color: #4A443B; color: #CFC6B8; }
/* шторки (оплата, поддержка) остаются светлыми и на тёмной главной */
body.lab dialog.sheet .btn-o { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
body.lab dialog.sheet .btn-o:hover { border-color: var(--accent); }

@media (max-width: 1023px) {
  .lab-hero { padding-top: 20px; gap: 20px; }
  .lab-head, .lab-stage { grid-template-columns: 1fr; }
  .lab-drop { min-height: 0; padding: 36px 20px; }
  body.lab .hero-compare { aspect-ratio: 4 / 5; flex: none; min-height: 0; }
  .lab-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .lab-features { grid-template-columns: 1fr; }
  .lab-drop-actions .btn { width: 100%; }
  .filmstrip span { display: none; }
  body.lab .section h2 { font-size: 30px; }
  body.lab .card .price { font-size: 30px; }
  body.lab .card { padding: 20px; }
}

/* ─── Телефон и планшет ──────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--card); border-top: 1px solid var(--line); }
  body.dark .bottom-nav { background: var(--d-bg-2); border-color: var(--d-line); }
  .bottom-nav button { border: none; background: none; padding: 0; font: inherit; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted) !important; text-decoration: none; position: relative; }
  body.dark .bottom-nav a, body.dark .bottom-nav button { color: var(--d-muted) !important; }
  .bottom-nav a.on { color: var(--accent) !important; font-weight: 600; }
  body.dark .bottom-nav a.on { color: var(--d-accent) !important; }
  .bottom-nav .nav-badge { position: absolute; top: 6px; left: 55%; min-width: 16px; height: 16px; font-size: 10px; }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .hero-compare { aspect-ratio: 4 / 5; }
  .site-nav { display: none; }
  .cards-3 { grid-template-columns: 1fr; }
  .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio, .viewer { grid-template-columns: 1fr; grid-template-rows: auto; }
  .panel { border-left: none; border-top: 1px solid var(--d-line); }
  .stage, .view-stage { min-height: 0; }
  .hints { display: none; }
  .topbar { padding: 10px 16px; }
  .footer-bar { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 12px 16px; }
  .footer-bar .kbds { display: none; }
  .film { padding: 12px 16px; }
  .lib { padding: 20px 16px 32px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .share { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; }
  .watch { margin: 12px 16px 0; }
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--nav-h) + 16px); max-width: none; }
  .desktop-only { display: none !important; }
}
@media (min-width: 1024px) { .mobile-only { display: none !important; } }
@media (max-width: 560px) {
  .site-header { gap: 12px; }
  .site-header .btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .dropzone { padding: 20px; }
  .dropzone .btn { width: 100%; }
  .section h2 { font-size: 36px; }
  .card .price { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ─── Фаза 2: альбомы, выбор, публичный альбом, камера ──────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lchip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2) !important;
  font-size: 14px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.lchip span { color: var(--muted); }
.lchip.on { background: var(--ink); color: var(--paper) !important; border-color: var(--ink); }
.lchip.on span { color: #CFC6B8; }
.lchip.dashed { border-style: dashed; color: var(--accent-hover) !important; }
.lfield, .lselect { height: 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; padding: 0 10px; font: inherit; font-size: 14px; color: var(--ink); }
.album-bar { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.select-bar { position: sticky; top: 8px; z-index: 5; border-radius: 12px; background: var(--ink); color: var(--paper); padding: 8px 8px 8px 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-dk2 { background: transparent; color: #F4EFE6; border-color: #4A443B; }
.btn-dk2:hover { border-color: #CFC6B8; color: #fff; }
.select-bar .lselect { background: transparent; color: #F4EFE6; border-color: #4A443B; }
.select-bar .lselect option { color: var(--ink); }
.tile .tick { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 999px; border: 2px solid #fff; background: rgba(29,26,22,.35);
  display: flex; align-items: center; justify-content: center; color: transparent; }
.tile .tick .icon { width: 14px; height: 14px; }
.tile.picked .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile.picked .img { outline: 3px solid var(--accent); outline-offset: 2px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.album-grid button { padding: 0; border: none; background: none; text-align: left; display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.album-grid .img { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--line); }
.album-grid img { width: 100%; height: 100%; object-fit: cover; }
dialog.viewer-modal { border: none; padding: 0; background: #171512; color: var(--d-text); width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 24px); border-radius: 16px; }
dialog.viewer-modal::backdrop { background: rgba(10, 9, 8, .8); }
.camera { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera .frame { position: absolute; left: 8%; right: 8%; top: 14%; bottom: 26%; border: 2px solid rgba(227,155,92,.95); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.camera .top { position: relative; display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 14px 0; }
.camera .hint { position: relative; align-self: center; margin-top: 12px; padding: 8px 14px; border-radius: 10px; background: rgba(0,0,0,.6); font-size: 14px; text-align: center; max-width: 90%; }
.camera .hint.warn { background: rgba(180,120,30,.92); }
.camera .bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 28px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.85) 35%);
  display: flex; align-items: center; justify-content: space-between; }
.camera .shutter { width: 76px; height: 76px; border-radius: 999px; border: 4px solid #fff; background: transparent; padding: 5px; }
.camera .shutter span { display: block; width: 100%; height: 100%; border-radius: 999px; background: #fff; transition: transform .1s; }
.camera .shutter:active span { transform: scale(.9); }
.camera .last { position: relative; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; border: 2px solid #fff; background: #222; }
.camera .last img { width: 100%; height: 100%; object-fit: cover; }
.camera .last b { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--accent); font-size: 11px; display: flex; align-items: center; justify-content: center; }
.camera .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .15s; }
.camera .flash.on { opacity: .6; transition: none; }
