/* Квіз (js/quiz.js) — поверх сторінки. Розмиття тла немає навмисно: живий пісок під ним — дорого для слабких пристроїв. */
html.quiz-open { overflow: hidden; }
.quiz { padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
  width: min(660px, calc(100% - 32px)); max-width: none; max-height: none; margin: auto; }
.quiz::backdrop { background: rgba(14, 10, 8, .8); }
.quiz[open] .quiz-card { animation: quiz-in .34s cubic-bezier(.2, .8, .2, 1); }
@keyframes quiz-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.quiz-card { position: relative; margin-top: 130px; padding: 26px 32px 22px; border-radius: 28px;
  background: linear-gradient(180deg, #1D1612, #140F0C); border: 1px solid var(--line);
  box-shadow: 0 40px 80px #000c, inset 0 1px 0 #D9C4A61f; }
.quiz-scroll { max-height: calc(100dvh - 200px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #5C4334 transparent; padding-right: 4px; }
/* Золоті кутики-рамки, як на картках каруселей. */
.quiz-card::before, .quiz-card::after { content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none;
  border: 2px solid #D9C4A666; }
.quiz-card::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.quiz-card::after { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

/* Джуліо стоїть на верхньому краї картки (фізичний контакт — правило бренду), лише темна тінь під ногами. */
.quiz-julio { position: absolute; right: 40px; bottom: calc(100% - 2px); width: 150px; height: 150px; pointer-events: none; }
.quiz-julio img { position: absolute; right: 0; bottom: 0; height: 100%; width: auto; opacity: 0; transform: scale(.94);
  transform-origin: 50% 100%; transition: opacity .35s ease, transform .35s cubic-bezier(.3, 1.3, .5, 1); }
.quiz-julio img.on { opacity: 1; transform: none; }
.quiz-julio::after { content: ""; position: absolute; right: 18px; bottom: -6px; width: 90px; height: 12px; border-radius: 50%;
  background: radial-gradient(closest-side, #000b, transparent); }

.quiz-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; display: grid; place-items: center; z-index: 2;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; }
.quiz-x:hover { color: var(--text); background: #ffffff0d; }
.quiz-x svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

.quiz-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.quiz-head[hidden] { display: none; }
.quiz-kicker { font: 600 11px/1 var(--body); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); padding-bottom: 8px; }
.quiz-num { font: 800 56px/.9 var(--head); color: var(--title); text-shadow: var(--title-glow); }
.quiz-num span { font-size: 24px; color: var(--muted); text-shadow: none; }
.quiz-glass { width: 22px; height: 33px; margin: 0 0 4px 4px; }
.qg-frame { fill: none; stroke: var(--sand); stroke-width: 1.4; stroke-linecap: round; opacity: .85; }
.qg-sand { fill: var(--sand); transform-box: fill-box; transform-origin: 50% 100%; transition: transform .6s ease; }
.qg-top { transform: scaleY(calc(1 - var(--qp, 0))); }
.qg-bot { transform: scaleY(var(--qp, 0)); }
.qg-stream { fill: var(--skin); animation: qg-flow 1.2s ease-in-out infinite; }
@keyframes qg-flow { 50% { opacity: .25; } }
.quiz-card:not(.qg-live) .qg-stream { animation-play-state: paused; }   /* картки не видно — не рахуємо (js/quiz.js) */

.quiz h2 { font: 800 clamp(28px, 4vw, 38px)/1.04 var(--head); color: var(--title); margin: 0 48px 6px 0; }
.quiz h2:focus { outline: none; }
.quiz-result-title em { font-family: var(--accent); font-style: italic; font-weight: 600; color: #E9CDA6; text-shadow: 0 0 26px rgba(235, 200, 150, .65); }
.quiz h3 { margin: 18px 0 6px; font: 600 11px/1.2 var(--body); letter-spacing: .2em; text-transform: uppercase; color: var(--sand); }
.quiz p { color: var(--text-2); }
.quiz .quiz-hint { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.quiz .quiz-big { font-size: 18px; color: var(--text); margin: 8px 0 4px; }
.quiz .quiz-note { font-size: 12px; color: var(--muted); margin-top: 12px; }
.quiz-list { list-style: none; padding: 0; display: grid; gap: 6px; color: var(--text-2); }
.quiz-list li { position: relative; padding-left: 20px; }
.quiz-list li::before { content: "✦"; position: absolute; left: 0; color: var(--sand); }

.quiz-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 16px; }
.quiz-opts--wrap { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 6px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; text-align: left;
  border-radius: 16px; border: 1px solid var(--line); background: #211812; color: var(--text); font: 600 15px/1.3 var(--body);
  cursor: pointer; transition: border-color .2s ease, background-color .2s ease, transform .15s ease, box-shadow .2s ease; }
.opt:hover { border-color: #D9C4A688; }
.opt:active { transform: scale(.985); }
.opt[aria-pressed="true"] { border-color: var(--sand); background: #2B1F17; box-shadow: inset 0 0 0 1px var(--sand), 0 0 24px #D9C4A622; }
.opt:disabled { opacity: .42; cursor: default; }
.opt--chip { min-height: 48px; padding: 10px 14px; }
.opt-text small { display: block; margin-top: 2px; font: 500 12px/1.3 var(--body); color: var(--muted); }
.opt-check { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px;
  border: 1.5px solid #D9C4A666; transition: background-color .2s ease, border-color .2s ease; }
.opt-check svg { width: 14px; height: 14px; fill: none; stroke: var(--cta-text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .15s ease; }
.opt[aria-pressed="true"] .opt-check { background: var(--sand); border-color: var(--sand); }
.opt[aria-pressed="true"] .opt-check svg { opacity: 1; }

.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.quiz .btn-cta { padding: 16px 28px; font-size: 16px; }
.quiz .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.quiz .quiz-tease { margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.quiz-tease span { filter: blur(5px); color: var(--sand); font-weight: 700; user-select: none; }

/* «Аналізую…»: смужки з відблиском, що пробігає (лише transform). */
.quiz-skel { display: grid; gap: 10px; margin: 18px 0 6px; }
.quiz-skel i { position: relative; display: block; height: 14px; border-radius: 8px; background: #2A1F18; overflow: hidden; }
.quiz-skel i:nth-child(2) { width: 82%; }
.quiz-skel i:nth-child(4) { width: 64%; }
.quiz-skel i::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, #D9C4A633, transparent); animation: skel 1.1s ease-in-out infinite; }
@keyframes skel { to { transform: translateX(100%); } }

.quiz-form { margin-top: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--text-2); }
.field input, .field textarea { font: 500 16px/1.4 var(--body); color: var(--text); padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: #120D0A; resize: vertical; transition: border-color .2s ease, box-shadow .2s ease; }
.field input::placeholder, .field textarea::placeholder { color: #9E8C7999; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--sand); box-shadow: 0 0 0 3px #D9C4A633; }
.field [aria-invalid="true"] { border-color: var(--err); }
.field-err { display: block; font-size: 13px; color: var(--err); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--sand); flex: none; }
.check a { color: var(--sand); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 767px) {
  .quiz { width: 100%; height: 100dvh; margin: 0; }
  .quiz-card { margin-top: 100px; min-height: calc(100dvh - 100px); padding: 20px 16px 22px; border-radius: 24px 24px 0 0; }
  .quiz-scroll { max-height: calc(100dvh - 150px); }
  .quiz-julio { width: 104px; height: 104px; right: 20px; }
  .quiz-num { font-size: 46px; }
  .quiz-opts, .quiz-opts--wrap { grid-template-columns: 1fr; }
  .quiz-nav .btn { flex: 1 1 auto; }
}

/* ── Квіз прямо на сторінці (секція #quiz під першим екраном, Юра 13.10) ── */
.sec-quiz .quiz-intro { text-align: center; margin-bottom: 10px; }
.sec-quiz .quiz-intro h2 { margin: 0 auto 12px; max-width: 18ch; }
.sec-quiz .quiz-sub { max-width: 46ch; margin: 0 auto; color: var(--text-2); font-size: 17px; }
.quiz--inline { width: auto; height: auto; max-width: 680px; margin: 0 auto; }
.quiz--inline .quiz-card { margin-top: 128px; }
.quiz--inline .quiz-scroll { max-height: none; overflow: visible; padding-right: 0; }
.quiz--inline .quiz-x { display: none; }
/* Як у референсі: великий номер кроку по центру, питання по центру. */
.quiz--inline .quiz-head { justify-content: center; }
.quiz--inline .quiz-num { font-size: 72px; }
.quiz--inline h2 { max-width: none; margin-right: 0; text-align: center; }   /* .sec h2 обмежує 16ch — у картці не треба */
.quiz--inline .quiz-hint { text-align: center; }

@media (max-width: 767px) {
  .quiz--inline { width: auto; height: auto; margin: 0 auto; }
  .quiz--inline .quiz-card { margin-top: 100px; min-height: 0; padding: 20px 14px 18px; border-radius: 24px; }
  .quiz--inline .quiz-num { font-size: 58px; }
  /* Варіанти — плитками по два, як у референсі; великі зони дотику. */
  .quiz--inline .quiz-opts:not(.quiz-opts--wrap) { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quiz--inline .opt { min-height: 66px; padding: 10px 11px; gap: 9px; font-size: 14px; border-radius: 14px; }
  .quiz--inline .opt-check { width: 18px; height: 18px; border-radius: 6px; }
  .sec-quiz .quiz-sub { font-size: 16px; }
}

/* Перехід «пісок → квіз»: струмені починаються ще в низу першого екрана й тануть над дюнами (js/sand-fall.js). */
.sec-quiz { overflow: visible; }
.sand-fall { position: absolute; left: 0; right: 0; top: -170px; height: 540px; z-index: 0; pointer-events: none; overflow: hidden; opacity: var(--fall-op, .6);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 30%, #000 42%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 30%, #000 42%, transparent 100%); }
.sand-fall i { position: absolute; left: 0; right: 0; top: -256px; height: calc(100% + 256px); background-size: 256px 256px;
  opacity: 0; transition: opacity 1s ease; }
/* Струмені з'являються, лише коли пісок першого екрана вже ліг (js/sand-fall.js), — не сиплються над порожнім екраном завантаження. */
.sand-fall.lit i { opacity: 1; }
.sand-fall.on i { animation: sand-fall var(--fall-dur, 2.4s) linear infinite; }
@keyframes sand-fall { to { transform: translateY(256px); } }
@media (prefers-reduced-motion: reduce) { .sand-fall.on i { animation: none; } }
