/* Roomrum pilot — минимальный стиль, без зависимостей. */

* { box-sizing: border-box; min-width: 0; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: #1f2330;
  background: #f6f7fb;
  min-height: 100vh;
  /* Жёсткая защита от горизонтального overflow — какой-то элемент-наследник
   * может попытаться вытянуть страницу шире viewport, и в FF это даёт
   * horizontal scroll, в Chrome — zoom-out страницы и вид "как декстоп". */
  overflow-x: hidden;
  max-width: 100vw;
}
img, svg { max-width: 100%; }

a { color: #4554f0; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e6e8ef;
  padding: 16px 24px;
}
.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.topbar .subtitle {
  margin: 4px 0 0;
  color: #6a6f7d;
  font-size: 14px;
}
.back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #6a6f7d;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.upload-card,
.action-card,
.history-section,
.main-block {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e6e8ef;
  padding: 20px;
}

h2 { margin: 0 0 12px; font-size: 17px; }
h3 { margin: 0 0 8px; font-size: 15px; }
.hint { color: #6a6f7d; font-size: 13px; margin: 4px 0; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ebedf3;
  color: #1f2330;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { background: #dde0ea; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: #4554f0;
  color: #fff;
  border-color: #4554f0;
}
.btn-primary:hover { background: #3543d6; }
.btn-block { width: 100%; margin-top: 8px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4a4f5d;
  margin: 6px 0;
  cursor: pointer;
}
.check input { margin: 0; }

/* ===== upload ===== */
.dropzone {
  border: 2px dashed #cdd2db;
  border-radius: 10px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: #4554f0;
  background: #f4f6ff;
}
.dropzone .hint { margin-bottom: 12px; }

.upload-progress { margin-top: 14px; }

/* ====================================================================
 * Мульти-загрузка: список карточек прогресса (одна карточка = одно фото)
 * Используется на index.html (см. RR.initIndex). Каждая карточка имеет
 * 4 состояния: queued / uploading|processing / done / error (unsafe|failed).
 * Done-карточки уходят сами через 2 сек; error остаются с причиной.
 * ==================================================================== */
.upload-list {
  display: grid;
  /* Карточки в строку. Сделали порог 180px чтобы 2-3 помещались внутри
     hero-card (~600px). На мобильном (<420px) минимум 180 → одна в ряд. */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.upload-list.hidden { display: none; }

.upload-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 12px;
  text-align: left;
  /* Не даём grid растягивать ячейку под содержимое — иначе разная длина
     имён файлов даёт разную высоту строк. */
  min-width: 0;
  animation: upload-card-in 0.22s ease-out;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.upload-card.upload-card-removing {
  opacity: 0;
  transform: translateY(-4px);
}
@keyframes upload-card-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.upload-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  position: relative;
}
.upload-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* Placeholder когда оригинал blob потерян (после reload при resume) — */
/* серый квадрат с первой буквой filename. */
.upload-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
}
.upload-thumb-badge {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  font-weight: 700;
}
.upload-thumb-badge-ok { background: rgba(31, 122, 63, 0.78); }
.upload-thumb-badge-bad { background: rgba(160, 40, 40, 0.78); }

.upload-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.upload-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.upload-name {
  font-family: "Manrope", inherit;
  font-weight: 600;
  font-size: 13px;
  color: #0e1018;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-cancel {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: #8a8d9b; cursor: pointer;
  font-size: 18px; line-height: 1;
  padding: 0; border-radius: 50%;
}
.upload-cancel:hover { background: #f0eee8; color: #1f2937; }

.upload-bar {
  width: 100%;
  height: 4px;
  background: #f0eee8;
  border-radius: 2px;
  overflow: hidden;
}
.upload-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.upload-status {
  font-size: 12px;
  color: #6a6f7d;
  line-height: 1.4;
}
/* Compact статус-строка с info-кнопкой справа. */
.upload-status-row {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 2px;
}
.upload-status-row .upload-status {
  flex: 1; min-width: 0;
  word-break: break-word;
}
.upload-status-error {
  color: #a02828; font-weight: 600;
}
.upload-info-btn {
  flex-shrink: 0;
  width: 18px; height: 18px; line-height: 16px;
  padding: 0; margin: 0;
  background: #f4f5f7; border: 1px solid #d8d6cf; border-radius: 50%;
  color: #6a6f7d; font-size: 11px; font-weight: 700; font-style: italic;
  cursor: pointer; text-align: center;
  font-family: Georgia, serif;
  transition: background 0.12s, border-color 0.12s;
}
.upload-info-btn:hover {
  background: #e9eaef; border-color: #b6b3a8;
}
.upload-card.upload-error .upload-info-btn {
  background: #fff; border-color: #f0c5c5; color: #a02828;
}
.upload-card.upload-error .upload-info-btn:hover {
  background: #fff5f5;
}

/* Legacy class — для обратной совместимости если где-то ещё используется. */
.upload-status-title {
  font-family: "Manrope", inherit;
  font-weight: 600;
  font-size: 13px;
  color: #a02828;
  margin-bottom: 1px;
}

/* Error-состояние: рамка/фон с лёгким красным акцентом, без прогресс-бара. */
.upload-card.upload-error {
  background: #fff5f5;
  border-color: #f7d4d4;
}
.upload-card.upload-error .upload-status { color: #7a4848; }

/* Done — зелёный акцент короткий, потом карточка исчезнет. */
.upload-card.upload-done {
  background: #f4fbf6;
  border-color: #cfe8d6;
}
.upload-card.upload-done .upload-status { color: #1f7a3f; }

/* Queued — приглушённый вид «ждёт своей очереди». */
.upload-card.upload-queued { opacity: 0.7; }

/* «Сервера сейчас заняты» — раньше была плашкой внутри карточки, теперь
   состояние slow показывается коротким текстом в .upload-status + (i)
   кнопкой которая открывает popup с полным объяснением. CSS .upload-slow
   оставлен на случай fallback использования, но карточка его не рендерит. */
.upload-slow {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff8e0;
  border: 1px solid #f3dc7a;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: #6e5818;
}

/* ===== Popup для деталей upload-карточки =====
   Показывается по клику на (i) в карточке. Содержит полный заголовок ошибки,
   подробный hint и raw issues от backend / VLM reason. Модальный — фон затемнён,
   закрытие по крестику / клику на фон / Esc. */
.up-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 17, 22, 0.55);
  display: flex; align-items: center; justify-content: center;
  /* Выше mobile-меню (9700) и topbar (9500) — попап всегда на самом верху. */
  z-index: 10000;
  padding: 20px;
  animation: up-popup-fade-in 0.15s ease-out;
}
.up-popup-overlay.hidden { display: none; }
@keyframes up-popup-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.up-popup-card {
  background: #fff; border-radius: 12px;
  max-width: 480px; width: 100%;
  max-height: 80vh; overflow: auto;
  padding: 22px 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
  animation: up-popup-scale-in 0.18s ease-out;
}
@keyframes up-popup-scale-in {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.up-popup-close {
  position: absolute; top: 8px; right: 10px;
  width: 30px; height: 30px;
  background: transparent; border: none;
  font-size: 22px; color: #6a6f7d;
  cursor: pointer; line-height: 1;
}
.up-popup-close:hover { color: #1f2937; }
.up-popup-title {
  font-family: "Manrope", inherit;
  font-weight: 700; font-size: 16px;
  color: #1f2937;
  margin: 0 30px 12px 0;
  line-height: 1.3;
}
.up-popup-body {
  font-size: 13.5px; line-height: 1.5; color: #374151;
}
.up-popup-hint {
  margin: 0 0 12px;
}
.up-popup-section-title {
  font-size: 11px; font-weight: 700; color: #6b7280;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin: 14px 0 6px;
}
.up-popup-issues {
  margin: 0; padding-left: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.5;
  color: #4b5563;
  word-break: break-word;
}
.up-popup-issues li { margin-bottom: 6px; }

/* Тех. детали (safety.issues / geometry-validate reason) — раскрывашка,
   не пугает юзера длинным английским текстом. Свёрнуто по умолчанию. */
.upload-details {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.75;
}
.upload-details summary { cursor: pointer; user-select: none; outline: none; }
.upload-details ul {
  margin: 4px 0 0; padding-left: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Длинные английские reason'ы от Gemini могут быть на пару предложений —
     ограничиваем высоту и даём скролл вместо распирания карточки. */
  max-height: 120px; overflow-y: auto;
  word-break: break-word;
  font-size: 10.5px; line-height: 1.45;
}
.upload-details ul li { margin-bottom: 4px; }

/* Сводка после завершения всех загрузок. */
.upload-summary {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  animation: upload-card-in 0.22s ease-out;
}
.upload-summary.hidden { display: none; }
.upload-summary-ok    { background: #ddf3e1; color: #1f7a3f; border: 1px solid #b6e3c0; }
.upload-summary-bad   { background: #fce8e8; color: #a02828; border: 1px solid #f0c1c1; }
.upload-summary-mixed { background: #fff8e0; color: #6e5818; border: 1px solid #f3dc7a; }

/* Флеш-сообщение / toast — фиксированное вверху, всегда видно. */
.upload-flash {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11000;
  max-width: min(500px, calc(100vw - 32px));
  padding: 12px 18px;
  background: #fff;
  border: 1px solid #ffd98a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #6b4905;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  animation: upload-flash-slide 0.28s cubic-bezier(0.32, 0.72, 0.34, 1);
}
.upload-flash.hidden { display: none; }
@keyframes upload-flash-slide {
  from { transform: translate(-50%, -120%); opacity: 0; }
  to   { transform: translate(-50%, 0);     opacity: 1; }
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e6e8ef;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #4554f0;
  width: 0;
  transition: width 0.3s;
}

.upload-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffe8e8;
  border: 1px solid #ffc4c4;
  color: #b22a2a;
  font-size: 13px;
}

.hidden { display: none !important; }

/* ===== history ===== */
.history-section { margin-top: 24px; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-header h2 { margin: 0; }
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.history-card {
  background: #fff;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}
.history-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(20, 25, 50, 0.08);
}
.history-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #ebedf3;
}
.history-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: #ebedf3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-placeholder .spinner.small {
  width: 24px;
  height: 24px;
  border: 2px solid #cdd2db;
  border-top-color: #4554f0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.history-placeholder .x-mark {
  color: #b22a2a;
  font-size: 26px;
  font-weight: 600;
}
.history-card-pending .meta { color: #4554f0; }
.history-card-failed  .meta { color: #b22a2a; }

/* Активная (просматриваемая в главном блоке) карточка */
.history-card.active {
  border-color: #4554f0;
  box-shadow: 0 0 0 3px rgba(69, 84, 240, 0.18);
}
.history-card .meta {
  padding: 8px 10px;
  font-size: 12px;
  color: #6a6f7d;
}
.history-card .meta b {
  display: block;
  color: #1f2330;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.badge-pending {
  display: inline-block;
  background: #eef0fe;
  color: #4554f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* ===== result page ===== */
.result-page {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 800px) {
  .result-page { grid-template-columns: 1fr; }
}

/* result page: один большой блок картинки слева + правая панель.
   Левая колонка делается sticky — при скролле длинной галереи справа
   главное превью остаётся виден сверху. */
.result-pane {
  position: sticky;
  top: 24px;
  align-self: start;
}
.actions-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 800px) {
  .result-pane { position: static; top: auto; }
}

/* main-frame — единственный блок где живёт и оригинал, и результат */
.main-frame {
  position: relative;
  border-radius: 8px;
  background: #f0f2f7;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.main-frame img {
  display: block;
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  background: #ebedf3;
  border-radius: 8px;
}

/* затемнение поверх картинки на время рендера */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 30, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  text-align: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.overlay p { margin: 0; font-size: 14px; }
.overlay-queued { font-size: 12px; opacity: 0.8; }
.overlay .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

.overlay-error {
  position: absolute;
  inset: 0;
  background: rgba(255, 230, 230, 0.95);
  color: #b22a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 14px;
  cursor: pointer;
}
.overlay-error::after {
  content: " (нажмите чтобы скрыть)";
  opacity: 0.6;
  font-size: 11px;
  margin-left: 6px;
}

.main-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.render-meta {
  margin: 0;
  font-size: 12px;
  color: #6a6f7d;
  flex: 1;
}
.btn-link {
  background: transparent;
  color: #4554f0;
  padding: 4px 6px;
  font-size: 13px;
  border: 0;
}
.btn-link:hover { background: #f0f1f8; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #cdd2db;
  border-top-color: #4554f0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== quality selector (segmented) ===== */
.quality-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 6px;
}
.quality-btn {
  background: #ebedf3;
  border: 1px solid #ebedf3;
  border-radius: 8px;
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.quality-btn b {
  font-size: 13px;
  font-weight: 600;
  color: #1f2330;
}
.quality-btn span {
  font-size: 11px;
  color: #6a6f7d;
}
.quality-btn:hover { background: #dde0ea; }
.quality-btn.active {
  background: #4554f0;
  border-color: #4554f0;
}
.quality-btn.active b,
.quality-btn.active span { color: #fff; }

.wallpapers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}
/* Empty-state сообщение («Каталог пуст», «Под этот стиль не нашлось…»):
   занимает всю ширину сетки, центрируется. Покрываем оба варианта grid-а
   каталога: старый .wallpapers-grid и новый result-v3 .catalog-grid-compact /
   .catalog-grid-full. Без grid-column: 1/-1 текст падает в первую ячейку
   и выглядит как поломанный layout. */
.wallpapers-grid > .hint,
.catalog-grid-compact > .hint,
.catalog-grid-full > .hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  margin: 4px auto;
  font-size: 13px;
  line-height: 1.5;
  color: #6a6f7d;
  background: #fafaf7;
  border: 1px dashed #e5e3da;
  border-radius: 12px;
  max-width: 320px;
}
.wallpaper-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #ebedf3;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.wallpaper-item:hover { transform: translateY(-2px); }
.wallpaper-item.active { border-color: #4554f0; }
.wallpaper-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.wallpaper-item .label {
  padding: 4px 6px;
  font-size: 11px;
  color: #4a4f5d;
  background: #fff;
  border-top: 1px solid #e6e8ef;
}

.footer {
  text-align: center;
  padding: 24px;
  color: #9aa0ad;
  font-size: 12px;
}

/* ===== safety banner ===== */
.safety-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: 10px;
  margin: 16px auto;
}
.safety-banner.unsafe {
  background: #ffe8e8;
  border: 1px solid #ffc4c4;
  color: #7a1f1f;
}
.safety-banner.warning {
  background: #fff8e0;
  border: 1px solid #f3dc7a;
  color: #6e5818;
}
.safety-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.08);
}
.safety-text { flex: 1; }
.safety-text b { display: block; margin-bottom: 4px; font-size: 14px; }
.safety-text p { margin: 0; font-size: 13px; line-height: 1.4; }
.safety-text ul { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.safety-text .safety-details {
  margin-top: 8px; font-size: 11px; opacity: 0.7;
}
.safety-text .safety-details summary {
  cursor: pointer; user-select: none; outline: none;
}
.safety-text .safety-details ul {
  margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

/* блокировка действий при UNSAFE */
.unsafe-locked .quality-btn,
.unsafe-locked .wallpaper-item,
.unsafe-locked #auto-btn {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== lightbox ===== */
.main-frame img {
  cursor: zoom-in;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #fff;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.lightbox-img {
  max-width: 96vw;
  max-height: 92vh;
  display: block;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: transform 0.04s linear;
  will-change: transform;
}
.lightbox.dragging .lightbox-img { cursor: grabbing; }
.lightbox-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  pointer-events: none;
  text-align: center;
  padding: 0 12px;
  user-select: none;
}

/* Лоадер при переключении тяжёлой картинки в lightbox */
.lightbox-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.lightbox-loader .spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.85);
  border-radius: 50%;
  animation: lb-spin 0.9s linear infinite;
}
@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* Затемнение картинки пока грузится новая (плавнее, без мигания) */
.lightbox.loading img#lightbox-img {
  opacity: 0.25;
  transition: opacity 0.12s linear;
}

/* Кнопки навигации в lightbox (← →) */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  font-size: 32px;
  line-height: 56px;
  cursor: pointer;
  padding: 0;
  user-select: none;
  z-index: 2;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.24); }
.lightbox-nav:disabled { opacity: 0.25; cursor: not-allowed; }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-info {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  user-select: none;
  background: rgba(0,0,0,0.45);
  padding: 6px 14px;
  border-radius: 8px;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================================================
   Result page v2 — redesign (Phase 1+2)
   =========================================================== */

.result-page-v2 {
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --- Main view (большая картинка + strip снизу) --- */

.result-page-v2 .main-view {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.result-page-v2 .main-frame {
  position: relative;
  background: #f3f4f6;
  border-radius: 10px;
  overflow: hidden;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-page-v2 .main-frame img#main-img {
  width: 100%;
  height: auto;
  max-height: 68vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #f3f4f6;
}

.result-page-v2 .main-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.result-page-v2 .main-meta .render-meta {
  margin: 0;
  font-size: 13px;
  color: #4b5063;
  flex: 1;
  min-width: 0;
}
.result-page-v2 .main-meta-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* --- Render strip (поверх main-frame в нижней части) --- */

.render-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.45);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  scrollbar-width: thin;
}
.render-strip::-webkit-scrollbar { height: 6px; }
.render-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
.render-strip:empty { display: none; }

.strip-thumb {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: #2a2d3a;
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.12s;
}
.strip-thumb:hover { transform: translateY(-1px); }
.strip-thumb.active { border-color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.4); }
.strip-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.strip-thumb .strip-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-thumb .strip-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  color: #fff;
}
.strip-thumb .strip-spinner .spinner {
  width: 22px; height: 22px; border-width: 2px;
}
.strip-thumb.failed {
  background: #4a1f1f;
}
.strip-thumb.failed::before {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #ff8585;
  font-size: 26px;
  font-weight: 600;
}
.strip-thumb.original .strip-label {
  background: rgba(50,90,200,0.85);
}

