/* BeautyV — модальное окно вопроса */
.bvq-modal {
  --bvq-bg: #fbf8f1;
  --bvq-surface: #fffdf8;
  --bvq-ink: #161b26;
  --bvq-muted: #6b7b7a;
  --bvq-line: rgba(22, 27, 38, .12);
  --bvq-field: #fff;
  --bvq-gold: #c6a24a;
  --bvq-gold-hi: #f5e5a3;
  --bvq-teal: #2f9e99;
  --bvq-danger: #a33;
  /* переменные, которые использует форма из /experts */
  --muted: var(--bvq-muted);
  --ink: var(--bvq-ink);
  --line: var(--bvq-line);
  --gold: var(--bvq-gold);
  --teal-d: var(--bvq-teal);
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility .35s ease;
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.bvq-modal.is-visible { visibility: visible; pointer-events: auto; }
.bvq-modal.is-open { opacity: 1; }
html.bvq-lock, html.bvq-lock body { overflow: hidden; }

.bvq-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 22, .58);
  opacity: 0;
  transition: opacity .35s ease;
}
.bvq-modal.is-open .bvq-modal__backdrop { opacity: 1; }

.bvq-modal__dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: min(92dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(198, 162, 74, .28);
  border-radius: 28px;
  background: var(--bvq-bg);
  color: var(--bvq-ink);
  box-shadow: 0 40px 100px -34px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .25) inset;
  opacity: 0;
  transform: translateY(26px) scale(.965);
  transition: opacity .35s ease, transform .5s cubic-bezier(.22, 1, .36, 1);
}
.bvq-modal.is-open .bvq-modal__dialog { opacity: 1; transform: none; }

.bvq-modal__top {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px 15px 22px;
  border-bottom: 1px solid var(--bvq-line);
  background: var(--bvq-bg);
}
.bvq-modal__brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.bvq-modal__brand img { width: 30px; height: 30px; object-fit: contain; flex: 0 0 30px; }
.bvq-modal__brand span {
  color: var(--bvq-ink);
  font-family: Montserrat, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bvq-modal__close {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--bvq-line);
  border-radius: 50%;
  background: var(--bvq-surface);
  color: var(--bvq-ink);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.bvq-modal__close:hover { background: var(--bvq-gold-hi); border-color: var(--bvq-gold); transform: rotate(90deg); }
.bvq-modal__close svg { width: 17px; height: 17px; }

.bvq-modal__content {
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 26px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 162, 74, .45) transparent;
}
.bvq-modal__content::-webkit-scrollbar { width: 6px; }
.bvq-modal__content::-webkit-scrollbar-thumb { background: rgba(198, 162, 74, .45); border-radius: 99px; }

