/* ================================================================
   «Разместить на FunPay» — кнопка на странице лота и модалка подтверждения (B-127 этап 5b)
   Цвета и скругления как у остального сайта (main.css): тёмная карточка, синяя кнопка FunPay, радиус 30 / 25.
   ================================================================ */

/* ── Кнопка на странице лота ───────────────────────────────── */
button.lot-header-prepare-btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  gap: 3px;
}
button.lot-header-prepare-btn .funpay-logo { display: block; }
html:not([data-tn-kbd]) :is(.lot-header-prepare-btn, .pp-btn, .pp-close, .pps-btn, .pps-x, .pps-pill, .btn-prepare, .qv-btn-prepare):focus { outline: none; }
html[data-tn-kbd] .lot-header-prepare-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* «Зарезервирован»: серая, не кнопка, но подсказка при наведении работает (поэтому без pointer-events: none) */
.lot-header-prepare-btn--reserved,
.lot-header-prepare-btn--reserved:hover {
  background: #323640;
  color: var(--text-muted, #9a9da3);
  cursor: not-allowed;
  white-space: nowrap;
  font-weight: 600;
}

/* ── Модалка ───────────────────────────────────────────────── */
.pp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;   /* выше быстрого просмотра (.qv-modal = 1000): модалка открывается и из него */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  overscroll-behavior: contain;   /* iOS: прокрутка за затемнением не тянет страницу */
  animation: pp-fade 0.18s ease-out;
}
.pp-dialog {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-card, #111518);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  border-radius: 30px;
  box-shadow: var(--shadow-lg, 0 8px 48px rgba(0, 0, 0, 0.7));
  color: var(--text, #e8eaf0);
  scrollbar-width: thin;
  will-change: transform, opacity;   /* слой готов заранее: на последнем кадре анимации текст не перерисовывается */
  animation: pp-rise 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.pp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 0 28px;
}
.pp-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.pp-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease), transform 0.12s ease;
}
.pp-close svg { width: 18px; height: 18px; }
.pp-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text, #e8eaf0); }

.pp-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 14px 28px 28px;
}
.pp-sec { display: flex; flex-direction: column; gap: 18px; }
.pp-sec[hidden], .pp-body [hidden] { display: none !important; }

.pp-intro {
  font-size: 15px;
  line-height: 1.5;
  color: #97aac6;
  color: #abb7ca;
}