/* --- Actions row (Качество + Подобрать стиль) --- */

.result-page-v2 .actions-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.result-page-v2 .action-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-page-v2 .action-card .action-label {
  font-size: 12px;
  font-weight: 600;
  color: #6a6f7d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.result-page-v2 .action-card .quality-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.result-page-v2 .action-card .quality-btn {
  flex: 1 1 100px;
  min-width: 100px;
}
.result-page-v2 .action-card .hint {
  margin: 0;
  font-size: 12px;
  color: #6a6f7d;
}
.result-page-v2 .action-card-auto {
  justify-content: space-between;
}

/* --- Catalog section — full-width grid --- */

.result-page-v2 .catalog-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.result-page-v2 .catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.result-page-v2 .catalog-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.result-page-v2 .catalog-head .hint {
  font-size: 13px;
  color: #6a6f7d;
  margin: 0;
}

.result-page-v2 .catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.result-page-v2 .catalog-grid .wallpaper-item {
  background: #fff;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.result-page-v2 .catalog-grid .wallpaper-item:hover {
  border-color: #c5c9d6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.result-page-v2 .catalog-grid .wallpaper-item.active {
  border-color: #4554f0;
  box-shadow: 0 0 0 2px rgba(69,84,240,0.25);
}
.result-page-v2 .catalog-grid .wallpaper-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f3f4f6;
}
.result-page-v2 .catalog-grid .wallpaper-item .label {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #1f2330;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-page-v2 .catalog-grid .wallpaper-item {
  position: relative;
}
/* Бейдж «уже есть рендер с этими обоями» */
.wallpaper-item .done-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #1f7a3f;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.wallpaper-item .done-badge::before {
  content: "✓";
  font-size: 11px;
}
.wallpaper-item.has-render { border-color: #1f7a3f; }
.wallpaper-item.has-render:hover { border-color: #1f7a3f; box-shadow: 0 4px 12px rgba(31,122,63,0.18); }

/* --- UNSAFE-блокировка действий --- */

.result-page-v2 .actions-row.unsafe-locked,
.result-page-v2 .catalog-section.unsafe-locked {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.4);
}

/* --- Mobile (≤ 760px) — стек в столбик, strip скроллится --- */

@media (max-width: 760px) {
  .result-page-v2 .main-frame img#main-img {
    max-height: 56vh;
  }
  .result-page-v2 .actions-row {
    grid-template-columns: 1fr;
  }
  .result-page-v2 .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
  .render-strip {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px;
    gap: 6px;
  }
  .strip-thumb {
    width: 64px; height: 64px;
  }
  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 24px;
    line-height: 44px;
  }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-info {
    font-size: 12px;
    padding: 4px 10px;
    top: 12px;
  }
}

/* ===========================================================
   Home page v2 — редизайн главной (index.html)
   =========================================================== */