/* Форма из /experts/ask.php */
.bvq-modal .a-form-card {
  max-width: none;
  margin: 0;
  padding: 22px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bvq-ink);
}
.bvq-modal .a-form-card .a-crumbs { display: none; }
.bvq-modal .a-form-card h1 {
  margin: 0 0 7px;
  color: var(--bvq-ink);
  font-family: Montserrat, sans-serif;
  font-size: clamp(25px, 4.2vw, 33px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.03em;
}
.bvq-modal .a-form-card .a-lead { margin: 0 0 20px; color: var(--bvq-muted); font-size: 12.5px; line-height: 1.6; }
.bvq-modal .a-field { margin-bottom: 13px; }
.bvq-modal .a-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--bvq-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.bvq-modal .a-field input,
.bvq-modal .a-field textarea,
.bvq-modal .a-field select {
  width: 100%;
  border: 1px solid var(--bvq-line);
  border-radius: 12px;
  background: var(--bvq-field);
  color: var(--bvq-ink);
  padding: 11px 13px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bvq-modal .a-field input:focus,
.bvq-modal .a-field textarea:focus,
.bvq-modal .a-field select:focus {
  border-color: var(--bvq-gold);
  box-shadow: 0 0 0 3px rgba(198, 162, 74, .18);
}
.bvq-modal .a-field textarea { min-height: 132px; resize: vertical; }
.bvq-modal .a-field small { display: block; margin-top: 5px; color: var(--bvq-muted); font-size: 9.5px; }
.bvq-modal .a-field--half { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bvq-modal .a-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0;
  color: var(--bvq-muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.bvq-modal .a-check input { width: auto; margin-top: 2px; accent-color: var(--bvq-gold); }
.bvq-modal .a-check a { color: var(--bvq-teal); font-weight: 600; }
.bvq-modal .a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 24px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.bvq-modal .a-btn--primary {
  width: 100%;
  margin-top: 4px;
  background: linear-gradient(135deg, #d4af37 0%, #f5e5a3 100%);
  color: #211a0d;
  box-shadow: 0 10px 28px -16px rgba(198, 162, 74, .8);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.bvq-modal .a-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 34px -18px rgba(198, 162, 74, .9); }
.bvq-modal .a-btn--primary:disabled { cursor: wait; opacity: .72; transform: none; }
.bvq-modal .a-btn--primary.is-loading { position: relative; color: transparent; }
.bvq-modal .a-btn--primary.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(33, 26, 13, .25);
  border-top-color: #211a0d;
  border-radius: 50%;
  animation: bvqSpin .7s linear infinite;
}
.bvq-modal .a-error-box {
  margin-bottom: 14px;
  border: 1px solid rgba(170, 51, 51, .25);
  border-radius: 12px;
  background: rgba(170, 51, 51, .08);
  color: var(--bvq-danger);
  padding: 11px 14px;
  font-size: 11.5px;
  line-height: 1.5;
}
.bvq-modal .a-error-box a { color: var(--bvq-danger); text-decoration: underline; }
.bvq-modal .a-notice { border-radius: 12px; font-size: 11.5px; }
.bvq-modal .a-honeypot { position: absolute; left: -9999px; }

/* Загрузка */
.bvq-loading { padding: 34px 0 26px; text-align: center; color: var(--bvq-muted); font-size: 11.5px; }
.bvq-loading__orb {
  width: 34px;
  height: 34px;
  margin: 0 auto 20px;
  border: 2px solid rgba(198, 162, 74, .22);
  border-top-color: var(--bvq-gold);
  border-radius: 50%;
  animation: bvqSpin .85s linear infinite;
}
.bvq-skeleton {
  height: 13px;
  margin: 10px auto;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(198, 162, 74, .1), rgba(198, 162, 74, .25), rgba(198, 162, 74, .1));
  background-size: 200% 100%;
  animation: bvqShimmer 1.25s linear infinite;
}
.bvq-skeleton--lg { width: 56%; height: 26px; margin-top: 0; }
.bvq-skeleton--sm { width: 78%; }
.bvq-skeleton--field { width: 100%; height: 42px; margin-top: 14px; border-radius: 12px; }

/* Успех */
.bvq-success { padding: 32px 4px 12px; text-align: center; animation: bvqFadeUp .5s cubic-bezier(.22, 1, .36, 1) both; }
.bvq-success__icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #8f7124;
  background: radial-gradient(circle at 35% 25%, #fffdf2, #f5e5a3 62%, #e6cf82);
  box-shadow: 0 0 0 8px rgba(198, 162, 74, .1), 0 18px 42px -22px rgba(198, 162, 74, .8);
  animation: bvqPop .55s cubic-bezier(.22, 1.4, .4, 1) both;
}
.bvq-success__icon svg { width: 52px; height: 52px; }
.bvq-success__icon path { stroke-dasharray: 52; stroke-dashoffset: 52; animation: bvqCheck .55s .22s cubic-bezier(.22, 1, .36, 1) forwards; }
.bvq-success__icon circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: bvqCheck .7s .1s ease forwards; }
.bvq-success__eyebrow { display: block; margin-bottom: 8px; color: var(--bvq-teal); font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.bvq-success h2 { margin: 0 0 9px; color: var(--bvq-ink); font-family: Montserrat, sans-serif; font-size: clamp(27px, 4vw, 34px); line-height: 1.05; letter-spacing: -.03em; }
.bvq-success p { max-width: 430px; margin: 0 auto; color: var(--bvq-muted); font-size: 12px; line-height: 1.65; }
.bvq-success__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 24px; }
.bvq-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 0; border-radius: 999px; padding: 10px 20px; font-family: inherit; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.bvq-btn--gold { background: linear-gradient(135deg, #d4af37 0%, #f5e5a3 100%); color: #211a0d; box-shadow: 0 10px 26px -16px rgba(198, 162, 74, .85); }
.bvq-btn--gold:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -16px rgba(198, 162, 74, .95); }
.bvq-btn--ghost { border: 1px solid var(--bvq-line); background: var(--bvq-surface); color: var(--bvq-ink); }
.bvq-btn--ghost:hover { border-color: var(--bvq-gold); }

/* Ошибка */
.bvq-error { padding: 34px 4px 14px; text-align: center; }
.bvq-error__icon { width: 56px; height: 56px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(170, 51, 51, .1); color: var(--bvq-danger); font-size: 26px; font-weight: 700; }
.bvq-error h2 { margin: 0 0 7px; font-family: Montserrat, sans-serif; font-size: 25px; color: var(--bvq-ink); }
.bvq-error p { margin: 0 auto; max-width: 420px; color: var(--bvq-muted); font-size: 12px; }

/* Ночная версия */
html[data-theme="dark"] .bvq-modal {
  --bvq-bg: #151b24;
  --bvq-surface: #1c2530;
  --bvq-ink: #f7f3ea;
  --bvq-muted: #a9b5b1;
  --bvq-line: rgba(247, 243, 234, .14);
  --bvq-field: #202a36;
  --bvq-gold: #d4af37;
  --bvq-gold-hi: #f1df9b;
  --bvq-teal: #7edbd5;
  --bvq-danger: #ff9d9d;
}
html[data-theme="dark"] .bvq-modal__dialog {
  border-color: rgba(212, 175, 55, .28);
  background: var(--bvq-bg);
  box-shadow: 0 40px 100px -34px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .04) inset;
}
html[data-theme="dark"] .bvq-modal__top { background: rgba(21, 27, 36, .88); }
html[data-theme="dark"] .bvq-modal .a-field input,
html[data-theme="dark"] .bvq-modal .a-field textarea,
html[data-theme="dark"] .bvq-modal .a-field select { color-scheme: dark; }
html[data-theme="dark"] .bvq-success__icon {
  color: #ffe9a8;
  background: radial-gradient(circle at 35% 25%, #3a301b, #d4af37 68%, #a5812b);
  box-shadow: 0 0 0 8px rgba(212, 175, 55, .12), 0 18px 42px -22px rgba(212, 175, 55, .65);
}

@keyframes bvqSpin { to { transform: rotate(360deg); } }
@keyframes bvqShimmer { to { background-position: -200% 0; } }
@keyframes bvqFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes bvqPop { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bvqCheck { to { stroke-dashoffset: 0; } }

@media (max-width: 640px) {
  .bvq-modal { padding: 10px; place-items: center; }
  .bvq-modal__dialog { width: 100%; max-height: 94dvh; border-radius: 24px 24px 18px 18px; }
  .bvq-modal__top { padding: 14px 14px 12px 16px; }
  .bvq-modal__brand span { font-size: 8.5px; letter-spacing: .12em; }
  .bvq-modal__content { padding: 0 16px 20px; }
  .bvq-modal .a-field--half { grid-template-columns: 1fr; }
  .bvq-modal .a-field textarea { min-height: 120px; }
  .bvq-success { padding-top: 22px; }
  .bvq-success__icon { width: 74px; height: 74px; margin-bottom: 18px; }
  .bvq-success__icon svg { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .bvq-modal, .bvq-modal__dialog, .bvq-modal__backdrop, .bvq-success, .bvq-success__icon,
  .bvq-success__icon path, .bvq-success__icon circle, .bvq-loading__orb, .bvq-skeleton {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

/* ===== Создание темы сообщества ===== */
.bvq-modal__dialog--wide {
  width: min(880px, 100%);
  height: min(90dvh, 920px);
  max-height: 92dvh;
}
.bvq-modal__content--frame {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.cmm-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #f6f9f8;
}
.cmm-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f6f9f8;
}
.cmm-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: #f6f9f8;
  color: #6b7b7a;
  font-size: 11px;
}
.cmm-loading span {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(198, 162, 74, .2);
  border-top-color: #c6a24a;
  border-radius: 50%;
  animation: bvqSpin .8s linear infinite;
}
.cmm-loading p { margin: 0; }
html[data-theme="dark"] .cmm-frame,
html[data-theme="dark"] .cmm-frame iframe,
html[data-theme="dark"] .cmm-loading { background: #111a1e; color: #a7b7b1; }
html[data-theme="dark"] body.c-page-new--embed { background: #111a1e; }
@media (max-width: 640px) {
  .bvq-modal__dialog--wide { width: 100%; height: 94dvh; }
}

/* Успех создания темы — компактная карточка */
.bvq-modal__dialog--wide.is-success {
  height: auto;
  max-height: 92dvh;
}
.bvq-modal__dialog--wide.is-success .bvq-modal__content--frame {
  display: block;
  flex: 0 1 auto;
  padding: 0 22px 14px;
}
.bvq-success__icon { color: #4a3510; }