/* Основной текст модалки: одна фраза под инфоплашкой, без заголовков и номеров */
.pp-lead { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text, #e8eaf0); }
/* Три спокойных пункта: мельче и приглушённее основного текста, слева круглая точка (не шаги, а просто примечания) */
.pp-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pp-note { position: relative; padding-left: 16px; font-size: 14px; line-height: 1.45; color: #5f6878; }
.pp-note::before { content: ''; position: absolute; left: 3px; top: 0.6em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.pp-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 17px;   /* одна строка текста: при 20px края выходили слишком круглыми */
  background: rgb(21 124 255 / 11%);
}
.pp-info__icon { flex-shrink: 0; display: inline-flex; width: 22px; height: 22px; color: rgb(95 165 255); }
.pp-info__icon svg { width: 100%; height: 100%; }
.pp-info__text { margin: 0; min-width: 0; }
.pp-pause {
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 18px;
  border-radius: 20px;
  background: rgb(21 124 255 / 11%);
  color: rgb(95 165 255);
  font-variant-numeric: tabular-nums;
}
.pp-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 1.4;
  padding: 12px 18px;
  border-radius: 20px;
}
.pp-msg__title { font-weight: 600; }
.pp-msg--info { background: rgb(21 124 255 / 11%); color: rgb(95 165 255); }
.pp-msg--bad { background: rgba(239, 68, 68, 0.1); color: #f27b7b; }

.pp-actions, .pp-fb-actions { display: flex; flex-direction: column; gap: 10px; }
/* Пояснение под основным текстом «Подготовки лота»: мельче и приглушённее, без точки-маркера */
.pp-note-plain { margin: 0; font-size: 14px; line-height: 1.45; color: #5f6878; }
.pp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 25px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease), opacity var(--transition, 0.2s ease), transform 0.12s ease;
}
.pp-btn--primary { background: rgba(0, 91, 255, 1); color: #f0f0f0; }
.pp-btn--primary:hover:not(:disabled) { background: rgb(34 113 255); }
.pp-btn--primary:disabled { background: #2a2e34; color: var(--text-muted, #6b7280); cursor: not-allowed; }
.pp-btn--ghost { background: #ffffff14; color: var(--text, #e8eaf0); }
.pp-btn--ghost:hover { background: #ffffff22; }
/* «Скопировать ссылку»: иконка слева, при копировании меняется на зелёную галочку (анимация .t-icon-swap из main.css) */
.pp-btn--copy { gap: 8px; }
.pp-copy-ico { width: 20px; height: 20px; flex-shrink: 0; color: currentColor; transition: color 0.18s ease; }
.pp-copy-ico .t-icon svg { width: 20px; height: 20px; display: block; }
.pp-btn--copy.is-copied .pp-copy-ico { color: #4ade80; }

/* «Продавливание» при нажатии: кнопки целиком (фон и текст) чуть уменьшаются, пока зажаты */
.pp-btn:active:not(:disabled):not([aria-disabled='true']) { transform: scale(0.98); }
.pp-close:active { transform: scale(0.88); }
@media (prefers-reduced-motion: reduce) {
  .pp-btn, .pp-close { transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease); }
  .pp-btn:active, .pp-close:active { transform: none; }
}
html[data-tn-kbd] .pp-btn:focus-visible, html[data-tn-kbd] .pp-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@keyframes pp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pp-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }   /* без scale: на последнем кадре текст не перерисовывается и не «подпрыгивает» */

/* ПК: стеклянная модалка (на телефоне шторка остаётся сплошной) */
@media (min-width: 561px) {
  .pp-dialog {
    background: #111518d6;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

/* Телефон: окно прижато к низу, как «шторка» */
@media (max-width: 560px) {
  .pp-overlay { align-items: flex-end; padding: 0; }
  .pp-dialog {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;   /* iOS Safari: vh считается вместе с панелью браузера, шторка уезжала под неё */
    border-radius: 28px 28px 0 0;
    border-bottom: 0;
    animation-name: pp-sheet;
  }
  .pp-head { padding: 22px 14px 0 22px; }
  .pp-close { width: 44px; height: 44px; }   /* минимальная цель нажатия на телефоне */
  .pp-title { font-size: 21px; }
  .pp-body { padding: 12px 22px calc(22px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes pp-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .pp-overlay, .pp-dialog { animation: none; }
}

/* ================================================================
   Окно статуса заявки (5c): плавающая карточка справа снизу, на телефоне шторка
   ================================================================ */
.pps {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1050;   /* выше быстрого просмотра, ниже модалки */
  width: 386px;
  background: var(--bg-card, #111518);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  border-radius: 26px;
  box-shadow: var(--shadow-lg, 0 8px 48px rgba(0, 0, 0, 0.7));
  color: var(--text, #e8eaf0);
  animation: pp-rise 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.pps[hidden], .pps [hidden] { display: none !important; }
.pps-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 0 20px; }
.pps-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: #6ea2ff; }
.pps--wait .pps-dot { animation: pps-pulse 1.4s ease-in-out infinite; }
.pps--ok .pps-dot { background: var(--success, #22c55e); }
.pps--bad .pps-dot { background: var(--danger, #ef4444); }
.pps--info .pps-dot { background: var(--text-muted, #6b7280); }
.pps-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; line-height: 10px; }
.pps-x {
  flex-shrink: 0; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted, #6b7280); cursor: pointer;
}
.pps-x { transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease), transform 0.12s ease; }
.pps-x svg { width: 18px; height: 18px; }
.pps-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text, #e8eaf0); }
.pps-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 20px 20px; }
.pps-text { font-size: 14px; line-height: 1.5; color: var(--text-dim, #9ca3af); }
.pps-timer {
  align-self: flex-start; padding: 6px 14px; border-radius: 16px; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; background: rgb(21 124 255 / 11%); color: rgb(95 165 255);
}
.pps--ok .pps-timer { background: rgba(34, 197, 94, 0.1); color: var(--success, #22c55e); }
.pps-actions { display: flex; flex-direction: column; gap: 8px; }
.pps-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
  border: 0; border-radius: 22px; font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background var(--transition, 0.2s ease), opacity var(--transition, 0.2s ease), transform 0.12s ease;
}
.pps-btn--primary { background: rgba(0, 91, 255, 1); color: #f0f0f0; }
.pps-btn--primary:hover { background: rgb(34 113 255); }
.pps-btn--ghost { background: #ffffff14; color: var(--text, #e8eaf0); }
.pps-btn--ghost:hover { background: #ffffff22; }
.pps-btn--danger { background: rgba(239, 68, 68, 0.9); color: #fff; }
.pps-btn--danger:hover { background: #ef4444; }
.pps-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pps-btn:active:not(:disabled) { transform: scale(0.98); }
.pps-x:active { transform: scale(0.88); }
html[data-tn-kbd] .pps-btn:focus-visible, html[data-tn-kbd] .pps-x:focus-visible, html[data-tn-kbd] .pps-pill:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.pps-sure { display: flex; flex-direction: column; gap: 8px; }
.pps-sure__t { font-size: 14px; color: var(--text-dim, #9ca3af); }

/* Свёрнутое окно: одна плашка */
.pps--min { width: auto; max-width: calc(100vw - 32px); border-radius: 24px; }
.pps-pill {
  display: block; width: 100%; padding: 12px 20px; border: 0; border-radius: 24px; background: transparent;
  color: var(--text, #e8eaf0); font-family: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pps:not(.pps--min) .pps-pill { display: none; }

/* ── Живое ожидание: блик по тексту, ход по этапам, цифры ──────────────────────────────── */
/* Блик (shimmer): светлая полоса скользит по тексту при ожидании в очереди и при отмене заявки (заголовок и другие окна без блика).
   Два слоя фона: снизу сплошной цвет текста (он есть всегда, текст не может исчезнуть), сверху движущаяся полоса света. */
.pps--shimmer .pps-text {
  --sh-base: var(--text-dim, #9ca3af);
  --sh-hi: #ffffff;
  color: transparent;
  background-image: linear-gradient(100deg, transparent 38%, var(--sh-hi) 50%, transparent 62%), linear-gradient(var(--sh-base), var(--sh-base));
  background-size: 260% 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: 100% 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  animation: pps-shimmer 2.8s ease-in-out infinite;
}
/* 100% → 0%: полоса проходит слева направо; вторая половина цикла — пауза, чтобы блик не мельтешил */
@keyframes pps-shimmer { 0% { background-position: 100% 0, 0 0; } 65%, 100% { background-position: 0% 0, 0 0; } }

/* Три точки в конце текста очереди: идёт процесс. Точки появляются по одной (0 → 1 → 2 → 3) и гаснут, ширина места под них постоянная, текст не прыгает.
   Собственный цвет у точек, а не прозрачный как у текста с бликом: так они видны в любом браузере (в том числе iOS Safari). */
.pps--dots .pps-text::after {
  content: '...';
  display: inline-block;
  margin-left: 1px;
  color: var(--sh-base, var(--text-dim, #9ca3af));
  -webkit-text-fill-color: currentColor;
  clip-path: inset(0 100% 0 0);
  animation: pps-dots 1.8s steps(1, end) infinite;
}
@keyframes pps-dots {
  0%   { clip-path: inset(0 100% 0 0); }
  20%  { clip-path: inset(0 66% 0 0); }
  40%  { clip-path: inset(0 33% 0 0); }
  60%  { clip-path: inset(0 0 0 0); }
  90%  { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 100% 0 0); }
}

/* Этапы: три отрезка, пройденный залит, текущий дышит */
.pps-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 2px; }
.pps-track.pps-track--2 { grid-template-columns: repeat(2, 1fr); }   /* очереди не было: только «Размещение» и «Готово» */
.pps-seg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pps-seg__bar { position: relative; display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.pps-seg__t { font-size: 12px; line-height: 1.2; color: #5f6878; transition: color 0.3s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pps-seg.is-done .pps-seg__bar { background: #2f80ed; }
.pps-seg.is-done .pps-seg__t { color: var(--text-dim, #9ca3af); }
.pps-seg.is-on .pps-seg__t { color: var(--text, #e8eaf0); }
.pps-seg.is-on .pps-seg__bar { background: rgba(47, 128, 237, 0.28); }
.pps-seg.is-on .pps-seg__bar::after {   /* бегущий отрезок: идёт работа, ждать не зря */
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; border-radius: 4px; background: #2f80ed;
  animation: pps-run 1.5s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}
.pps--ok .pps-seg.is-done .pps-seg__bar { background: var(--success, #22c55e); }
@keyframes pps-run { from { transform: translateX(-100%); } to { transform: translateX(230%); } }

/* Цифры: позиция, прошло, осталось. Одной строкой, цифры одной ширины, чтобы не дрожали каждую секунду */
.pps-stats { display: flex; gap: 22px; margin: 0; padding: 2px 0 0; }
.pps-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pps-stat__k { margin: 0; font-size: 12px; line-height: 1.2; color: #5f6878; }
.pps-stat__v { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; color: var(--text, #e8eaf0); font-variant-numeric: tabular-nums; }
.pps-stat--eta .pps-stat__v { font-size: 15px; line-height: 24px; font-weight: 600; color: var(--text-dim, #9ca3af); }

@media (max-width: 560px) { .pps-stats { gap: 18px; } }
@media (prefers-reduced-motion: reduce) {
  .pps--shimmer .pps-text { animation: none; color: var(--sh-base); background: none; -webkit-background-clip: border-box; background-clip: border-box; }
  .pps--dots .pps-text::after { animation: none; clip-path: none; }   /* без анимации точки просто стоят */
  .pps-seg.is-on .pps-seg__bar::after { animation: none; width: 100%; opacity: 0.6; }
}

@keyframes pps-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (max-width: 560px) {
  .pps { right: 0; left: 0; bottom: 0; width: 100%; max-height: 80vh; max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 26px 26px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .pps-btn { height: 48px; border-radius: 24px; }
  .pps--min { left: 16px; right: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: auto; border-radius: 24px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.07)); padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .pps, .pps--wait .pps-dot { animation: none; } .pps-btn:active, .pps-x:active { transform: none; } }

/* ================================================================
   B-127 этап 5d: кнопки на карточках, в быстром просмотре, «В резерве», мини-карточки
   ================================================================ */

/* ── Карточка: круглая кнопка в оверлее (рядом с «глазом» и «Купить») ── */
.lot-card-overlay .card-action-btn.btn-prepare svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #aaaaaa;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
  transition: stroke 0.18s ease;
}
.lot-card-overlay .card-action-btn.btn-prepare:hover svg { fill: none; stroke: #ffffff; }
html[data-tn-kbd] .card-action-btn.btn-prepare:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
/* «В резерве»: не кнопка, но подсказка (title) работает */
.lot-card-overlay .card-action-btn.btn-prepare--reserved,
.lot-card-overlay .card-action-btn.btn-prepare--reserved:hover { background: #000000c2; cursor: not-allowed; }
.lot-card-overlay .card-action-btn.btn-prepare--reserved svg,
.lot-card-overlay .card-action-btn.btn-prepare--reserved:hover svg { stroke: #6f7379; }
/* Как и «Купить на FunPay»: на тач-экранах в оверлее не показываем, покупатель открывает страницу лота (5e: сверить на телефоне) */
@media (hover: none) {
  .lot-card-overlay-center .btn-prepare { display: none; }
}

/* ── Капсула «В резерве» на фото карточки ── */
.lot-card-reserved-capsule {
  background: #3a3d42;
  color: #c3c6cc;
  padding: 5px 10px;
  cursor: help;
  font-weight: 600;
}

/* ── Быстрый просмотр: широкая кнопка как «Купить на FunPay» ── */
button.qv-btn-prepare { font-family: inherit; cursor: pointer; white-space: nowrap; }
html[data-tn-kbd] .qv-btn-prepare:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
.qv-btn-prepare--reserved,
.qv-btn-prepare--reserved:hover,
.qv-btn-prepare--reserved:focus {
  background: #3a3d42;
  color: #9a9da3;
  cursor: not-allowed;
  font-weight: 600;
}

/* ── Мини-карточки «Похожие» и шторка продавца ── */
.cs-mini-card__reserved-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #c3c6cc;
  background: #3a3d42;
  border-radius: 20px;
  padding: 2px 8px 3px;
}

/* ================================================================
   Нажатие кнопок «Разместить / Открыть / Перейти на FunPay»: scale(0.98) всей кнопкой.
   Серые «Продан» и «Зарезервирован» не кликабельны и не затронуты.
   ================================================================ */
.lot-header-funpay-btn:not(.lot-header-funpay-btn--sold):not(.lot-header-prepare-btn--reserved) {
  transition: background var(--transition), border-color var(--transition), transform 0.12s ease;
}
.lot-header-funpay-btn:not(.lot-header-funpay-btn--sold):not(.lot-header-prepare-btn--reserved):active,
.qv-btn-buy:not(.qv-btn-prepare--reserved):active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) {
  .lot-header-funpay-btn:active, .qv-btn-buy:active { transform: none !important; }
}
