:root {
    --accent: #4E6ADA;
    --bg: #F5F6FA;
    --card: #FFFFFF;
    --text: #1F2330;
    --muted: #5A6070;
    --border: #E2E5EE;
    --shadow: 0 1px 3px rgba(20, 30, 60, 0.08);
}

[data-theme="dark"] {
    --accent: #8A9EF0;
    --bg: #15171E;
    --card: #1F222B;
    --text: #E8EAF0;
    --muted: #A6ACBA;
    --border: #2E323D;
    --shadow: none;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    color: var(--accent);
}

.header,
.footer {
    position: sticky;
    z-index: 10;
    background: var(--bg);
}

.header {
    top: 0;
    border-bottom: 1px solid var(--border);
}

.footer {
    bottom: 0;
    border-top: 1px solid var(--border);
}

.header__inner,
.footer__inner,
.content {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.header__inner {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer__inner {
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    white-space: nowrap;
}

.brand__logo {
    border-radius: 8px;
}

.brand__name {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
}

.actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.button--primary {
    background: var(--accent);
    color: #FFFFFF;
}

[data-theme="dark"] .button--primary {
    color: #15171E;
}

.button--secondary {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.button--icon {
    background: transparent;
    color: var(--muted);
}

.button--icon .button__text {
    display: none;
}

.content {
    flex: 1;
    padding-top: 24px;
    padding-bottom: 32px;
}

.cover {
    text-align: center;
    padding: 32px 0 24px;
}

.cover h1 {
    margin: 0 0 12px;
    text-wrap: balance;
    font-size: 36px;
    line-height: 1.2;
    color: var(--accent);
}

.cover p {
    margin: 0 auto;
    text-wrap: balance;
    max-width: 640px;
    font-size: 18px;
    color: var(--muted);
}

.section-title {
    margin: 40px 0 16px;
    font-size: 28px;
    color: var(--accent);
}

.blocks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.block {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.block:nth-child(even) {
    flex-direction: row-reverse;
}

.block img {
    flex: none;
    width: 128px;
    height: 128px;
}

.block div {
    flex: 1;
}

.block h2,
.block h3 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
    color: var(--accent);
}

.block p {
    margin: 0;
}

/* Витрина «Свежее в сети» (ЗД-039): одна карточка за раз, подпись повёрнута слева */
.showcase {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin: 0 0 24px;
}

.showcase__label {
    flex: none;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

.showcase__body {
    flex: 1;
    min-width: 0;
}

.card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    height: 176px;
    padding: 20px 24px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.card__picture {
    flex: none;
    width: 160px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
}

.card__text {
    flex: 1;
    min-width: 0;
}

.card__title {
    text-wrap: balance;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    font-size: 20px;
    line-height: 1.3;
    color: var(--accent);
}

.card__annotation {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 15px;
    color: var(--muted);
}

.card__area {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 14px;
}

.card__area-picture {
    width: 24px;
    height: 24px;
}

.showcase__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.showcase__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
}

.showcase__dot[aria-selected="true"] {
    background: var(--accent);
}

/* Опрос для продвижения (ЗД-039): строка с кнопкой, сам опрос — в окне поверх лендинга */
.survey {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 24px;
    padding: 16px 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.survey__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.survey__text strong {
    color: var(--accent);
}

.survey-dialog {
    width: min(900px, calc(100vw - 32px));
    height: min(760px, calc(100vh - 32px));
    padding: 0;
    border: none;
    border-radius: 12px;
    background: var(--card);
    overflow: hidden;
}

.survey-dialog::backdrop {
    background: rgba(10, 12, 20, 0.45);
}

.survey-dialog__close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    background: var(--card);
}

.survey-dialog__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

.refused {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 16px;
    text-align: center;
}

.refused h2 {
    margin: 0;
    font-size: 28px;
}

.refused p {
    margin: 0 0 8px;
    color: var(--muted);
}

[hidden] {
    display: none !important;
}

.banner {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 12, 20, 0.45);
}

.banner__inner {
    width: 100%;
    max-width: 720px;
    padding: 20px 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.banner__inner p {
    margin: 0 0 10px;
}

.banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

@media (max-width: 639px) {
    .header__inner {
        gap: 8px;
        padding: 0 10px;
    }

    .brand__name {
        font-size: 18px;
    }

    .actions {
        gap: 4px;
    }

    .button {
        padding: 0 8px;
    }

    .actions .button__text {
        display: none;
    }

    .cover h1 {
        font-size: 28px;
    }

    .block,
    .block:nth-child(even) {
        flex-direction: row;
        align-items: flex-start;
        gap: 14px;
        padding: 16px;
    }

    .block img {
        width: 64px;
        height: 64px;
    }

    .block h2,
    .block h3 {
        font-size: 18px;
    }

    .showcase__label {
        font-size: 15px;
    }

    .card {
        gap: 12px;
        height: 150px;
        padding: 14px;
    }

    .card__picture {
        width: 80px;
        height: 60px;
    }

    .card__title {
        font-size: 17px;
    }

    .card__annotation {
        -webkit-line-clamp: 3;
        font-size: 14px;
    }

    .survey {
        padding: 14px 16px;
    }

    .survey-dialog {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}

/* Страницы каталога областей и справки (ЗД-040) */

.cover .cover__areas {
    margin-top: 12px;
    font-size: 17px;
}

.page {
    max-width: 880px;
}

.page h1 {
    margin: 8px 0 12px;
    font-size: 32px;
    line-height: 1.2;
    color: var(--accent);
}

.page h2 {
    margin: 32px 0 12px;
    font-size: 22px;
}

.page__lead {
    margin: 0 0 24px;
    font-size: 17px;
    color: var(--muted);
}

.crumbs {
    font-size: 14px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.crumbs a {
    text-decoration: none;
}

.crumbs a:hover {
    text-decoration: underline;
}

.catalog {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.catalog__group {
    padding: 16px 20px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.page .catalog__group h2 {
    margin: 0 0 8px;
    font-size: 19px;
}

.catalog__group h2 a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.areas-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.areas-list .areas-list {
    padding-left: 22px;
}

.areas-list a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    color: var(--text);
    text-decoration: none;
}

.areas-list a:hover span {
    color: var(--accent);
    text-decoration: underline;
}

.areas-list__picture,
.catalog__picture {
    flex: none;
    border-radius: 6px;
}

.area {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-top: 16px;
    padding: 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.area__picture {
    flex: none;
    border-radius: 12px;
}

.area__text h1 {
    margin-top: 0;
}

.area__kind {
    margin: -6px 0 12px;
    font-size: 14px;
    color: var(--muted);
}

.area__text p:last-child {
    margin-bottom: 0;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-top: 32px;
    padding: 18px 24px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.cta p {
    margin: 0;
    flex: 1 1 320px;
}

.help-sections {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}

.help-sections li {
    padding: 16px 20px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.help-sections a {
    font-size: 19px;
    font-weight: 600;
    text-decoration: none;
}

.help-sections p {
    margin: 4px 0 0;
    color: var(--muted);
}

.help {
    padding: 8px 24px 16px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-wrap: anywhere;
}

.page .help h2 {
    margin: 24px 0 8px;
    font-size: 21px;
    color: var(--accent);
}

.help li p {
    margin: 0 0 4px;
}

.help-other {
    padding-left: 20px;
}

.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 0;
    text-align: center;
}

.not-found p {
    margin: 0 0 8px;
    color: var(--muted);
}

@media (max-width: 899px) {
    .catalog {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 639px) {
    .page h1 {
        font-size: 26px;
    }

    .area {
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }

    .area__picture {
        width: 72px;
        height: 72px;
    }

    .help {
        padding: 4px 16px 12px;
    }

    .cta {
        padding: 16px;
    }
}

/* Пять кнопок шапки (ЗД-040): на узком телефоне название уступает место кнопкам, логотип остаётся */
@media (max-width: 429px) {
    .brand__name {
        display: none;
    }
}

/* Квиз подбора областей (ЗД-041): кнопка в первом экране и окно поверх лендинга —
   на компьютере половина ширины и высоты, на планшете и телефоне почти весь экран */

.cover__quiz {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.cover .cover__quiz .cover__areas {
    margin-top: 0;
    font-size: 20px;
    color: var(--text);
}

.button--large {
    height: 52px;
    padding: 0 28px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(78, 106, 218, 0.35);
}

.quiz-dialog {
    width: 50vw;
    height: 50vh;
    min-width: 560px;
    min-height: 420px;
    padding: 24px 24px 20px;
    border: none;
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    overflow: auto;
}

.quiz-dialog::backdrop {
    background: rgba(10, 12, 20, 0.45);
}

.quiz-dialog__close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--card);
}

.quiz-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
}

.quiz-step[hidden] {
    display: none;
}

.quiz-dialog__title {
    margin: 0 32px 0 0;
    font-size: 22px;
    line-height: 1.25;
    color: var(--accent);
}

.quiz-dialog__text {
    width: 100%;
    flex: 1;
    min-height: 96px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    resize: none;
}

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

.quiz-dialog__under {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.quiz-dialog__count {
    flex: none;
}

.quiz-dialog__error {
    margin: 0;
    color: #C0392B;
}

.quiz-dialog__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.quiz-dialog__actions .button[aria-disabled="true"],
.quiz-dialog__actions .button:disabled {
    opacity: 0.5;
    cursor: default;
}

.quiz-dialog__note {
    margin: 0;
    color: var(--muted);
}

.quiz-areas {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.quiz-area {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.quiz-area input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.quiz-area img {
    flex: none;
    width: 40px;
    height: 40px;
}

.quiz-area__name {
    font-weight: 600;
}

.quiz-area__text {
    display: block;
    font-size: 14px;
    color: var(--muted);
}

.quiz-missing {
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--bg);
}

.quiz-missing p,
.quiz-missing ul {
    margin: 0;
}

.quiz-missing ul {
    margin: 6px 0;
    padding-left: 20px;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .quiz-dialog {
        width: 96vw;
        height: 92vh;
        min-width: 0;
        min-height: 0;
        max-width: none;
        max-height: none;
        padding: 20px 16px 16px;
    }
}
