/* ===== AUTH PRE-PAINT — скрываем кнопку «Войти» если в localStorage сессия ===== */
html.auth-likely-logged-in #loginBtn { display: none !important; }

/* ===== A11Y: скрытая метка только для скринридера (не display:none) ===== */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== ПЕРЕМЕННЫЕ ===== */
:root {
  --bg: #faf6ef;
  --bg-alt: #f2ead8;
  --fg: #1c1410;
  --muted: #6b5c4e;
  --accent: #b8652a;
  --accent-hover: #9a5020;
  --accent-soft: #e8b88a;
  --line: rgba(28,20,16,0.12);
  --card: #ffffff;
  --dark: #221510;
  --sans: 'Inter', sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(28,20,16,0.10);
}

/* ===== СБРОС ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}
/* Sticky footer — единый для ВСЕХ страниц (прецедент 30.05: подвал «уезжал» вверх
   на широких мониторах при коротком контенте — баг был на каждой странице, кроме
   album). Селектор :has(> footer): прижимает футер к низу окна, только если <footer>
   есть прямым потомком <body> (т.е. это нижний колонтитул страницы, не модалка).
   <main> растягивается на свободную высоту. Прогрессивно: браузеры без :has() (старые)
   просто игнорируют правило → поведение не хуже текущего, без регрессии. */
body:has(> footer) { display: flex; flex-direction: column; min-height: 100vh; }
body:has(> footer) > main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ===== КОНТЕЙНЕР ===== */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ===== КНОПКИ ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-alt); }
.btn-large { padding: 15px 26px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== ШАПКА ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,246,239,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--fg);
}
.logo em {
  color: var(--accent);
  font-weight: 400;
  font-size: 1.3em;
}
nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-link {
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--fg); }
.nav-link--legal { display: inline !important; }

/* Login button in header — dark pill */
.btn-login {
  background: var(--fg) !important;
  color: var(--bg) !important;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  gap: 8px;
}
.btn-login svg { flex-shrink: 0; }
.btn-login:hover { background: #3a2a20 !important; transform: none; }

.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ===== АВТОРИЗАЦИЯ В ШАПКЕ ===== */
#authArea { display: flex; align-items: center; }

/* Дропдаун пользователя */
.user-menu { position: relative; display: flex; align-items: center; }
.user-menu-trigger { display: flex; align-items: center; gap: 8px; cursor: default; }
.user-menu-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.user-menu-avatar svg { stroke: #fff; display: block; }
.user-menu-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.user-menu-avatar-initials { font-size: 13px; font-weight: 600; line-height: 1; }
.user-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 10px;
  z-index: 1000;
  min-width: 220px;
}
.user-menu:hover .user-menu-dropdown { display: block; }
.user-menu-inner {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.07);
  overflow: hidden;
}
.user-menu-head {
  padding: 12px 16px;
  font-size: 13px;
  color: #888;
  background: #faf8f5;
  border-bottom: 1px solid #f0ece4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-item {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  color: #2a2a2a;
  text-decoration: none;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background 0.12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(184,101,42,0.08);
}
.user-menu-item-admin { color: var(--fg); font-weight: 500; font-size: 13px; }
.user-menu-item:hover { background: #faf8f5; color: var(--fg); }
.user-menu-item-accent { color: var(--fg) !important; font-weight: 600; }
.user-menu-item-accent:hover { background: #faf8f5 !important; }
.user-menu-item-bonus { color: var(--accent) !important; font-weight: 600; }
.user-menu-item-bonus:hover { background: rgba(184,101,42,0.06) !important; color: var(--accent-hover) !important; }
.user-menu-item-logout { color: #999; }
.user-menu-item-logout:hover { color: #c0392b !important; background: rgba(192,57,43,0.05) !important; }
.user-menu-sep { height: 1px; background: #f0ece4; }
.user-menu-credits-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(184,101,42,0.05);
  border-bottom: 1px solid #f0ece4;
}

#userInfo { display: flex; align-items: center; gap: 12px; }
#userName {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name-link { color: inherit; text-decoration: none; font-weight: 500; }
.user-name-link:hover { color: var(--fg); }
.user-balance {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(184,101,42,0.1);
  color: var(--accent);
  border-radius: 99px;
  white-space: nowrap;
}
.user-balance.is-empty {
  background: rgba(179,51,51,0.1);
  color: #b33;
}

/* ===== ГЕРОЙ ===== */
.hero {
  padding: 24px 0 60px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 56px;
  align-items: center;
}
.hero-text { padding-top: 0; min-width: 0; }
/* Плашка-фон под h1 чтобы текст читался поверх георгиевской ленты */
.hero h1 {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  background: rgba(250, 246, 239, 0.92);
  padding: 16px 26px 18px;
  border-radius: 14px;
  box-shadow: 0 8px 32px -10px rgba(40,20,10,0.22);
  backdrop-filter: blur(2px);
  white-space: nowrap;
  line-height: 1.1;
}
.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: rgba(250, 246, 239, 0.92);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
}
h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.97;
  letter-spacing: -2.2px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 24px;
}
h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.hero-desc {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 460px;
  margin-bottom: 34px;
}
.hero-btns {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  align-items: center;
}
.btn-accent-pill {
  background: var(--accent);
  color: #fff;
  padding: 15px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-accent-pill:hover { background: var(--accent-hover); }
.btn-header-cta { padding: 9px 18px; font-size: 13px; transition: background 0.2s, color 0.2s, border-color 0.2s; }
/* Scroll-aware: пока #upload в viewport — header CTA становится outline (не дублирует upload-CTA) */
.btn-accent-pill.btn-header-cta.is-outline {
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--line-soft, #b9a989);
  padding: 7.5px 16.5px;
}
.btn-accent-pill.btn-header-cta.is-outline:hover {
  background: rgba(0,0,0,0.04);
  color: var(--fg);
}
/* Hero CTA — крупная (×1.5 от базы), только в hero-секции */
.hero-btns .btn-accent-pill { padding: 22px 40px; font-size: 21px; }
.btn-outline-pill {
  border: 1px solid var(--line);
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
}
.btn-outline-pill:hover { border-color: var(--accent); background: rgba(184,101,42,0.04); }

.hero-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-bullets li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--fg);
}
.hero-bullet-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(184,101,42,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}

.privacy-note {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
  text-align: center;
}

.hero-counter {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero-avatars { display: flex; }
.hero-avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  border: 2px solid var(--bg);
  margin-left: -9px;
  object-fit: cover;
  display: block;
}
.hero-avatars .hero-avatar:first-child { margin-left: 0; }
.hero-counter-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}
.hero-counter-text b {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  margin-right: 6px;
}
.counter-flash { animation: counterFlash 600ms ease-out; }
@keyframes counterFlash {
  0%   { color: var(--accent); transform: scale(1); }
  30%  { color: #d4863e; transform: scale(1.06); }
  100% { color: var(--accent); transform: scale(1); }
}
/* Анимация только цифры баланса в шапке (auth.js renderBalance) */
.ub-num { display: inline-block; transform-origin: center; transition: color .2s; }
.ub-num-bump { animation: ubNumBump 700ms ease-out; }
@keyframes ubNumBump {
  0%   { color: inherit; transform: scale(1); }
  18%  { color: #2e7a3a; transform: scale(1.35); }
  60%  { color: #2e7a3a; transform: scale(1.1); }
  100% { color: inherit; transform: scale(1); }
}

/* Hero visual: tilted frame */
.hero-visual { position: relative; }
.hero-frame {
  background: var(--card);
  padding: 14px;
  box-shadow: 0 28px 80px -20px rgba(40,20,10,0.28);
  transform: rotate(1.5deg);
}
.hero-photo-caption {
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
  color: #5a4a3a;
  text-align: center;
  padding: 12px 8px 6px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.hero-quote {
  font-family: var(--serif);
  font-style: italic;
  position: absolute;
  bottom: -26px;
  left: -24px;
  width: 170px;
  background: var(--bg-alt);
  padding: 12px 16px;
  font-size: 14px;
  transform: rotate(-3deg);
  box-shadow: 0 10px 30px rgba(40,20,10,0.14);
  line-height: 1.4;
}
.hero-time-badge {
  position: absolute;
  top: -16px;
  right: -16px;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.4px;
}

/* ===== СЛАЙДЕР (hero реальные фото) ===== */
.slider-container, .result-slider-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  cursor: col-resize;
}
.hero-frame > .slider-container {
  aspect-ratio: 1728/2452;
  max-height: 540px;
  height: auto;
}
.slider-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}
.slider-after {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.slider-before {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  clip-path: inset(0 0 0 70%);
}
.slider-handle {
  position: absolute;
  top: 0;
  left: 70%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.handle-circle {
  width: 38px;
  height: 38px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  flex-shrink: 0;
  color: var(--accent);
}
.slider-label {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.label-before { right: 12px; background: rgba(30,15,8,0.7); backdrop-filter: blur(4px); }
.label-after { left: 12px; background: rgba(184,101,42,0.88); }

/* Shimmer skeleton while images load */
.slider-container {
  background: linear-gradient(90deg, #e9dcc3 0%, #f0e6d4 50%, #e9dcc3 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.slider-container.is-loaded {
  background: none;
  animation: none;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ===== ГАЛЕРЕЯ ===== */
.gallery { padding: 60px 0 80px; }
.gallery .container { margin-bottom: 36px; }
.gallery-track-wrap {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black 80px, black calc(100% - 80px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, black 80px, black calc(100% - 80px), transparent 100%);
}
#galTrack {
  display: flex;
  gap: 32px;
  width: max-content;
  padding: 36px 48px;
  will-change: transform;
}
.gal-item {
  flex-shrink: 0;
  width: 300px;
  text-align: center;
}
.gal-stack {
  position: relative;
  width: 270px;
  height: 345px;
  margin: 0 auto;
}
.gal-card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  transform: rotate(-9deg) translate(-18px, -14px);
  box-shadow: 0 4px 20px rgba(28,20,16,0.16);
  background: var(--bg-alt);
}
.gal-card-front {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 10px 36px rgba(28,20,16,0.24);
  background: var(--card);
}
.gal-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.4;
}
.gallery-title-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.gal-hint {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--sans);
  color: #8B5E3C;
  pointer-events: none;
  transform: rotate(-3deg);
  letter-spacing: 0.3px;
  margin-left: 20px;
  margin-bottom: 4px;
  opacity: 0.85;
}
.gal-hint-arrow {
  position: absolute;
  left: calc(100% + 2px);
  top: -6px;
  width: 56px;
  height: 64px;
  overflow: visible;
  opacity: 0.9;
}

/* ===== КАК ЭТО РАБОТАЕТ ===== */
.how {
  background: var(--bg-alt);
  padding: 72px 0;
}
h2 {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 700;
  letter-spacing: -1.4px;
  margin-bottom: 12px;
}
h2 em {
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.section-sub {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 64px;
}
.how-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 52px;
  align-items: center;
}
.how-title {
  white-space: nowrap;
  margin-bottom: 32px;
}
.how-visual {
  aspect-ratio: 4/3;
  background: var(--dark);
  padding: 10px;
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(40,20,10,0.35);
  overflow: hidden;
}
.how-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
.how-steps { display: flex; flex-direction: column; }
.how-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.how-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  padding-top: 6px;
}
.how-step-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.how-step-desc {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

/* ===== ЗАГРУЗКА ===== */
.upload-section {
  padding: 12px 0 24px;
  background: var(--bg);
  scroll-margin-top: 64px;
}
.upload-section-header {
  text-align: center;
  margin-bottom: 12px;
}
.upload-section-header h2 {
  font-size: clamp(32px, 4vw, 54px);
}
.howto-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: rgba(184,101,42,0.4);
  text-underline-offset: 3px;
}
.howto-trigger svg { color: var(--muted); flex-shrink: 0; }
.howto-trigger:hover { color: var(--fg); }
.upload-area {
  max-width: 760px;
  margin: 0 auto;
  border: 1.5px solid #e8dcc8;
  border-radius: 20px;
  background: var(--card);
  height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  padding: 18px;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: #fffdf8;
}
.upload-area.has-preview {
  cursor: default;
  height: auto;
  min-height: auto;
  align-items: flex-start;
  padding: 12px 18px 16px;
  border: 1px solid #e8dcc8;
  background: #faf6ef;
}
.upload-area.has-preview:hover { border-color: #e8dcc8; background: #faf6ef; }
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.upload-icon-wrap {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  filter: drop-shadow(0 4px 10px rgba(184, 101, 42, 0.18));
}
.upload-text {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--fg);
}
.upload-text-mobile { display: none; }
.upload-sub { font-size: 14px; color: var(--muted); }
.upload-formats {
  display: inline-flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ===== ПРЕВЬЮ ===== */
.upload-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}
.preview-wrap {
  width: 100%;
  height: clamp(220px, 38vh, 360px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.upload-result .preview-wrap { overflow: hidden; }
.canvas-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--canvas-ar, 1);
  line-height: 0;
}
#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
}

/* ===== РЕЗУЛЬТАТ ===== */
.upload-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.result-img-wrap {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
}
.result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

/* ===== СТРОКА ДЕЙСТВИЙ ===== */
/* margin-top убран — расстояние от фото регулирует gap родителя .upload-preview (10px) */
.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Ряд с переключателем режима + кнопкой восстановить */
.action-row--mode {
  justify-content: space-between;
  flex-wrap: wrap;
}
.mode-chips-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* Слайдер-кнопка режима реставрации */
.mode-slide-btn {
  position: relative;
  width: 145px;
  height: 34px;
  background: #ede7da;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.mode-slide-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 118px;
  height: calc(100% - 6px);
  background: #fef5e8;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.13);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: inherit;
  color: var(--accent, #c17a2a);
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.25s ease, background 0.25s ease;
  pointer-events: none;
  user-select: none;
}
.mode-slide-btn[data-mode="bw"] .mode-slide-knob {
  transform: translateX(21px);
  background: #0d0a08;
  color: #fff;
}
.mode-info-wrap { position: relative; }
.mode-info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted, #7a6e5e);
  background: transparent;
  color: var(--text-muted, #7a6e5e);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  font-family: inherit;
}
.mode-info-btn:hover { border-color: var(--fg, #1c1410); color: var(--fg, #1c1410); }
.mode-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  background: #faf6ef;
  color: #2c2416;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 12px;
  width: 252px;
  line-height: 1.6;
  white-space: normal;
  z-index: 100;
  border: 1px solid #e8dcc8;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.mode-tooltip-item { padding: 4px 0; }
.mode-tooltip-item + .mode-tooltip-item {
  border-top: 1px solid #e8dcc8;
  margin-top: 8px;
  padding-top: 10px;
}
.mode-tooltip-label { font-weight: 700; color: var(--fg, #1c1410); }
.mode-tooltip.hidden { display: none; }
@media (min-width: 601px) {
  .mode-info-btn { display: none; }
  .mode-info-wrap { position: static; }
  .mode-chips-wrap { position: relative; }
  .mode-chips-wrap:hover .mode-tooltip { display: block; left: 50%; right: auto; bottom: calc(100% + 10px); transform: translateX(-50%); }
}
@media (max-width: 480px) {
  .action-row--mode { flex-direction: column; align-items: stretch; gap: 10px; }
  .action-row--mode .mode-chips-wrap { justify-content: center; }
  .action-row--mode #restoreBtn { width: 100%; justify-content: center; }
}

/* Вторичный ряд: Редактировать | Другое фото — две равные таблетки 50/50.
   Должны быть заметно компактнее primary «Восстановить фото» — она доминирует.
   Desktop: уже основной — текст короткий, нет смысла растягивать на 480px. */
.action-row--secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: nowrap;
}
.action-row--secondary .btn-secondary {
  justify-content: center;
  text-align: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box; /* без border-box width:100% + padding ломает 50/50 grid */
  min-height: 38px;
  line-height: 1.2;
  padding: 9px 18px;
  font-size: 13px;
}
.action-row--secondary .btn-secondary svg { color: var(--muted); flex-shrink: 0; }

/* Под результатом: разметка идентична preview-стейту — большая «Скачать фото» сверху +
   две меньшие «Поделиться» / «Загрузить другое фото» снизу. */
.upload-result .action-row--mode {
  display: flex;
  justify-content: center;
  width: 100%;
}
.upload-result .action-row--mode > #downloadBtn {
  width: 100%;
  max-width: 360px;
  text-align: center;
  justify-content: center;
}
/* .action-row--secondary в result: позиция #newPhotoBtn всегда правая колонка,
   даже если #shareBtn скрыт inline display:none (левая колонка просто пустая). */
.upload-result .action-row--secondary #newPhotoBtn {
  grid-column: 2;
}

@media (max-width: 600px) {
  .upload-result { gap: 10px; }
  /* Mobile: уменьшенный шрифт чтобы текст «Поделиться с близкими» / «Обрезать или повернуть»
     не упирался в края кнопки. min-height 44px для touch-target (iOS HIG). */
  .action-row--secondary { gap: 8px; max-width: 100%; }
  .action-row--secondary .btn-secondary {
    padding: 7px 8px;
    font-size: 11px;
    min-height: 44px;
    gap: 6px;
    letter-spacing: -0.1px;
  }
  /* G5 — на мобиле скрываем SVG-иконку у shareBtn чтобы освободить место под текст */
  .upload-result #shareBtn svg { display: none; }
  .upload-result #shareBtn { gap: 0; padding-left: 4px; padding-right: 4px; }
}
@media (max-width: 380px) {
  .action-row--secondary .btn-secondary {
    white-space: normal;
    line-height: 1.15;
    font-size: 11px;
    min-height: 44px;
  }
}
/* G4 — текст rating thanks/regen центрирован по блоку */
#rating5Wrap .rating5-thanks,
#rating5Wrap .rating5-regen {
  width: 100%;
  justify-content: center;
  text-align: center;
}
.rotate-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-rotate {
  width: 48px; height: 48px;
  border: 1.5px solid rgba(184,101,42,0.3);
  background: var(--card);
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.btn-rotate-sm { width: 34px; height: 34px; }

/* Кнопка «Поделиться с близкими» — иконка + текст в одну линию */
.btn-share-cta { display: inline-flex; align-items: center; gap: 8px; }
.btn-share-cta svg { flex-shrink: 0; }
.btn-rotate:hover { border-color: var(--accent); color: var(--accent); }
.btn-rotate:active { transform: scale(0.92); }

/* ===== ЛАЙК / ДИЗЛАЙК ===== */
/* Контейнер rating-UI — центрирует звёзды (#rating5Wrap из rating-5star-test.js). */
.thumb-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 2px;
  width: 100%;
}
/* ===== FEEDBACK MODAL ===== */
.feedback-modal-content {
  text-align: center;
}
.feedback-modal-content h3 {
  text-align: center;
}
.feedback-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 16px;
}
.feedback-tag {
  padding: 8px 16px;
  border: 1.5px solid var(--border, #e0d8d0);
  border-radius: 20px;
  background: transparent;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.feedback-tag:hover:not(.selected) {
  border-color: var(--accent);
  color: var(--accent);
}
.feedback-tag.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
#feedbackText {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--card);
  color: var(--fg);
  margin-bottom: 16px;
  display: block;
}
#feedbackText:focus { outline: none; border-color: var(--accent); }

.btn-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 10px;
}
.btn-link:hover { color: var(--fg); }

/* ===== OVERLAY ОБРАБОТКИ ===== */
.proc-overlay {
  position: absolute; inset: 0;
  border-radius: 12px;
  overflow: hidden;
  pointer-events: none;
}
.proc-overlay-scan {
  position: absolute; left: 0; right: 0; top: -40px; height: 80px;
  background: linear-gradient(180deg, transparent, rgba(240,170,90,0.45) 50%, transparent);
  pointer-events: none;
  animation: uploadScan 2.2s linear infinite;
}
@keyframes uploadScan { 100% { transform: translateY(520px); } }
.proc-overlay-info {
  display: flex; align-items: center; gap: 8px;
  background: rgba(15,8,4,0.78); backdrop-filter: blur(6px);
  padding: 6px 14px; border-radius: 999px;
  color: #fff9ef; font-size: 12px; font-weight: 500;
  align-self: flex-start; position: relative; z-index: 1;
}
.proc-overlay-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #f0a860; box-shadow: 0 0 8px #f0a860;
  animation: pulse 1s infinite; flex-shrink: 0;
}
.proc-overlay-bar-wrap {
  height: 3px; background: rgba(255,245,225,0.2);
  border-radius: 2px; overflow: hidden; position: relative; z-index: 1;
}
.proc-overlay-bar {
  height: 100%; width: 5%;
  background: linear-gradient(90deg, #d98840, #f2c070);
  transition: width 1s cubic-bezier(.3,1,.5,1);
  border-radius: 2px;
}


/* ===== ОШИБКА ===== */
.error-box {
  max-width: 500px;
  margin: 0 auto;
  background: #fff8e6;
  border: 1px solid #f5d98a;
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.error-box p { color: #1a1a1a; font-size: 16px; text-align: center; margin: 0; line-height: 1.5; }
.error-title { color: #1a1a1a; font-size: 18px; font-weight: 600; text-align: center; margin: 0; line-height: 1.3; }
.error-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--accent, #b8652a); }
.error-icon svg { width: 36px; height: 36px; }
.error-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; width: 100%; }
@media (min-width: 600px) { .error-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; width: auto; } }

/* ===== СПИННЕР ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:.45}50%{opacity:1} }

/* ===== ПОДСКАЗКИ ЗАГРУЗКИ ===== */
.upload-tips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 760px;
  margin: 28px auto 0;
}
.tip {
  border: 1px dashed rgba(184,101,42,0.25);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  gap: 12px;
}
.tip-icon { color: var(--muted); flex-shrink: 0; margin-top: 2px; }
.tip h4 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--fg);
}
.tip p { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0; }

