/* Деловые Линии — фирменный стиль.
   Палитра, типографика и модульная сетка согласованы с PDF-отчётом
   (admin_opros/web/report.html): чёрный/белый как основа, жёлтый —
   только акцент, прямые углы, без круглых элементов. */

:root {
    color-scheme: light;
    --ink: #000;
    --paper: #fff;
    --bg: #e9e9e9;
    --yellow: #f2a900;
    --grey-1: #cfcfcf;
    --grey-3: #4a4a4a;
    --line: #d8d8d8;
    --muted: #666;
    --red: #a02e2e;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 15px/1.55 "Директ", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

b,
strong {
    font-weight: 700;
}

/* Полоса прогресса: тонкая, поверх шапки, без цифр и надписей — движение
   должно читаться боковым зрением и не спорить с документом. */
.progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 10;
    height: 3px;
    background: #333;
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--yellow);
    transition: width .25s ease-out;
}

/* Оценка времени под подводкой */
.estimate {
    margin: 14px 0 0;
    color: #8a8a8a;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Страница целиком белая; ширину держит не фон, а колонка контента */
.container {
    width: 100%;
    padding: 0 0 56px;
    min-height: 100vh;
}

/* Колонка контента — единая мера для шапки, формы и финального экрана */
.header-inner,
form,
.success-wrap {
    width: min(820px, 100%);
    margin-inline: auto;
    padding-inline: clamp(24px, 5vw, 56px);
}

/* Шапка-плашка: чёрный фон во всю ширину, текст — по колонке контента */
.header-plate {
    background: var(--ink);
    color: #fff;
    padding: 28px 0 26px;
    margin-bottom: 40px;
}

.header-plate img {
    display: block;
    height: 26px;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 14px;
    color: #b8b8b8;
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: .09em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-weight: 700;
    font-size: clamp(24px, 4.4vw, 34px);
    line-height: 1.15;
    font-family: inherit;
    letter-spacing: -.01em;
}

.intro {
    max-width: 60ch;
    margin: 12px 0 0;
    color: #cfcfcf;
    font-size: 14px;
}

form {
    display: grid;
    gap: 34px;
}

/* Вопрос — секция документа, а не карточка */
fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Сюжет (v3) и все вопросы по нему обведены одной рамкой. Сюжет отдельным
   инфоблоком читался хорошо, но только у первого вопроса группы: у второго
   условия будто не было, и приходилось догадываться, о чём вопрос. Рамка на всю
   группу решает это без повтора текста. */
/* Отступы между группами держит grid-gap формы, поэтому своих margin нет */
.scenario-group {
    display: grid;
    /* Внутри группы вопросы стоят плотнее, чем группы между собой: так видно,
       что это один сюжет, а не соседние разделы анкеты */
    gap: 26px;
    min-width: 0;
    padding: 0 0 26px;
    border: 1.5px solid var(--ink);
}

/* Условие задачи — чёрная плашка во всю ширину рамки, как шапка страницы:
   светлая подложка была слишком тихой, и вопросы читались отдельно от сюжета */
.scenario-group .scenario {
    margin: 0;
    padding: 16px 22px 18px;
    background: var(--ink);
    color: #fff;
}

.scenario-group .scenario span {
    display: block;
    margin-bottom: 9px;
    color: var(--yellow);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.scenario-group .scenario p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

/* Вопросы внутри рамки отбиты от неё по бокам */
.scenario-group fieldset {
    padding: 0 22px;
}

.question-title {
    display: grid;
    gap: 7px;
    padding: 0 0 9px;
    margin-bottom: 14px;
    border-bottom: 1.5px solid var(--ink);
}

/* Отвеченный вопрос помечается галочкой в номере — видно, где остановился */
fieldset.done .question-title span::before {
    content: "✓ ";
    color: var(--yellow);
    font-weight: 700;
}

fieldset.missing .question-title {
    border-bottom-color: var(--red);
}

fieldset.missing .question-title span {
    color: var(--red);
}

.question-title span {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.question-title b {
    font-weight: 700;
    font-size: 17px;
    line-height: 1.35;
    font-family: inherit;
}

.hint {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12.5px;
}

/* Варианты ответа */
fieldset>label:not(.text-field) {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}

fieldset>label:not(.text-field):hover {
    background: #f4f4f4;
}

fieldset>label:not(.text-field):has(:checked) {
    background: #f4f4f4;
    border-left-color: var(--yellow);
}

input[type="checkbox"],
input[type="radio"] {
    width: 17px;
    height: 17px;
    margin: 3px 0 0;
    flex: none;
    border-radius: 0;
    accent-color: var(--ink);
}

/* Ранжирование: вариант и колонка на каждое место */
.ranking {
    display: grid;
}

.ranking-head,
.ranking-row {
    display: grid;
    grid-template-columns: 1fr repeat(3, 56px);
    align-items: center;
    gap: 8px;
}

.ranking-head {
    padding: 0 12px 6px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ranking-head span+span {
    text-align: center;
}

.ranking-row {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
}

.ranking-row:last-child {
    border-bottom: 0;
}

.ranking-row:has(input:checked) {
    background: #f4f4f4;
}

/* Первое место помечается акцентом, последнее — приглушённой меткой:
   расстановка должна читаться взглядом, но акцент только один. */
.ranking-row:has(input[name$="__1"]:checked) {
    border-left-color: var(--yellow);
}

.ranking-row:has(input[name$="__3"]:checked) {
    border-left-color: var(--grey-1);
}

.ranking-text {
    font-size: 14.5px;
}

.ranking-cell {
    display: grid;
    place-items: center;
    padding: 6px 0;
    cursor: pointer;
}

.ranking-cell input {
    margin: 0;
}

.text-field {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

input[type="text"],
textarea {
    width: 100%;
    border: 1px solid var(--grey-1);
    border-radius: 0;
    padding: 12px 14px;
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
    outline: 2px solid var(--yellow);
    outline-offset: -1px;
    border-color: var(--ink);
}

/* Отправка */
.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.counter {
    flex: 1 1 100%;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

#status {
    flex: 1 1 260px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

#status.error {
    color: var(--red);
    font-weight: 700;
}

button {
    border: 0;
    border-radius: 0;
    padding: 15px 32px;
    background: var(--ink);
    color: #fff;
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.2;
    font-family: inherit;
    letter-spacing: .09em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .12s, color .12s;
}

button:hover {
    background: var(--yellow);
    color: var(--ink);
}

button:disabled {
    opacity: .45;
    cursor: wait;
}

button:disabled:hover {
    background: var(--ink);
    color: #fff;
}

/* Экран благодарности */
.success {
    padding: 64px 40px;
    border: 1px solid var(--line);
    border-top: 4px solid var(--yellow);
    text-align: center;
}

.success span {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    background: var(--yellow);
    color: var(--ink);
    font-size: 21px;
    font-weight: 700;
}

.success h2 {
    margin: 18px 0 6px;
    font-weight: 700;
    font-size: 24px;
    font-family: inherit;
}

.success p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width:600px) {
    .header-plate {
        padding: 22px 18px;
    }

    .header-inner,
    form,
    .success-wrap {
        padding-inline: 18px;
    }

    form {
        gap: 28px;
    }

    /* На узком экране рамка группы съедает и без того малую ширину колонки */
    .scenario-group .scenario {
        padding: 14px 14px 15px;
    }

    .scenario-group fieldset {
        padding: 0 14px;
    }

    .success {
        padding: 44px 22px;
    }

    .question-title b {
        font-size: 16px;
    }

    .ranking-head,
    .ranking-row {
        grid-template-columns: 1fr repeat(3, 38px);
        gap: 4px;
    }

    .ranking-row {
        padding: 10px 8px;
    }

    .ranking-text {
        font-size: 13.5px;
    }

    .actions button {
        width: 100%;
    }
}
