/* ─── Квиз: премиум-тёмная тема ─────────────────── */

:root {
    --q-bg: #070E1A;
    --q-card: linear-gradient(135deg, #0E1A2E 0%, #0A1423 100%);
    --q-card-hover: linear-gradient(135deg, #132440 0%, #0E1A2E 100%);
    --q-card-selected: linear-gradient(135deg, rgba(58,123,200,0.18) 0%, rgba(14,26,46,1) 60%);
    --q-border: rgba(127, 219, 255, 0.15);
    --q-border-hover: rgba(127, 219, 255, 0.45);
    --q-border-selected: rgba(127, 219, 255, 0.85);
    --q-accent: #3A7BC8;
    --q-accent-light: #7FDBFF;
    --q-text: #FAFCFF;
    --q-text-mut: #8FA3B8;
    --q-success: #22C97A;
    --q-warn: #F5A623;
    --q-danger: #E85D4C;
}

.quiz-wrap {
    min-height: calc(100vh - 80px);
    padding: 32px 0 48px;
    position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.quiz-wrap::before,
.quiz-wrap::after {
    content: ''; position: absolute; pointer-events: none;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: q-blob 20s ease-in-out infinite;
}
.quiz-wrap::before {
    width: 420px; height: 420px; top: -80px; left: -120px;
    background: radial-gradient(circle, #1a4a8c 0%, transparent 70%);
}
.quiz-wrap::after {
    width: 520px; height: 520px; bottom: -120px; right: -140px;
    background: radial-gradient(circle, #0d5a8a 0%, transparent 70%);
    animation-delay: -10s; animation-duration: 26s;
}
@keyframes q-blob {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(40px, -30px); }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-wrap::before, .quiz-wrap::after { animation: none; }
}

#quiz-root {
    width: 100%;
    max-width: 720px; margin: 0 auto; padding: 0 16px;
    position: relative; z-index: 1;
}

/* ─── Shell / переходы между шагами ───────────── */
.q-shell {
    opacity: 0; transform: translateY(12px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    gap: 32px;
}
.q-shell.is-in { opacity: 1; transform: translateY(0); }

/* ─── Шапка: кольцо + сегменты, всё по центру ───────────────── */
.q-head {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px; margin: 0;
}
.q-ring {
    position: relative; width: 52px; height: 52px; flex-shrink: 0;
}
.q-ring svg { width: 100%; height: 100%; display: block; }
.q-ring-num {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 17px; color: var(--q-accent-light);
}
.q-head-txt {
    width: 100%; max-width: 420px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.q-step-label {
    font-size: 11px; color: var(--q-text-mut);
    letter-spacing: 2px; text-transform: uppercase;
}
.q-segs { display: flex; gap: 6px; width: 100%; }
.q-seg {
    flex: 1; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.06);
    transition: background 0.3s, box-shadow 0.3s;
}
.q-seg.done { background: var(--q-success); }
.q-seg.current {
    background: linear-gradient(90deg, var(--q-accent-light) 0%, var(--q-accent) 100%);
    animation: q-seg-pulse 1.8s ease-in-out infinite;
}
@keyframes q-seg-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(127,219,255,0); }
    50%      { box-shadow: 0 0 10px rgba(127,219,255,0.6); }
}

/* ─── Тело: заголовок + варианты ─────────────── */
.q-body {
    margin: 0;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.q-title {
    font-size: 32px; font-weight: 600; line-height: 1.2;
    color: var(--q-text); margin: 0;
    letter-spacing: -0.5px; text-align: center;
    max-width: 600px;
}
.q-sub {
    font-size: 14px; color: var(--q-text-mut); font-weight: 400;
    margin: 0; text-align: center; max-width: 520px;
}

/* Симметричная сетка: распределение опций по количеству */
.q-options {
    display: grid; gap: 12px;
    width: 100%;
    margin-top: 8px;
}
/* 2 опции — 2 колонки на десктопе */
.q-options[data-count="2"] { grid-template-columns: 1fr 1fr; }
/* 3 опции — 3 колонки */
.q-options[data-count="3"] { grid-template-columns: 1fr 1fr 1fr; }
/* 4 опции — квадрат 2×2 */
.q-options[data-count="4"] { grid-template-columns: 1fr 1fr; }
/* 5 опций — 2+2+1 (последняя на всю ширину центрально, но ограничена) */
.q-options[data-count="5"] {
    grid-template-columns: 1fr 1fr;
}
.q-options[data-count="5"] > .q-opt:nth-child(5) {
    grid-column: 1 / -1;
    justify-self: center; max-width: calc(50% - 6px); width: 100%;
}
/* 6 опций — 3×2 (компактно) */
.q-options[data-count="6"] { grid-template-columns: 1fr 1fr 1fr; }
/* 7 опций — 3×2 + 1 центральная */
.q-options[data-count="7"] { grid-template-columns: 1fr 1fr 1fr; }
.q-options[data-count="7"] > .q-opt:nth-child(7) {
    grid-column: 1 / -1; justify-self: center;
    max-width: calc(33.333% - 8px); width: 100%;
}
/* 8 опций — 4×2 */
.q-options[data-count="8"] { grid-template-columns: 1fr 1fr 1fr 1fr; }

@media (max-width: 720px) {
    .q-options[data-count="3"],
    .q-options[data-count="6"],
    .q-options[data-count="7"],
    .q-options[data-count="8"] { grid-template-columns: 1fr 1fr; }
    .q-options[data-count="7"] > .q-opt:nth-child(7) { max-width: calc(50% - 6px); }
}
@media (max-width: 540px) {
    .q-options { grid-template-columns: 1fr !important; }
    .q-options > .q-opt { max-width: 100% !important; grid-column: auto !important; }
}

/* ─── Карточка ответа ──────────────────────── */
.q-opt {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    min-height: 84px; padding: 18px 20px;
    background: var(--q-card);
    border: 1px solid var(--q-border);
    border-radius: 14px;
    color: var(--q-text); font-family: inherit; font-size: 18px;
    text-align: left; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.18s ease-out, box-shadow 0.22s, border-color 0.2s, background 0.22s;
    overflow: hidden;
}
.q-opt::before {
    /* тонкая световая линия сверху */
    content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(127,219,255,0.45), transparent);
    opacity: 0; transition: opacity 0.22s;
}
.q-opt:hover {
    background: var(--q-card-hover);
    border-color: var(--q-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 24px rgba(58,123,200,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
}
.q-opt:hover::before { opacity: 1; }
.q-opt:active { transform: translateY(0); }
.q-opt.is-selected {
    background: var(--q-card-selected);
    border-color: var(--q-border-selected);
    box-shadow: 0 0 0 2px rgba(127,219,255,0.25), 0 8px 28px rgba(58,123,200,0.35), inset 0 1px 0 rgba(255,255,255,0.10);
}
.q-opt.is-selected::before { opacity: 1; }

.q-opt-ico {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 10px;
    background: rgba(127,219,255,0.06);
    border: 1px solid rgba(127,219,255,0.1);
    transition: background 0.22s, border-color 0.22s;
}
.q-opt-ico svg { width: 30px; height: 30px; display: block; }
.q-opt:hover .q-opt-ico, .q-opt.is-selected .q-opt-ico {
    background: rgba(127,219,255,0.12);
    border-color: rgba(127,219,255,0.3);
}

.q-opt-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.q-opt-label { font-size: 17px; font-weight: 500; color: var(--q-text); line-height: 1.3; }
.q-opt-sub { font-size: 13px; font-weight: 400; color: var(--q-text-mut); line-height: 1.3; }

.q-opt-check {
    width: 26px; height: 26px; flex-shrink: 0;
    border-radius: 50%;
    background: rgba(34,201,122,0.15);
    border: 1.5px solid rgba(34,201,122,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0.6);
    transition: opacity 0.22s, transform 0.22s cubic-bezier(0.4, 1.5, 0.6, 1);
}
.q-opt-check svg { width: 16px; height: 16px; }
.q-opt.is-selected .q-opt-check {
    opacity: 1; transform: scale(1);
    background: rgba(34,201,122,0.25);
    border-color: var(--q-success);
}

/* ─── Навигация ───────────────────────────── */
.q-nav {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: 12px; margin: 0;
}
.q-nav > .q-back  { justify-self: start; }
.q-nav > .q-time  { justify-self: center; }
.q-nav > .q-next  { justify-self: end; }
.q-back, .q-next {
    min-height: 46px; min-width: 130px; padding: 0 22px;
    border-radius: 10px; font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; border: 1px solid transparent; transition: all 0.18s;
}
.q-back {
    background: transparent; color: var(--q-text-mut);
    border-color: rgba(255,255,255,0.08);
}
.q-back:hover:not(:disabled) { color: var(--q-text); border-color: rgba(255,255,255,0.2); }
.q-back:disabled { opacity: 0.3; cursor: not-allowed; }
.q-next {
    background: rgba(58,123,200,0.15); color: var(--q-text-mut);
    border-color: rgba(58,123,200,0.3);
}
.q-next.is-ready {
    background: linear-gradient(135deg, var(--q-accent-light) 0%, var(--q-accent) 100%);
    color: #070E1A;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(58,123,200,0.35);
}
.q-next.is-ready:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(127,219,255,0.5); }
.q-next.is-shake { animation: q-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes q-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}
.q-time { font-size: 12px; color: var(--q-text-mut); }

/* Sticky nav на мобильном */
@media (max-width: 600px) {
    .q-title { font-size: 24px; }
    .q-sub { font-size: 13px; }
    .q-opt { min-height: 72px; padding: 14px 16px; font-size: 16px; }
    .q-opt-label { font-size: 15px; }
    .q-opt-sub { font-size: 12px; }
    .q-opt-ico { width: 40px; height: 40px; }
    .q-opt-ico svg { width: 26px; height: 26px; }
    .q-nav {
        position: sticky; bottom: 0;
        background: linear-gradient(180deg, transparent 0%, var(--q-bg) 40%);
        padding: 20px 0 12px; margin: 20px -16px 0;
        padding-left: 16px; padding-right: 16px;
    }
    .q-time { display: none; }
}

/* ─── Финальный экран ────────────────────── */
.q-result {
    padding: 20px 0 60px;
    display: flex; flex-direction: column; align-items: center; gap: 32px;
    width: 100%;
}
.q-scan {
    text-align: center; padding: 20px 0 10px;
    transition: opacity 0.4s, transform 0.4s;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.q-scan-status, .q-scan-sub { margin: 0; }
.q-scan-ring {
    position: relative; width: 280px; height: 280px; margin: 0 auto;
}
.q-scan-ring svg { width: 100%; height: 100%; display: block; }
.q-scan-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
}
.q-scan-num {
    font-size: 92px; font-weight: 700; line-height: 1;
    color: var(--q-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -3px;
}
.q-scan-pct {
    font-size: 14px; color: var(--q-text-mut);
    letter-spacing: 1px; text-transform: uppercase;
}
.q-scan-pulse, .q-scan-pulse-2 {
    position: absolute; inset: -10px; border-radius: 50%;
    border: 1.5px solid rgba(127,219,255,0.4);
    animation: q-scan-pulse 2.4s ease-out infinite;
    pointer-events: none;
}
.q-scan-pulse-2 { animation-delay: 1.2s; }
@keyframes q-scan-pulse {
    0%   { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.25); opacity: 0; }
}
.q-scan-status {
    font-size: 18px; color: var(--q-text); font-weight: 500;
    margin: 0 0 6px 0;
}
.q-scan-sub { font-size: 13px; margin: 0; }

@media (max-width: 600px) {
    .q-scan-ring { width: 240px; height: 240px; }
    .q-scan-num { font-size: 72px; letter-spacing: -2px; }
}

.q-verdict {
    opacity: 0; transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    width: 100%; max-width: 640px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.q-verdict.is-in { opacity: 1; transform: translateY(0); }
.q-verdict-label {
    display: inline-block; font-size: 12px; font-weight: 700;
    letter-spacing: 2px; text-transform: uppercase;
    padding: 6px 14px; border-radius: 99px; border: 1px solid;
    margin: 0;
}
.q-verdict-title {
    font-size: 26px; font-weight: 600; line-height: 1.35;
    color: var(--q-text); margin: 0; text-align: center;
    max-width: 580px;
}
@media (max-width: 600px) {
    .q-verdict-title { font-size: 20px; }
}

/* ─── Риск-карточки ───────────────────────── */
.q-risks { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 0; }
.q-risk {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px 18px;
    background: var(--q-card);
    border: 1px solid var(--q-border);
    border-left: 3px solid;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.q-risk-red    { border-left-color: var(--q-danger); }
.q-risk-yellow { border-left-color: var(--q-warn); }
.q-risk-green  { border-left-color: var(--q-success); }
.q-risk-dot {
    display: block; width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0; margin-top: 6px;
    box-shadow: 0 0 10px currentColor;
}
.q-risk-red .q-risk-dot    { background: var(--q-danger); color: var(--q-danger); }
.q-risk-yellow .q-risk-dot { background: var(--q-warn);   color: var(--q-warn); }
.q-risk-green .q-risk-dot  { background: var(--q-success); color: var(--q-success); }
.q-risk strong { display: block; font-size: 15px; font-weight: 600; color: var(--q-text); margin-bottom: 4px; }
.q-risk span { font-size: 13px; color: var(--q-text-mut); line-height: 1.45; }

/* ─── CTA с формой ──────────────────────── */
.q-cta {
    background: linear-gradient(135deg, rgba(58,123,200,0.12) 0%, rgba(14,26,46,0.9) 100%);
    border: 1px solid var(--q-border-hover);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(127,219,255,0.1);
    width: 100%;
    text-align: center;
}
.q-cta-list { text-align: left; max-width: 380px; margin-left: auto; margin-right: auto; }
.q-form { text-align: left; max-width: 460px; margin: 0 auto; }
.q-form-hint, .q-form-status { text-align: center; }
.q-cta h2 {
    font-size: 22px; font-weight: 600; line-height: 1.3;
    color: var(--q-text); margin: 0 0 16px 0; letter-spacing: -0.3px;
}
.q-cta-list {
    list-style: none; padding: 0; margin: 0 0 20px 0;
    display: grid; gap: 8px;
}
.q-cta-list li {
    font-size: 14px; color: var(--q-text); line-height: 1.45;
}

.q-form-row {
    display: flex; gap: 10px; margin-bottom: 12px;
}
.q-form-row input[type="tel"] {
    flex: 1; min-height: 52px; padding: 0 16px;
    background: rgba(7,14,26,0.6);
    border: 1.5px solid var(--q-border-hover);
    border-radius: 10px; color: var(--q-text); font: inherit; font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.q-form-row input[type="tel"]::placeholder { color: var(--q-text-mut); }
.q-form-row input[type="tel"]:focus {
    outline: none; border-color: var(--q-accent-light);
    box-shadow: 0 0 0 3px rgba(127,219,255,0.15);
}
.q-form-row .btn-primary {
    min-height: 52px; padding: 0 24px; font-size: 15px;
    background: linear-gradient(135deg, var(--q-accent-light) 0%, var(--q-accent) 100%);
    color: #070E1A; border: none; border-radius: 10px;
    font-weight: 600; cursor: pointer;
    box-shadow: 0 8px 24px rgba(58,123,200,0.4);
    transition: transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}
.q-form-row .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(127,219,255,0.55); }
.q-form-row .btn-primary:disabled { opacity: 0.6; cursor: wait; }
@media (max-width: 520px) {
    .q-form-row { flex-direction: column; }
}
.q-form-consent {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 12px; color: var(--q-text-mut); line-height: 1.4;
    margin-bottom: 8px;
}
.q-form-consent input { margin-top: 2px; accent-color: var(--q-accent-light); }
.q-form-consent a { color: var(--q-accent-light); }
.q-form-hint { font-size: 12px; margin: 0; }
.q-form-status { font-size: 13px; min-height: 20px; margin: 8px 0 0 0; }
.q-form-status.ok { color: var(--q-success); }
.q-form-status.err { color: var(--q-danger); }

.q-restart { text-align: center; margin-top: 28px; }
.q-restart .btn-link {
    background: none; border: none; font: inherit; font-size: 13px;
    color: var(--q-text-mut); cursor: pointer; padding: 8px 16px;
}
.q-restart .btn-link:hover { color: var(--q-accent-light); }

/* ─── Lead gate ──────────────────────────── */
.q-gate {
    opacity: 0; transform: translateY(16px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    width: 100%; max-width: 500px; margin: 0 auto;
    text-align: center;
    background: linear-gradient(135deg, rgba(58,123,200,0.1) 0%, rgba(14,26,46,0.95) 100%);
    border: 1px solid var(--q-border-hover);
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), inset 0 1px 0 rgba(127,219,255,0.1);
}
.q-gate.is-in { opacity: 1; transform: translateY(0); }
.q-gate-icon { font-size: 48px; margin-bottom: 16px; }
.q-gate-title { font-size: 26px; font-weight: 700; color: var(--q-text); margin: 0 0 10px; }
.q-gate-sub { font-size: 15px; color: var(--q-text-mut); line-height: 1.5; margin: 0 0 28px; }
.q-gate-name {
    width: 100%; min-height: 52px; padding: 0 16px;
    background: rgba(7,14,26,0.6);
    border: 1.5px solid var(--q-border-hover);
    border-radius: 10px; color: var(--q-text); font: inherit; font-size: 16px;
    margin-bottom: 10px; box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.q-gate-name::placeholder { color: var(--q-text-mut); }
.q-gate-name:focus { outline: none; border-color: var(--q-accent-light); box-shadow: 0 0 0 3px rgba(127,219,255,0.15); }

/* ─── Score ring (verdict phase) ─────────── */
.q-score-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.q-score-ring {
    position: relative; width: 220px; height: 220px;
}
.q-score-ring svg { width: 100%; height: 100%; display: block; }
.q-score-ring .q-scan-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
@media (max-width: 600px) { .q-score-ring { width: 180px; height: 180px; } }

/* ─── Plan технического обслуживания ───────────────────── */
.q-plan {
    background: linear-gradient(135deg, rgba(34,201,122,0.08) 0%, rgba(14,26,46,0.95) 100%);
    border: 1px solid rgba(34,201,122,0.25);
    border-radius: 16px; padding: 28px 24px; text-align: center; width: 100%;
}
.q-plan-icon { font-size: 40px; margin-bottom: 12px; }
.q-plan h2 { font-size: 20px; font-weight: 700; color: var(--q-text); margin: 0 0 10px; }
.q-plan p { font-size: 15px; color: var(--q-text-mut); margin: 0 0 12px; line-height: 1.5; }
.q-plan-wait { color: var(--q-text) !important; font-weight: 500; }
.btn-outline-tel {
    display: inline-block; min-height: 48px; padding: 0 24px; line-height: 48px;
    border: 1.5px solid var(--q-success); border-radius: 10px;
    color: var(--q-success); font-size: 15px; font-weight: 600;
    text-decoration: none; transition: background 0.18s, color 0.18s;
}
.btn-outline-tel:hover { background: var(--q-success); color: #070E1A; }

/* ─── Risk cards: staggered reveal ──────── */
@keyframes q-risk-in {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
.q-verdict.is-in .q-risk { animation: q-risk-in 0.4s ease-out both; }