/* ===== ПОПАП ПРОГРЕССА ===== */
.restore-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 3;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(28,20,16,0.22), 0 4px 16px rgba(28,20,16,0.08);
  padding: 24px 28px 22px;
  line-height: 1.4;
  text-align: left;
}
.restore-popup.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.restore-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.restore-popup-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(184,101,42,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.restore-popup-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  color: var(--fg);
}
.restore-popup-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.restore-popup-bar-wrap {
  height: 4px;
  background: rgba(184,101,42,0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 18px;
}
.restore-popup-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #d98840, #f2c070);
  transition: width 1s cubic-bezier(.3,1,.5,1);
  border-radius: 2px;
}
.restore-popup-stages {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.restore-popup-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(108,92,78,0.4);
  transition: color 0.3s;
}
.restore-popup-stage.active { color: var(--fg); font-weight: 500; }
.restore-popup-stage.done { color: var(--muted); }
.restore-popup-stage-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(184,101,42,0.18);
  transition: background 0.3s, box-shadow 0.3s;
}
.restore-popup-stage.active .restore-popup-stage-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(184,101,42,0.55);
  animation: pulse 1s infinite;
}
.restore-popup-stage.done .restore-popup-stage-dot { background: #5a9e62; }

/* ===== ТАРИФЫ ===== */
.pricing {
  padding: 72px 0;
  background: var(--bg-alt);
}

/* === Промо-баннер активной акции (вставляется promo-render.js перед .pricing-grid) === */
.promo-banner {
  max-width: 980px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #d4a96a 0%, #c49050 50%, #b8832a 100%);
  padding: 22px 28px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
  border: 2px solid #8b5e1a;
  box-shadow: 0 4px 16px rgba(139, 94, 26, 0.25);
}
.promo-banner-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
  color: #2a1a06;
  margin-bottom: 6px;
  text-shadow: 0 1px 2px rgba(255,255,255,0.3);
}
.promo-banner-sub {
  font-family: Georgia, serif;
  font-size: 13px;
  color: #4a2e08;
  font-style: italic;
}
.promo-banner-text { font-size: 14px; color: #6a5d4e; margin-bottom: 6px; }
.promo-banner-timer { font-size: 13px; color: #7a6e5e; }
.promo-banner-timer strong { color: var(--accent, #b8652a); }

/* ===== Promo top banner ===== */
.promo-top-banner {
  background: #ede4d3;
  border-bottom: 1px solid #c9b898;
  padding: 14px 48px 14px 20px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}
.promo-top-banner-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.promo-top-banner-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 700;
  color: #1c0e00;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
  white-space: nowrap;
}
.promo-top-banner-sub {
  font-family: Georgia, serif;
  font-size: 13px;
  font-style: italic;
  color: #3a2000;
}
.promo-top-banner-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #3a2000;
  line-height: 1;
  padding: 4px 6px;
  opacity: 0.6;
}
.promo-top-banner-close:hover { opacity: 1; }

/* ===== Promo pricing row layout ===== */
.pricing-grid--promo-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 18px !important;
  max-width: none !important;
  margin: 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px 0 8px !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
}
/* Десктоп: карточки растягиваются на всю ширину контейнера — ничего не обрезается */
.pricing-grid--promo-row .plan-card {
  flex: 1 1 0 !important;
  min-width: 220px !important;
  max-width: none !important;
  width: auto !important;
  scroll-snap-align: start !important;
}
.pricing-grid--promo-row::-webkit-scrollbar { height: 4px; }
.pricing-grid--promo-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

@media (max-width: 700px) {
  .promo-top-banner { padding: 8px 40px 8px 14px; }
  .promo-top-banner-title { font-size: 15px; white-space: normal; line-height: 1.3; word-break: break-word; }
  .promo-top-banner-sub { display: none; }
  /* Мобиль: snap по центру — 1 свайп = 1 карточка по центру экрана */
  .pricing-grid--promo-row {
    scroll-snap-type: x mandatory;
    padding-left: calc(50vw - 130px) !important;
    padding-right: calc(50vw - 130px) !important;
    padding-top: 20px !important;
    padding-bottom: 8px !important;
  }
  .pricing-grid--promo-row .plan-card {
    flex: 0 0 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    scroll-snap-align: center !important;
  }
}

.promo-countdown {
  background: #1c1410;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  text-align: center;
}
.promo-countdown-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b8a898;
  margin-bottom: 4px;
}
.promo-countdown-time {
  font-family: 'Courier New', Courier, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.plan-card { position: relative; }
@keyframes promoBadgeZoom {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.plan-promo-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--accent, #b8652a);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  animation: promoBadgeZoom 1.8s ease-in-out infinite;
  transform-origin: left center;
}
.plan-card-extra { border-color: var(--line); }
.plan-card--offer {
  border-color: var(--accent, #b8652a);
  box-shadow: 0 0 0 2px rgba(184,101,42,0.25), 0 4px 18px rgba(184,101,42,0.18);
}
.plan-card--offer .plan-price-old {
  font-size: 0.8em;
  color: var(--muted, #888);
  text-decoration: line-through;
  margin-right: 4px;
}
.plan-card--offer .plan-price-offer {
  color: var(--accent, #b8652a);
  font-weight: 700;
}
/* На тёмном фоне карточки .popular сохраняем читаемость */
.plan-card.popular.plan-card--offer {
  border-color: #f0a06a;
  box-shadow: 0 0 0 2px rgba(240,160,106,0.35), 0 4px 18px rgba(240,160,106,0.25);
}
.plan-card.popular.plan-card--offer .plan-price-old { color: rgba(255,255,255,0.55); }
.plan-card.popular.plan-card--offer .plan-price-offer { color: #ffd0a0; }
.pricing-header {
  text-align: center;
  margin-bottom: 36px;
}
.pricing-header h2 { margin-bottom: 10px; }
.pricing-header .pricing-note { color: var(--muted); font-size: 15px; }
/* Заголовок «Начните бесплатно» + «Первое фото - бесплатно» — только для гостей. Залогиненным скрываем. */
body:not(.is-anonymous) .pricing-anonymous-only { display: none; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 980px;
  margin: 0 auto;
}
.pricing-grid--with-welcome {
  grid-template-columns: repeat(4, 1fr);
  max-width: 1240px;
}
@media (max-width: 1100px) {
  .pricing-grid--with-welcome { grid-template-columns: repeat(2, 1fr); max-width: 760px; }
}
.plan-card {
  background: var(--card);
  padding: 34px 26px;
  border-radius: 18px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.plan-card:hover {
  transform: scale(1.025);
  box-shadow: 0 24px 64px -16px rgba(40,20,10,0.22);
}
@keyframes planBtnPulseOutline {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,101,42,0); }
  50%       { box-shadow: 0 0 0 7px rgba(184,101,42,0.22); }
}
@keyframes planBtnPulseFill {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  50%       { box-shadow: 0 0 0 7px rgba(255,255,255,0.28); }
}
.plan-btn.outline.pulsing {
  animation: planBtnPulseOutline 1.5s ease-in-out infinite;
}
.plan-btn.fill.pulsing {
  animation: planBtnPulseFill 1.5s ease-in-out infinite;
}
/* Прямое наведение на кнопку — устойчивое свечение вместо пульса */
.plan-btn.outline.pulsing:hover {
  animation: none;
  box-shadow: 0 0 0 6px rgba(184,101,42,0.28);
}
.plan-btn.fill.pulsing:hover {
  animation: none;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.3);
}
@keyframes planBtnSnapBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.plan-card.popular {
  background: var(--dark);
  color: #fff;
  border: none;
  box-shadow: 0 20px 60px -20px rgba(40,20,10,0.4);
  position: relative;
}

/* ===== Welcome card (бонус за регистрацию) ===== */
.plan-card-welcome {
  background: #f5e8d3;
  color: #2a1a0e;
  border: 2px solid #e8b88a;
  box-shadow: 0 6px 28px rgba(184,101,42,0.16);
  position: relative;
}
.plan-card-welcome .plan-badge {
  background: #2a1a0e;
}
.plan-card-welcome .plan-divider {
  border-color: rgba(184,101,42,0.18);
}
.plan-card-welcome .plan-period {
  color: #6b5c4e;
}
.plan-card-welcome .plan-name {
  font-size: 20px;
  line-height: 1.25;
}
/* Выравниваем заголовки/цены по линии у соседних тарифов (welcome ходит в 2 строки) */
.pricing-grid--with-welcome .plan-card .plan-name {
  min-height: 56px;
  display: flex;
  align-items: flex-start;
}
.welcome-gift {
  position: absolute;
  top: -24px;
  left: -24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff3e6;
  border: 1px solid rgba(184, 101, 42, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(184,101,42,0.45);
  transform-origin: center;
  animation: welcomeGiftPulse 1.6s ease-in-out infinite;
  z-index: 3;
  font-size: 24px;
  line-height: 1;
}
@keyframes welcomeGiftPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.25) rotate(15deg); }
}

/* Подсветка welcome-карточки при приходе из email (?promo=welcome) */
.plan-card-welcome.is-highlight {
  animation: welcomeHighlight 2.4s ease-in-out 1;
}
@keyframes welcomeHighlight {
  0%   { box-shadow: 0 6px 28px rgba(184,101,42,0.16), 0 0 0 0 rgba(184,101,42, 0); }
  35%  { box-shadow: 0 6px 28px rgba(184,101,42,0.16), 0 0 0 14px rgba(184,101,42, 0.45); }
  100% { box-shadow: 0 6px 28px rgba(184,101,42,0.16), 0 0 0 0 rgba(184,101,42, 0); }
}

/* ===== Цена + таймер в одной строке (welcome) ===== */
.welcome-price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 18px;
}
.welcome-price-row .plan-price { margin-bottom: 4px; }
.welcome-price-row .plan-period { margin-bottom: 0; }
.welcome-timer {
  text-align: right;
  color: var(--accent);
  flex-shrink: 0;
  padding-top: 4px;
}
.welcome-timer-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(184,101,42,0.75);
  line-height: 1;
}
.welcome-timer-value {
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 4px;
  letter-spacing: 0.5px;
}
.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
}
.plan-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.plan-price {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.plan-period {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 22px;
}
.plan-card.popular .plan-period { color: rgba(255,255,255,0.55); }
.plan-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin-bottom: 18px;
}
.plan-card.popular .plan-divider { border-color: rgba(255,255,255,0.1); }
.plan-features { list-style: none; flex: 1; margin-bottom: 22px; }
.plan-features li {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  align-items: flex-start;
}
.plan-features li::before {
  content: '';
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='none' stroke='%23b8652a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 7.5l4 4 7-8'/%3E%3C/svg%3E") no-repeat center;
}
.plan-card.popular .plan-features li::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='none' stroke='%23e8b88a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 7.5l4 4 7-8'/%3E%3C/svg%3E") no-repeat center;
}
.plan-card.popular .plan-features li { color: rgba(255,255,255,0.82); }
.plan-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}
.plan-btn.outline { background: none; border: 1px solid var(--line); color: var(--fg); }
.plan-btn.outline:hover { background: var(--bg-alt); }
.plan-btn.fill { background: var(--accent); border: none; color: #fff; }
.plan-btn.fill:hover { background: var(--accent-hover); }

/* ===== Desktop hover-swap: всегда ровно 1 fill-кнопка на pricing-grid =====
   Класс .is-hover-active навешивается JS (script.js, mouseover/mouseout на grid).
   :has(:hover) не используется — в Chromium он не реактивный к :hover. */
@media (min-width: 601px) {
  .pricing-grid.has-hover-active .plan-card.is-hover-active .plan-btn {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
  }
  .pricing-grid.has-hover-active .plan-card.popular:not(.is-hover-active) .plan-btn {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
  }
  .pricing-grid.has-hover-active .plan-card.plan-card-welcome:not(.is-hover-active) .plan-btn {
    background: none;
    color: var(--fg);
    border: 1px solid var(--line);
  }
  .pricing-grid.has-hover-active .plan-card.popular:not(.is-hover-active) .plan-btn.pulsing,
  .pricing-grid.has-hover-active .plan-card.plan-card-welcome:not(.is-hover-active) .plan-btn.pulsing {
    animation: none;
    box-shadow: none;
  }
  /* welcome-режим, default-state: ровно один мастер — welcome. Семейный кнопка
     становится outline (тёмный фон карточки оставляем — это бренд-акцент,
     а не индикатор «купи меня»). Снимает двойную fill-подсветку. */
  .pricing-grid--with-welcome .plan-card.popular:not(.is-hover-active) .plan-btn {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
  }
}

/* ===== Пресеты количества фото в «Свой пакет» ===== */
.custom-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.custom-preset {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.custom-preset:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.custom-preset.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== FAQ ===== */
.faq { padding: 110px 0; background: var(--bg); }
.faq-header { text-align: center; margin-bottom: 56px; }
.faq-header h2 { margin-bottom: 0; }
#faqList { max-width: 740px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  cursor: pointer;
  user-select: none;
}
.faq-q-text {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--fg);
}
.faq-plus {
  width: 26px;
  height: 26px;
  border-radius: 13px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
  color: var(--accent);
  flex-shrink: 0;
}
.faq-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(.3,1,.4,1);
}
.faq-body-inner {
  padding-bottom: 20px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}