body.home-v2 {
  background: #fafaf7;
  color: #0e1018;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.home-v2 ::selection { background: rgba(14,16,24,0.12); }

/* Бренд и заголовки — Manrope ExtraBold/Bold с тугим letter-spacing */
.home-v2 .brand,
.home-v2 .brand-small {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.home-v2 .hero-title,
.home-v2 .history-title {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* ===== TOPBAR ===== */

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid #ececea;
  background: #fafaf7;
}
.home-topbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}
.home-topbar .brand {
  font-size: 26px;
  color: #0e1018;
  text-decoration: none;
  line-height: 1;
}
.home-topbar .brand:hover { text-decoration: none; }
.home-topbar .topbar-link {
  font-size: 14px;
  color: #2a2e3a;
  text-decoration: none;
}
.home-topbar .topbar-link:hover { text-decoration: underline; }

/* topbar-link стилизованный как button (без рамки, как ссылка). */
.home-topbar button.topbar-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

/* BETA-бэйдж рядом с brand. Маленький, ненавязчивый — сигнал что сервис */
/* в экспериментальном режиме. Hover-tooltip объясняет. */
.brand-beta {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 7px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: #f59e0b;
  border-radius: 6px;
  vertical-align: middle;
  position: relative;
  top: -3px;
  user-select: none;
}

/* ===== Info-popups (Как это работает / Какие фото) ===== */
.info-popup-card {
  max-width: 560px;
}
.info-popup-card .up-popup-title {
  font-size: 22px;
  margin-bottom: 16px;
}
.info-steps {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.55;
  color: #374151;
}
.info-steps li { margin-bottom: 8px; }
.info-tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
}
.info-tip-good { background: rgba(22, 163, 74, 0.08);  color: #1f3924; }
.info-tip-bad  { background: rgba(220, 38, 38, 0.07);  color: #3b1d1d; }
.info-tip-mark {
  flex: 0 0 22px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.info-tip-good .info-tip-mark { background: #16a34a; }
.info-tip-bad  .info-tip-mark { background: #dc2626; }
.info-disclaimer {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #fafafa;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
}
.info-disclaimer b { color: #92520a; }

/* «Почему мы» — placeholder для будущей таблицы сравнения */
.info-compare-placeholder {
  margin-top: 10px;
  padding: 24px;
  background: #fafaf7;
  border: 1px dashed #d8d6cf;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  color: #8a8d9b;
  font-style: italic;
}
.info-popup-why { max-width: 760px; }

/* YouTube embed внутри "Как это работает" — responsive 16:9 */
.info-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 18px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.info-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Галерея референсов в "Совет по фото" ===== */
.info-ref-lede {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #4b5568;
}
.info-ref-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 0 0 22px;
}
.info-ref-item {
  margin: 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}
.info-ref-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;            /* квадрат — единый вид при любой ориентации */
  object-fit: cover;
  background: #f0ede5;
}
.info-ref-item figcaption {
  padding: 7px 9px 9px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #0a8866;
  font-weight: 500;
  text-align: center;
  border-top: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 520px) {
  .info-ref-gallery {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  /* На мобиле — третью карточку растягиваем на 2 колонки внизу */
  .info-ref-item:nth-child(3) {
    grid-column: 1 / -1;
  }
  .info-ref-item:nth-child(3) img {
    aspect-ratio: 16 / 9;          /* широкая для последней */
  }
  .info-ref-item figcaption { font-size: 11px; padding: 6px 8px 8px; }
}

/* ============================================================
 * "Почему не ChatGPT Image 2.0" — premium v2 design
 * ============================================================ */

.up-popup-card.bench-v2 {
  max-width: 820px;
  width: 100%;
  max-height: 92vh;
  padding: 0;
  background: #fdfcf9;
  overflow-y: auto;       /* скролл внутри карточки — содержимое длинное */
  overflow-x: hidden;
  /* iOS-momentum + thin scrollbar */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}
.up-popup-card.bench-v2::-webkit-scrollbar { width: 8px; }
.up-popup-card.bench-v2::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18);
  border-radius: 4px;
}
.up-popup-card.bench-v2::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.28);
}
.up-popup-card.bench-v2::-webkit-scrollbar-track { background: transparent; }
.up-popup-card.bench-v2 .up-popup-close {
  position: sticky;        /* не уезжать при скролле */
  top: 12px;
  left: calc(100% - 44px); /* в правом верхнем углу */
  margin: 12px -32px -42px 0;  /* «вытянуть» из потока чтобы не двигать hero */
  width: 32px;
  height: 32px;
  border-radius: 50%;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  color: #1a1a1a;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- HERO ---- */
.bench-v2-hero {
  background:
    radial-gradient(ellipse at top right, rgba(91, 71, 187, 0.08), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(16, 185, 129, 0.06), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #faf8f3 100%);
  padding: 48px 40px 36px;
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.bench-v2-hero-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5b47bb;
  margin-bottom: 14px;
}
.bench-v2-hero-title {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #0a0a14;
  margin: 0 0 14px;
}
.bench-v2-hero-sub {
  font-size: 15px;
  line-height: 1.55;
  color: #4b5568;
  max-width: 520px;
  margin: 0 auto 28px;
}
.bench-v2-score-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.bench-v2-score {
  text-align: center;
}
.bench-v2-score-num {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.bench-v2-score-num span {
  font-size: 26px;
  font-weight: 600;
  opacity: 0.55;
  margin-left: 2px;
}
.bench-v2-score-us .bench-v2-score-num { color: #1a1a1a; }
.bench-v2-score-them .bench-v2-score-num { color: #9da5b1; }
.bench-v2-score-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4b5568;
  margin-top: 6px;
}
.bench-v2-score-them .bench-v2-score-name { color: #9da5b1; }
.bench-v2-delta {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #0a8866;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ---- BODY ---- */
.bench-v2-body {
  padding: 40px;
}

/* ---- SECTION ---- */
.bench-v2-section {
  position: relative;
  margin: 0 0 48px;
}
.bench-v2-section:last-of-type { margin-bottom: 0; }

.bench-v2-section-num {
  position: absolute;
  top: -2px;
  left: 0;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(91, 71, 187, 0.08);
  pointer-events: none;
  z-index: 0;
}
.bench-v2-section-title {
  position: relative;
  z-index: 1;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #0a0a14;
  margin: 0 0 12px;
  padding-left: 48px;
}
.bench-v2-title-plain {
  padding-left: 0;
}
.bench-v2-section-lede {
  position: relative;
  z-index: 1;
  font-size: 14.5px;
  line-height: 1.6;
  color: #4b5568;
  margin: 0 0 22px;
  padding-left: 48px;
}
.bench-v2-section .bench-v2-title-plain + .bench-v2-section-lede,
.bench-v2-section > .bench-v2-section-lede:not(:first-of-type) {
  padding-left: 0;
}
.bench-v2-section > .bench-v2-title-plain ~ .bench-v2-section-lede {
  padding-left: 0;
}

/* ---- STATS pair ---- */
.bench-v2-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 22px;
}
.bench-v2-stat {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow:
    0 1px 2px rgba(10, 10, 20, 0.04),
    0 4px 16px rgba(10, 10, 20, 0.04);
  overflow: hidden;
}
.bench-v2-stat-good::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #10b981, #0a8866);
}
.bench-v2-stat-bad::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
}
.bench-v2-stat-side {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7488;
  margin-bottom: 6px;
}
.bench-v2-stat-num {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #0a0a14;
}
.bench-v2-stat-num span {
  font-size: 22px;
  opacity: 0.55;
  margin-left: 1px;
}
.bench-v2-stat-good .bench-v2-stat-num { color: #0a8866; }
.bench-v2-stat-bad  .bench-v2-stat-num { color: #b45309; }
.bench-v2-stat-cap {
  font-size: 13px;
  line-height: 1.45;
  color: #4b5568;
  margin-top: 8px;
}

/* ---- FIGURE (фото-примеры) ---- */
.bench-v2-figure {
  margin: 0 0 22px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(10, 10, 20, 0.04),
    0 8px 24px rgba(10, 10, 20, 0.06);
}
.bench-v2-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #f5f3ee;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.bench-v2-figure img:hover {
  opacity: 0.95;
}

/* Bench zoom overlay — full-screen увеличение коллажа */
.bench-zoom-layer {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.92);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: bench-zoom-fade 0.18s ease-out;
  padding: 20px;
}
.bench-zoom-layer.hidden { display: none; }
.bench-zoom-layer img {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
}
.bench-zoom-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.bench-zoom-close:hover { background: rgba(255, 255, 255, 0.3); }
@keyframes bench-zoom-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.bench-v2-figure figcaption {
  padding: 12px 18px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5568;
  border-top: 1px solid rgba(0,0,0,0.05);
}
.bench-v2-figure figcaption b {
  color: #0a0a14;
  font-weight: 700;
}

.bench-v2-figure-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 22px;
}
.bench-v2-figure-pair .bench-v2-figure { margin: 0; }

/* Missing-image fallback. Если src 404, JS добавляет .bench-v2-figure-missing
   на <figure> → показываем overlay поверх "битой" img и подсказку какой
   файл надо залить. Это виде только админу/разработчику до заливки. */
.bench-v2-figure-missing-overlay {
  display: none;
}
.bench-v2-figure.bench-v2-figure-missing {
  position: relative;
  min-height: 180px;
}
.bench-v2-figure.bench-v2-figure-missing img {
  visibility: hidden;
  min-height: 180px;
}
.bench-v2-figure.bench-v2-figure-missing figcaption {
  opacity: 0.45;
}
.bench-v2-figure.bench-v2-figure-missing .bench-v2-figure-missing-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: absolute;
  inset: 0;
  bottom: 56px;        /* над figcaption */
  background: repeating-linear-gradient(
    45deg, #fafaf7, #fafaf7 12px, #f3f1ea 12px, #f3f1ea 24px
  );
  border: 2px dashed #c8c6bd;
  border-radius: 14px 14px 0 0;
  margin: 0;
}
.bench-v2-figure-missing-icon {
  font-size: 36px;
  opacity: 0.4;
}
.bench-v2-figure-missing-text {
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  line-height: 1.5;
}
.bench-v2-figure-missing-text code {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  color: #0a0a14;
}

/* ---- DISTRIBUTION ---- */
.bench-v2-dist {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow:
    0 1px 2px rgba(10, 10, 20, 0.04),
    0 4px 16px rgba(10, 10, 20, 0.04);
}
.bench-v2-dist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
}
.bench-v2-dist-row:last-of-type { margin-bottom: 14px; }
.bench-v2-dist-label {
  flex: 0 0 90px;
  font-size: 13px;
  font-weight: 600;
  color: #0a0a14;
}
.bench-v2-dist-bar {
  flex: 1;
  display: flex;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f3ee;
}
.bench-v2-dist-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.bench-v2-dist-seg.bench-v2-dist-good { background: #0a8866; }
.bench-v2-dist-seg.bench-v2-dist-mid  { background: #d97706; }
.bench-v2-dist-seg.bench-v2-dist-bad  { background: #dc2626; }
.bench-v2-dist-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 12.5px;
  color: #4b5568;
}
.bench-v2-dist-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.bench-v2-dist-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.bench-v2-dist-dot.bench-v2-dist-good { background: #0a8866; }
.bench-v2-dist-dot.bench-v2-dist-mid  { background: #d97706; }
.bench-v2-dist-dot.bench-v2-dist-bad  { background: #dc2626; }

/* ---- METRIC BARS (поэлементное) ---- */
.bench-v2-metric {
  margin: 0 0 20px;
}
.bench-v2-metric-name {
  font-size: 14px;
  font-weight: 600;
  color: #0a0a14;
  margin-bottom: 10px;
}
.bench-v2-metric-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bench-v2-mbar {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  align-items: center;
  gap: 12px;
}
.bench-v2-mbar-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #4b5568;
}
.bench-v2-mbar-track {
  height: 10px;
  background: #f0ede5;
  border-radius: 999px;
  overflow: hidden;
}
.bench-v2-mbar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.bench-v2-mbar-fill.bench-v2-mbar-us   { background: linear-gradient(90deg, #0a8866, #10b981); }
.bench-v2-mbar-fill.bench-v2-mbar-them { background: linear-gradient(90deg, #9da5b1, #b8bfc8); }
.bench-v2-mbar-val {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: #0a0a14;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---- HONEST section ---- */
.bench-v2-honest {
  background: #faf8f3;
  border-radius: 14px;
  padding: 28px 30px;
  border: 1px solid rgba(0,0,0,0.05);
}
.bench-v2-honest-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bench-v2-honest-list li {
  position: relative;
  padding: 12px 0 12px 28px;
  font-size: 14px;
  line-height: 1.6;
  color: #4b5568;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.bench-v2-honest-list li:last-child { border-bottom: none; }
.bench-v2-honest-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 12px;
  color: #b45309;
  font-weight: 700;
}
.bench-v2-honest-list b {
  color: #0a0a14;
  font-weight: 700;
}

/* ---- VERDICT ---- */
.bench-v2-verdict {
  margin-top: 40px;
  padding: 36px 36px 32px;
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), transparent 60%),
    linear-gradient(135deg, #0a0a14 0%, #1a1d2e 100%);
  border-radius: 16px;
  color: #f5f3ee;
  text-align: center;
}
.bench-v2-verdict-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #10b981;
  margin-bottom: 14px;
}
.bench-v2-verdict p {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
  color: #fafaf7;
  margin: 0 0 10px;
}
.bench-v2-verdict p b {
  color: #fff;
  font-weight: 700;
}
.bench-v2-verdict-small {
  font-size: 13.5px !important;
  color: rgba(245, 243, 238, 0.65) !important;
  margin: 16px 0 0 !important;
  font-weight: 400 !important;
}

/* ---- MOBILE ---- */
@media (max-width: 640px) {
  .up-popup-card.bench-v2 { max-width: 100%; }
  .bench-v2-hero { padding: 32px 22px 28px; }
  .bench-v2-hero-title { font-size: 24px; }
  .bench-v2-hero-sub { font-size: 13.5px; }
  .bench-v2-score-row { gap: 32px; }
  .bench-v2-score-num { font-size: 40px; }
  .bench-v2-body { padding: 26px 22px; }
  .bench-v2-section { margin-bottom: 36px; }
  .bench-v2-section-num {
    font-size: 44px;
    top: 0;
  }
  .bench-v2-section-title {
    font-size: 18px;
    padding-left: 34px;
  }
  .bench-v2-section-lede {
    font-size: 13.5px;
    padding-left: 34px;
  }
  .bench-v2-stats,
  .bench-v2-figure-pair { grid-template-columns: 1fr; }
  .bench-v2-stat { padding: 16px 18px; }
  .bench-v2-stat-num { font-size: 36px; }
  .bench-v2-dist { padding: 18px 16px 16px; }
  .bench-v2-dist-label { flex: 0 0 70px; font-size: 12px; }
  .bench-v2-dist-legend { gap: 16px; font-size: 11.5px; }
  .bench-v2-honest { padding: 22px 20px; }
  .bench-v2-verdict { padding: 28px 22px 26px; margin-top: 32px; }
  .bench-v2-verdict p { font-size: 16px; }
  .bench-v2-mbar { grid-template-columns: 60px 1fr 42px; gap: 8px; }
}

/* ============================================================
 * OLD bench-* стили (от первой версии) — удалены, сейчас актуальны
 * только bench-v2-*
 * ============================================================ */

.bench-subtitle {
  margin: -4px 0 18px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.bench-body { padding-right: 4px; }

.bench-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1f2937;
  margin: 26px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
}

.bench-body-text {
  margin: 8px 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #374151;
}

/* ---- HERO: общий балл (большие цифры) ---- */
.bench-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 6px;
  flex-wrap: wrap;
}
.bench-hero-card {
  flex: 1;
  min-width: 200px;
  background: linear-gradient(180deg, #f9fafb 0%, #eef0f4 100%);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
}
.bench-hero-us {
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}
.bench-hero-them {
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  border-color: #d1d5db;
}
.bench-hero-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 6px;
}
.bench-hero-us .bench-hero-label { color: #065f46; }
.bench-hero-value {
  font-size: 42px;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: -0.02em;
  line-height: 1;
}
.bench-hero-us .bench-hero-value { color: #047857; }
.bench-hero-value span { font-size: 22px; font-weight: 600; opacity: 0.8; }
.bench-hero-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}
.bench-hero-vs {
  font-size: 16px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bench-hero-hint {
  text-align: center;
  font-size: 13px;
  color: #047857;
  font-weight: 600;
  margin: 0 0 8px;
}

/* ---- Метрики: горизонтальные бары ---- */
.bench-bar-row {
  margin: 16px 0;
}
.bench-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: #1f2937;
}
.bench-bar-label b { font-weight: 600; }
.bench-bar-delta {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 999px;
}
.bench-bar-delta-neg {
  color: #92400e;
  background: #fef3c7;
}
.bench-bar-pair {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bench-bar-wrap {
  background: #f3f4f6;
  border-radius: 6px;
  height: 26px;
  overflow: hidden;
  position: relative;
}
.bench-bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 80px;
  white-space: nowrap;
}
.bench-bar-us {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}
.bench-bar-them {
  background: linear-gradient(90deg, #6b7280 0%, #9ca3af 100%);
}
.bench-bar-name { opacity: 0.95; font-size: 11.5px; }
.bench-bar-value { font-weight: 700; }

/* ---- Двухколоночные stat-карточки ---- */
.bench-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.bench-stat-card {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.bench-stat-card-warn {
  background: #fef3c7;
  border-color: #fcd34d;
}
.bench-stat-big {
  font-size: 36px;
  font-weight: 800;
  color: #047857;
  line-height: 1;
  margin-bottom: 4px;
}
.bench-stat-card-warn .bench-stat-big { color: #92400e; }
.bench-stat-mid {
  font-size: 12.5px;
  font-weight: 600;
  color: #065f46;
  margin-bottom: 6px;
}
.bench-stat-card-warn .bench-stat-mid { color: #b45309; }
.bench-stat-small {
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
}

/* ---- Заглушки для будущих фото ---- */
.bench-img-placeholder {
  margin: 14px 0;
  padding: 28px 16px;
  background: repeating-linear-gradient(
    45deg, #fafafa, #fafafa 10px, #f3f4f6 10px, #f3f4f6 20px
  );
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.bench-img-placeholder-icon {
  font-size: 32px;
  opacity: 0.5;
}
.bench-img-placeholder-text {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}
.bench-img-placeholder-hint {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
  margin-top: 2px;
  font-style: italic;
}

/* ---- Stacked distribution bar ---- */
.bench-dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.bench-dist-label {
  flex: 0 0 130px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1f2937;
}
.bench-dist-bar {
  flex: 1;
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
}
.bench-dist-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  transition: width 0.4s ease;
  min-width: 22px;
}
.bench-dist-seg.bench-dist-good { background: #10b981; }
.bench-dist-seg.bench-dist-mid  { background: #f59e0b; }
.bench-dist-seg.bench-dist-bad  { background: #ef4444; }
.bench-dist-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 6px 0 10px;
  font-size: 12px;
  color: #6b7280;
}
.bench-dist-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bench-dist-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.bench-dist-legend-dot.bench-dist-good { background: #10b981; }
.bench-dist-legend-dot.bench-dist-mid  { background: #f59e0b; }
.bench-dist-legend-dot.bench-dist-bad  { background: #ef4444; }

/* ---- Победы по сумме баллов (горизонтальные) ---- */
.bench-wins { margin: 8px 0 6px; }
.bench-win-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.bench-win-label {
  flex: 0 0 120px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.bench-win-bar {
  flex: 1;
  background: #f3f4f6;
  border-radius: 6px;
  height: 28px;
  overflow: hidden;
}
.bench-win-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.bench-win-us    { background: #10b981; }
.bench-win-draw  { background: #9ca3af; }
.bench-win-them  { background: #6b7280; }

/* ---- Use-case list ---- */
.bench-usecase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 12px;
}
.bench-usecase-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #10b981;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bench-usecase-item b {
  font-size: 13.5px;
  color: #1f2937;
}
.bench-usecase-item span {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
}

/* ---- Сводная таблица ---- */
.bench-table-wrap {
  margin: 8px 0 14px;
  overflow-x: auto;
}
.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.bench-table th,
.bench-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.bench-table th {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  background: #f9fafb;
}
.bench-table tbody tr:hover { background: #f9fafb; }
.bench-table .bench-strong {
  font-weight: 700;
  color: #047857;
}
.bench-table .bench-win-cell {
  font-weight: 600;
  color: #047857;
  font-size: 11.5px;
}
.bench-table .bench-loss-cell {
  font-weight: 600;
  color: #92400e;
  font-size: 11.5px;
}

/* ---- Финальный вердикт ---- */
.bench-verdict {
  margin: 18px 0 8px;
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%);
  border: 1px solid #6ee7b7;
  border-radius: 14px;
}
.bench-verdict-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #065f46;
  margin-bottom: 8px;
}
.bench-verdict p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
  color: #1f2937;
}
.bench-verdict p:last-child { margin-bottom: 0; }
.bench-verdict b { color: #047857; }

.bench-footnote {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.5;
  font-style: italic;
  text-align: center;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .info-popup-why { max-width: 100%; }
  .bench-hero { flex-direction: column; gap: 10px; }
  .bench-hero-vs { display: none; }
  .bench-twocol,
  .bench-usecase { grid-template-columns: 1fr; }
  .bench-hero-value { font-size: 36px; }
  .bench-stat-big { font-size: 30px; }
  .bench-dist-label,
  .bench-win-label { flex: 0 0 100px; font-size: 11.5px; }
  .bench-table { font-size: 11.5px; }
  .bench-table th,
  .bench-table td { padding: 7px 6px; }
}
.info-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 8px 0 8px;
}
.info-spec-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #374151;
}
.info-spec-list li {
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
}
.info-spec-list li:last-child { border-bottom: none; }
.info-spec-list b { color: #1f2937; font-weight: 600; }

.hero-file-hint {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #8a8d9b;
  font-family: "Manrope", inherit;
}

/* Inline-ссылки внутри hero-subtitle (legacy — могут остаться где-то). */
.hero-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  color: #5b47bb;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s;
}
.hero-link:hover {
  color: #4338ca;
  text-decoration-thickness: 1.5px;
}

/* ===== Hero badges рядом с кнопкой загрузки (слева и справа) ===== */
.hero-card { position: relative; }
.hero-idle  { position: relative; }
.hero-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e5e2d8;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.hero-badge:hover {
  background: #faf8f3;
  border-color: #5b47bb;
  color: #5b47bb;
  transform: translateY(-1px);
}
.hero-badge:active { transform: translateY(0); }
.hero-badge-icon {
  font-size: 12px;
  opacity: 0.85;
}

/* ===== Drop-зона = вся карточка hero-idle. Визуальное состояние через
   класс .dragover. Хвост подсказки + кнопка остаются внутри. ===== */
.hero-idle {
  border: 2px dashed transparent;
  border-radius: 14px;
  transition: border-color 0.18s, background 0.18s;
}
.hero-idle.dragover {
  border-color: #5b47bb;
  background: rgba(91, 71, 187, 0.04);
  border-style: solid;
}
.hero-dropzone-hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #8a8d96;
  user-select: none;
  pointer-events: none;
}
.hero-idle.dragover .hero-dropzone-hint {
  color: #5b47bb;
  font-weight: 600;
}
.hero-idle.dragover .hero-dropzone-hint::before {
  content: "↓ ";
}

/* ===== Дисклеймер о согласии под кнопкой загрузки — короткий, 1 ссылка ===== */
.hero-consent-note {
  margin: 14px auto 0;
  max-width: 420px;
  font-size: 11.5px;
  line-height: 1.55;
  color: #8a8d96;
  text-align: center;
}
.hero-consent-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #5b47bb;
  cursor: pointer;
  border-bottom: 1px solid rgba(91, 71, 187, 0.3);
  transition: border-color 0.15s;
}
.hero-consent-link:hover {
  border-bottom-color: rgba(91, 71, 187, 0.7);
}

/* ===== Попап со списком юридических документов ===== */
.info-popup-agreements { max-width: 520px; }
.agreements-lede {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #4b5568;
}
.agreements-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agreements-list li { margin: 0; }
.agreements-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #faf8f3;
  border: 1px solid #e9e6db;
  color: #1f2937;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.agreements-list a:hover {
  background: #fff;
  border-color: #5b47bb;
  color: #5b47bb;
  transform: translateX(2px);
}
.agreements-icon {
  font-size: 16px;
  flex: 0 0 auto;
  opacity: 0.85;
}
.agreements-name {
  flex: 1;
  line-height: 1.35;
}
.agreements-arrow {
  flex: 0 0 auto;
  color: #9ca3af;
  font-size: 16px;
  transition: color 0.15s, transform 0.15s;
}
.agreements-list a:hover .agreements-arrow {
  color: #5b47bb;
  transform: translateX(2px);
}
.agreements-hint {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #e9e6db;
  font-size: 12px;
  color: #8a8d96;
  text-align: center;
  line-height: 1.5;
}
.agreements-hint a {
  color: #5b47bb;
  text-decoration: none;
  border-bottom: 1px solid rgba(91, 71, 187, 0.3);
}

@media (max-width: 540px) {
  /* Mobile layout:
       row 1: [Выбрать файлы] (full width)
       row 2: [Как пользоваться] [Советы по фото]
     Используем flexbox order + flex-basis:100% на кнопке для wrap. */
  .hero-action-row {
    gap: 10px 8px;
    flex-wrap: wrap;
  }
  #choose-btn {
    order: 1;
    flex-basis: 100%;
    margin: 0 auto;
  }
  .hero-action-row .hero-badge {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;         /* НЕ переносить текст внутри пилюли */
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Скрываем иконку на узких экранах — освобождает место для текста.
     Иконка не несёт смысла без подписи. */
  .hero-action-row .hero-badge .hero-badge-icon {
    display: none;
  }
  .hero-badge {
    font-size: 12px;
    padding: 9px 8px;
    line-height: 1.15;
  }
  .hero-consent-note { font-size: 11px; max-width: 320px; }
  .agreements-list a { padding: 10px 12px; font-size: 12.5px; }
  .agreements-icon { font-size: 14px; }
}

/* Очень узкие экраны (~360px iPhone SE) — ужимаем ещё */
@media (max-width: 380px) {
  .hero-action-row .hero-badge {
    font-size: 11.5px;
    padding: 8px 6px;
  }
}

/* Бэйдж «Публичный проект» на result.html у гостя (не-owner). */
.shared-viewer-badge {
  display: inline-block;
  margin-left: 12px;
  padding: 4px 10px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 8px;
  vertical-align: middle;
}

/* Footer-блок каталога: sentinel (для IO) + кнопка-fallback. */
/* Размещается grid-column: 1/-1 чтобы занимал весь ряд. */
.catalog-footer {
  grid-column: 1 / -1;
  padding: 8px 0;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.catalog-footer-done {
  grid-column: 1 / -1;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}
/* Sentinel — нужен только IntersectionObserver, юзеру не виден. */
.catalog-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}
.catalog-load-more-btn {
  width: 100%;
  padding: 10px 16px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #1f2937;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.catalog-load-more-btn:hover {
  background: #e5e7eb;
}

/* ===== Share modal — диалог «Поделиться» (как у Google Photos) ===== */
.share-modal {
  position: fixed; inset: 0;
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.share-modal.hidden { display: none; }
.share-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(14, 16, 24, 0.55);
  animation: share-fade-in 0.15s ease-out;
}
.share-modal-card {
  position: relative;
  background: #fff; border-radius: 18px;
  max-width: 480px; width: 100%;
  padding: 26px 24px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: share-scale-in 0.16s ease-out;
}
@keyframes share-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes share-scale-in {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.share-modal-close {
  position: absolute; top: 10px; right: 12px;
  width: 32px; height: 32px;
  background: transparent; border: none;
  font-size: 24px; line-height: 1; color: #6a6f7d;
  cursor: pointer;
}
.share-modal-close:hover { color: #1f2937; }
.share-modal-title {
  font-family: "Manrope", inherit;
  font-size: 20px; font-weight: 700; color: #0e1018;
  margin: 0 30px 8px 0;
}
.share-modal-hint {
  font-size: 13.5px; color: #5a5d68; line-height: 1.5;
  margin: 0 0 18px;
}

.share-link-row {
  display: flex; gap: 8px; align-items: stretch;
  margin-bottom: 14px;
}
.share-link-input {
  flex: 1 1 auto; min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid #d1d5db; border-radius: 10px;
  background: #fafafa; color: #1f2937;
  outline: none;
}
.share-link-input:focus {
  border-color: #0e1018;
  background: #fff;
}
.share-link-copy {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: #0e1018; color: #fff;
  border: none; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 13px;
  font-family: inherit;
  transition: background 0.15s;
}
.share-link-copy:hover { background: #1f2937; }
.share-link-copy svg { width: 16px; height: 16px; }
.share-link-copy.copied {
  background: #16a34a;
}

.share-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 8px;
}
.share-action-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: #f3f4f6; color: #1f2937;
  border: 1px solid #e5e7eb; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  text-align: left; width: 100%;
  transition: background 0.15s, border-color 0.15s;
}
.share-action-btn:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}
.share-action-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* Danger-вариант — закрыть публичный доступ */
.share-action-btn.share-action-danger {
  background: #fff5f5;
  color: #b91c1c;
  border-color: #fecaca;
}
.share-action-btn.share-action-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.share-action-btn.share-action-danger svg { stroke: #b91c1c; }

.share-modal-note {
  font-size: 12px; color: #9ca3af;
  text-align: center;
  margin-top: 8px;
  min-height: 16px;
}
.share-modal-note.ok  { color: #16a34a; }
.share-modal-note.err { color: #b91c1c; }

@media (max-width: 520px) {
  .share-modal-card { padding: 22px 18px 18px; }
  .share-modal-title { font-size: 17px; }
  .share-link-row { flex-direction: column; }
  .share-link-copy { width: 100%; justify-content: center; }
}

/* ===== Hamburger button (видна только на мобиле) ===== */
.topbar-burger {
  display: none;          /* desktop: скрыта */
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  position: relative;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  transition: background 0.18s, border-color 0.18s;
}
.topbar-burger:hover {
  background: rgba(0,0,0,0.04);
}
.topbar-burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #0a0a14;
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.18s ease;
  transform-origin: center;
}
.topbar-burger.open {
  background: rgba(0,0,0,0.06);
}
.topbar-burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.topbar-burger.open span:nth-child(2) {
  opacity: 0;
}
.topbar-burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Mobile dropdown menu (slide down from top) ===== */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}
.mobile-menu.open {
  pointer-events: auto;
}
.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0);
  transition: background 0.25s ease;
}
.mobile-menu.open .mobile-menu-backdrop {
  background: rgba(10, 10, 20, 0.32);
}
.mobile-menu-sheet {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #fdfcf9;
  padding: 78px 16px 20px;    /* верхний отступ — место для topbar */
  box-shadow: 0 12px 30px rgba(10, 10, 20, 0.12);
  transform: translateY(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.34, 1);
}
.mobile-menu.open .mobile-menu-sheet {
  transform: translateY(0);
}
.mobile-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 14px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #0a0a14;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.mobile-menu-item + .mobile-menu-item {
  margin-top: 4px;
}
.mobile-menu-item:active {
  background: rgba(0,0,0,0.05);
}
.mobile-menu-item-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-menu-item-arrow {
  color: #9da5b1;
  font-size: 22px;
  font-weight: 300;
  flex: 0 0 auto;
  margin-left: 12px;
}
.mobile-menu-item-accent {
  background: linear-gradient(135deg, #0a0a14 0%, #1a1d2e 100%);
  color: #fff;
  margin-top: 12px !important;
}
.mobile-menu-item-accent:active {
  background: linear-gradient(135deg, #1a1d2e 0%, #2a2d3e 100%);
}
.mobile-menu-item-accent .mobile-menu-item-arrow {
  color: rgba(255,255,255,0.5);
}
.mobile-menu-spark {
  color: #10b981;
  font-size: 14px;
}

body.menu-open,
body.popup-open {
  overflow: hidden;
  /* iOS Safari: position:fixed предотвращает scroll chaining за пределами */
  touch-action: none;
}

/* ===== "Почему не ChatGPT" — кнопка с звёздочкой ===== */
.topbar-why-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar-why-spark {
  color: #10b981;
  font-size: 13px;
}

/* Mobile-only banner-кнопка под хедером. Desktop: спрятана. */
.topbar-why-mobile { display: none; }

/* Wrapper кнопок справа: gap между why-btn и гамбургером */
.home-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Mobile breakpoint — гамбургер вкл, desktop-nav выкл ===== */
@media (max-width: 720px) {
  .home-topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: #fdfcf9;
    position: relative;
    z-index: 9500;
  }
  .home-topbar-left {
    flex: 0 1 auto;
    min-width: 0;
  }
  .home-topbar-right {
    flex: 0 0 auto;
    gap: 8px;
  }
  .topbar-desktop-only { display: none !important; }
  .topbar-burger { display: flex; }
  .mobile-menu { display: block; }

  /* В topbar остаётся только логотип слева + гамбургер справа */
  .home-topbar .brand {
    font-size: 22px;
    letter-spacing: -0.01em;
  }
  .brand-beta {
    font-size: 9px;
    padding: 2px 6px;
    margin-left: 6px;
  }

  /* ===== Banner-кнопка "Почему не ChatGPT" — полоса под хедером ===== */
  .topbar-why-mobile {
    display: block;
    padding: 10px 14px 12px;
    background: #fdfcf9;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: relative;
    z-index: 9400;          /* выше hero, но ниже открытого мобильного меню */
  }
  .topbar-why-mobile-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    background: #0a0a14;
    color: #fff;
  }
  .topbar-why-mobile-btn .topbar-why-spark {
    color: #10b981;
    font-size: 14px;
  }

  /* Гамбургер-меню должно ПОВЕРХ topbar и banner — добавляем padding под их высоту */
  .mobile-menu { z-index: 9700; }
  .mobile-menu-sheet {
    /* topbar ~ 62px + banner ~ 68px = ~130px. Учитываем + запас. */
    padding: 140px 16px 24px;
  }

  .info-popup-card .up-popup-title { font-size: 18px; }
}

@media (max-width: 380px) {
  .home-topbar { padding: 10px 12px; gap: 8px; }
  .home-topbar .brand { font-size: 19px; }
  .topbar-burger { width: 36px; height: 36px; }
  .topbar-why-mobile { padding: 8px 12px 10px; }
  .topbar-why-mobile-btn { padding: 12px 14px; font-size: 13.5px; }
  .mobile-menu-sheet { padding: 130px 14px 20px; }
  .mobile-menu-item { font-size: 15px; padding: 14px 12px; }
}

/* ===== Кнопка тёмная (универсальная для home) ===== */

.btn.btn-dark {
  background: #0e1018;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: transform 0.08s, background 0.12s;
}
.btn.btn-dark:hover { background: #1d2030; transform: translateY(-1px); }
.btn.btn-dark:active { transform: translateY(0); }
.btn.btn-dark svg { width: 18px; height: 18px; }

/* ===== MAIN ===== */

.home-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 32px 60px;
}

/* ===== HERO CARD ===== */

.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, #f4f4f0 100%);
  border: 1px solid #ececea;
  border-radius: 32px;
  padding: 80px 40px 72px;
  text-align: center;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 8px 30px rgba(14,16,24,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.hero-icon {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.hero-icon svg,
.hero-icon img {
  width: 84px;
  height: 84px;
  color: #0e1018;
}

.hero-title {
  margin: 0;
  font-size: 36px;
  color: #0e1018;
  line-height: 1.15;
}

.hero-subtitle {
  margin: 0 0 14px;
  font-size: 15px;
  color: #5c6072;
  line-height: 1.55;
  max-width: 460px;
}

.hero-dropzone {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-align: center;
}

/* ===== hero-card: переключение idle ↔ processing ===== */

/* hero-card должен сохранять одинаковую высоту в обоих стейтах. Делаем  */
/* idle всегда занимающим место (visibility:hidden когда processing —    */
/* высота остаётся), а processing накладываем абсолютным слоем сверху.   */
/* Так анимация занимает ровно тот же контур что был у idle, ничего не   */
/* прыгает.                                                              */
.hero-card { position: relative; }

.hero-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}
.hero-processing {
  position: absolute;
  inset: 0;                /* заполняет ВЕСЬ hero-card */
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  box-sizing: border-box;
  pointer-events: none;     /* не блокируем клики */
}
.hero-card.processing .hero-idle       { visibility: hidden; } /* высоту сохраняем */
.hero-card.processing .hero-processing { display: flex; }

.hero-processing-caption {
  font-family: "Manrope", inherit;
  font-size: 15px;
  font-weight: 500;
  color: #6b6e7a;
  letter-spacing: -0.005em;
}

/* ===== анимация (roomrum 3D-scene) — встраивается «нативно» в hero-card */
/* Без своей подложки/тени/рамки — фон карточки виден насквозь.           */
.roomrum-animation-container {
  width: 100%;
  max-width: 560px;
  flex: 1 1 auto;          /* SVG-сцена тянется на доступную высоту */
  min-height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.roomrum-bg-grid {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
.roomrum-3d-scene {
  width: 100%;
  height: 100%;
  max-width: 360px;
  max-height: 100%;
  z-index: 10;
  opacity: 0.9;
}
@keyframes rr-scan-vertical {
  0%   { transform: translateY(-20px); }
  100% { transform: translateY(280px); }
}
.rr-animate-scan-vertical {
  animation: rr-scan-vertical 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes rr-dash-draw {
  0%   { stroke-dashoffset: 400; }
  100% { stroke-dashoffset: 0; }
}
.rr-animate-dash {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: rr-dash-draw 4.5s ease-out infinite alternate;
}
@keyframes rr-pulse-node {
  0%, 100% { opacity: 0.3; transform: scale(1);   filter: drop-shadow(0 0 2px rgba(99,102,241,0.1)); }
  50%      { opacity: 0.8; transform: scale(1.2); filter: drop-shadow(0 0 5px rgba(99,102,241,0.3)); }
}
.rr-svg-node {
  animation: rr-pulse-node 2.5s ease-in-out infinite;
  transform-origin: center;
}
@keyframes rr-blob1 {
  0%, 100% { transform: translate(0, 0) scale(1);    opacity: 0.5; }
  33%      { transform: translate(50px, 40px) scale(1.1); opacity: 0.2; }
  66%      { transform: translate(-40px, 50px) scale(0.9); opacity: 0.6; }
}
@keyframes rr-blob2 {
  0%, 100% { transform: translate(0, 0) scale(1);     opacity: 0.3; }
  33%      { transform: translate(-50px, -50px) scale(0.85); opacity: 0.7; }
  66%      { transform: translate(40px, -40px) scale(1.15);  opacity: 0.2; }
}
@keyframes rr-blob3 {
  0%, 100% { transform: translate(0, 0) scale(1);    opacity: 0.6; }
  50%      { transform: translate(0, -50px) scale(1.2); opacity: 0.3; }
}
.rr-animate-blob1 { animation: rr-blob1  9s ease-in-out infinite; transform-origin: center; }
.rr-animate-blob2 { animation: rr-blob2 11s ease-in-out infinite; transform-origin: center; }
.rr-animate-blob3 { animation: rr-blob3 13s ease-in-out infinite; transform-origin: center; }

/* На мобилке padding hero-card меньше, processing-слой тоже жмётся. */
@media (max-width: 720px) {
  .hero-processing { padding: 18px; }
  .roomrum-3d-scene { max-width: 260px; }
}

.btn.btn-hero {
  font-size: 15px;
  padding: 14px 28px;
}
.btn.btn-hero svg { width: 18px; height: 18px; }

/* ===== прогресс / ошибка / safety поверх hero-card ===== */

.hero-card .upload-progress,
.hero-card .upload-error,
.hero-card .safety-banner {
  width: 100%;
  max-width: 500px;
  margin-top: 18px;
}

/* ===== HISTORY ===== */

.history-section-v2 {
  margin-top: 64px;
}
/* Head с заголовком слева и кнопкой «Очистить рендеры» справа. */
.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.history-head .history-title {
  margin: 0;
}
.history-title {
  margin: 0 0 26px;
  font-size: 32px;
  color: #0e1018;
}
/* Невидимая «текстовая» кнопка с тонким акцентом опасности. */
.btn-link-danger {
  background: transparent;
  border: 1px solid transparent;
  color: #a02828;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.12s, border-color 0.12s;
}
.btn-link-danger:hover {
  background: #fef0f0;
  border-color: #f0c1c1;
}
.btn-link-danger.hidden { display: none; }
.history-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}
.history-grid-v2 .history-card,
.history-grid-v2 a.history-card {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.history-grid-v2 .history-card:hover {
  transform: translateY(-2px);
  border-color: #d8d6cf;
  box-shadow: 0 10px 26px rgba(14,16,24,0.07);
}
/* Мгновенный feedback при клике — карточка получает спиннер-оверлей пока
   browser грузит result.html. На медленном инете между кликом и появлением
   страницы могут быть секунды белого экрана — без этого юзер не понимает
   принят ли клик. */
.history-grid-v2 .history-card.loading {
  pointer-events: none;
  position: relative;
}
.history-grid-v2 .history-card.loading::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(1px);
  border-radius: 18px;
  z-index: 1;
}
.history-grid-v2 .history-card.loading::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid rgba(14,16,24,0.15);
  border-top-color: #0e1018;
  border-radius: 50%;
  animation: history-card-spin 0.8s linear infinite;
  z-index: 2;
}
@keyframes history-card-spin {
  to { transform: rotate(360deg); }
}
/* Когда одна карточка в loading — остальные тоже блокируем чтобы юзер
   не успел ткнуть в две сразу и удивиться. */
.history-grid-v2.has-loading .history-card:not(.loading) {
  pointer-events: none;
  opacity: 0.45;
}
.history-grid-v2 .history-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #f0efeb;
}
.history-grid-v2 .history-card-thumb {
  position: relative;
}
.history-grid-v2 .history-card-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  background: rgba(14, 16, 24, 0.78);
  color: #fff;
  font-family: "Manrope", inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.01em;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  z-index: 2;
}
.history-grid-v2 .history-card .meta {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-grid-v2 .history-card .meta b {
  font-family: "Manrope", inherit;
  font-weight: 600;
  font-size: 15px;
  color: #0e1018;
  letter-spacing: -0.01em;
}
.history-grid-v2 .history-card .meta span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #8a8d9b;
}
.history-grid-v2 .history-card .meta .badge-pending {
  font-family: inherit;
  font-size: 12px;
  color: #92520a;
  background: #fef3c7;
  border-radius: 8px;
  padding: 2px 8px;
  display: inline-block;
  width: fit-content;
}

/* Бейдж «✓ новых N» — рендеры завершились пока юзер не смотрел / новая */
/* комната догнана через resume. Сбрасывается при открытии комнаты      */
/* (клик карточки или переход на result.html → markRoomSeen).           */
.history-grid-v2 .history-card .meta .badge-fresh {
  font-family: inherit;
  font-size: 12px;
  color: #fff;
  background: #16a34a;
  border-radius: 8px;
  padding: 2px 8px;
  display: inline-block;
  width: fit-content;
  font-weight: 600;
}

/* Зелёная точка в углу карточки — лёгкий пульс чтобы привлечь внимание. */
.history-grid-v2 .history-card {
  position: relative;
}
.history-grid-v2 .history-card.history-card-fresh {
  border-color: #16a34a;
}
.history-card-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: roomrum-fresh-pulse 1.8s ease-out infinite;
  z-index: 3;
}
@keyframes roomrum-fresh-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(22, 163, 74, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0);    }
  100% { box-shadow: 0 0 0 0    rgba(22, 163, 74, 0);    }
}

/* ===== FOOTER ===== */

.home-footer {
  margin-top: 80px;
  padding: 28px 36px 24px;
  background: #f3f2ed;
  border-top: 1px solid #e5e3dc;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
/* На result-странице footer прижат к контенту — без огромного gap */
body.result-v3 .home-footer {
  margin-top: 0;
}

/* Компактная одиночная строка-дисклеймер — занимает мало места */
.home-footer-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: #8a8d96;
  text-align: center;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.home-footer-note a {
  color: #5b47bb;
  text-decoration: none;
  border-bottom: 1px solid rgba(91, 71, 187, 0.25);
}
.home-footer-note a:hover {
  border-bottom-color: rgba(91, 71, 187, 0.6);
}

/* Нижняя полоска футера: brand слева, копирайт справа */
.home-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

@media (max-width: 640px) {
  .home-footer { padding: 22px 18px 18px; gap: 18px; }
  .home-footer-disclaimer p { font-size: 11px; }
  .home-footer-bottom { padding-top: 14px; }
}
.home-footer-left {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.home-footer .brand-small {
  font-size: 17px;
  color: #0e1018;
}
.home-footer .footer-link {
  font-size: 13px;
  color: #5c6072;
  text-decoration: none;
}
.home-footer .footer-link:hover {
  color: #0e1018;
  text-decoration: underline;
}
.home-footer-right {
  font-size: 13px;
  color: #8a8d9b;
}

/* ===== Legal pages (privacy.html, terms.html) ===== */

.home-main.legal-page {
  max-width: 760px;
  padding: 48px 32px 60px;
}
.legal-title {
  font-size: 34px;
  margin-bottom: 8px;
}
.legal-meta {
  font-size: 13px;
  color: #8a8d9b;
  margin: 0 0 32px;
}
.legal-section {
  margin-bottom: 32px;
}
.legal-section h2 {
  font-family: "Manrope", inherit;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: #0e1018;
  margin: 0 0 12px;
}
.legal-section p,
.legal-section li {
  font-size: 14.5px;
  color: #3a3e4d;
  line-height: 1.7;
}
.legal-section p { margin: 0 0 12px; }
.legal-section ul {
  margin: 0 0 12px;
  padding-left: 22px;
}
.legal-section ul li { margin-bottom: 6px; }
.legal-section b { font-weight: 600; color: #0e1018; }
.legal-section a { color: #5b47bb; text-decoration: none; border-bottom: 1px solid rgba(91,71,187,0.3); }
.legal-section a:hover { border-bottom-color: rgba(91,71,187,0.7); }

/* Содержание для consents.html (две статьи на одной странице) */
.legal-toc {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 36px;
  padding: 14px 18px;
  background: #f7f5ee;
  border: 1px solid #e9e6db;
  border-radius: 12px;
}
.legal-toc-link {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 500;
  color: #4338ca;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(91,71,187,0.2);
  transition: background 0.15s, border-color 0.15s;
}
.legal-toc-link:hover {
  background: #f5f3ff;
  border-color: rgba(91,71,187,0.5);
}

/* Вступительный абзац перед нумерованными разделами */
.legal-intro {
  font-size: 14.5px;
  line-height: 1.7;
  color: #3a3e4d;
  margin: 0 0 28px;
  padding: 16px 20px;
  background: #faf8f3;
  border-left: 3px solid #5b47bb;
  border-radius: 0 8px 8px 0;
}
.legal-intro a {
  color: #5b47bb;
  text-decoration: none;
  border-bottom: 1px solid rgba(91,71,187,0.3);
}

/* Разделитель между статьями на одной странице (Согласия 1 и 2) */
.legal-article + .legal-divider,
hr.legal-divider {
  margin: 60px 0;
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.15), transparent);
}
.legal-article {
  scroll-margin-top: 80px;  /* для красивого якорного скролла из toc */
}

/* ===========================================================
   Result page v3 — редизайн под home-стилистику (Manrope, светлый фон)
   =========================================================== */

body.result-v3 {
  background: #fafaf7;
  color: #0e1018;
}

.result-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 32px 28px;
}

/* Шапка result-страницы: title слева, «Вернуться» справа */
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-top: 8px;
}
.result-head .result-title {
  margin: 0;
  font-family: "Manrope", inherit;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 22px;
  color: #1f2330;
  line-height: 1.2;
}
.result-head .result-back {
  font-size: 13px;
  color: #6a6f7d;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.result-head .result-back:hover {
  background: #f1f0ec;
  color: #0e1018;
  text-decoration: none;
}

/* Safety banner v3 — мягкая жёлтая плашка */
.safety-banner-v3 {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-left: 3px solid #f59f0b;
  background: #fef3c7;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.safety-banner-v3 .safety-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  color: #92520a;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 18px;
}
.safety-banner-v3 .safety-text { flex: 1; min-width: 0; }
.safety-banner-v3 .safety-text b {
  display: block;
  color: #5c3a00;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.safety-banner-v3 .safety-text p,
.safety-banner-v3 .safety-text ul {
  margin: 0;
  color: #7a4a00;
  font-size: 13px;
  line-height: 1.5;
}
.safety-banner-v3 .safety-text ul { padding-left: 18px; margin-top: 4px; }
.safety-banner-v3.unsafe {
  background: #fee2e2;
  border-left-color: #dc2626;
}
.safety-banner-v3.unsafe .safety-icon { color: #b91c1c; }
.safety-banner-v3.unsafe .safety-text b { color: #7f1d1d; }
.safety-banner-v3.unsafe .safety-text p,
.safety-banner-v3.unsafe .safety-text ul { color: #991b1b; }

/* Двухколоночный grid */
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: flex-start;
}

/* ===== LEFT column ===== */

.result-main-col .main-frame {
  position: relative;
  background: #e9eae5;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-main-col .main-frame img#main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e9eae5;
  display: block;
  cursor: zoom-in;
}

/* Badge поверх картинки — сверху-слева (внизу теперь strip) */
.image-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(14,16,24,0.78);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.image-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

/* Action toolbar — OVERLAY в верхней части main-frame */
.action-toolbar-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 3;
  pointer-events: none;  /* контейнер прозрачен для кликов мимо кнопок */
}
.action-toolbar-overlay > * { pointer-events: auto; }
.action-toolbar-overlay .btn-violet svg { width: 16px; height: 16px; }
.action-spacer { flex: 1 1 auto; }

/* Иконочные кнопки поверх картинки — полупрозрачный тёмный фон с blur */
.icon-btn.icon-btn-onimage {
  background: rgba(255,255,255,0.92);
  border-color: rgba(255,255,255,0.7);
  color: #1f2330;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(14,16,24,0.18);
}
.icon-btn.icon-btn-onimage:hover {
  background: #fff;
  border-color: #fff;
  color: #0e1018;
}

/* Иконочная кнопка — квадратная, только svg */
.icon-btn {
  background: #fff;
  color: #2a2e3a;
  border: 1px solid #ddd9d0;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
  font-family: inherit;
}
.icon-btn:hover {
  background: #f7f6f1;
  border-color: #c8c4ba;
  color: #0e1018;
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0); }
.icon-btn svg { width: 17px; height: 17px; }

/* Акцентная (фиолетовая) иконочная кнопка — для «Узнать стоимость» */
.icon-btn.icon-btn-violet {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.icon-btn.icon-btn-violet:hover {
  background: #3f37c4;
  border-color: #3f37c4;
  color: #fff;
}

/* Кнопочные варианты — добавки к существующему .btn */
.btn.btn-light {
  background: #fff;
  color: #0e1018;
  border: 1px solid #ddd9d0;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.btn.btn-light:hover { background: #f7f6f1; transform: translateY(-1px); }
.btn.btn-light svg { width: 17px; height: 17px; }
.btn.btn-violet {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: background 0.12s, transform 0.08s;
}
.btn.btn-violet:hover { background: #3f37c4; transform: translateY(-1px); }

/* Render strip — overlay в нижней части main-frame */
.render-strip-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(14,16,24,0.55);
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.render-strip-overlay::-webkit-scrollbar { height: 5px; }
.render-strip-overlay::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}
.render-strip-overlay:empty { display: none; }
.render-strip-overlay .strip-thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: #2a2d3a;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.render-strip-overlay .strip-thumb:hover { transform: translateY(-1px); }
.render-strip-overlay .strip-thumb.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.render-strip-overlay .strip-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.render-strip-overlay .strip-thumb .strip-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(14,16,24,0.78);
  color: #fff;
  font-size: 9.5px;
  font-weight: 500;
  text-align: center;
  padding: 2px 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.render-strip-overlay .strip-thumb.original .strip-label {
  background: rgba(40,80,180,0.85);
}

/* Meta-строка под main-frame — компактная, скрыта если пуста */
.main-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  min-height: 18px;
}
.render-meta {
  margin: 0;
  font-size: 12.5px;
  color: #6a6f7d;
  flex: 1;
  min-width: 0;
}
.render-meta:empty { display: none; }

/* ===== RIGHT sidebar — карточки ===== */

.result-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 24px;
}
.side-card {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}
.side-card .side-label {
  font-size: 11px;
  font-weight: 600;
  color: #6a6f7d;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.side-card .side-hint {
  margin: 0;
  font-size: 13px;
  color: #5c6072;
  line-height: 1.4;
}
.side-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.side-card-title {
  margin: 0;
  font-family: "Manrope", inherit;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.015em;
  color: #0e1018;
}

/* Качество — toggle */
.side-card-quality {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
}
.quality-group-v3 {
  display: inline-flex;
  background: #f1f0ec;
  border-radius: 14px;
  padding: 3px;
  gap: 0;
}
.quality-group-v3 .quality-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 11px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  gap: 1px;
  color: #2a2e3a;
}
.quality-group-v3 .quality-btn b { font-weight: 600; font-size: 13px; }
.quality-group-v3 .quality-btn span {
  font-size: 10.5px;
  font-weight: 400;
  color: #6a6f7d;
  display: block;
}
.quality-group-v3 .quality-btn.active {
  background: #4f46e5;
  color: #fff;
}
.quality-group-v3 .quality-btn.active span { color: rgba(255,255,255,0.85); }

/* Textarea в auto-card */
.side-textarea {
  width: 100%;
  border: 1px solid #ececea;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  color: #0e1018;
  resize: vertical;
  min-height: 38px;
  max-height: 140px;
  outline: none;
  transition: border-color 0.12s;
  background: #fafaf7;
}
.side-textarea:focus { border-color: #4f46e5; background: #fff; }
.side-textarea::placeholder { color: #9da0ad; }

.btn.btn-block { width: 100%; justify-content: center; }

/* Style tags — chips */
.style-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0;
}
.style-tag {
  background: transparent;
  border: 1px solid #ddd9d0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #2a2e3a;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.style-tag:hover { background: #f7f6f1; }
.style-tag.active {
  background: #0e1018;
  color: #fff;
  border-color: #0e1018;
}

/* Каталог обоев в боковой колонке — 2 колонки */
.catalog-grid-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.catalog-grid-side .wallpaper-item {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.catalog-grid-side .wallpaper-item:hover {
  transform: translateY(-1px);
  border-color: #c5c9d6;
  box-shadow: 0 6px 14px rgba(14,16,24,0.06);
}
.catalog-grid-side .wallpaper-item.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.catalog-grid-side .wallpaper-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f0efeb;
}
.catalog-grid-side .wallpaper-item .label {
  padding: 6px 8px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #2a2e3a;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catalog-grid-side .wallpaper-item.has-render {
  border-color: #16a34a;
}
.catalog-grid-side .wallpaper-item .done-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ===== Catalog header row + auto-popover ===== */

.catalog-side-card { padding: 16px 16px 14px; }

.catalog-head-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.catalog-head-row .side-card-title {
  margin: 0;
  flex-shrink: 0;
}
.catalog-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* «+ Подобрать стиль» кнопка в шапке каталога */
.catalog-auto-btn {
  background: #f0eefe;
  color: #4f46e5;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px 6px 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.catalog-auto-btn:hover { background: #e5e2fd; }
.catalog-auto-btn.open { background: #4f46e5; color: #fff; }
.catalog-auto-btn svg { width: 14px; height: 14px; }

/* Popover — absolute под кнопкой */
.auto-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 14px;
  padding: 6px;
  width: 280px;
  max-width: calc(100vw - 32px);  /* не вылезать за края viewport */
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 28px rgba(14,16,24,0.12);
}
.auto-option {
  background: #fafaf7;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.auto-option:hover {
  background: #fff;
  border-color: #4f46e5;
}
.auto-option b {
  font-size: 13.5px;
  font-weight: 600;
  color: #0e1018;
}
.auto-option span {
  font-size: 11.5px;
  color: #6a6f7d;
  line-height: 1.35;
}
.auto-option-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.auto-option-disabled:hover {
  background: #fafaf7;
  border-color: transparent;
}

/* ===== Catalog side card (компактный) ===== */

.catalog-side-card { padding-bottom: 14px; }
.catalog-expand-btn {
  background: transparent;
  border: 1px solid #ececea;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2e3a;
  transition: background 0.12s, border-color 0.12s;
}
.catalog-expand-btn:hover {
  background: #fafaf7;
  border-color: #d8d6cf;
  color: #0e1018;
}
.catalog-expand-btn svg { width: 15px; height: 15px; }

/* Style tags row — горизонтальный скролл + кнопки ‹ › */
.style-tags-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}
.tag-scroll-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ececea;
  color: #2a2e3a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.tag-scroll-btn:hover {
  background: #f7f6f1;
  border-color: #d8d6cf;
  color: #0e1018;
}
.tag-scroll-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.style-tags-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.style-tags-scroll::-webkit-scrollbar { display: none; }
.style-tags-scroll .style-tags {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 2px 1px;
}
.style-tags-scroll .style-tag {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Компактная сетка обоев в сайдбаре — 3 колонки, максимум 3 ряда видимы.
 * Если обоев больше 9 — появляется вертикальный скролл внутри карточки. */
.catalog-grid-compact {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  /* Firefox: align-content default = stretch заставляет grid сжимать строки
     чтобы влезли в max-height. align-content: start выключает это. */
  align-content: start;
  max-height: 360px;       /* ~3 ряда */
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;           /* FF: разрешает scroll в grid с overflow:auto */
  padding-right: 4px;      /* место под скроллбар */
  scrollbar-width: thin;
  scrollbar-color: #d8d6cf transparent;
}
.catalog-grid-compact::-webkit-scrollbar { width: 6px; }
.catalog-grid-compact::-webkit-scrollbar-thumb { background: #d8d6cf; border-radius: 3px; }
.catalog-grid-compact::-webkit-scrollbar-track { background: transparent; }
.catalog-grid-compact .wallpaper-item {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  /* Firefox: без min-height карточка collapse-ится до загрузки картинки
     (aspect-ratio на img не работает корректно в grid контейнере с
     overflow:auto). Фиксируем минимум — Chrome тоже OK, не растягивается. */
  min-height: 130px;
}
.catalog-grid-compact .wallpaper-item:hover {
  transform: translateY(-1px);
  border-color: #c5c9d6;
  box-shadow: 0 4px 10px rgba(14,16,24,0.05);
}
.catalog-grid-compact .wallpaper-item.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.2);
}
.catalog-grid-compact .wallpaper-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f0efeb;
}
.catalog-grid-compact .wallpaper-item .label {
  padding: 4px 5px;
  font-size: 9.5px;
  font-weight: 500;
  color: #2a2e3a;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catalog-grid-compact .wallpaper-item.has-render {
  border-color: #16a34a;
}
.catalog-grid-compact .wallpaper-item .done-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #16a34a;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Прелоадер каталога — пока перезагружается список после клика по style-чипу.
 * Существующие thumb-ы затемняются, в центре крутится спиннер.
 * Клик блокируется чтобы юзер не успел кликнуть на обои до того как они
 * перестроятся под новый фильтр. */
.catalog-grid-compact.catalog-loading,
.catalog-grid-full.catalog-loading {
  position: relative;
  pointer-events: none;
  min-height: 120px;
}
.catalog-grid-compact.catalog-loading > .wallpaper-item,
.catalog-grid-full.catalog-loading > .wallpaper-item {
  opacity: 0.35;
  filter: saturate(0.4);
  transition: opacity 0.12s, filter 0.12s;
}
.catalog-grid-compact.catalog-loading::before,
.catalog-grid-full.catalog-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;  /* центровка без transform — чтобы animation не съел её */
  border: 3px solid rgba(14,16,24,0.15);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: catalog-loader-spin 0.85s linear infinite;
  z-index: 10;
}
@keyframes catalog-loader-spin {
  to { transform: rotate(360deg); }
}

/* Generating state — пока идёт рендер, обои помечаются спиннером
 * поверх миниатюры, цепляются как фиолетовая обводка и блокируют клик
 * (cursor: wait + click меняет behavior на viewJob → не запускает второй). */
.wallpaper-item.generating {
  border-color: #4f46e5;
  cursor: wait;
}
.wallpaper-item .generating-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14,16,24,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.wallpaper-item .generating-overlay .spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.85s linear infinite;
}

/* ===== Каталог fullscreen modal ===== */

.catalog-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(14,16,24,0.55);
  z-index: 900;
  display: flex;
  flex-direction: column;
  padding: 36px 32px;
}
.catalog-fs-head {
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ececea;
}
.catalog-fs-head h2 {
  margin: 0;
  font-family: "Manrope", inherit;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #0e1018;
}
.catalog-fs-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #5c6072;
  padding: 4px 10px;
  border-radius: 8px;
}
.catalog-fs-close:hover { background: #fafaf7; color: #0e1018; }

.catalog-fs-body {
  background: #fff;
  border-radius: 0 0 18px 18px;
  padding: 18px 24px 26px;
  flex: 1;
  overflow-y: auto;
}
.catalog-fs-body .style-tags-fs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.catalog-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.catalog-grid-full .wallpaper-item {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.catalog-grid-full .wallpaper-item:hover {
  transform: translateY(-2px);
  border-color: #c5c9d6;
  box-shadow: 0 8px 20px rgba(14,16,24,0.07);
}
.catalog-grid-full .wallpaper-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f0efeb;
}
.catalog-grid-full .wallpaper-item .label {
  padding: 8px 10px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #1f2330;
  text-align: center;
}
.catalog-grid-full .wallpaper-item.has-render {
  border-color: #16a34a;
}
.catalog-grid-full .wallpaper-item .done-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* UNSAFE-блокировка */
.result-sidebar.unsafe-locked {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.4);
}

/* ===== Cost modal (выбор обоев → WhatsApp) ===== */

.cost-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(14,16,24,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cost-modal-card {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(14,16,24,0.25);
}
.cost-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #ececea;
  flex-shrink: 0;
}
.cost-modal-head h3 {
  margin: 0;
  font-family: "Manrope", inherit;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: #0e1018;
}
.cost-modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #5c6072;
  padding: 4px 10px;
  border-radius: 8px;
}
.cost-modal-close:hover { background: #faf9f6; color: #0e1018; }

.cost-modal-body {
  padding: 16px 22px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cost-modal-body .hint {
  margin: 0;
  font-size: 13px;
  color: #5c6072;
}

.cost-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.cost-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a6f7d;
  margin: 4px 0 -2px 2px;
}
.cost-section-head:first-child { margin-top: 0; }

.cost-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fafaf7;
  border: 1px solid #ececea;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.cost-item:hover { background: #fff; border-color: #d8d6cf; }
.cost-item.cost-item-current {
  background: #f0eefe;
  border-color: #4f46e5;
}
.cost-item.cost-item-current:hover {
  background: #e9e6ff;
  border-color: #4f46e5;
}
.cost-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4f46e5;
  cursor: pointer;
  flex-shrink: 0;
}
.cost-item-thumbs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cost-item-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #f0efeb;
  flex-shrink: 0;
  cursor: zoom-in;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s;
}

/* Mobile: разворачиваем .cost-item в 2 строки.
   Row 1: [✓] [info]
   Row 2: [   РЕНДЕР   ][   УЗОР   ]  (на всю ширину, аспект 4:3)
   Используем grid для thumbs — flex с aspect-ratio в Safari/iOS глючит.
   Аспект 4:3 (а не 1:1) — рендер изначально снят 4:3/16:9, при квадрате
   centre-crop срезал важные части (мебель/обои на стене).
   Текстура — pattern, object-fit:cover красиво заполнит любой ratio. */
@media (max-width: 540px) {
  .cost-item {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 12px;
  }
  .cost-item input[type="checkbox"] {
    order: 1;
    width: 22px;
    height: 22px;
  }
  .cost-item-info {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
  }
  .cost-item-thumbs {
    order: 3;
    flex-basis: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .cost-item-thumb {
    width: 100% !important;     /* перебиваем 72px из base */
    height: auto !important;
    aspect-ratio: 4 / 3;
    min-width: 0;
    min-height: 110px;          /* фоллбек если aspect-ratio не поддержан */
    flex: none;
  }
  /* Render — показываем целиком (object-fit:contain), чтобы юзер
     видел свою комнату, а не случайный crop. Заполняем фон чтобы
     letterbox-ы не светились белым. */
  .cost-item-render img {
    object-fit: cover;
  }
  /* Texture — паттерн, cover красивее (без полос по краям). */
  .cost-item-texture img {
    object-fit: cover;
  }
  /* Подпись «РЕНДЕР»/«УЗОР» крупнее на тач */
  .cost-item-render::after,
  .cost-item-texture::after {
    font-size: 11px;
    padding: 4px 0;
  }
}
.cost-item-thumb:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 1;
}
.cost-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cost-item-thumb.cost-item-texture {
  border: 1px dashed rgba(91,71,187,0.3);
}
/* Подпись над thumbnail-ом — для различения R/T */
.cost-item-render::after,
.cost-item-texture::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 2px 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  text-align: center;
  background: rgba(0,0,0,0.55);
  text-transform: uppercase;
  line-height: 1.2;
}
.cost-item-render::after  { content: "Рендер"; }
.cost-item-texture::after { content: "Узор"; }
.cost-item-thumb-empty {
  width: 100%;
  height: 100%;
  background: #f0efeb;
}
.cost-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.cost-item-info b {
  font-weight: 600;
  font-size: 13px;
  color: #1f2330;
}
.cost-item-info > span {
  font-size: 11px;
  color: #6a6f7d;
}
.cost-item-name {
  font-size: 12px !important;
  color: #1f2330 !important;
  font-weight: 500 !important;
}
.cost-item-desc {
  font-size: 11px !important;
  color: #6a6f7d !important;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cost-item-meta {
  font-size: 10.5px !important;
  color: #8a8d96 !important;
  letter-spacing: 0.02em;
}

/* Zoom overlay для cost-modal превью */
.cost-zoom-layer {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.88);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: cost-zoom-fade 0.18s ease-out;
}
.cost-zoom-layer.hidden { display: none; }
.cost-zoom-layer img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.cost-zoom-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cost-zoom-close:hover { background: rgba(255,255,255,0.3); }
@keyframes cost-zoom-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cost-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #ececea;
  flex-wrap: wrap;
}
.cost-counter {
  font-size: 13px;
  color: #5c6072;
}

