@property --q-c1 { syntax: '<color>'; initial-value: #00f6dd; inherits: false; }
@property --q-c2 { syntax: '<color>'; initial-value: #025f99; inherits: false; }

/* Основа модалки */
.quiz-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100000;
    font-family: 'Segoe UI', Roboto, sans-serif;
}
.quiz-overlay { background: rgba(0,0,0,0.85); width: 100%; height: 100%; position: absolute; }

.quiz-content { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; width: 95%; max-width: 850px; border-radius: 8px; 
    overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    max-height: 95vh; overflow-y: auto; /* Для маленьких экранов */
}

/* Кнопка закрытия */
.custom-btn.q-close-btn {
    position: absolute; top: 10px; right: 15px; background: none; border: none; 
    font-size: 35px; color: #ccc; cursor: pointer; z-index: 10; transition: 0.2s; padding: 0; line-height: 1;
}
.custom-btn.q-close-btn:hover { color: #333; }

/* Сетка */
.quiz-layout { display: flex; min-height: 520px; }
.quiz-main { flex: 1; padding: 35px; display: flex; flex-direction: column; }
.quiz-side { width: 250px; background: #f9fbfc; border-left: 1px solid #eef2f5; padding: 35px 20px; text-align: center; }

/* Прогресс */
.quiz-header h2 { font-size: 20px; color: #025f99; margin: 0 0 15px; font-weight: bold; }
.pq-info { font-size: 11px; color: #999; margin-bottom: 5px; display: flex; justify-content: space-between; text-transform: uppercase; }
.pq-bar-bg { background: #eee; height: 6px; border-radius: 10px; overflow: hidden; margin-bottom: 25px; }
#pq-fill { background: linear-gradient(90deg, #00f6dd, #025f99); height: 100%; width: 0%; transition: 0.4s; }

/* Шаги */
.q-step { display: none; }
.q-step.active { display: block; animation: qFade 0.3s ease; }
@keyframes qFade { from { opacity: 0; } to { opacity: 1; } }
.q-title { font-size: 18px; font-weight: bold; margin-bottom: 20px; color: #333; }

/* Сетки */
.q-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.q-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.q-option { cursor: pointer; }
.q-option input { display: none; }

.q-card-ui { 
    border: 1px solid #ddd; border-radius: 5px; padding: 10px; text-align: center; 
    transition: 0.2s; height: 100%; display: flex; flex-direction: column;
}
.q-card-ui img { width: 100%; border-radius: 3px; margin-bottom: 10px; height: 100px; object-fit: contain; }
.q-card-ui span { font-size: 13px; font-weight: 600; color: #555; line-height: 1.2; }

.q-check-ui {
    display: flex; align-items: center; padding: 12px; border: 1px solid #ddd; 
    border-radius: 5px; transition: 0.2s; font-size: 13px; text-align: left;
}
.q-check-ui::before {
    content: ''; width: 16px; height: 16px; border: 1px solid #ccc; border-radius: 2px; 
    margin-right: 10px; flex-shrink: 0; background: #fff;
}

.q-option input:checked + .q-card-ui, 
.q-option input:checked + .q-check-ui { border-color: #025f99; background: #f0f7ff; }
.q-option input:checked + .q-check-ui::before { background: #025f99; border-color: #025f99; box-shadow: inset 0 0 0 3px #fff; }

/* Слайдер */
.q-range-block { padding: 30px 0; text-align: center; }
.q-range-val { font-size: 28px; font-weight: bold; color: #025f99; margin-bottom: 10px; }
.q-slider { width: 100%; height: 6px; accent-color: #025f99; cursor: pointer; }

/* Финал */
.q-bonus-box { background: #fff9e6; border: 1px dashed #ffcc00; padding: 15px; border-radius: 6px; margin-bottom: 20px; }
.q-bonus-box b { display: block; font-size: 12px; color: #888; margin-bottom: 8px; text-transform: uppercase; }
.q-bonus-box ul { margin: 0; padding: 0; list-style: none; }
.q-bonus-box li { font-size: 12px; font-weight: bold; margin-bottom: 5px; padding-left: 18px; position: relative; color: #444; }
.q-bonus-box li::before { content: '●'; position: absolute; left: 0; color: #ffcc00; }

.q-input { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 15px; }

/* Согласие (без инлайна) */
.q-policy-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; margin-top: 5px; }
.q-policy-label input { width: 16px; height: 16px; flex-shrink: 0; margin: 0; cursor: pointer; }
.q-policy-label span { font-size: 11px; color: #999; line-height: 1.3; }
.q-policy-label a { color: #025f99; text-decoration: underline; }

/* Кнопки с префиксом custom-btn */
.custom-btn.q-btn-next, .custom-btn.q-btn-submit { 
    --q-c1: #00f6dd; --q-c2: #025f99;
    background: linear-gradient(to bottom, var(--q-c1) 0%, var(--q-c2) 100%);
    transition: --q-c1 0.5s, --q-c2 0.5s;
    color: #fff; border: none; padding: 14px 35px; border-radius: 4px; 
    cursor: pointer; font-weight: bold; text-transform: uppercase; margin-left: auto; font-size: 14px;
}
.custom-btn.q-btn-next:hover, .custom-btn.q-btn-submit:hover { --q-c1: #025f99; --q-c2: #00f6dd; }
.custom-btn.q-btn-prev { background: none; border: 1px solid #ccc; padding: 12px 20px; border-radius: 4px; cursor: pointer; color: #aaa; font-weight: bold; }

/* Доктор */
.q-doc-img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); margin-bottom: 10px; }
.q-doc-name { font-weight: bold; font-size: 15px; margin-bottom: 3px; color: #333; }
.q-doc-post { color: #025f99; font-size: 11px; font-weight: bold; text-transform: uppercase; margin-bottom: 12px; display: block; }
.q-doc-quote { font-size: 12px; font-style: italic; color: #777; line-height: 1.4; border-top: 1px solid #eee; padding-top: 12px; }

/* Адаптив: Центрирование на мобильных */
@media (max-width: 768px) {
    .quiz-layout { flex-direction: column; }
    .quiz-side { display: none; }
    .quiz-content { width: 92%; max-width: 400px; } /* Всегда по центру */
    .quiz-main { padding: 25px 20px; }
    .q-grid { grid-template-columns: 1fr; }
    .q-grid-2 { grid-template-columns: 1fr; }
    .custom-btn.q-btn-next, .custom-btn.q-btn-submit { width: 100%; margin-left: 0; }
    .q-nav { flex-direction: column-reverse; gap: 10px; }
    .custom-btn.q-btn-prev { width: 100%; }
}