/* ARTVILL квиз */
:root { --avl-accent: #ffc673; }
.avl-quiz, .avl-form, .avl-modal { --avl-text: #2b2b2b; --avl-muted: #8a8a8a; --avl-line: #e6e6e6; --avl-soft: #f5f5f5; font-family: inherit; color: var(--avl-text); box-sizing: border-box; }
.avl-quiz *, .avl-form *, .avl-modal * { box-sizing: border-box; }
.avl-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* кнопки */
.avl-btn { appearance: none; border: 1px solid var(--avl-line); background: #fff; color: var(--avl-text); border-radius: 6px; padding: 14px 26px; font: inherit; font-size: 17px; line-height: 1.2; cursor: pointer; transition: background .15s, box-shadow .15s, opacity .15s; }
.avl-btn:disabled { opacity: .5; cursor: default; }
.avl-btn--primary { background: var(--avl-accent); border-color: var(--avl-accent); color: #2b2b2b; box-shadow: 0 8px 22px -10px var(--avl-accent); }
.avl-btn--primary:not(:disabled):hover { filter: brightness(1.04); box-shadow: 0 10px 26px -8px var(--avl-accent); }
.avl-btn--ghost { padding: 14px 18px; }
.avl-btn--wide { width: 100%; }
.avl-btn.is-loading { opacity: .7; pointer-events: none; }

/* макет */
.avl-quiz { display: flex; background: #fff; min-height: 560px; position: relative; text-align: left; }
.avl-quiz__main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.avl-quiz__header { padding: 22px 36px; border-bottom: 1px solid var(--avl-line); color: #555; font-size: 15px; }
.avl-quiz__house { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 12px; background: #fff6e6; border: 1px solid var(--avl-accent); font-weight: 500; font-size: 13px; color: var(--avl-text); }
.avl-quiz__body { flex: 1 1 auto; padding: 26px 36px 10px; overflow: auto; }
.avl-quiz__title { font-size: 30px; line-height: 1.2; font-weight: 500; margin: 0 0 18px; color: var(--avl-text); }
.avl-quiz__hint { display: inline-block; margin: -6px 0 18px; padding: 4px 10px; font-size: 13px; background: #fff6e6; border: 1px solid var(--avl-accent); border-radius: 4px; }
.avl-quiz__hint::before { content: "✓"; display: inline-block; width: 16px; height: 16px; margin-right: 6px; border-radius: 50%; background: var(--avl-accent); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.avl-quiz__footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 36px 26px; }
.avl-quiz__stepno { font-size: 14px; color: #555; margin-bottom: 8px; }
.avl-quiz__bar { width: 140px; height: 5px; border-radius: 3px; background: var(--avl-soft); overflow: hidden; }
.avl-quiz__bar span { display: block; height: 100%; background: var(--avl-accent); transition: width .3s; }
.avl-quiz__buttons { display: flex; gap: 12px; }

/* боковая панель */
.avl-quiz__side { flex: 0 0 260px; background: var(--avl-soft); padding: 28px 22px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.avl-quiz__manager { display: flex; gap: 12px; align-items: center; }
.avl-quiz__avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.avl-quiz__mname { font-weight: 500; }
.avl-quiz__mrole { color: var(--avl-muted); font-size: 14px; }
.avl-quiz__bubble { background: #ececec; border-radius: 12px; padding: 16px 18px; font-size: 15px; line-height: 1.45; position: relative; }
.avl-quiz__bubble::before { content: ""; position: absolute; top: -8px; left: 24px; border: 8px solid transparent; border-top: 0; border-bottom-color: #ececec; }

/* карточки */
.avl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.avl-card { appearance: none; padding: 0; background: #fff; border: 1px solid var(--avl-line); border-radius: 6px; overflow: hidden; text-align: left; cursor: pointer; font: inherit; color: inherit; position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
.avl-card:hover { box-shadow: 0 8px 24px -14px rgba(0,0,0,.35); transform: translateY(-1px); }
.avl-card.is-active { border-color: var(--avl-accent); box-shadow: 0 0 0 2px var(--avl-accent); }
.avl-card.is-active::after { content: ""; position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--avl-accent); border: 5px solid #fff; box-shadow: 0 0 0 2px var(--avl-accent); }
.avl-card__img { display: block; aspect-ratio: 16 / 10; background: #eee; }
.avl-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avl-card__img.is-empty { background: #eee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' fill='%23c8c8c8' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18v14H3zM5 17h14l-4.5-6-3.5 4.5-2.5-3z'/%3E%3C/svg%3E") center no-repeat; }
.avl-card__label { display: flex; flex-direction: column; gap: 2px; padding: 14px 14px 16px; }
.avl-card__label b { font-weight: 500; font-size: 16px; }
.avl-card__label small { color: var(--avl-muted); font-size: 13px; }

/* варианты */
.avl-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.avl-choice { appearance: none; display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 14px 20px; background: #fff; border: 1px solid var(--avl-line); border-radius: 6px; text-align: left; font: inherit; font-size: 17px; color: inherit; cursor: pointer; transition: border-color .15s; }
.avl-choice:hover { border-color: #cfcfcf; }
.avl-choice.is-active { border-color: var(--avl-accent); }
.avl-choice__mark { flex: 0 0 22px; height: 22px; border-radius: 50%; background: #e8e8e8; position: relative; }
.avl-choice.is-multi .avl-choice__mark { border-radius: 4px; }
.avl-choice.is-active .avl-choice__mark { background: var(--avl-accent); }
.avl-choice.is-active .avl-choice__mark::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 14px; line-height: 22px; text-align: center; }

/* ползунок */
.avl-range { max-width: 980px; }
.avl-range__top { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.avl-range__num { width: 200px !important; }
.avl-range__unit { color: var(--avl-muted); }
.avl-range__slider { -webkit-appearance: none; appearance: none; width: 100%; height: 60px; border-radius: 30px; background: linear-gradient(90deg, var(--avl-accent) var(--p, 0%), var(--avl-soft) var(--p, 0%)); outline: none; margin: 0; }
.avl-range__slider::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 36px; border-radius: 4px; background: rgba(255,255,255,.85); cursor: pointer; }
.avl-range__slider::-moz-range-thumb { width: 8px; height: 36px; border: 0; border-radius: 4px; background: rgba(255,255,255,.85); cursor: pointer; }
.avl-range__scale { display: flex; justify-content: space-between; color: #555; margin-top: 8px; }

/* поля */
.avl-input { display: block; width: 100%; padding: 16px 18px; font: inherit; font-size: 17px; border: 1px solid var(--avl-line); border-radius: 6px; background: #fff; color: var(--avl-text); outline: none; transition: border-color .15s; }
.avl-input:focus { border-color: var(--avl-accent); }
.avl-label { display: block; margin: 16px 0 8px; font-size: 17px; color: #444; }
.avl-consent { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; font-size: 13px; line-height: 1.4; color: #555; cursor: pointer; }
.avl-consent input { margin-top: 2px; accent-color: var(--avl-accent); width: 16px; height: 16px; flex: 0 0 16px; }
.avl-consent a { color: #d99a2b; }
.avl-form__msg { margin-top: 10px; font-size: 14px; color: #c0392b; min-height: 1em; }
.avl-form__msg.is-ok { color: #2e7d32; }
.avl-captcha:not(:empty) { margin: 14px 0 0; }

/* финал */
.avl-quiz.is-final .avl-quiz__side { display: none; }
.avl-final { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 44px; align-items: center; min-height: 100%; padding: 10px 0 20px; }
.avl-final__text { color: #555; font-size: 17px; line-height: 1.5; margin: 0 0 18px; }
.avl-final__label { font-size: 14px; color: var(--avl-muted); margin: 6px 0 10px; }
.avl-final__matches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.avl-mini { display: block; border: 1px solid var(--avl-line); border-radius: 6px; overflow: hidden; color: inherit; text-decoration: none; background: #fff; }
.avl-mini__img { display: block; aspect-ratio: 4 / 3; background: #eee; }
.avl-mini__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avl-mini__t { display: block; padding: 8px 10px; font-size: 13px; line-height: 1.3; }
.avl-final__form .avl-btn { margin-top: 18px; }
.avl-final__back { margin-top: 10px; border: 0; padding: 8px 0; color: var(--avl-muted); background: none; font-size: 15px; }
.avl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.avl-chips__label { width: 100%; font-size: 14px; color: #555; }
.avl-chip { appearance: none; padding: 9px 14px; border-radius: 20px; border: 1px solid var(--avl-line); background: var(--avl-soft); font: inherit; font-size: 14px; cursor: pointer; color: inherit; }
.avl-chip.is-active { background: var(--avl-accent); border-color: var(--avl-accent); }

.avl-thanks { max-width: 680px; margin: 30px auto; text-align: center; }
.avl-thanks__icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; background: var(--avl-accent); color: #fff; font-size: 34px; line-height: 64px; }
.avl-thanks p { color: #555; font-size: 17px; }
.avl-thanks .avl-final__matches { text-align: left; margin-top: 10px; }

/* окно */
html.avl-lock, html.avl-lock body { overflow: hidden !important; }
.avl-modal { position: fixed; inset: 0; z-index: 2147483000; background: rgba(20,20,20,.62); display: flex; align-items: center; justify-content: center; padding: 20px; animation: avlFade .2s ease; }
.avl-modal__frame { position: relative; width: min(1120px, 100%); height: min(690px, 100%); }
.avl-modal__win { width: 100%; height: 100%; border-radius: 4px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.avl-modal__win .avl-quiz__main { overflow: hidden; }
.avl-modal__close { position: absolute; top: -14px; right: -14px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; color: #333; font-size: 24px; line-height: 36px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
@keyframes avlFade { from { opacity: 0; } to { opacity: 1; } }

.avl-quiz-inline .avl-quiz, .avl-quiz-inline.avl-quiz { border: 1px solid var(--avl-line); border-radius: 8px; overflow: hidden; }

/* кнопка квиза в плавающих кнопках связи */
.avl-float { position: relative; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: #e0952b; box-shadow: 0 10px 30px rgba(0,0,0,.12); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.avl-float:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.16); }
.avl-float::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--avl-accent); opacity: 0; animation: avlPulse 2.4s ease-out infinite; pointer-events: none; }
.avl-float__badge { position: absolute; top: -6px; right: -8px; padding: 1px 6px; border-radius: 8px; background: #2b2b2b; color: #fff; font-size: 10px; line-height: 16px; font-family: system-ui, sans-serif; }
.avl-float-col { position: fixed; right: 18px; bottom: 18px; z-index: 1050; display: flex; flex-direction: column; gap: 12px; }
@keyframes avlPulse { 0% { opacity: .7; transform: scale(.92); } 70% { opacity: 0; transform: scale(1.18); } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .avl-float::after { animation: none; } }

/* простая форма */
.avl-form { display: grid; gap: 12px; max-width: 460px; }
.avl-form__title { font-size: 22px; font-weight: 500; }
.avl-form__text { color: #555; }

/* кнопки темы, открывающие квиз: крупная надпись сверху, пояснение под ней */
.avl-cta-stack { display: inline-flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; gap: 2px; text-align: center; line-height: 1.2 !important; }
.avl-cta-stack .avl-cta__main { display: inline-flex; align-items: center; gap: 8px; font-size: 1.08em; font-weight: 600; }
.avl-cta-stack .avl-cta__main i, .avl-cta-stack .avl-cta__main .bi { margin: 0 !important; }
.avl-cta-stack small { display: block !important; margin: 0 !important; font-size: .8em; font-weight: 400; opacity: .8; }

@media (max-width: 900px) {
  .avl-quiz__side { display: none; }
  .avl-final { grid-template-columns: 1fr; gap: 18px; align-items: start; }
}
@media (max-width: 640px) {
  .avl-modal { padding: 0; }
  .avl-modal__frame { width: 100%; height: 100%; height: 100dvh; }
  .avl-modal__win { border-radius: 0; }
  .avl-modal__close { top: 8px; right: 8px; width: 34px; height: 34px; line-height: 34px; font-size: 22px; box-shadow: none; background: var(--avl-soft); }
  .avl-quiz { min-height: 0; }
  .avl-quiz__header { padding: 13px 52px 12px 16px; font-size: 13px; line-height: 1.35; }
  .avl-quiz__house { margin: 4px 0 0; }
  .avl-quiz__body { padding: 14px 16px 6px; }
  .avl-quiz__title { font-size: 21px; margin-bottom: 14px; }
  .avl-quiz__hint { margin: -4px 0 12px; }
  .avl-quiz__footer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--avl-line); }
  /* карточки: три в ряд, чтобы все варианты помещались без прокрутки */
  .avl-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .avl-card { border-radius: 8px; }
  .avl-card__img { aspect-ratio: 4 / 3; }
  .avl-card__label { padding: 6px 8px 8px; gap: 1px; }
  .avl-card__label b { font-size: 14px; line-height: 1.2; }
  .avl-card__label small { font-size: 11px; line-height: 1.25; }
  .avl-card.is-active::after { top: 5px; right: 5px; width: 18px; height: 18px; border-width: 3px; }
  .avl-choices { grid-template-columns: 1fr; gap: 8px; }
  .avl-choice { min-height: 50px; padding: 10px 14px; font-size: 16px; }
  .avl-btn { font-size: 16px; padding: 13px 18px; }
  .avl-quiz__bar { width: 90px; }

  /* финал: всё на одном экране */
  .avl-final { gap: 12px; padding: 0 0 8px; min-height: 0; align-content: start; }
  .avl-final .avl-quiz__title { font-size: 19px; margin-bottom: 6px; }
  .avl-final__text { font-size: 14px; line-height: 1.4; margin: 0 0 10px; }
  .avl-final__label { font-size: 12px; margin: 0 0 6px; }
  .avl-final__matches { gap: 6px; }
  .avl-mini__img { aspect-ratio: 16 / 10; }
  .avl-mini__t { padding: 4px 6px 5px; font-size: 11px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .avl-final .avl-label { display: none; }
  .avl-final .avl-input { padding: 13px 14px; margin-top: 8px; font-size: 16px; }
  .avl-chips { flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin-top: 10px; scrollbar-width: none; }
  .avl-chips::-webkit-scrollbar { display: none; }
  .avl-chips__label { display: none; }
  .avl-chip { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }
  .avl-final__form .avl-btn { margin-top: 12px; }
  .avl-consent { margin-top: 10px; font-size: 12px; }
  .avl-final__back { margin-top: 4px; padding: 6px 0; font-size: 14px; }
  .avl-thanks { margin: 10px auto; }
}
@media (max-width: 340px) {
  .avl-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) and (max-height: 720px) {
  .avl-final__text, .avl-final__label { display: none; }
}