/* Зелёная WhatsApp-кнопка */
.btn.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: background 0.12s, transform 0.08s;
}
.btn.btn-whatsapp:hover { background: #1ebe57; transform: translateY(-1px); }
.btn.btn-whatsapp:active { transform: translateY(0); }
.btn.btn-whatsapp:disabled {
  background: #c0c4cf;
  cursor: not-allowed;
  transform: none;
}
.btn.btn-whatsapp svg { width: 18px; height: 18px; }

@media (max-width: 480px) {
  .cost-modal { padding: 8px; }
  .cost-modal-card { border-radius: 12px; max-height: 95vh; }
  .cost-modal-head { padding: 14px 16px; }
  .cost-modal-body { padding: 14px 16px 16px; }
  .cost-item { padding: 8px 10px; gap: 10px; }
  /* НЕ перебиваем .cost-item-thumb width/height здесь — за thumbs
     на мобиле отвечает @media (max-width: 540px) выше:
       grid 1fr 1fr + aspect-ratio: 4/3 + полная ширина колонки.
     Старый override `width:40px; height:40px` ломал layout —
     grid игнорировал width, но height: 40px + min-height: 120px
     давал рваные кривые превью. */
  .btn.btn-whatsapp { padding: 10px 16px; font-size: 13px; }
}

/* ===== Mobile ===== */

@media (max-width: 980px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
  .result-sidebar {
    position: static;
  }
}

@media (max-width: 980px) {
  /* Базовый шрифт побольше для удобства чтения с пальца */
  html { font-size: 16px; }

  .result-main { padding: 16px 16px 24px; max-width: 100%; }
  .result-head { padding-top: 4px; margin-bottom: 14px; }
  .result-head .result-title { font-size: 22px; }
  .result-head .result-back { font-size: 14px; padding: 7px 14px; }

  /* Картинка — квадрат на мобильном, чтобы занимала больше вертикали */
  .result-main-col .main-frame { aspect-ratio: 1 / 1; border-radius: 14px; }
  .main-meta-row { margin-top: 8px; gap: 8px; }
  .render-meta { font-size: 12.5px; }

  /* Action toolbar — cost-кнопка с текстом «Цена», share/download иконками */
  .action-toolbar-overlay {
    top: 10px; left: 10px; right: 10px;
    gap: 8px;
  }
  .action-toolbar-overlay .btn-violet {
    padding: 10px 16px;
    font-size: 13.5px;
  }
  .action-toolbar-overlay .btn-violet svg { width: 16px; height: 16px; }

  .icon-btn { width: 42px; height: 42px; }
  .icon-btn svg { width: 17px; height: 17px; }

  /* Strip снизу — нормального размера thumb-ы */
  .render-strip-overlay {
    left: 10px; right: 10px; bottom: 10px;
    padding: 8px;
    gap: 8px;
  }
  .render-strip-overlay .strip-thumb { width: 72px; height: 72px; border-radius: 10px; }
  .render-strip-overlay .strip-thumb .strip-label { font-size: 10px; padding: 2px 4px; }

  .image-badge { top: 10px; left: 10px; font-size: 12px; padding: 6px 10px; }

  .side-card { padding: 14px; }
  .side-card-quality { padding: 12px 14px; }

  /* Каталог 3 колонки на планшете/телефоне.
   * На мобилке max-height + overflow-y съедают touch-скролл страницы:
   * палец попадает в каталог → внутренний scroll вместо скролла страницы.
   * Поэтому на mobile: полная высота, без внутреннего скролла. */
  .catalog-grid-compact {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
  .catalog-grid-compact .wallpaper-item .label { font-size: 10.5px; padding: 5px 6px; }

  .catalog-head-row { gap: 6px; flex-wrap: wrap; }
  .catalog-side-card .side-card-title { font-size: 16px; }
  .catalog-auto-btn { padding: 6px 12px 6px 8px; font-size: 12.5px; }
  .catalog-auto-btn svg { width: 13px; height: 13px; }
  .catalog-expand-btn { width: 30px; height: 30px; }

  .auto-popover { width: min(280px, calc(100vw - 48px)); }

  .tag-scroll-btn { width: 26px; height: 26px; font-size: 17px; }

  .catalog-fullscreen { padding: 16px 12px; }
  .catalog-fs-head { padding: 14px 18px; }
  .catalog-fs-body { padding: 14px 18px 22px; }
  .catalog-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
}

/* Узкий телефон ≤ 480: каталог 2 кол, но всё ещё крупное */
@media (max-width: 480px) {
  html { font-size: 15.5px; }
  .result-main { padding: 12px 12px 20px; }
  .result-head .result-title { font-size: 20px; }

  /* Кнопка «Цена» компактнее, share/download иконки тоже */
  .action-toolbar-overlay { gap: 6px; }
  .action-toolbar-overlay .btn-violet { padding: 8px 14px; font-size: 12.5px; }
  .action-toolbar-overlay .btn-violet svg { width: 14px; height: 14px; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 15px; height: 15px; }

  /* Каталог: 2 колонки — карточки крупные, удобно тыкать. Без max-height —
   * иначе внутренний touch-скролл блокирует scroll страницы. */
  .catalog-grid-compact {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: none;
    overflow-y: visible;
  }
  .catalog-grid-compact .wallpaper-item .label { font-size: 11px; }

  /* «Подобрать» с иконкой и текстом — компактные размеры */
  .catalog-auto-btn { padding: 5px 10px 5px 8px; font-size: 12px; }
  .catalog-auto-btn svg { width: 13px; height: 13px; }
  .catalog-auto-btn .btn-label { display: inline; }

  /* Footer компактнее */
  .home-footer { padding: 16px 14px; font-size: 12px; }
  .home-footer-left { gap: 10px; }
  .home-footer .brand-small { font-size: 15px; }
  .home-footer .footer-link { font-size: 12px; }
  .home-footer-right { font-size: 11.5px; }
}

/* ===== Mobile (общий для home-v2) ===== */

@media (max-width: 760px) {
  .legal-title { font-size: 26px; }
  .home-main.legal-page { padding: 28px 18px 40px; }

  .home-topbar {
    padding: 16px 18px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .home-topbar-left { gap: 18px; }
  .home-topbar .brand { font-size: 22px; }
  .home-topbar .topbar-link { font-size: 13px; }

  .home-main { padding: 28px 16px 40px; }

  .hero-card { padding: 48px 22px 52px; border-radius: 22px; }
  .hero-icon { width: 68px; height: 68px; }
  .hero-icon svg,
  .hero-icon img { width: 68px; height: 68px; }
  .hero-title { font-size: 26px; }
  .hero-subtitle { font-size: 14px; }
  .btn.btn-hero { font-size: 14px; padding: 12px 22px; }

  .history-section-v2 { margin-top: 40px; }
  .history-title { font-size: 24px; }
  .history-grid-v2 {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
  .history-grid-v2 .history-card .meta b { font-size: 15px; }

  .home-footer {
    padding: 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .home-footer-left { gap: 14px; }
}

/* ============================================================
   SEO content block — длинный текст для поисковиков.
   Не должен забирать внимание у основного интерфейса:
     - на всю ширину контейнера (без max-width/auto-центровки)
     - без фона / рамки / тени — просто текст в потоке
     - тонкая линия сверху отделяет от истории/главного контента
     - мельче шрифты (h2 18px, p 13.5px) — это для поисковиков
     - бледный цвет основного текста (#6b7280) — секондэри
   ============================================================ */
.seo-section {
  margin-top: 120px;
  padding-top: 48px;
  padding-bottom: 16px;
  /* Тонкая разделительная линия сверху — чтобы юзер понимал что это
     второстепенная часть, не часть основного UI.
     Большой отступ 120px+48px=168px от main content — секция должна
     ощущаться как «отдельный SEO-блок далеко внизу», а не продолжение
     истории. */
  border-top: 1px solid #ece9e0;
}
.seo-article {
  max-width: 920px;            /* читабельная длина строки для длинного текста */
  /* НЕ центрируем — статья прижата к левому краю как остальные секции. */
}
.seo-article h2 {
  font-size: 18px;
  font-weight: 600;
  color: #4b5563;              /* секондэри-серый, не насыщенно-чёрный */
  margin: 22px 0 8px;
  letter-spacing: -0.005em;
}
.seo-article h2:first-child {
  margin-top: 4px;
}
.seo-article p {
  color: #6b7280;              /* бледно-серый */
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 10px;
}
.seo-article p strong, .seo-list strong {
  color: #4b5563;              /* акценты — тоже неяркие */
  font-weight: 600;
}
.seo-article p em {
  font-style: normal;
  color: #6366f1;
  font-weight: 500;
}
.seo-list {
  margin: 2px 0 14px;
  padding-left: 20px;
}
.seo-list li {
  color: #6b7280;
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 5px;
}
.seo-faq {
  border-bottom: 1px solid #ece9e0;
  margin: 0;
  padding: 0;
  background: transparent;
}
.seo-faq:first-of-type {
  border-top: 1px solid #ece9e0;
}
.seo-faq summary {
  cursor: pointer;
  padding: 10px 32px 10px 0;
  font-weight: 500;
  font-size: 13.5px;
  color: #4b5563;
  list-style: none;
  position: relative;
}
.seo-faq summary::-webkit-details-marker { display: none; }
.seo-faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 400;
  color: #9ca3af;
  transition: transform 0.15s;
  line-height: 1;
}
.seo-faq[open] summary::after {
  content: "−";
  color: #6b7280;
}
.seo-faq p {
  padding: 0 0 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}
.seo-faq a {
  color: #6366f1;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .seo-section {
    margin-top: 80px;
    padding-top: 32px;
  }
  .seo-article h2 { font-size: 16px; margin: 18px 0 6px; }
  .seo-article p,
  .seo-list li { font-size: 13px; }
  .seo-faq summary { font-size: 13px; padding: 10px 28px 10px 0; }
  .seo-faq p { font-size: 12.5px; }
}