.faq-body-inner a { color: var(--accent); }

/* ===== ОЧЕРЕДЬ ФОТО ===== */
.queue-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  width: 100%;
}
.queue-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 72px;
}
.queue-item-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.queue-item-name {
  flex-grow: 1;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.queue-badge {
  min-width: 100px;
  text-align: center;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.queue-badge.pending   { background: var(--bg-alt); color: var(--muted); }
.queue-badge.processing { background: var(--bg-alt); color: var(--muted); }
.queue-badge.done      { background: rgba(42,122,58,0.1); color: #2a7a3a; }
.queue-badge.error     { background: rgba(179,51,51,0.1); color: #b33; }
.queue-badge.processing::after {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  margin-left: 6px;
  border: 2px solid rgba(99,85,65,0.3);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
.queue-item-remove {
  width: 32px; height: 32px;
  border: none; background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
}
.queue-item-remove:hover { background: var(--bg-alt); color: var(--fg); }
.queue-item-download {
  font-size: 14px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.queue-summary { text-align: center; font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ===== ГЛОБАЛЬНЫЙ ERROR TOAST ===== */
.global-error {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #b33;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  font-size: 14px;
  z-index: 99999;
  max-width: 92vw;
  text-align: center;
  display: none;
  animation: toastIn 0.25s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20,12,6,0.94);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: zoom-out;
  padding: 24px;
  animation: lightboxIn 0.15s ease-out;
}
@keyframes lightboxIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px; right: 24px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-hint { color: rgba(255,255,255,0.7); font-size: 13px; margin: 0; }
.result-slider-container img { cursor: zoom-in; }

/* ===== ГАЛЕРЕЯ — ПОПАП ===== */
.gal-popup {
  position: fixed; inset: 0;
  background: rgba(15,8,4,0.82);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  padding: 20px;
}
.gal-popup.visible { opacity: 1; pointer-events: auto; }
.gal-popup-inner {
  position: relative;
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  max-width: 92vw;
  width: auto;
  min-width: 300px;
  box-shadow: 0 32px 80px rgba(15,8,4,0.35);
  animation: popupIn 0.28s cubic-bezier(.3,1.4,.5,1) both;
}
.gal-popup:not(.visible) .gal-popup-inner { animation: none; }
@keyframes popupIn { from { transform: scale(0.93); opacity:0; } to { transform: scale(1); opacity:1; } }
.gal-popup-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: rgba(184,101,42,0.1);
  border: none; border-radius: 50%;
  font-size: 18px; line-height: 1;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.gal-popup-close:hover { background: var(--fg); color: #fff; }
.gal-popup-pair {
  display: flex; gap: 16px;
  align-items: flex-start;
}
.gal-popup-side {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.gal-popup-img-wrap {
  width: auto;
  max-width: 44vw;
  border-radius: 12px; overflow: hidden;
  background: rgba(0,0,0,0.04);
}
.gal-popup-img-wrap img {
  max-height: min(520px, 62vh);
  width: auto; max-width: 100%;
  display: block;
}
.gal-popup-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted);
}
@media (max-width: 600px) {
  .gal-popup-pair { flex-direction: column; align-items: center; }
  .gal-popup-img-wrap { max-width: 85vw; }
  .gal-popup-img-wrap img { max-height: min(260px, 38vh); }
}
.result-hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; text-align: center; font-style: italic; }

/* ===== МОДАЛКИ ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(28,20,16,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 40px rgba(28,20,16,0.2);
}
.modal-content h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--fg);
}
.modal-content p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}
.modal-close {
  position: absolute;
  top: 8px; right: 8px;
  background: none; border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  padding: 0; line-height: 1;
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { color: var(--fg); }

/* ===== AUTH MODAL ===== */
.auth-modal { max-width: 400px; text-align: left; padding: 24px 28px; }
.auth-modal h3 { text-align: center; margin-bottom: 4px; }
.auth-modal-subtitle { text-align: center; color: #666; font-size: 13.5px; margin-bottom: 10px; line-height: 1.35; }
/* Миниатюра восстановленного фото в режиме post-restore — contain для любой ориентации */
.auth-modal-thumb {
  width: 100%;
  max-width: 320px;
  height: 200px;
  margin: 0 auto 10px;
  border-radius: 8px;
  background: #f0e6d4 center / contain no-repeat;
  box-shadow: 0 4px 14px -4px rgba(40,20,10,0.25);
  border: 2px solid #fff;
}
@media (max-width: 480px) {
  .auth-modal-thumb { max-width: 240px; height: 150px }
}
.auth-modal .btn-login {
  width: 100%;
  justify-content: center;
  padding: 11px 20px;
  font-size: 15px;
  margin-bottom: 8px;
}
.btn-yandex {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}
.btn-yandex:hover { background: #2d2d2d; }
.btn-yandex:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-yandex .ya-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FC3F1D;
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-email-form { display: flex; flex-direction: column; gap: 6px; }
.auth-email-form button[type="submit"] { align-self: center; justify-content: center; padding: 10px 52px; font-size: 14px; margin-top: 2px; }
.auth-email-form input[type="email"],
.auth-email-form input[type="password"] {
  padding: 13px 12px;
  border: 1px solid rgba(184,101,42,0.25);
  border-radius: 8px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fffaf2;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.auth-email-form input:focus { border-color: var(--accent); background: #fff; }
.auth-status {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  color: var(--muted);
}
.auth-status.is-error { color: #b33; }
.auth-status.is-success { color: #2a7a3a; }
.auth-consent-hint { display: block; font-size: 11.5px; color: #999; text-align: center; margin: 2px 0 8px; min-height: 14px; transition: color 0.15s, font-size 0.2s; transform-origin: center; }
.auth-consent-hint.is-error { color: #d32f2f; font-weight: 700; font-size: 13.5px; }
.btn.is-pending-consent { opacity: 0.6; }
.btn.is-pending-consent:hover { opacity: 0.65; }
.auth-consent-hint.pulse-now { animation: hint-pulse 0.55s ease-out; }
@keyframes hint-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.18); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.auth-links { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; text-align: center; }
.auth-links a { color: var(--accent); font-size: 14px; }
.auth-links a:hover { text-decoration: underline; }
.auth-forgot-inline { font-size: 13px; color: #888; text-align: right; text-decoration: none; margin-top: -4px; }
.auth-forgot-inline:hover { color: var(--accent); text-decoration: underline; }

/* ===== ЧЕКБОКС СОГЛАСИЯ ===== */
.consent-label {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 11.5px; color: #6a5d4e; line-height: 1.35;
  margin: 6px 0 0; text-align: left;
  transition: color 0.15s;
}
.consent-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; width: 14px; height: 14px; cursor: pointer; }
.consent-label a { color: var(--accent); text-decoration: underline; }

/* ===== ФУТЕР ===== */
.footer {
  background: var(--dark);
  color: #f0e4cc;
  padding: 64px 0 36px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-logo {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.footer-logo em { color: var(--accent-soft); font-weight: 400; font-size: 1.3em; }
.footer-tagline {
  font-size: 13px;
  color: rgba(240,228,204,0.6);
  line-height: 1.65;
  max-width: 280px;
}
.footer-col-title {
  font-size: 10px;
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
}
.footer-link {
  display: block;
  font-size: 13px;
  color: rgba(240,228,204,0.75);
  margin-bottom: 8px;
  cursor: pointer;
  transition: color 0.15s;
}
.footer-link:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(240,228,204,0.1);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 11px;
  color: rgba(240,228,204,0.7);
}
.footer-bottom a { color: rgba(240,228,204,0.72); }
.footer-legal { display: flex; flex-direction: column; gap: 4px; }
.footer-ip { font-size: 11px; color: rgba(240,228,204,0.7); }

/* C6 — мобайл-футер: 1 колонка, крупный шрифт для 55+ */
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-link { font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
  .footer-col-title { font-size: 12px; margin-bottom: 10px; }
  .footer-tagline { font-size: 14px; }
}

/* ===== ЛЕГАЛЬНЫЕ СТРАНИЦЫ ===== */
/* Унифицированная типографика: Inter для всех заголовков и текста, фиксированные размеры. */
.legal { padding: 40px 0 80px; background: var(--bg); min-height: 60vh; }
.legal-container { max-width: 760px; }
.legal h1 { font-family: var(--sans); font-weight: 700; font-size: 32px; line-height: 1.2; letter-spacing: -0.01em; color: var(--fg); margin: 0 0 16px; }
.legal h2 { font-family: var(--sans); font-weight: 600; font-size: 20px; line-height: 1.3; color: var(--fg); margin: 32px 0 12px; }
.legal h3 { font-family: var(--sans); font-weight: 600; font-size: 17px; line-height: 1.4; color: var(--fg); margin: 20px 0 8px; }
.legal p, .legal li { font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.65; color: #444; margin: 0 0 10px; }
.legal ul { padding-left: 22px; margin: 0 0 14px; }
.legal a:not(.btn) { color: var(--accent); }
.legal-meta { font-family: var(--sans); color: #676767; font-size: 14px; }
.legal-tldr {
  background: #fff5e6;
  border: 1px solid #f0d8b0;
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 24px 0 32px;
}
.legal-toc { margin: 0 0 32px; }
.legal-toc-title { font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--fg); margin: 0 0 8px; }
.legal-toc ol { margin: 0; padding-left: 22px; columns: 2; column-gap: 28px; }
.legal-toc li { margin-bottom: 6px; font-size: 14px; }
.legal-toc a { color: var(--accent); }
@media (max-width: 600px) { .legal-toc ol { columns: 1; } }
.legal-tldr h2 { font-family: var(--sans); font-weight: 600; font-size: 17px !important; margin: 0 0 10px !important; }
.legal-tldr ul { padding-left: 22px; margin: 0; }
.legal-tldr li { margin-bottom: 6px; }
.legal-table-wrap { overflow-x: auto; margin: 14px 0 20px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-table th, .legal-table td { border: 1px solid #ddd; padding: 10px 12px; text-align: left; vertical-align: top; }
.legal-table th { background: #f0ebe3; font-weight: 600; }

/* ===== ФОКУС ===== */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible, a:focus-visible { outline-offset: 3px; }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* ===== ГАМБУРГЕР + МОБИЛЬНОЕ МЕНЮ ===== */
.mobile-account-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--fg);
  flex-shrink: 0;
}
.nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--fg);
  gap: 0;
  line-height: 1;
}
.nav-burger svg { display: block; }

/* ===== TOP DROPDOWN МЕНЮ ===== */
.nav-drawer {
  position: fixed;
  top: 64px;
  left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(28,20,16,0.12);
  z-index: 99;
  padding: 8px 0 24px;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.3s ease;
  pointer-events: none;
}
.nav-drawer.is-open {
  clip-path: inset(0 0 0% 0);
  pointer-events: auto;
}
.nav-drawer-link {
  display: block;
  padding: 15px 0;
  font-size: 20px;
  font-family: var(--serif);
  font-weight: 500;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  transition: color 0.15s;
}
.nav-drawer-link:hover { color: var(--fg); }
.nav-drawer-cta {
  display: flex;
  margin-top: 20px;
  width: 100%;
  justify-content: center;
  font-size: 15px;
  padding: 14px 20px;
  box-sizing: border-box;
}
.nav-drawer-sep { height: 1px; background: var(--line); margin: 8px 0; }
.nav-drawer-logout {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: #999;
  padding: 15px 0;
  transition: color 0.15s;
}
.nav-drawer-logout:hover { color: #c0392b; }

/* ===== АДАПТИВ ===== */
@media (max-width: 1024px) {
  .container { padding: 0 32px; }
  h1 { font-size: clamp(42px, 5vw, 66px); }
  .how-inner { grid-template-columns: 1fr; }
  .how-visual { max-width: 480px; margin: 0 auto; }
  .how-title { white-space: normal; }
}
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-desc { max-width: 100%; }
  .hero-btns { justify-content: center; gap: 14px; }
  .hero-counter { justify-content: center; }
  .hero-visual { order: -1; max-width: 420px; margin: 0 auto; }
  .hero-quote { display: none; }
  .hero-time-badge { top: -12px; right: -12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  /* Mobile/tablet: убираем десктопные «крупные» правила hero */
  .hero-text { padding-top: 0; }
  .hero-btns .btn-accent-pill { padding: 14px 24px; font-size: 16px; }
  .hero-counter-text { font-size: 13px; }
  .hero-counter-text b { font-size: 18px; margin-right: 5px; }
  .hero-photo-caption { font-size: 14px; padding: 8px 4px 4px; }
}
@media (max-width: 600px) {
  .container { padding: 0 20px; }
  /* Mobile hero (rebuild 2026-05-12): фолд iPhone 375x667. Видим: banner+header+ribbon+photo+caption+CTA+«примеры». H1 ниже фолда (margin-top:30 сдвигает за край). */
  .header .container { height: 60px; }
  .may9-banner { padding: 6px 40px 6px 12px; min-height: 44px; align-items: center; }
  .may9-banner .may9-text { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: nowrap; max-width: 100%; }
  .may9-banner .may9-star { font-size: 18px; flex-shrink: 0; line-height: 1; }
  .may9-banner .may9-text-inner { font-size: 13px; line-height: 1.25; text-align: center; max-width: 270px; font-style: italic; font-family: var(--serif); font-weight: 500; }
  .may9-banner .may9-close { width: 30px; height: 30px; right: 6px; font-size: 16px; opacity: 1; }
  .hero { padding: 23px 0 24px; }
  .hero-photo-caption { padding: 4px 4px 2px; font-size: 12px; }
  .hero-text .hero-btns { gap: 8px; }
  .hero-text h1 { margin-top: 30px; }
  /* :has() scope — flex-start ТОЛЬКО для auth-modal (большая, не помещается). Маленькие модалки остаются центрированными. */
  .modal-overlay:has(.auth-modal) { align-items: flex-start; padding: 12px; }
  .modal-overlay:has(.auth-modal) .modal-content { max-height: calc(100vh - 24px); overflow-y: auto; }
  .auth-modal { padding: 14px 16px 10px; }
  .auth-modal h3 { font-size: 18px; margin-bottom: 1px; }
  .auth-modal-subtitle { font-size: 12px; margin-bottom: 6px; line-height: 1.3; }
  .auth-modal-thumb { max-width: 160px; height: 80px; margin-bottom: 6px; }
  .auth-modal .btn-login, .btn-yandex { padding: 0 16px; font-size: 13px; margin-bottom: 4px; height: 44px; box-sizing: border-box; }
  .auth-divider { margin: 6px 0; }
  .auth-email-form input { padding: 13px 12px; font-size: 13px; margin-bottom: 0; }
  .auth-email-form { gap: 6px; }
  .consent-label { font-size: 11px; line-height: 1.25; margin-bottom: 2px; }
  #authMarketingWrapper { margin-bottom: 2px; }
  .auth-links { margin: 4px 0 0; }
  /* Compact upload + стабильная высота блока (rebuild 2026-05-12 v2): min-height 360px на обоих state (idle/preview) — блок не «прыгает» при загрузке фото. gap header→h2 уменьшен. */
  .upload-section { padding: 12px 0 32px; }
  .upload-section-header h2 { font-size: 28px; margin-bottom: 6px; }
  .upload-section-header .howto-trigger { margin-top: 4px; font-size: 13px; }
  .upload-area { padding: 10px; height: auto; }
  .upload-area.has-preview { min-height: 320px; padding: 10px; }
  .upload-icon-wrap { width: 48px; height: 48px; }
  .upload-area .preview-wrap { height: 220px; }
  .upload-area .rotate-pair { gap: 12px; margin: 8px 0; }
  .upload-area .btn-rotate { width: 36px; height: 36px; }
  .upload-area .action-row { gap: 6px; margin-bottom: 6px; }
  .upload-area #restoreBtn { padding: 12px 22px; font-size: 15px; }
  .hero-desc { font-size: 17px; }
  .section-sub { font-size: 14px; }
  nav .nav-link { display: none; }
  .btn-header-cta { display: none; }
  .nav-burger { display: flex; height: 40px; padding-top: 0; padding-bottom: 0; }
  .btn-login { height: 40px; padding-top: 0; padding-bottom: 0; }
  .logo { font-size: 18px; }
  .btn-large { padding: 14px 22px; font-size: 14px; }
  .upload-area { padding: 16px; height: 270px; border-radius: 16px; }
  .upload-area.has-preview { min-height: 340px; }
  .upload-text { font-size: 20px; }
  .upload-text-desktop { display: none; }
  .upload-text-mobile { display: inline; }
  .upload-sub { display: none; }
  /* Карусель тарифов */
  .pricing .container { padding-left: 0; padding-right: 0; }
  .pricing-header { padding: 0 20px; }
  .pricing-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
    gap: 10px;
    padding: 24px 12% 20px;
    max-width: none;
    margin: 0;
  }
  .pricing-grid::-webkit-scrollbar { display: none; }
  .plan-card {
    flex-shrink: 0;
    width: 76%;
    scroll-snap-align: center;
    padding: 22px 18px 18px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  .plan-card:not(.is-active) { transform: scale(0.97); }
  .plan-card.is-active {
    transform: scale(1.04);
    box-shadow: 0 16px 48px -12px rgba(28,20,16,0.22);
  }
  .plan-card.popular.is-active {
    box-shadow: 0 20px 64px -16px rgba(40,20,10,0.45);
  }
  /* Кнопка зависит от позиции в карусели, а не от HTML-модификатора (.fill/.outline).
     Активная (по центру) — фирменная оранжевая + одноразовый bounce при попадании. */
  .plan-card.is-active .plan-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    animation: planBtnSnapBounce 0.4s ease-out;
  }
  .plan-card:not(.is-active) .plan-btn {
    background: #fff;
    color: var(--fg);
    border: 1px solid var(--line);
  }
  /* Mobile pricing — compact чтобы карточка влезала в реальный iPhone Safari viewport (~520px после address bar) */
  .pricing { padding: 24px 0 32px !important; }
  .pricing-header h2 { font-size: 28px !important; margin-bottom: 4px !important; }
  .pricing-header .pricing-note { font-size: 13px !important; }
  .plan-card { padding: 16px 16px 14px !important; }
  .plan-card.popular { padding-top: 22px !important; }
  .plan-name { font-size: 18px !important; margin-bottom: 4px !important; }
  .plan-price { font-size: 28px !important; }
  .plan-period { font-size: 12px !important; }
  .plan-divider { margin: 8px 0 !important; }
  .plan-features { margin-bottom: 10px !important; }
  .plan-features li { font-size: 12.5px !important; padding: 3px 0 !important; }
  .plan-card .btn-large, .plan-card .plan-btn { padding: 10px 18px !important; font-size: 14px !important; }
  .upload-section { padding: 12px 0 32px; }
  .upload-tips { grid-template-columns: 1fr; gap: 12px; }
  #userName { display: none; }
  .user-balance { font-size: 12px; padding: 3px 8px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  .preview-wrap { height: 280px; }
  .action-row { gap: 10px; width: 100%; }
  .btn-rotate { width: 48px; height: 48px; }
  .modal-content { padding: 24px 18px; max-width: 92vw; }
  .faq { padding: 60px 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  .gallery { padding: 40px 0 60px; }
  .how { padding: 60px 0; }
  .pricing { padding: 60px 0; }

  /* Hero на мобиле — переупорядочивание: фото → CTA → заголовок → описание → буллеты → счётчик */
  .hero { padding: 24px 0 32px; }
  .hero-inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
  }
  .hero-visual {
    order: 1;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
  .hero-frame { transform: none; height: auto; }
  .hero-frame > .slider-container { aspect-ratio: 1728/2452; max-height: 380px; }
  .hero-time-badge { display: none; }

  .hero-text {
    order: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 0;
    gap: 14px;
  }
  /* Внутри hero-text: сначала CTA, потом заголовок, потом описание/буллеты/счётчик */
  .hero-text .hero-btns    { order: 1; margin: 0; gap: 12px; flex-direction: column; width: 100%; }
  .hero-text .hero-btns .btn-accent-pill,
  .hero-text .hero-btns .btn-outline-pill { width: 100%; justify-content: center; }
  .hero-text h1            { order: 2; margin: 0; font-size: 36px; line-height: 1.1; padding: 10px 16px; white-space: nowrap; }
  .hero-text .hero-desc    { order: 3; margin: 0; font-size: 15px; max-width: 100%; }
  .hero-text .hero-bullets { order: 4; margin: 0; align-items: flex-start; }
  .hero-text .hero-counter { order: 5; margin: 0; }

  .hero-text .btn-accent-pill { padding: 14px 24px; font-size: 16px; }
  .hero-text .btn-outline-pill { padding: 12px 18px; font-size: 14px; }

  .hero-photo-caption { font-size: 13px; padding: 6px 4px 2px; }
  .hero-counter-text { font-size: 12px; }
  .hero-counter-text b { font-size: 16px; }

  /* Sticky-tab «3 фото 99₽» на мобильном — компактнее */
  .welcome-side-content { width: 64px; }
  #welcomeSideTab.is-collapsed { left: -64px; }

  /* Mobile account button: только когда залогинен (класс is-logged-in выставляет auth.js) */
  .mobile-account-btn { display: none; }
  .mobile-account-btn.is-logged-in { display: flex !important; }

  /* Section header centering */
  .gallery .container { text-align: center; }
  .how-title { text-align: center; }
  .section-label { text-align: center; }
  h2 { text-align: center; }

  /* Уплотнение вертикальных отступов — first-screen fit (rebuild 2026-05-12: 80→24 чтобы CTA + «примеры» влезали в фолд) */
  .hero { padding: 24px 0 32px; }
  .hero-inner { gap: 20px; }
  .hero-badge-pill { margin-bottom: 8px; }
  h1 { margin-bottom: 10px; }
  .hero-desc { margin-bottom: 16px; }
  .hero-btns { margin-bottom: 20px; }
  .section-sub { margin-bottom: 32px; }
  .upload-section { padding: 12px 0 32px; }
  .gallery { padding: 40px 0 48px; }
  .how { padding: 48px 0; }
  .how-step { padding: 12px 0; }
  .how-step-title { font-size: 18px; }
  .how-steps { gap: 0; }
  .pricing { padding: 48px 0; }
  .faq { padding: 48px 0; }
  .footer { padding: 48px 0 28px; }

  /* Хедер: убрать balance + avatar из шапки */
  .user-menu-trigger { display: none; }
  /* Dropdown от person-icon: fixed под хедером */
  .user-menu:hover .user-menu-dropdown { display: none; }
  .user-menu-dropdown {
    position: fixed;
    top: 64px;
    right: 12px;
    left: auto;
    min-width: 240px;
    padding-top: 0;
  }
  .user-menu-dropdown.is-open { display: block; }
  /* Бургер дальше от края */
  .nav-burger { margin-right: 4px; }
  /* Upload section: заголовок влево, но howto-кнопку центруем отдельно */
  .upload-section-header { text-align: left; }
  .upload-section-header .howto-trigger {
    display: flex;
    margin: 12px auto 0;
    width: fit-content;
    max-width: 100%;
  }
}
@media (max-width: 380px) {
  .preview-wrap { height: 240px; }
  .upload-area { height: 360px; }
  .btn-rotate { width: 48px; height: 48px; }
}

/* ===== БАННЕР 9 МАЯ ===== */
.may9-banner {
  background: #1e0d00;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 60px 28px 20px;
  position: relative;
  overflow: hidden;
}
.may9-text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  font-style: italic;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.2;
}
.may9-star {
  font-style: normal;
  font-size: 28px;
  line-height: 1;
  color: #e32636;
  display: inline-block;
  animation: starPulse 2s ease-in-out infinite;
}
.may9-star-end {
  animation-delay: 1s;
}
@keyframes starPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.35); }
}
.may9-close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.may9-close:hover { color: #fff; }

/* ===== ГЕОРГИЕВСКАЯ ЛЕНТА — фон за контентом ===== */
main {
  position: relative;
}
.ribbon-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32vw;       /* достаточно, чтобы лента не обрезалась снизу */
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  line-height: 0;
}
.ribbon-strip img {
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(-40%);  /* сдвиг вверх — лента в файле начинается примерно с 40% высоты */
}
main > *:not(.ribbon-strip):not(.modal-overlay):not(.lightbox):not(.result-lightbox) {
  position: relative;
  z-index: 1;
}
@media (max-width: 600px) {
  .may9-banner { padding: 18px 48px 18px 14px; }
  .may9-text { font-size: 18px; gap: 8px; }
  .may9-star { font-size: 16px; }
}

/* ===== ALBUM PAGE ===== */
main.album-page { padding: 32px 0 80px; min-height: 70vh; }
.album-loading { text-align: center; padding: 80px 0; color: var(--muted); }
.album-not-found { text-align: center; padding: 80px 0; color: var(--muted); }

.album-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.album-title-input {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--line);
  padding: 4px 6px;
  outline: none;
  min-width: 200px;
  flex: 1;
  transition: border-color 0.15s;
}
.album-title-input:focus { border-color: var(--accent); }
.album-title-input::placeholder { color: var(--muted); font-weight: 400; font-size: 18px; }

.album-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.album-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.album-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.album-btn-primary {
  background: var(--accent);
  color: #fff;
}
.album-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.album-btn-primary:disabled { opacity: 0.5; cursor: default; }
.album-btn-download {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.album-btn-download:hover { background: rgba(184,101,42,0.07); }
.album-btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--line);
}
.album-btn-ghost:hover { background: var(--bg-alt); }

.album-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.album-select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

.album-preset-btns {
  display: flex;
  gap: 4px;
}

.album-preset-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.15s;
}

.album-preset-btn:hover {
  background: var(--line);
}

.album-preset-btn--active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.album-progress {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
}
/* Спиннер в индикаторе «Собираем раскладку…» — чтобы первичная сборка (~8с) не
   выглядела зависшей. Крутится через существующий @keyframes spin. */
.album-progress-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--accent, #b8652a);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
/* Ребилд/перемешивание раскладки (фидбек 03.06): крутим иконку самой кнопки + слегка гасим
   превью — БЕЗ поток-индикатора, который двигал страницу (reflow «съезжает→схлопывается»). */
.album-btn-icon.is-loading { cursor: wait; }
.album-btn-icon.is-loading svg { animation: spin 0.7s linear infinite; transform-origin: center; }
.album-viewer-wrap.is-rebuilding { opacity: 0.5; pointer-events: none; transition: opacity 0.15s ease; }
/* «Пересобрать» подсвечена, когда выбран новый формат/плотность (есть что применить). */
.album-btn-icon.album-btn--attention {
  border-color: var(--accent, #b8652a);
  color: var(--accent, #b8652a);
}
/* Сетка drag-drop (до генерации layout) */
.album-spreads {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.album-spreads.is-book-preview {
  display: block;
}

.album-photo-card {
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  position: relative;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s, outline 0.1s;
  -webkit-user-select: none;
  user-select: none;
}
.album-photo-card:active { cursor: grabbing; }
.album-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
.album-photo-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.97);
}
.album-photo-card.drag-over {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  transform: scale(1.03);
}
.album-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
}

/* Разворот-вью (после рендера, layout заполнен) */
.album-spread {
  position: relative;
  aspect-ratio: 1.414 / 1; /* A4 landscape */
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
/* В разворот-режиме — 1-2 разворота в ряд */
.album-spreads:has(.album-spread) {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

@media (max-width: 640px) {
  .album-toolbar { gap: 8px; }
  .album-title-input { font-size: 18px; min-width: 140px; }
  .album-spreads { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .album-spreads:has(.album-spread) { grid-template-columns: 1fr; }
}

/* ===== ALBUMS LIST PAGE ===== */
.albums-page { padding: 32px 0 80px; min-height: 70vh; }
.albums-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg);
  margin-bottom: 24px;
}

.albums-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.albums-list-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  align-items: stretch;
}
@media (hover: hover) {
  .albums-list-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
  }
}
.albums-list-item .album-link { flex: 1; min-width: 0; }
.albums-list-item.is-editing .album-link { pointer-events: none; }

.album-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  flex-shrink: 0;
}
.album-list-action {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}
.album-list-action:hover {
  background: rgba(139, 94, 60, 0.08);
  color: var(--fg);
  border-color: rgba(139, 94, 60, 0.2);
}
.album-list-action-delete:hover {
  background: rgba(180, 50, 40, 0.08);
  color: #a33;
  border-color: rgba(180, 50, 40, 0.25);
}
.album-list-action:disabled { opacity: 0.4; cursor: default; }

.album-link-title-input {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  border: 1px solid #8b5e3c;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  outline: none;
  width: 100%;
  max-width: 360px;
  pointer-events: auto;
  text-decoration: none;
}

.album-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.album-link-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
}

.album-link-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.albums-empty {
  text-align: center;
  padding: 60px 0;
  color: var(--muted);
}
.albums-empty a { color: var(--accent); font-weight: 500; }

@media (max-width: 580px) {
  .album-link { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ===== КНИЖНЫЙ ПРЕДПРОСМОТР АЛЬБОМА ===== */
/* ===== ALBUM VIEWER (новый book preview) ===== */

.album-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 56px;
  margin-top: 12px;
  position: relative;
}

.album-spread-container {
  width: min(92vw, 1040px);
  position: relative;
}

/* Разворот — два слайда рядом */
.album-slide {
  display: none;
  position: relative; /* контекст для .album-spread-canvas (absolute поверх страниц) */
  width: 100%;
  aspect-ratio: 4 / 3;
  flex-direction: row;
  box-shadow: 0 6px 28px rgba(60, 40, 20, 0.18), 0 2px 6px rgba(60, 40, 20, 0.08);
  border-radius: 2px;
}
.album-slide--active { display: flex; }

/* Обложка-разворот (Wave 2) — задняя | корешок | передняя */
.album-slide--cover {
  width: 100%;
  box-shadow: 0 6px 28px rgba(60, 40, 20, 0.20), 4px 0 12px rgba(60, 40, 20, 0.10);
  /* aspect-ratio задаётся inline через JS (getFormatAspect) */
}
.album-slide--cover.album-slide--active { display: flex; flex-direction: row; }

.album-cover-page {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.album-cover-back {
  box-shadow: inset -3px 0 8px rgba(0,0,0,0.10);
}
.album-cover-front {
  box-shadow: inset 3px 0 8px rgba(0,0,0,0.10);
}
.album-cover-spine {
  width: 6px;
  flex-shrink: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.28) 100%);
  z-index: 1;
}
.album-cover-back-logo {
  position: absolute;
  left: 0; right: 0; bottom: 14px;
  text-align: center;
  font-family: var(--serif, Georgia, serif);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Подписи под обложкой-разворотом */
.album-cover-labels {
  display: flex;
  margin-top: 8px;
  gap: 6px;
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  color: #8a7866;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.album-cover-labels .album-cover-label {
  flex: 1;
  text-align: center;
}

/* Страница */
.album-page {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
  padding: 10px;
  box-sizing: border-box;
}
.album-page--left  { box-shadow: inset -3px 0 8px rgba(0,0,0,0.10); }
.album-page--right { box-shadow: inset  3px 0 8px rgba(0,0,0,0.10); }
.album-page--cover { width: 100%; height: 100%; }

/* Корешок */
.album-spine {
  width: 4px;
  flex-shrink: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.04) 50%, rgba(0,0,0,0.2) 100%);
  z-index: 1;
}

/* Единый холст разворота поверх «бумаги» страниц: слоты позиционируются по rect
   всего разворота (как PDF). Страницы left/right/spine под ним — только фон. */
.album-spread-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
}
/* Без padding — поля уже заложены в rect слотов (safe-зона из album-templates). */
.album-spread-canvas .album-photo-frame { padding: 0; }

/* Слот под фото */
.album-photo-slot {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f5f5f5;
}
.album-photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
}

/* Полароидная рамка вокруг каждого фото в развороте.
   Фото никогда не обрезается, letterbox заливается цветом бумаги.
   Тень на фото — через drop-shadow по alpha-каналу (object-fit:contain
   делает letterbox прозрачным → тень повторяет видимые края фото). */
.album-photo-frame {
  background: #fff;
  overflow: hidden;
  border-radius: 2px;
}
.album-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.18));
}

/* --- Ручное кадрирование (фаза C3) --- */
/* Кнопки ⤢ больше нет: тап/клик по фото = вход в редактирование (album.js appendSlotImage).
   Hover-аффорданс (десктоп) подсказывает что фото редактируемо; на тач — is-cropping outline
   появляется сразу по тапу. touch-action:manipulation убирает 300ms click-delay на iOS. */
.album-photo-frame, .album-cover-crop-wrap { touch-action: manipulation; }
.album-photo-frame:not(.is-cropping):hover,
.album-cover-crop-wrap:not(.is-cropping):hover { outline: 2px solid rgba(184,101,42,0.45); cursor: zoom-in; }
.album-photo-frame.is-cropping { outline: 2px solid #b8652a; cursor: move; z-index: 5; }
.album-photo-frame.is-cropping img { filter: none; }

/* Кадрирование фото ОБЛОЖКИ — те же состояния, без рамки/фона album-photo-frame
   (обложка = cover-фото на чистом фоне, не полароидная рамка разворота). */
.album-cover-crop-wrap.is-cropping { outline: 2px solid #b8652a; cursor: move; z-index: 5; }

.album-crop-facebox {
  position: absolute; pointer-events: none; z-index: 5;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
  border-radius: 2px;
}
.album-crop-panel {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; z-index: 7;
  background: rgba(0,0,0,0.85); padding: 5px 8px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); /* отделить панель от нижележащего фото */
}
.album-crop-panel .album-crop-hint { color: rgba(255,255,255,0.8); font-size: 11px; white-space: nowrap; }
.album-crop-panel .album-crop-zoom { width: 80px; }
.album-crop-panel button {
  border: none; border-radius: 5px; padding: 4px 8px;
  font-size: 12px; cursor: pointer;
}
/* «Сбросить» — мелкая вторичная (сохранение авто, «Готово» убрано). */
.album-crop-panel .album-crop-reset {
  background: rgba(255,255,255,0.18); color: #fff;
  padding: 2px 6px; font-size: 11px; opacity: 0.85;
}
@media (max-width: 600px) {
  .album-crop-panel { bottom: 4px; padding: 4px 6px; gap: 4px; }
  .album-crop-panel .album-crop-zoom { width: 60px; }
  .album-crop-panel .album-crop-hint { display: none; }
}

/* #3: «добавить фото» на пустой половине последнего разворота */
.album-add-photo-slot {
  position: absolute; top: 8%; height: 84%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed #c9b9a3; border-radius: 4px; background: rgba(255,255,255,0.45);
  color: #9a8a72; font-size: 14px; cursor: pointer; z-index: 3;
  transition: border-color .15s, color .15s, background .15s;
}
.album-add-photo-slot--right { left: 52%; width: 44%; }
.album-add-photo-slot--left  { left: 4%;  width: 44%; }
.album-add-photo-slot:hover { border-color: #b8652a; color: #b8652a; background: rgba(184,101,42,0.06); }
.album-add-photo-plus { font-size: 34px; line-height: 1; font-weight: 300; }

/* Экран настроек перед раскладкой (новый альбом, layout ещё не сгенерирован) */
.album-layout-setup {
  display: flex; justify-content: center;
  padding: 48px 16px 64px;
}
.album-layout-setup__inner {
  max-width: 480px; text-align: center;
  background: #faf6ef; border: 1px solid rgba(0,0,0,0.08); border-radius: 12px;
  padding: 32px 28px;
}
.album-layout-setup__title {
  font-family: var(--serif, Georgia, serif); font-size: 22px; font-weight: 600;
  color: #1a1a1a; margin-bottom: 10px;
}
.album-layout-setup__text {
  font-size: 15px; line-height: 1.5; color: rgba(0,0,0,0.65); margin: 0 0 22px;
}
.album-layout-setup .album-btn-cta { font-size: 16px; padding: 12px 24px; }
@media (max-width: 600px) {
  .album-layout-setup { padding: 28px 12px 40px; }
  .album-layout-setup__inner { padding: 24px 18px; }
  .album-layout-setup__title { font-size: 19px; }
}

/* Плейсхолдер пустого слота */
.album-page-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9e3d9;
  color: var(--muted);
  font-size: 14px;
}
/* Пустая страница — кликабельная кнопка «+ Добавить фото» */
.album-page-placeholder--add {
  flex-direction: column;
  gap: 6px;
  border: 2px dashed #c9bda6;
  cursor: pointer;
  font-family: var(--sans, sans-serif);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.album-page-placeholder--add:hover {
  background: #ded5c5;
  border-color: #b09a72;
  color: #6a5a44;
}
.album-page-add-icon {
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}
.album-page-add-label {
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* Оверлей обложки */
.album-cover-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

/* Кнопки навигации — наложение поверх viewer по краям */
.album-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(60, 40, 20, 0.15);
  color: #3a2f24;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
  user-select: none;
  z-index: 2;
  opacity: 0;
  box-shadow: 0 2px 8px rgba(60, 40, 20, 0.12);
}
.album-viewer:hover .album-nav-btn { opacity: 1; }
.album-nav-btn:hover { background: #fff; box-shadow: 0 3px 12px rgba(60, 40, 20, 0.20); }
.album-nav-btn:disabled { opacity: 0; cursor: default; pointer-events: none; }
.album-nav-btn--prev { left: 12px; }
.album-nav-btn--next { right: 12px; }

/* Подпись под слайдом */
.album-slide-label {
  text-align: center;
  color: #6a5a48;
  font-family: var(--sans, sans-serif);
  font-size: 14px;
  font-weight: 500;
  margin-top: 14px;
  background: none;
  padding-bottom: 0;
  border-radius: 0;
}

@media (max-width: 700px) {
  .album-viewer { padding: 16px 8px; gap: 0; }
  .album-spread-container { width: min(94vw, 680px); }
  .album-nav-btn { width: 36px; height: 36px; font-size: 15px; opacity: 1; background: rgba(255,255,255,0.92); }
  .album-nav-btn--prev { left: 4px; }
  .album-nav-btn--next { right: 4px; }
}

/* ===== COVER SELECTOR (07-04) ===== */
.cover-selector {
  margin: 0 auto 12px;  /* по центру, не на всю ширину — компактнее */
  background: #fff;
  border: 1px solid #e6dcc9;
  border-radius: 10px;
  padding: 10px 16px;
  width: fit-content;
  max-width: 100%;
}

/* Макет (слева) + фон (справа) рядом, компоненты близко (не раздвинуты) */
.cover-selector-row {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.cover-selector-col {
  flex: 0 0 auto;
  min-width: 0;
}
@media (max-width: 600px) {
  .cover-selector-row { flex-direction: column; gap: 14px; }
}

.cover-selector-heading {
  font-family: var(--sans, sans-serif);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b5a44;
  margin-bottom: 10px;
}

.cover-selector-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.cover-tpl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.cover-tpl-card:hover { background: rgba(255,255,255,0.1); }

.cover-tpl-card--active {
  border-color: #b9a989;
  background: rgba(185,169,137,0.12);
}

/* Thumbnail 100×50 — схематично */
.cover-tpl-thumb {
  width: 100px;
  height: 50px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  background: #2a2820;
}

/* full-bleed: вся площадь — фото + полоса снизу */
.cover-tpl-thumb--full-bleed { background: linear-gradient(to bottom, #5a5040 60%, rgba(0,0,0,0.6) 60%); }
.cover-tpl-thumb--full-bleed::after {
  content: '';
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  height: 2px; background: rgba(255,255,255,0.6);
}

/* frame: рамочный прямоугольник */
.cover-tpl-thumb--frame {
  background: #3a3228;
}
.cover-tpl-thumb--frame::before {
  content: '';
  position: absolute;
  left: 8%; top: 12%; right: 8%; bottom: 30%;
  background: #5a5040;
  border: 1px solid #b9a989;
}
.cover-tpl-thumb--frame::after {
  content: '';
  position: absolute;
  bottom: 8px; left: 0; right: 0;
  height: 2px; background: rgba(255,255,255,0.3);
}

/* top-label: белая полоса сверху + фото снизу */
.cover-tpl-thumb--top-label { background: #5a5040; }
.cover-tpl-thumb--top-label::before {
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0; height: 22%;
  background: #f5f0e8;
}
.cover-tpl-thumb--top-label::after {
  content: '';
  position: absolute;
  top: 25%; left: 0; right: 0; bottom: 0;
}

/* double: два прямоугольника рядом */
.cover-tpl-thumb--double { background: #2a2820; }
.cover-tpl-thumb--double::before {
  content: '';
  position: absolute;
  left: 5%; top: 8%; width: 42%; bottom: 8%;
  background: #5a5040;
  border-radius: 2px;
}
.cover-tpl-thumb--double::after {
  content: '';
  position: absolute;
  left: 53%; top: 8%; right: 5%; bottom: 8%;
  background: #5a5040;
  border-radius: 2px;
}

/* text-only: цветной фон + текстовые линии */
.cover-tpl-thumb--text-only { background: #f5f0e8; }
.cover-tpl-thumb--text-only::before {
  content: '';
  position: absolute;
  left: 15%; top: 36%; right: 15%; height: 4px;
  background: #5a4a3a;
  border-radius: 2px;
}
.cover-tpl-thumb--text-only::after {
  content: '';
  position: absolute;
  left: 30%; top: 50%; right: 30%; height: 2px;
  background: #8a7a6a;
  border-radius: 2px;
}

.cover-tpl-label {
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  color: #6b5a44;
  text-align: center;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wave 6: Viewer wrap = grid + side panel + spread nav strip */
.album-viewer-wrap {
  display: grid;
  grid-template-columns: 1fr 152px;
  gap: 8px;
  align-items: start;
}
.album-viewer-side {
  /* max-height выставляется из JS = высота книги (syncCoverSideHeight),
     чтобы лента не уходила ниже разворота. Fallback — 60vh. */
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e6dcc9;
  border-radius: 10px;
  padding: 12px 10px;
  overflow: hidden;
}
.album-viewer-side[hidden] { display: none; }
.album-viewer-side__title {
  flex: 0 0 auto;
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b5a44;
  margin-bottom: 10px;
  text-align: center;
}
.album-viewer-side__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;       /* список скроллится внутри высоты книги */
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-content: start;
  padding: 2px;           /* чтобы border активной карточки не обрезался */
}
/* Переопределяем базовые правила .cover-photo-thumb (60×60 fixed).
   Квадратная карточка: aspect-ratio:1/1 на КНОПКЕ (задаёт высоту grid-ячейки),
   img width/height:100% object-fit:cover. Только на img — кнопка оставалась auto-height
   и растягивалась под натуральный размер фото при изменении размера альбома. */
.album-viewer-side__list .cover-photo-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}
.album-viewer-side__list .cover-photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.album-viewer-side__list .cover-photo-thumb:hover { transform: none; }
.album-viewer-side__note {
  grid-column: 1 / -1;
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  color: #8a7866;
  text-align: center;
  line-height: 1.4;
  padding: 12px 4px;
}

/* Bottom spread navigator (мини-thumbs всех разворотов) */
.album-spread-nav {
  display: flex;
  gap: 8px;
  margin: 0 auto 14px;
  padding: 10px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  width: min(96vw, 900px);
}
.album-nav-thumb {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.album-nav-thumb__inner {
  width: 88px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #ece2cf;
  overflow: hidden;
  position: relative;
  display: flex;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: border-color 0.15s, transform 0.15s;
}
.album-nav-thumb:hover .album-nav-thumb__inner {
  border-color: #c4a577;
  transform: translateY(-1px);
}
.album-nav-thumb--active .album-nav-thumb__inner {
  border-color: #d97a30;
  box-shadow: 0 0 0 2px rgba(217,122,48,0.2);
}
.album-nav-thumb__page {
  flex: 1;
  position: relative;
  background: #fff;
  border-right: 1px solid rgba(0,0,0,0.18);
}
.album-nav-thumb__page:last-child { border-right: none; }
.album-nav-thumb__inner--cover {
  /* фон передаётся inline */
  align-items: center;
  justify-content: center;
}
.album-nav-thumb__cover-photo {
  width: 50%;
  height: 70%;
  object-fit: cover;
  position: absolute;
  right: 8%;
  top: 15%;
}
.album-nav-thumb__label {
  font-family: var(--sans, sans-serif);
  font-size: 10px;
  color: #6b5a44;
  letter-spacing: 0.02em;
}
.album-nav-thumb--active .album-nav-thumb__label {
  color: #d97a30;
  font-weight: 600;
}

/* Mobile/планшет: панель «Фото обложки» под книгой — компактная ГОРИЗОНТАЛЬНАЯ лента
   (не растягивается на весь список, фидбек 30.05). */
@media (max-width: 760px) {
  .album-viewer-wrap { grid-template-columns: 1fr; }
  .album-viewer-side {
    position: static;
    max-height: none;            /* высота по контенту ленты */
    margin-top: 12px;
    overflow: hidden;
  }
  .album-viewer-side__list {
    grid-template-columns: none;
    grid-auto-flow: column;       /* лента: карточки в ряд */
    grid-auto-columns: 72px;
    overflow-x: auto;             /* горизонтальный скролл вместо вертикальной простыни */
    overflow-y: hidden;
    max-height: 120px;
  }
}

/* Базовый адаптив книги под узкие экраны (фидбек 30.05: оптимизировать под разные
   экраны, пока браузер). Книга резиновая (min(96vw)), стрелки компактнее, тулбар-pills
   скроллятся горизонтально вместо переноса в 3-4 строки. */
@media (max-width: 640px) {
  .album-viewer { padding: 0 36px; }            /* меньше места под стрелки */
  .album-spread-container { width: min(96vw, 680px); }
  .album-nav-btn { width: 32px; height: 32px; }
  /* pills формата/плотности — горизонтальный скролл, не ломаются в столбик */
  .album-toolbar-row--controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .album-pill-group { flex-shrink: 0; }
}
@media (max-width: 400px) {
  .album-viewer { padding: 0 28px; }
  .album-nav-btn { width: 28px; height: 28px; }
}

/* Wave 5: Add-photos modal */
.add-photos-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.add-photos-modal[hidden] { display: none; }
.add-photos-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20,16,12,0.55);
  backdrop-filter: blur(2px);
}
.add-photos-modal__panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: min(96vw, 820px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.32);
  overflow: hidden;
}
.add-photos-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #ece2cf;
}
.add-photos-modal__title {
  margin: 0;
  font-family: var(--serif, Georgia, serif);
  font-size: 18px;
  font-weight: 600;
  color: #2a201a;
}
.add-photos-modal__close {
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 22px;
  color: #6b5a44;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.add-photos-modal__close:hover { background: #f5f0e8; border-color: #d6cab8; }
.add-photos-modal__meta {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  color: #6b5a44;
  background: #faf6ef;
  border-bottom: 1px solid #ece2cf;
}
.add-photos-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}
.add-photos-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.add-photos-modal__empty,
.add-photos-modal__loading {
  text-align: center;
  padding: 40px 0;
  color: #8a7866;
  font-family: var(--sans, sans-serif);
  font-size: 14px;
}
.add-photos-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: #eee;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.add-photos-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.add-photos-card:hover { border-color: #c4a577; transform: translateY(-1px); }
.add-photos-card--selected { border-color: #d97a30; box-shadow: 0 0 0 2px rgba(217,122,48,0.2); }
.add-photos-card__check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: color 0.15s, background 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.add-photos-card--selected .add-photos-card__check {
  background: #d97a30;
  color: #fff;
}
.add-photos-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #ece2cf;
}

@media (max-width: 600px) {
  .add-photos-modal__panel { width: 100vw; max-height: 100vh; border-radius: 0; }
  .add-photos-modal__grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

/* Cover inline editing (Wave 4) — hover/focus visible на title/subtitle */
.cover-text-editable {
  border-radius: 3px;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.cover-text-editable:hover {
  background: rgba(255,255,255,0.06);
  box-shadow: inset 0 -1px 0 currentColor;
}
.album-cover-front [data-bg-tone="dark"] .cover-text-editable:hover,
.album-cover-front[data-bg-tone="dark"] .cover-text-editable:hover {
  background: rgba(255,255,255,0.10);
}
.cover-text-editable:focus {
  background: rgba(255,255,255,0.18);
  outline: 1px dashed currentColor;
  outline-offset: 2px;
}

/* Cover background picker — Wave 1: tabs Цвет/Градиент/Текстура */
.cover-bg-picker {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cover-bg-label {
  font-family: var(--sans, sans-serif);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b5a44;
}

.cover-bg-tabs {
  display: inline-flex;
  border: 1px solid #d6cab8;
  border-radius: 18px;
  padding: 2px;
  background: #fff;
  align-self: flex-start;
}
.cover-bg-tab {
  border: none;
  background: none;
  padding: 5px 14px;
  font-family: var(--sans, sans-serif);
  font-size: 12px;
  font-weight: 500;
  color: #6a5a48;
  cursor: pointer;
  border-radius: 16px;
  transition: background 0.15s, color 0.15s;
}
.cover-bg-tab:hover { color: #2a201a; }
.cover-bg-tab--active {
  background: #3a2f24;
  color: #fff;
}
.cover-bg-tab--active:hover { color: #fff; }

.cover-bg-swatches {
  display: flex;
  flex-wrap: nowrap;   /* все свотчи в один ряд (8 цветов / 4 градиента / 4 текстуры) */
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  /* Фикс. размер зоны под МАКСИМУМ свотчей (8 цветов: 8×30 + 7×6 = 282px),
     чтобы блок не скакал по ширине/высоте при смене вкладки (4 vs 8 свотчей). */
  min-height: 32px;
  width: 282px;
  max-width: 100%;
}

.cover-bg-swatch {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.cover-bg-swatch:hover { border-color: #c4a577; transform: translateY(-1px); }
.cover-bg-swatch--active { border-color: #d97a30; box-shadow: 0 0 0 2px rgba(217,122,48,0.2); }

/* ===== ТАБ-НАВИГАЦИЯ ЛК (глобальные стили) ===== */
.lk-tabs-wrap {
  background: var(--bg, #faf6ef);
  border-bottom: 1px solid rgba(185,169,137,0.25);
  padding: 0;
}
.lk-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 0 0;
  align-items: center;
  justify-content: center;
}
.lk-tab {
  padding: 8px 18px;
  border-radius: 20px 20px 0 0;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg, #2a1f15);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.lk-tab:hover:not(.lk-tab-active) {
  background: rgba(185,169,137,0.12);
  border-color: rgba(185,169,137,0.3);
}
.lk-tab-active {
  background: var(--fg, #1c1410);
  color: #fff;
  border-color: var(--fg, #1c1410);
}
.lk-tab-topup {
  margin-left: auto;
  border-radius: 20px;
  border: 1.5px solid rgba(185,169,137,0.45);
  font-size: 13px;
  padding: 7px 14px;
}
@media (max-width: 580px) {
  .lk-tabs { gap: 2px; padding: 8px 0 0; }
  .lk-tab { padding: 7px 12px; font-size: 13px; }
}

/* ===== ALBUM BREADCRUMB ===== */
.album-breadcrumb {
  border-bottom: 1px solid rgba(185, 169, 137, 0.18);
  background: #faf6ec;
}
.album-breadcrumb .container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}
.album-breadcrumb-back {
  color: #8b5e3c;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.album-breadcrumb-back:hover {
  color: #6e4727;
  text-decoration: underline;
}
.album-breadcrumb-sep {
  color: #b9a989;
}
.album-breadcrumb-current {
  color: #5a4a3a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}

/* ===== Welcome Promo: side-tab + модалка ===== */
@keyframes sideTabShimmer {
  0%    { transform: translateX(-180%) skewX(-12deg); }
  8%    { transform: translateX(280%) skewX(-12deg); }
  100%  { transform: translateX(280%) skewX(-12deg); }
}
#welcomeSideTab {
  position: fixed;
  left: 0;
  top: 70%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: row;
  transition: left 0.28s ease;
  filter: drop-shadow(2px 2px 8px rgba(184, 101, 42, 0.35));
}
#welcomeSideTab.is-collapsed { left: -78px; }
.welcome-side-content {
  width: 78px;
  padding: 14px 8px;
  background: linear-gradient(180deg, #b8652a 0%, #d97a3a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.welcome-side-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: sideTabShimmer 12s ease-in-out infinite;
  pointer-events: none;
}
.welcome-side-toggle {
  width: 20px;
  background: #9a4d1a;
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  transition: opacity 0.18s;
}
.welcome-side-toggle:hover { opacity: 0.8; }
.welcome-side-tab-icon { font-size: 20px; line-height: 1; }
.welcome-side-tab-label {
  font: 600 11px/1.3 system-ui, sans-serif;
}
.welcome-side-tab-price {
  font: 700 13px/1 system-ui, sans-serif;
}
.welcome-side-tab-timer {
  font: 600 11px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

/* ===== АКЦИОННЫЙ САЙДБАР (виден всем) ===== */
#promoSideTab {
  position: fixed;
  left: 0;
  top: 70%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: row;
  transition: left 0.28s ease;
  filter: drop-shadow(2px 2px 8px rgba(184, 101, 42, 0.35));
}
#promoSideTab.is-collapsed { left: -78px; }
.promo-side-content {
  width: 78px;
  padding: 14px 8px;
  background: linear-gradient(180deg, #b8652a 0%, #d97a3a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.promo-side-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 55%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: sideTabShimmer 10s ease-in-out infinite;
  pointer-events: none;
}
.promo-side-toggle {
  width: 20px;
  background: #9a4d1a;
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  transition: opacity 0.18s;
}
.promo-side-toggle:hover { opacity: 0.8; }
@media (max-width: 600px) {
  .promo-side-content { width: 64px; }
  #promoSideTab.is-collapsed { left: -64px; }
}

/* ===== ПЕРСОНАЛЬНЫЙ САЙДБАР (user_offer, только для владельца) ===== */
#userOfferSideTab {
  position: fixed;
  left: 0;
  top: 70%;
  transform: translateY(-50%);
  z-index: 91;
  display: flex;
  flex-direction: row;
  transition: left 0.28s ease;
  filter: drop-shadow(2px 2px 8px rgba(184, 101, 42, 0.35));
}
#userOfferSideTab.is-collapsed { left: -78px; }
.user-offer-side-content {
  width: 78px;
  padding: 14px 8px;
  background: linear-gradient(180deg, #b8652a 0%, #d97a3a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.user-offer-side-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 55%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: sideTabShimmer 10s ease-in-out infinite;
  pointer-events: none;
}
.user-offer-side-subtext {
  font: 400 10px/1.3 system-ui, sans-serif;
  opacity: 0.88;
}
.user-offer-side-price {
  font: 700 11px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .user-offer-side-content { width: 64px; }
  #userOfferSideTab.is-collapsed { left: -64px; }
}

/* ===== Срочный вид сайдбара — последний час акции (класс is-urgent на обёртке) ===== */
.is-urgent .welcome-side-content,
.is-urgent .promo-side-content,
.is-urgent .user-offer-side-content {
  background: linear-gradient(180deg, #d12f22 0%, #e8543a 100%);
  animation: urgentPulse 1.5s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(209, 47, 34, 0); }
  50%      { box-shadow: 0 0 18px 3px rgba(209, 47, 34, 0.6); }
}
/* Свёрнутый срочный сайдбар периодически слегка подрагивает на месте — привлечь внимание.
   Малая амплитуда: НЕ выезжает из свёрнутого положения, иначе читается как «развернулся». */
.is-urgent.is-collapsed {
  animation: urgentPeek 6s ease-in-out infinite;
}
@keyframes urgentPeek {
  0%, 78%, 100% { transform: translate(0, -50%); }
  82%, 90%      { transform: translate(4px, -50%); }
  86%, 94%      { transform: translate(-4px, -50%); }
}

/* Свёрнутый сайдбар разворачивается при наведении мыши — без клика по стрелке.
   Класс is-collapsed не снимается: курсор ушёл — сайдбар снова свёрнут. */
@media (hover: hover) {
  #welcomeSideTab.is-collapsed:hover,
  #promoSideTab.is-collapsed:hover,
  #userOfferSideTab.is-collapsed:hover {
    left: 0;
    animation: none;
  }
}

.welcome-promo-modal {
  max-width: 400px;
  text-align: center;
  padding: 28px 28px 24px;
}
.welcome-badge {
  display: inline-block;
  background: #b8652a;
  color: #fff;
  font: 700 11px/1 var(--sans, system-ui, sans-serif);
  letter-spacing: 0.10em;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.welcome-promo-modal h3 {
  font-family: var(--serif, Georgia, serif);
  font-size: 26px;
  margin: 0 0 6px;
  color: #1c1410;
}
.welcome-sub {
  color: #6b5c4e;
  font-size: 13px;
  margin: 0 0 22px;
}
.welcome-offer {
  margin-bottom: 18px;
  background: #faf6ef;
  border: 1px solid rgba(185, 169, 137, 0.35);
  border-radius: 14px;
  padding: 18px 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.welcome-offer-primary {
  background: linear-gradient(180deg, #fff5ea 0%, #ffe8d4 100%);
  border-color: #b8652a;
}
.offer-label {
  font: 700 10px/1 var(--sans, system-ui, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8652a;
}
.welcome-offer:not(.welcome-offer-primary) .offer-label { color: #888; }
.offer-title {
  font-family: var(--serif, Georgia, serif);
  font-size: 19px;
  line-height: 1.2;
  color: #1c1410;
  margin-top: 4px;
}
.offer-title b {
  font-weight: 700;
  font-size: 24px;
  color: #b8652a;
}
.offer-strike {
  color: #888;
  font-size: 13px;
}
.offer-sub {
  color: #6b5c4e;
  font-size: 12px;
}
.welcome-offer .btn {
  margin-top: auto;
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  text-decoration: none;
  border-radius: 30px;
  box-sizing: border-box;
}
.welcome-timer {
  font-size: 13px;
  color: #6b5c4e;
}
.welcome-timer strong {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  color: #b8652a;
  margin-left: 4px;
}
.welcome-decline {
  background: transparent;
  border: none;
  color: #8a7a6a;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  margin-bottom: 14px;
  text-decoration: underline;
  text-decoration-color: rgba(138, 122, 106, 0.4);
  transition: color 0.15s;
}
.welcome-decline:hover { color: #5a4a3a; }
@media (max-width: 480px) {
  .welcome-promo-modal { padding: 22px 18px; }
}

/* ===== Custom tariff slider ===== */
.custom-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}
.custom-controls input[type="range"] {
  width: 100%;
  accent-color: #b8652a;
  cursor: pointer;
  height: 4px;
}
.custom-controls input[type="number"] {
  width: 80px;
  align-self: center;
  text-align: center;
  border: 1.5px solid #d4c4ac;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 15px;
  font-weight: 600;
  color: #1c1410;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.custom-controls input[type="number"]:focus { border-color: #b8652a; }
.custom-controls input[type="number"]::-webkit-inner-spin-button,
.custom-controls input[type="number"]::-webkit-outer-spin-button { opacity: 1; }

.upload-disclaimer {
  max-width: 460px;
  margin: 24px auto 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  padding: 0 16px;
}
@media (max-width: 600px) {
  .upload-disclaimer {
    font-size: 10.5px;
    line-height: 1.45;
    margin-top: 16px;
    max-width: 320px;
  }
}

/* ===== CTA: Halo ring + Arrow nudge ===== */
@keyframes ctaHalo {
  0%   { box-shadow: 0 0 0 0 rgba(184, 101, 42, 0.55); }
  40%  { box-shadow: 0 0 0 14px rgba(184, 101, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 101, 42, 0); }
}
@keyframes ctaArrowNudge {
  0%, 55%, 100% { transform: translateX(0); }
  75%           { transform: translateX(5px); }
}
.btn-accent-pill:not(.btn-header-cta) {
  animation: ctaHalo 2.2s ease-out infinite;
}
.btn-accent-pill:not(.btn-header-cta) > svg,
.btn-accent-pill:not(.btn-header-cta) > .cta-arrow {
  animation: ctaArrowNudge 2.2s ease-in-out infinite;
  display: inline-block;
}
.btn-accent-pill:not(.btn-header-cta):hover,
.btn-accent-pill:not(.btn-header-cta):hover > svg,
.btn-accent-pill:not(.btn-header-cta):hover > .cta-arrow { animation-play-state: paused; }

/* ===== Upload area: дышащая рамка + баунс иконки (для всех пользователей) ===== */
@keyframes uploadBreathe {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(184, 101, 42, 0.18), 0 0 0 0 rgba(184, 101, 42, 0.10);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(184, 101, 42, 0.10), 0 0 32px 4px rgba(184, 101, 42, 0.18);
  }
}
@keyframes uploadIconBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.upload-area {
  animation: uploadBreathe 3s ease-in-out infinite;
}
.upload-area:hover,
.upload-area.drag-over,
.upload-area.is-uploading,
.upload-area.has-file,
.upload-area.has-preview {
  animation: none;
  box-shadow: none;
}
.upload-area:has(#uploadPreview:not([style*="display:none"])),
.upload-area:has(#uploadResult:not([style*="display:none"])) {
  animation: none;
  box-shadow: none;
}
.upload-icon-wrap {
  animation: uploadIconBounce 3s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .btn-accent-pill, .btn-accent-pill > svg, .btn-accent-pill > .cta-arrow,
  .upload-area, .upload-icon-wrap { animation: none; }
}

/* ===== OTO-БЛОК (One-Time Offer) ===== */
.oto-block {
  max-width: 460px;
  width: 100%;
  margin: 14px auto 0;
  padding: 16px 18px 14px;
  background: rgba(255, 251, 240, 1);
  border: 1.5px solid rgba(184, 101, 42, 0.4);
  border-radius: 16px;
  text-align: center;
  box-sizing: border-box;
}
.oto-block h3 {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  color: var(--accent);
  margin: 0 0 6px;
}
.oto-block p {
  text-align: center;
  line-height: 1.4;
  margin: 0 0 10px;
  font-size: 15px;
}
.oto-cta {
  width: 100%;
  justify-content: center;
  text-align: center;
  margin: 6px 0 8px;
  padding: 13px 20px;
  font-size: 15px;
  position: relative;
  overflow: hidden;
}
.oto-cta > span { position: relative; z-index: 1; }
.oto-cta::after {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: otoShimmer 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes otoShimmer {
  0%, 70%, 100% { left: -75%; }
  90% { left: 175%; }
}
.oto-cta:hover::after { animation-play-state: paused; }
.oto-fineprint {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 4px !important;
  line-height: 1.3;
}
.oto-timer {
  font-family: monospace;
  font-size: 22px;
  font-weight: 700;
  color: #b8652a;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
@media (max-width: 480px) {
  .oto-block { padding: 14px 14px 12px; max-width: 360px; }
  .oto-block h3 { font-size: 16px; }
  .oto-block p { font-size: 14px; }
  .oto-cta { padding: 12px 16px; font-size: 14px; }
  .oto-timer { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .oto-cta::after { animation: none; opacity: 0; }
}

/* ===== EMAIL VERIFY BANNER ===== */
.email-verify-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  z-index: 9000;
  font-size: 14px;
}
.email-verify-btn {
  background: #fff;
  color: var(--accent);
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.email-verify-btn:disabled {
  opacity: 0.7;
  cursor: default;
}
.email-verify-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  opacity: 0.8;
}
.email-verify-close:hover { opacity: 1; }
body:has(#emailVerifyBanner) { padding-top: 40px; }
@media (max-width: 480px) {
  .email-verify-banner { flex-wrap: wrap; text-align: center; }
}

/* ===== КРОП-МОДАЛКА ===== */
/* Z-index 10000 — выше lightbox (9999), чтобы кроп открывался поверх */
/* Затемнённая подложка — фокус на редакторе, страница не отвлекает */
.crop-modal { padding: 16px; z-index: 10000; background: rgba(28,20,16,0.85); }
.crop-modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px 14px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 8px;  /* поплотнее: header-body-footer ближе друг к другу */
  position: relative;
  box-shadow: 0 8px 40px rgba(28,20,16,0.25);
}
.crop-modal-header h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
  text-align: center;
}
.crop-modal-body {
  display: flex;
  gap: 16px;
  min-height: 0;
  flex: 1;
}
.crop-canvas-wrap {
  flex: 1;
  min-width: 0;
  background: #f0eae0;
  border-radius: 8px;
  overflow: hidden;
  max-height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-canvas-wrap img {
  display: block;
  max-width: 100%;
}
.crop-aspect-panel {
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding: 2px;
  /* Desktop: центрируем пресеты вертикально внутри правой колонки */
  justify-content: center;
}
.crop-aspect-btn {
  background: transparent;
  border: 1px solid #e0d5c0;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.crop-aspect-btn:hover { background: #f6efe1; }
/* Базовые фото-форматы выделены полутоном, чтобы юзер видел самые ходовые */
.crop-aspect-btn.is-common {
  background: rgba(184,101,42,0.08);
  border-color: rgba(184,101,42,0.28);
}
.crop-aspect-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.crop-modal-footer {
  display: flex;
  gap: 8px;
  /* Тянем по всей ширине body — таблетки выровнены под фото-блок */
  width: 100%;
}
.crop-footer-pill {
  border-radius: 999px !important;
  padding: 10px 18px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.crop-footer-text { flex: 1.4 1 0; min-width: 0; text-align: center; }
.crop-footer-rotate { flex: 1 1 0; min-width: 0; }
.crop-rotate-label { font-size: 13px; }

@media (max-width: 600px) {
  /* Модалка должна вместить превью + ряд пресетов + кнопки в один экран без скролла */
  .crop-modal { padding: 6px; align-items: flex-start; padding-top: 8px; }
  .crop-modal-content {
    padding: 10px 12px 12px;
    gap: 8px;
    max-height: calc(100vh - 16px);
    height: calc(100vh - 16px);
    border-radius: 12px;
  }
  .crop-modal-header h3 { font-size: 16px; }
  .crop-modal-body {
    flex-direction: column;
    gap: 8px;
  }
  .crop-canvas-wrap {
    /* Канвас занимает ровно столько, чтобы под ним помещались чипы пресетов + кнопки */
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    width: 100%;
  }
  .crop-aspect-panel {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 6px;
    /* плавная остановка по чипам */
    scroll-snap-type: x proximity;
    justify-content: flex-start;
    /* Свайп-хинт: фейд по краям ленты, видно что есть продолжение */
    mask-image: linear-gradient(to right, transparent 0, black 6%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 6%, black 92%, transparent 100%);
    gap: 8px;
  }
  .crop-aspect-panel::-webkit-scrollbar { display: none; }
  .crop-aspect-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    min-width: 64px;
    font-size: 14px;
    scroll-snap-align: center;
  }
  .crop-modal-footer {
    flex: 0 0 auto;
    gap: 6px;
    padding-top: 2px;
  }
  /* На мобиле: 4 элемента, центры выровнены, иконки маленькие, текст центрирован */
  .crop-footer-pill {
    padding: 11px 8px;
    font-size: 14px;
    min-width: 0;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .crop-footer-text {
    flex: 1.6 1 0;
    text-align: center;
    font-weight: 600;
  }
  .crop-footer-rotate {
    flex: 0.8 0 38px;
    padding: 11px 6px;
  }
  /* На мобиле текст у rotate-кнопок скрыт — только иконка */
  .crop-rotate-label { display: none; }
  /* Закрытие справа сверху чуть ближе к краю */
  .crop-modal .modal-close { top: 6px; right: 8px; font-size: 26px; }
}

/* Триггер-кнопка кропа рядом с rotate (на index-test). Pill с лейблом «Обрезать». */
.btn-crop-trigger {
  width: auto !important;
  height: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 0 16px !important;
  border-radius: 999px !important;
  min-height: 36px;
}
.btn-crop-label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .btn-crop-trigger { padding: 0 12px !important; min-height: 34px; }
  .btn-crop-label { font-size: 12px; }
}

/* ===== EDIT MODE В ЛАЙТБОКСЕ ГАЛЕРЕИ ===== */
.lb-actions-normal,
.lb-actions-edit {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  justify-content: center;
}
/* HTML-атрибут hidden должен побеждать display:flex выше — поэтому !important */
.lb-actions-normal[hidden],
.lb-actions-edit[hidden] { display: none !important; }
.lb-edit-rotate-l, .lb-edit-rotate-r,
.lb-edit-crop, .lb-edit-cancel { color: #faf6ef; }
.lb-edit-crop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto !important;
  padding: 0 14px;
  border-radius: 999px !important;
}
.lb-edit-crop svg { width: 18px; height: 18px; }
.lb-edit-label { font-size: 14px; font-weight: 500; }
.lb-edit-cancel {
  background: rgba(255,255,255,0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto !important;
  padding: 0 14px;
  border-radius: 999px !important;
}
.lb-edit-cancel svg { width: 16px; height: 16px; }
.lb-edit-cancel-label { font-size: 14px; font-weight: 500; }
.lb-edit-save {
  /* Стилизуется как обычная .lb-download-btn */
}
@media (max-width: 600px) {
  .lb-actions-normal,
  .lb-actions-edit { gap: 6px; }
  .lb-edit-crop { padding: 0 10px; }
  /* На мобилке убираем текст у иконок чтобы было компактнее, но Отмена/Сохранить наоборот растягиваем */
  .lb-edit-crop > .lb-edit-label { display: none; }
  /* Симметричные «таблетки» Отмена / Сохранить — обе одинаковой ширины, по центру */
  .lb-actions-edit .lb-edit-cancel,
  .lb-actions-edit .lb-edit-save {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    justify-content: center;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
  }
  /* Поворотные иконки и крон-кнопка между ними — фиксированной ширины, не растягиваются */
  .lb-actions-edit .lb-edit-rotate-l,
  .lb-actions-edit .lb-edit-rotate-r,
  .lb-actions-edit .lb-edit-crop {
    flex: 0 0 auto;
  }
}

/* ===== UX-redesign (перенесено из test-страницы 2026-05-20) ===== */

/* Header swap: howto-trigger (idle) ↔ #hdrStatus (preview) */
.upload-section-header[data-test-header] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.upload-section-header[data-test-header] h2 { margin: 0; }
.upload-section-header[data-test-header] .howto-trigger { margin-top: 0; }
.upload-section-header[data-test-header] [hidden] { display: none !important; }
.hdr-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #2e8540;
}
.hdr-status svg { flex-shrink: 0; }

body[data-crop-hints="1"] #sidewaysHint { display: none !important; }

/* Состояние «обнаружена проблема» — кликабельный warn-статус, открывает crop-modal. */
.hdr-status--warn {
  color: #9a7800;
  cursor: pointer;
  align-items: flex-start;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(175, 148, 0, 0.09);
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  max-width: 100%;
  transition: background 0.15s;
}
.hdr-status--warn:hover { background: rgba(175, 148, 0, 0.16); }
.hdr-status--warn:focus-visible {
  outline: 2px solid #9a7800;
  outline-offset: 2px;
}
@media (max-width: 640px) {
  .hdr-status--warn {
    text-align: center;
    align-items: center;
    justify-content: center;
  }
}
.hdr-status--warn svg { margin-top: 2px; }

/* Короткая пульсация кнопки «Обрезать или повернуть» при детекте проблемы.
   Без transform — чтобы layout соседей не двигался. */
@keyframes btnCropPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(44, 36, 22, 0); }
  50%      { box-shadow: 0 0 0 10px rgba(44, 36, 22, 0.18); }
}
.btn-crop-pulse {
  animation: btnCropPulse 0.8s ease-in-out 3;
  border-color: #6b5744 !important;
}

/* Help-link + tooltip (заменил #modeInfo с «?» на текстовую ссылку «Что выбрать?») */
.mode-help-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}
.mode-help-link {
  background: transparent;
  border: 0;
  padding: 3px 8px;
  color: var(--muted, #6b5c4e);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 28px;
}
.mode-help-link:hover { color: var(--fg, #1c1410); }
.mode-help-wrap .mode-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  right: auto; top: auto;
  width: min(280px, calc(100vw - 32px));
}
@media (min-width: 601px) {
  .mode-help-wrap .mode-help-link:hover ~ .mode-tooltip,
  .mode-help-wrap .mode-tooltip:hover { display: block !important; }
}

/* До/После tabs над результатом — тот же визуал что у segmented toggle */
.ba-tabs {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 224px;
  margin: 0 auto 11px;
  padding: 3px;
  background: #ede4d3;
  border-radius: 999px;
  gap: 0;
  position: relative;
  isolation: isolate;
}
.ba-tabs::before {
  content: '';
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  background: var(--accent, #b8652a);
  box-shadow: 0 2px 6px rgba(184,101,42,0.30);
  border-radius: 999px;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 0;
  pointer-events: none;
}
.ba-tabs[data-active="after"]::before { transform: translateX(100%); }
.ba-tab {
  flex: 1 1 50%;
  position: relative; z-index: 1;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: #2c2416;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.18s ease;
  white-space: nowrap;
}
.ba-tab.is-active { color: #fff; }
#resultBeforeImg, #resultAfterImg { cursor: zoom-in; }

/* Result Lightbox: fullscreen overlay с двумя картинками side-by-side.
   whitelist в `main > *:not(...)` расширен — !important не нужен. */
.result-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}
.result-lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.12);
  color: #fff; border: 0; border-radius: 50%;
  font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.result-lightbox-close:hover { background: rgba(255,255,255,0.22); }
.result-lightbox-grid {
  display: flex; gap: 20px;
  width: 100%; max-width: 1400px;
  max-height: 90vh;
}
.result-lightbox-fig {
  flex: 1 1 50%;
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  margin: 0;
  min-width: 0;
}
.result-lightbox-fig img {
  width: 100%;
  max-height: calc(90vh - 40px);
  object-fit: contain;
  border-radius: 8px;
  background: #1a1410;
  cursor: default;
}
.result-lightbox-fig figcaption {
  color: #fff; font-size: 14px;
  letter-spacing: 0.5px; opacity: 0.85;
  font-weight: 600;
}
@media (max-width: 720px) {
  .result-lightbox-grid {
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .result-lightbox-fig img {
    max-height: calc((100vh - 80px) / 2);
  }
}

/* Idle — кнопка «Выбрать фото» вместо текста */
.upload-pick-btn {
  width: 100%;
  max-width: 280px;
  padding: 12px 24px;
  font-size: 16px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Preview vertical stack: toggle → help → restore → ETA */
.action-row--mode.mode-stack {
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.mode-stack #restoreBtn { width: 100%; max-width: 320px; justify-content: center; margin-top: 0; }
.restore-eta {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, #7a6e5e);
}
.restore-eta svg { flex-shrink: 0; opacity: 0.85; }
.mode-stack .mode-chips-wrap { width: 100%; max-width: 320px; justify-content: center; }

/* Segmented toggle — скользящий knob через ::before */
.mode-stack .mode-slide-btn--segmented {
  width: 100%; max-width: 320px;
  height: 48px;
  padding: 4px;
  display: flex;
  gap: 0;
  background: #ede4d3;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  isolation: isolate;
}
.mode-stack .mode-slide-btn--segmented::before {
  content: '';
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: #dbbea0;
  box-shadow: 0 1px 4px rgba(190, 150, 110, 0.20);
  border: 1.5px solid rgba(120, 75, 40, 0.22);
  border-radius: 999px;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 0;
  pointer-events: none;
}
.mode-stack .mode-slide-btn--segmented[data-mode="bw"]::before {
  transform: translateX(100%);
}
.mode-stack .mode-slide-btn--segmented .mode-slide-knob { display: none !important; }
.mode-stack .mode-slide-opt {
  flex: 1 1 50%;
  position: relative; z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: #2c2416;
  transition: color 0.18s;
  user-select: none;
  white-space: nowrap;
}
.mode-stack .mode-slide-btn--segmented[data-mode="color"] .mode-slide-opt[data-opt="color"],
.mode-stack .mode-slide-btn--segmented[data-mode="bw"] .mode-slide-opt[data-opt="bw"] {
  color: #3a2518;
  font-weight: 600;
}

/* Rating-5star overlay-style positioning (перенос из inline test-страницы 2026-05-20) */
.rating5-wrap { position: relative; }
.rating5-thanks-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text, #2c2416);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.rating5-thanks-overlay.is-show { opacity: 1; }
.rating5-thanks-overlay .rating5-heart { font-size: 20px; }
.rating5-wrap.is-locked .rating5-star { pointer-events: none; }
.rating5-wrap.is-locked .rating5-label { visibility: hidden; }

@media (max-width: 600px) {
  .upload-section-header[data-test-header] h2 { font-size: 24px; }
  .hdr-status { font-size: 14px; }
  .hdr-status--warn { font-size: 10px; }
  .upload-pick-btn { max-width: 100%; font-size: 16px; }
  .mode-stack .mode-slide-btn,
  .mode-stack #restoreBtn,
  .mode-stack .mode-chips-wrap { max-width: 100%; }
  .restore-eta { font-size: 13px; }
  .mode-help-wrap .mode-tooltip { width: calc(100vw - 32px); }
}

/* ===== ALBUM EDITOR — UX FIXES ===== */

/* FIX 4: Toast notifications */
.album-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--sans, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.album-toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.album-toast--error   { background: #8b2020; }
.album-toast--success { background: #1e6b30; }
.album-toast--info    { background: #3a5a8a; }

@media (max-width: 640px) {
  .album-toast {
    left: 0; right: 0; bottom: 0;
    max-width: 100%;
    border-radius: 0;
    text-align: center;
  }
}

/* FIX 1: Drag-drop cursors for photos in viewer */
[data-photo-id][draggable="true"] { cursor: grab; }
[data-photo-id].is-dragging       { opacity: 0.45; cursor: grabbing; }
[data-photo-id].drag-over         { outline: 3px solid var(--accent, #b8652a); outline-offset: -2px; }

/* FIX 6: Subtitle input */
.album-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}
.album-subtitle-input {
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 2px 6px;
  outline: none;
  transition: border-color 0.15s;
}
.album-subtitle-input:focus { border-color: var(--accent); color: var(--fg); }
.album-subtitle-input::placeholder { color: rgba(90,70,50,0.4); }

/* FIX 7: Cover photo strip */
.cover-photo-strip {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.cover-photo-strip-label {
  font-family: var(--sans, sans-serif);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.45);
  margin-bottom: 8px;
}
.cover-photo-strip-note {
  font-family: var(--sans, sans-serif);
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  font-style: italic;
}
.cover-photo-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.cover-photo-thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  background: #2a2820;
}
.cover-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.cover-photo-thumb:hover { border-color: rgba(185,169,137,0.6); transform: scale(1.05); }
.cover-photo-thumb--active { border-color: #b8652a; }

/* DPI info banner — конструктивный совет (не warning) */
.dpi-warning-banner[hidden] { display: none; }
.dpi-warning-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #eef4fb;
  border: 1px solid #c9dceb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-family: var(--sans, sans-serif);
  color: #2c4a6e;
}
.dpi-warning-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.dpi-warning-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3a5a8a;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
}
.dpi-warning-text { flex: 1; min-width: 0; }
.dpi-warning-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f3a5a;
  margin-bottom: 3px;
}
.dpi-warning-sub {
  font-size: 13px;
  line-height: 1.4;
  color: #4a6485;
}
.dpi-warning-close {
  flex: 0 0 auto;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 22px;
  color: #1f3a5a;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s;
  margin-left: 8px;
}
.dpi-warning-close:hover { background: rgba(60, 90, 130, 0.12); border-color: #c9dceb; }
.dpi-warning-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.dpi-warning-thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.dpi-warning-thumb:hover { border-color: #3a5a8a; transform: translateY(-1px); }
.dpi-warning-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  pointer-events: none;
}
@media (max-width: 640px) {
  .dpi-warning-banner { border-radius: 8px; padding: 12px 14px; }
  .dpi-warning-sub { font-size: 12px; }
}

/* Toolbar v2 — два ряда: title и controls */
.album-toolbar--v2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  background: none;
  border: none;
}
.album-toolbar--v2 .album-toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.album-toolbar-row--title { align-items: center; }
/* мета не растягивается — спейсер толкает CTA-кнопки вправо */
.album-toolbar-row--title .album-meta { flex: 0 0 auto; }
.album-toolbar--v2 .album-title-group {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.album-toolbar--v2 .album-title-input {
  font-family: var(--serif, Georgia, serif);
  font-size: 22px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  color: #2a201a;
  outline: none;
  border-radius: 6px;
  transition: background-color 0.15s, border-color 0.15s;
}
.album-toolbar--v2 .album-title-input:hover { background: rgba(0,0,0,0.025); }
.album-toolbar--v2 .album-title-input:focus { background: #fff; border-color: #c4a577; }
.album-toolbar--v2 .album-subtitle-input {
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-style: italic;
  color: #8a7866;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  outline: none;
  border-radius: 6px;
  transition: background-color 0.15s, border-color 0.15s;
}
.album-toolbar--v2 .album-subtitle-input:hover { background: rgba(0,0,0,0.025); }
.album-toolbar--v2 .album-subtitle-input:focus { background: #fff; border-color: #d4c3a5; }
.album-toolbar--v2 .album-subtitle-input::placeholder { color: #c0b29e; }
.album-toolbar--v2 .album-meta {
  font-family: var(--sans, sans-serif);
  font-size: 12px;
  color: #8a7866;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Pill toggle group (формат + плотность) */
.album-pill-group {
  display: inline-flex;
  border: 1px solid #d6cab8;
  border-radius: 22px;
  padding: 2px;
  background: #fff;
  gap: 0;
}
.album-pill {
  border: none;
  background: none;
  padding: 6px 14px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: #6a5a48;
  cursor: pointer;
  border-radius: 18px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.album-pill:hover { color: #2a201a; }
.album-pill--active {
  background: #3a2f24;
  color: #fff;
}
.album-pill--active:hover { color: #fff; }

/* Иконочные кнопки (shuffle, delete) */
.album-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: none;
  border: 1px solid #d6cab8;
  border-radius: 18px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  color: #6a5a48;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.album-btn-icon:hover {
  background: #f5f0e8;
  border-color: #b8a888;
  color: #2a201a;
}
.album-btn-icon:disabled {
  opacity: 0.45;
  cursor: default;
}
.album-btn-icon:disabled:hover {
  background: none;
  border-color: #d6cab8;
  color: #6a5a48;
}
.album-btn-icon.album-btn-danger:hover {
  background: #fcecec;
  border-color: #d68a8a;
  color: #b03030;
}

/* Primary/secondary CTA */
.album-btn-cta {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border: none;
  border-radius: 22px;
  font-family: var(--sans, sans-serif);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
}
.album-btn-cta--primary {
  background: #d97a30;
  color: #fff;
  box-shadow: 0 1px 3px rgba(217, 122, 48, 0.3);
}
.album-btn-cta--primary:hover { background: #c66a25; box-shadow: 0 2px 6px rgba(217, 122, 48, 0.4); }
.album-btn-cta--primary:active { transform: translateY(1px); }
.album-btn-cta--primary:disabled { background: #c4a577; cursor: not-allowed; box-shadow: none; }
.album-btn-cta--secondary {
  background: #fff;
  color: #d97a30;
  border: 2px solid #d97a30;
  padding: 7px 16px;
}
.album-btn-cta--secondary:hover { background: #fff4ea; }

.album-toolbar-spacer { flex: 1 1 auto; min-width: 0; }

/* Desktop ≥1280px: контролы строго в одном ряду без переноса */
@media (min-width: 1280px) {
  .album-toolbar-row--controls {
    flex-wrap: wrap;
    gap: 10px;
  }
  .album-toolbar-row--controls .album-pill { padding: 6px 12px; }
  .album-toolbar-row--controls .album-btn-icon { padding: 6px 10px; }
}
/* Скрываем подпись только у iconic-кнопок (мусорка очевидна).
   add/shuffle — неочевидные действия, подпись остаётся всегда (аудитория 45-55). */
@media (min-width: 1280px) and (max-width: 1440px) {
  .album-toolbar-row--controls .album-btn-icon--iconic span { display: none; }
}

/* Mobile: stack toolbar в три ряда */
@media (max-width: 640px) {
  .album-toolbar--v2 { gap: 10px; }
  .album-toolbar-row--title { flex-direction: column; align-items: stretch; gap: 4px; }
  .album-toolbar--v2 .album-meta { font-size: 11px; }
  .album-toolbar-row--controls {
    gap: 8px;
    justify-content: flex-start;
  }
  .album-toolbar-spacer { display: none; }
  .album-pill { padding: 5px 11px; font-size: 12px; }
  .album-pill-group { border-radius: 18px; }
  .album-btn-icon { padding: 6px 10px; font-size: 12px; }
  .album-btn-icon--iconic span { display: none; }
  .album-btn-cta { padding: 8px 14px; font-size: 13px; flex: 1 1 auto; justify-content: center; }
}

/* Cookie consent info-баннер */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  background: #2a2018;
  color: #f0e4cc;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  transform: translateY(100%);
  transition: transform 300ms ease-out;
}
.cookie-consent--visible { transform: translateY(0); }
.cookie-consent-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.cookie-consent-text {
  flex: 1;
  min-width: 0;
}
.cookie-consent-link {
  color: #f4b271;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-consent-link:hover { color: #f8c891; }
.cookie-consent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-consent-accept {
  background: #d97a30;
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 8px 20px;
  font-family: var(--sans, sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.cookie-consent-accept:hover { background: #c66a25; }
.cookie-consent-close {
  background: none;
  border: none;
  color: rgba(240,228,204,0.6);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.cookie-consent-close:hover {
  color: #f0e4cc;
  background: rgba(255,255,255,0.08);
}
@media (max-width: 640px) {
  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    gap: 12px;
  }
  .cookie-consent-text { font-size: 12px; }
  .cookie-consent-actions { justify-content: flex-end; }
  .cookie-consent-accept { flex: 1; }
}

/* Mini-footer для подстраниц — только реквизиты + legal-ссылки */
.footer--mini {
  padding: 24px 0;
  font-size: 12px;
}
.footer-mini-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-mini-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.footer--mini .footer-link {
  color: rgba(240,228,204,0.6);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.15s;
}
.footer--mini .footer-link:hover { color: #fff; }
@media (max-width: 640px) {
  .footer-mini-row { flex-direction: column; gap: 12px; }
  .footer-mini-links { gap: 14px 16px; }
}

/* ===== A11Y: глобальный фолбэк для prefers-reduced-motion =====
   Гасит декоративную анимацию/прокрутку для пользователей с чувствительностью к движению.
   Не обнуляет в 0 (это сломало бы entrance-эффекты со стартом opacity:0), а сводит
   длительность к ~0 — элемент мгновенно доходит до конечного кадра. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Статичная плашка-напоминание вместо авто-статуса #hdrStatus.
   Прячем динамический #hdrStatus, показываем постоянный серый текст.
   Чисто HTML+CSS, без JS/гонок: видна ТОЛЬКО в preview (фото загружено,
   «Восстановить» не нажата). #uploadPreview в этом состоянии display:flex
   (inline из setUploadState), в idle/result — display:none.
   JS-гейт: script.js (initHeaderSwap) ставит data-static-status="1" при
   наличии .hdr-static-note → updatePhotoStatus() возвращается сразу,
   авто-детект поворота/полей не запускается. */
#hdrStatus { display: none !important; }
.hdr-static-note {
  display: none;
  margin: 0 auto;
  max-width: 440px;
  color: #3a3a3a;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.3;
  text-align: center;
}
.container:has(#uploadPreview[style*="flex"]) .hdr-static-note { display: block; }
@media (max-width: 640px) {
  .container:has(#uploadPreview[style*="flex"]) .hdr-static-note { font-size: 10px; line-height: 1.28; max-width: 300px; }
}
