﻿/* ---------- 1. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

/* ---------- 2. ДИЗАЙН-ТОКЕНЫ ---------- */
:root {
    color-scheme: light dark;

    /* Поверхности */
    --bg:            light-dark(#faf7f2, #16181c);
    --bg-soft:       light-dark(#f6f7f9, #1d2025);
    --bg-hover:      light-dark(#eef1f5, #24272d);
    --card:          light-dark(#ffffff, #1d2025);

    /* Границы */
    --line:          light-dark(#e6e1d8, #2b2f36);
    --border:        light-dark(#e3e6ea, #2b2f36);
    --border-strong: light-dark(#c9cfd6, #3a3f47);

    /* Текст */
    --fg:            light-dark(#232323, #e7e9ee);
    --text:          light-dark(#1c2126, #e7e9ee);
    --muted:         light-dark(#6a6a6a, #9aa3b2);
    --text-muted:    light-dark(#6b7480, #9aa3b2);

    /* Бренд */
    --brand:         light-dark(#1d3557, #16243d);
    --brand-2:       light-dark(#457b9d, #6b9bff);

    /* Акцент */
    --accent:        light-dark(#2f6fed, #6b9bff);
    --accent-soft:   light-dark(rgba(47, 111, 237, .12), rgba(107, 155, 255, .18));
    --focus-ring:    light-dark(rgba(47, 111, 237, .35), rgba(107, 155, 255, .45));

    /* Семантика */
    --danger:        light-dark(#c0392b, #ff7b6b);
    --danger-soft:   light-dark(rgba(192, 57, 43, .10), rgba(255, 123, 107, .15));
    --neutral:       light-dark(#5b636e, #a7b0bd);
    --neutral-soft:  light-dark(rgba(91, 99, 110, .10), rgba(167, 176, 189, .12));
    --warn:          light-dark(#b45309, #fbbf24);
    --success:       #26b050;
    --error:         #e50000;

    /* Тени */
    --shadow-sm: light-dark(0 1px 2px rgba(16, 24, 40, .05),
                            0 1px 2px rgba(0, 0, 0, .40));
    --shadow-md: light-dark(0 4px 14px rgba(16, 24, 40, .08),
                            0 4px 14px rgba(0, 0, 0, .50));

    /* Радиусы */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius:      12px;
    --radius-lg:   14px;
    --radius-pill: 999px;

    /* Отступы */
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    /* Переходы */
    --transition: 140ms ease;

    /* Иконка лупы — url() не поддерживает light-dark(), поэтому два варианта */
    --icon-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}

@media (prefers-color-scheme: dark) {
    :root {
        --icon-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
    }
}

/* ---------- 3. ТИПОГРАФИКА И ССЫЛКИ ---------- */
a {
    color: var(--accent);
    text-decoration: none;

    &:hover {
        color: var(--accent);
        filter: brightness(.85);
        text-decoration: underline;
    }
}

h1, h2, h3 {
    line-height: 1.2;
    color: var(--brand);
    margin: 0 0 .6rem;
}

h1 { font-size: clamp(1.6rem, 2vw + 1rem, 2.25rem); }
h2 {
    font-size: clamp(1.25rem, 1vw + 1rem, 1.6rem);
    margin-top: 1.5rem;
}
h3 { font-size: 1.05rem; }

p { margin: 0 0 .8rem; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

h1:focus { outline: none; }

/* ---------- 4. КНОПКИ ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1.4rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s ease, box-shadow .15s ease, border-color .15s ease;

    &:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}

.btn--primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 6px rgba(29, 53, 87, .18);

    &:hover {
        background: color-mix(in srgb, var(--brand) 85%, #000);
        color: #fff;
        box-shadow: 0 4px 12px rgba(29, 53, 87, .25);
        text-decoration: none;
        filter: none;
    }
}

.btn--ghost {
    background: transparent;
    color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 22%, transparent);

    &:hover {
        background: color-mix(in srgb, var(--brand) 6%, transparent);
        color: var(--brand);
        text-decoration: none;
        filter: none;
    }
}

.btn--lg { padding: .9rem 1.8rem; font-size: 1.05rem; }

/* ---------- 5. БЕЙДЖИ, СТАТУСЫ, ОШИБКИ ---------- */
.badge {
    display: inline-block;
    color: #fff;
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: .01em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.status,
.def__empty {
    color: var(--text-muted);
    padding: .5rem 0;
    margin: 0;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid                              { outline: 1px solid var(--error); }
.validation-message                   { color: var(--error); }

#blazor-error-ui {
    color-scheme: light only;
    background: #fff3cd;
    color: #232323;
    bottom: 0;
    left: 0;
    right: 0;
    padding: .6rem 1.25rem;
    position: fixed;
    box-shadow: 0 -1px 2px #00000033;
    display: none;
    z-index: 1000;

    .dismiss {
        cursor: pointer;
        position: absolute;
        right: .75rem;
        top: .5rem;
    }
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;

    &::after { content: "An error has occurred."; }
}

/* ---------- 6. LAYOUT ----------
   Структура сетки и off-canvas меню — как в оригинале.
   Изменены только цвета.                                        */
.layout {
    --sidebar-w: 260px;
    --header-h: 3.25rem;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr auto;
    grid-template-areas:
        "header  header"
        "sidebar main"
        "sidebar  footer";
    min-height: 100dvh;

    > .nav-toggle {
        position: absolute;
        left: -9999px;
        width: 1px;
        height: 1px;
        opacity: 0;
        margin: 0;
        pointer-events: none;
    }

    > .site-header {
        grid-area: header;
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: 0 1rem;
        background: linear-gradient(180deg, var(--brand) 0%,
                    color-mix(in srgb, var(--brand) 75%, #2c5282) 100%);
        color: #fff;
        box-shadow: 0 2px 8px #00000014;
        position: sticky;
        top: 0;
        z-index: 20;
    }

    > .sidebar {
        grid-area: sidebar;
        background: var(--brand);
        color: #e6eef7;
        padding: 1rem .75rem;
        overflow-y: auto;
    }

    > .content {
        grid-area: main;
        padding: clamp(1rem, 2.5vw, 2rem);
        max-width: 1100px;
        width: 100%;
        margin: 0 auto;
    }

    > .site-footer {
        grid-area: footer;
        background: var(--brand);
        color: #cfd6e0;
        text-align: center;
        padding: .75rem 1rem;
        font-size: .85rem;

        p { margin: 0; }
    }

    > .nav-backdrop { display: none; }
}

.site-header {
    .burger {
        display: none;
        cursor: pointer;
        font-size: 1.4rem;
        line-height: 1;
        padding: .3rem .6rem;
        border-radius: 8px;
        user-select: none;
        transition: background-color .15s;

        &:hover { background: #ffffff26; }
    }

    .brand {
        color: inherit;
        font-weight: 700;
        font-size: 1.05rem;
        letter-spacing: .01em;
        white-space: nowrap;
        text-decoration: none;

        &:hover { color: #fff; text-decoration: none; }
    }

    .spacer { flex: 1; }

    .top-nav a {
        color: #dbe4ee;
        font-size: .9rem;
        text-decoration: none;
        white-space: nowrap;

        &:hover { color: #fff; text-decoration: underline; }
    }
}

/* ---------- 6.1 МОБИЛЬНОЕ МЕНЮ ---------- */
@media (max-width: 720px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "footer";

        > .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            width: min(80vw, 280px);
            max-width: 100%;
            transform: translateX(-100%);
            transition: transform .25s ease;
            z-index: 30;
            box-shadow: 4px 0 20px #00000040;
        }

        > .nav-toggle:checked ~ .sidebar { transform: translateX(0); }

        > .nav-toggle:checked ~ .nav-backdrop {
            display: block;
            position: fixed;
            inset: 0;
            z-index: 25;
            background: #00000073;
        }
    }

    .site-header .burger { display: inline-block; }
}

/* ---------- 7. NAVMENU ---------- */
.menu {
    display: flex;
    flex-direction: column;
    gap: .25rem;

    .menu-link {
        display: flex;
        align-items: center;
        gap: .7rem;
        padding: .6rem .85rem;
        color: #d7e3f0;
        font-size: .95rem;
        line-height: 1.2;
        text-decoration: none;
        border-radius: 8px;
        transition: background-color .15s, color .15s;

        &:hover {
            background: #ffffff14;
            color: #fff;
            text-decoration: none;
            filter: none;
        }

        &.active {
            background: #ffffff2e;
            color: #fff;
            font-weight: 600;
        }
    }

    .ico {
        display: inline-block;
        width: 1.3rem;
        text-align: center;
        font-size: 1.05rem;
        line-height: 1;
        flex: none;
    }
}

/* ---------- 8. ГЛАВНАЯ ---------- */
.home {
    display: flex;
    flex-direction: column;
    gap: 2.75rem;
    padding-bottom: 2rem;
}

/* Hero */
.home-hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 2.5rem;
    align-items: center;
    padding: clamp(1.5rem, 3vw, 2.75rem);
    background:
        radial-gradient(circle at 100% 0%,
            color-mix(in srgb, var(--brand-2) 10%, transparent) 0%, transparent 45%),
        radial-gradient(circle at 0% 100%,
            color-mix(in srgb, var(--brand) 6%, transparent) 0%, transparent 50%),
        linear-gradient(135deg,
            light-dark(#fffaf2, #1b1e24) 0%,
            light-dark(#f3ebdd, #1e2228) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.home-hero__content { display: flex; flex-direction: column; }

.home-hero__eyebrow {
    display: inline-block;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--brand-2);
    font-weight: 700;
    margin-bottom: .8rem;
}

.home-hero__title {
    font-size: clamp(1.85rem, 3.6vw, 2.75rem);
    line-height: 1.12;
    margin: 0 0 1rem;
    color: var(--brand);
    font-weight: 800;
    letter-spacing: -.015em;
}

.home-hero__accent { color: var(--brand-2); }

.home-hero__lead {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--muted);
    max-width: 38rem;
    margin: 0 0 1.5rem;
}

.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.75rem;
}

.home-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.home-hero__art {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    perspective: 1200px;
}

/* Книга-иллюстрация */
.home-book {
    position: relative;
    width: 240px;
    height: 320px;
    display: flex;
    transform: rotateY(-10deg) rotateX(4deg);
    filter: drop-shadow(0 22px 28px rgba(29, 53, 87, .18));
}

.home-book__spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 6px;
    transform: translateX(-50%);
    background: linear-gradient(180deg,
        rgba(90, 70, 40, 0) 0%,
        rgba(90, 70, 40, .35) 15%,
        rgba(60, 45, 25, .5) 50%,
        rgba(90, 70, 40, .35) 85%,
        rgba(90, 70, 40, 0) 100%);
    border-radius: 2px;
    z-index: 3;
    pointer-events: none;
}

.home-book__page {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .6rem;
    padding: 1.5rem 1rem;
    background: linear-gradient(180deg,
        light-dark(#fffdf8, #23262c) 0%,
        light-dark(#f5eee2, #1c1f24) 100%);
    overflow: hidden;
}

.home-book__page--left {
    border-radius: 8px 0 0 8px;
    box-shadow: inset -12px 0 18px -14px rgba(90, 70, 40, .35);
}

.home-book__page--right {
    border-radius: 0 8px 8px 0;
    box-shadow: inset 12px 0 18px -14px rgba(90, 70, 40, .35);
}

.home-book__letter {
    font-family: Georgia, "Times New Roman", Cambria, serif;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brand);
    letter-spacing: -.03em;
}

.home-book__hint {
    font-family: Georgia, "Times New Roman", Cambria, serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--muted);
}

/* Статистика на главной */
.home-stat {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.home-stat__value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1;
    letter-spacing: -.02em;
}

.home-stat__label {
    font-size: .82rem;
    color: var(--muted);
}

/* Секции Home */
.home-section { padding: 0; }

.home-section__title {
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    margin: 0 0 .6rem;
    color: var(--brand);
    font-weight: 800;
    letter-spacing: -.01em;
}

.home-section__lead {
    font-size: 1rem;
    color: var(--muted);
    margin: 0 0 1.75rem;
    max-width: 62ch;
    line-height: 1.6;
}

.home-section p {
    max-width: 78ch;
    line-height: 1.65;
    color: var(--text);
    margin: 0 0 1rem;
}

/* Карточки Home */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.home-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow .18s ease, border-color .18s ease;

    &:hover {
        box-shadow: 0 8px 22px rgba(29, 53, 87, .08);
        border-color: color-mix(in srgb, var(--line) 60%, var(--brand-2));
    }
}

.home-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.3rem;
    background: color-mix(in srgb, var(--brand-2) 14%, transparent);
    color: var(--brand);
    margin-bottom: .2rem;
}

.home-card__title {
    margin: 0;
    color: var(--brand);
    font-size: 1.05rem;
    font-weight: 700;
}

.home-card__text {
    margin: 0;
    color: var(--muted);
    font-size: .94rem;
    line-height: 1.55;
}

/* Шаги */
.home-steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    gap: .85rem;
}

.home-step {
    position: relative;
    display: flex;
    gap: 1rem;
    padding: 1.1rem 1.25rem 1.1rem 4rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);

    &::before {
        counter-increment: step;
        content: counter(step);
        position: absolute;
        left: 1.1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 2.1rem;
        height: 2.1rem;
        border-radius: 50%;
        background: var(--brand);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: .95rem;
    }
}

.home-step__title {
    margin: 0 0 .25rem;
    font-size: 1.02rem;
    color: var(--brand);
}

.home-step__text {
    margin: 0;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.55;
}

/* FAQ */
.home-faq {
    display: grid;
    gap: .65rem;
    margin-top: 1.5rem;

    details {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: .9rem 1.15rem;
        transition: border-color .15s ease, box-shadow .15s ease;

        &[open] {
            border-color: color-mix(in srgb, var(--line) 60%, var(--brand-2));
            box-shadow: 0 4px 14px rgba(29, 53, 87, .05);

            summary::after { content: "−"; }
        }
    }

    summary {
        cursor: pointer;
        font-weight: 600;
        color: var(--brand);
        list-style: none;
        position: relative;
        padding-right: 1.75rem;
        font-size: 1rem;

        &::-webkit-details-marker { display: none; }

        &::after {
            content: "+";
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            font-weight: 700;
            font-size: 1.2rem;
            color: var(--brand-2);
            line-height: 1;
        }
    }

    p {
        margin: .65rem 0 0;
        color: var(--text);
        font-size: .95rem;
        line-height: 1.6;
    }
}

/* CTA */
.home-cta {
    text-align: center;
    padding: clamp(1.75rem, 3.5vw, 2.75rem);
    border-radius: var(--radius);
    background: linear-gradient(135deg,
        light-dark(#eaf2fb, #1b2431) 0%,
        light-dark(#dbe9f6, #16202e) 100%);
    border: 1px solid light-dark(#cfe0f2, #253449);
}

.home-cta__title {
    margin: 0 0 .5rem;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    color: var(--brand);
    font-weight: 800;
}

.home-cta__text {
    margin: 0 auto 1.35rem;
    max-width: 55ch;
    color: var(--muted);
    line-height: 1.6;
}

/* Футер главной */
.home-footer {
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--muted);
    font-size: .88rem;

    p { margin: 0; }

    a {
        color: var(--brand);
        text-decoration: none;
        border-bottom: 1px solid transparent;
        transition: border-color .15s ease, color .15s ease;

        &:hover {
            border-bottom-color: var(--brand);
            text-decoration: none;
            filter: none;
        }
    }
}

/* ---------- 9. СЛОВАРЬ — СТРАНИЦА СПИСКА ---------- */
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.page__header {
    position: sticky;
    top: 10px;
    background: transparent;
    padding: 1rem 0 .75rem;
    z-index: 10;
    border-bottom: 1px solid var(--border);

    h1 { margin: 0 0 .5rem; font-size: 1.5rem; }

    /* Старая форма input+button внутри .page */
    .search {
        display: flex;
        gap: .5rem;

        input {
            flex: 1;
            min-width: 0;
            padding: .6rem .8rem;
            border: 1px solid var(--border-strong);
            border-radius: .5rem;
            font-size: 1rem;
            background: var(--card);
            color: var(--text);

            &:focus-visible {
                outline: none;
                border-color: var(--accent);
                box-shadow: 0 0 0 3px var(--focus-ring);
            }
        }

        button {
            padding: .6rem 1rem;
            border: none;
            background: var(--accent);
            color: #fff;
            border-radius: .5rem;
            cursor: pointer;
            font-size: 1rem;

            &:disabled { opacity: .6; cursor: not-allowed; }
        }
    }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Карточка словаря */
.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 18px 14px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;

    &:hover {
        border-color: var(--border-strong);
        box-shadow: 0 8px 20px rgba(17, 24, 39, .08),
                    0 2px 6px rgba(17, 24, 39, .05);
    }
}

.card--obsolete {
    background: light-dark(#fffdf5, #23200f);
    border-style: dashed;
    border-color: light-dark(#fde68a, #7a5b1a);

    &::after {
        content: "устар.";
        position: absolute;
        top: 10px;
        right: 12px;
        font-size: .7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--warn);
        background: light-dark(#fef3c7, #3a2c0d);
        border-radius: var(--radius-pill);
        padding: 2px 8px;
        pointer-events: none;
    }
}

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card__lemma {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: var(--fg);
    word-break: break-word;
    letter-spacing: -.01em;
    text-transform: lowercase;
}

.card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: .82rem;
    color: var(--text-muted);
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}

.card__footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.card__view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    text-decoration: none;
    transition: background .15s ease, color .15s ease,
                border-color .15s ease, transform .1s ease;

    svg { transition: transform .15s ease; }

    &:hover {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
        filter: none;

        svg { transform: translateX(2px); }
    }

    &:active { transform: scale(.97); }
}

.meta-key { color: var(--text-muted); opacity: .7; }
.meta-item--warn { color: var(--danger); font-weight: 600; }

/* Определения в карточке */
.defs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.def {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: 1px solid transparent;
    transition: background .12s ease, border-color .12s ease;
}

.def--main {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

.def__text { line-height: 1.45; color: var(--text); font-size: .95rem; }
.def__num  { font-weight: 700; color: var(--accent); margin-right: 4px; }
.def__note {
    color: var(--text-muted);
    font-style: italic;
    margin-left: 6px;
    font-size: .88rem;
}

.def__examples {
    margin-top: 6px;
    font-size: .88rem;
    color: var(--text-muted);
    font-style: italic;
    padding-left: 10px;
    border-left: 2px solid var(--border);
}

/* ---------- 10. СЛОВАРЬ СИНОНИМОВ (.dictionary) ---------- */
.dictionary {
    color: var(--text);
    max-width: 56rem;
    margin-inline: auto;
    padding: var(--space-6) var(--space-4);
    line-height: 1.5;
}

.dictionary__crumbs { margin-bottom: var(--space-4); }

.dictionary__crumbs-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .85rem;
    color: var(--text-muted);
}

.dictionary__crumbs-item:not(:last-child)::after {
    content: "›";
    margin-left: var(--space-1);
    color: var(--text-muted);
    opacity: .6;
}

.dictionary__crumbs-link {
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: color var(--transition), border-color var(--transition);

    &:hover {
        color: var(--accent);
        border-bottom-color: currentColor;
        filter: none;
    }
}

.dictionary__header { margin-bottom: var(--space-5); }

.dictionary__title {
    margin: 0 0 var(--space-1);
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

.dictionary__author {
    margin: 0;
    color: var(--text-muted);
    font-size: .95rem;
    font-style: italic;
}

.dictionary__intro {
    margin: 0 0 var(--space-5);
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.65;
    max-width: 42rem;

    strong { color: var(--text); font-weight: 600; }
}

/* Поиск с лупой */
.search {
    position: relative;
    margin-bottom: var(--space-5);
}

.search__input {
    width: 100%;
    padding: .75rem 2.5rem .75rem 2.75rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--card);
    background-image: var(--icon-search);
    background-repeat: no-repeat;
    background-position: .9rem center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition),
                box-shadow var(--transition),
                background var(--transition);

    &::placeholder { color: var(--text-muted); opacity: .8; }
    &:hover { border-color: var(--accent); }
    &:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-sm);
    }
    &::-webkit-search-cancel-button { display: none; }
}

.search__clear {
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);

    &:hover { background: var(--bg-hover); color: var(--text); }
}

/* Общие заголовки результатов и алфавита */
.results__title,
.alphabet__title {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.results__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.4rem;
    padding: 0 .45rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .8rem;
    font-weight: 600;
}

.results__empty {
    padding: var(--space-4);
    margin: 0;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-align: center;
}

.results__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-2);
}

.results__item { margin: 0; }

/* Ссылки в результатах и на странице буквы — одинаковые */
.results__link,
.letter-page__link {
    display: block;
    padding: var(--space-3) var(--space-4);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition), border-color var(--transition),
                transform var(--transition), box-shadow var(--transition);

    &:hover {
        background: var(--bg-hover);
        border-color: var(--accent);
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
        filter: none;
    }

    &:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

.results__word,
.letter-page__word {
    font-weight: 600;
    color: var(--accent);
}

.results__definition,
.letter-page__definition {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: .9rem;
}

/* Алфавит */
.alphabet__nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.alphabet__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .6rem;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .95rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition), transform var(--transition);

    &:hover {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        transform: translateY(-1px);
        filter: none;
    }
}

.alphabet__seo-text {
    margin: var(--space-4) 0 0;
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.7;

    a {
        color: var(--text-muted);
        text-decoration: none;
        border-bottom: 1px dotted currentColor;
        transition: color var(--transition);

        &:hover { color: var(--accent); filter: none; }
    }
}

/* ---------- 11. СТРАНИЦА БУКВЫ ---------- */
.letter-page {
    color: var(--text);
    max-width: 56rem;
    margin-inline: auto;
    padding: var(--space-6) var(--space-4);
    line-height: 1.5;
}

.letter-page__back { margin-bottom: var(--space-4); }

/* «Назад» — общий вид для letter-page и word */
.letter-page__back-link,
.word__back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    margin-left: calc(-1 * var(--space-2));
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .9rem;
    text-decoration: none;
    transition: color var(--transition), background var(--transition);

    &:hover {
        color: var(--accent);
        background: var(--accent-soft);
        filter: none;
    }

    &:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

.letter-page__header {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.letter-page__title {
    margin: 0 0 var(--space-1);
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 700;
    letter-spacing: -.01em;
}

.letter-page__letter { color: var(--accent); }

.letter-page__count {
    margin: 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.letter-page__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-2);
}

.letter-page__item { margin: 0; }

.letter-page__empty {
    padding: var(--space-5) var(--space-4);
    margin: 0;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-align: center;
}

/* ---------- 12. СТРАНИЦА СЛОВА (.word) ---------- */
.word {
    color: var(--text);
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    line-height: 1.6;
}

.word__crumbs {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;

    a {
        color: var(--accent);
        text-decoration: none;

        &:hover { text-decoration: underline; }
    }
}

.word__back { margin-bottom: var(--space-4); }

.word__article {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.word__article--obsolete {
    border-color: light-dark(#fde68a, #7a5b1a);
    background: light-dark(#fffdf5, #23200f);
}

.word__header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.word__lemma {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
    color: var(--fg);
    text-transform: lowercase;
}

.word__title {
    margin: 0 0 var(--space-3);
    font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--fg);
    word-break: break-word;
}

.word__definition {
    margin: 0;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.65;
}

.word__props {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 24px;
    margin: 0 0 28px;
    padding: 16px;
    background: var(--bg-soft);
    border-radius: 10px;
}

.word__prop {
    display: flex;
    flex-direction: column;
    gap: 2px;

    dt {
        font-size: .75rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-muted);
    }

    dd {
        margin: 0;
        font-size: 1rem;
        color: var(--text);
    }
}

.word__prop--warn dd {
    color: var(--warn);
    font-weight: 600;
}

.word__section { margin: 0 0 28px; }
.word__section:last-of-type { margin-bottom: 0; }
.word__defs { margin: 0 0 28px; }

.word__section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text);
}

/* Общая типографика для HTML-контента */
.word__prose,
.word__defs-html {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    overflow-wrap: anywhere;

    p {
        margin: 0 0 .85em;

        &:last-child { margin-bottom: 0; }
    }

    ol, ul {
        margin: 0 0 1em;
        padding-left: 1.6em;

        &:last-child { margin-bottom: 0; }
    }

    li {
        margin: 0 0 .55em;
        padding-left: .15em;

        &:last-child { margin-bottom: 0; }
    }

    ol > li::marker {
        color: var(--accent);
        font-weight: 700;
    }

    i, em {
        color: var(--text-muted);
        font-style: italic;
    }

    b, strong {
        color: var(--fg);
        font-weight: 600;
    }

    q::before { content: "«"; }
    q::after  { content: "»"; }

    hr {
        border: 0;
        height: 1px;
        background: var(--border);
        margin: .9rem 0;
    }

    a {
        color: var(--accent);
        text-decoration: none;

        &:hover { text-decoration: underline; }
    }
}

/* Примеры из литературы */
.word__section--examples {
    padding: 18px 20px;
    border-radius: 12px;
    background: light-dark(#fbfbfd, #1a1d23);
    border: 1px solid light-dark(#eef0f3, #262a31);
    border-left: 3px solid light-dark(#c7d2fe, #3b4d82);

    .word__section-title { color: light-dark(#1e3a8a, #a8baf0); }
}

.word__prose--examples p {
    padding-left: 14px;
    border-left: 2px solid light-dark(#e0e7ff, #2c3456);
    color: var(--text);
}

/* История слова */
.word__section--history {
    padding: 18px 20px;
    border-radius: 12px;
    background: light-dark(#fffdf7, #241f10);
    border: 1px solid light-dark(#fef3c7, #453718);
    border-left: 3px solid light-dark(#fcd34d, #b98a13);

    .word__section-title { color: light-dark(#92400e, #f5c453); }
}

.word__prose--history {
    font-size: .97rem;
    color: var(--text-muted);
}

.word__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.word__updated { color: var(--text-muted); }

.word__not-found {
    text-align: center;
    padding: 64px 16px;

    h1 { margin: 0 0 8px; }
}

.word__not-found-title {
    margin: 0 0 var(--space-2);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.word__not-found-text {
    margin: 0;
    color: var(--text-muted);
}

/* ---------- 12.1 ЧИПЫ ---------- */
.chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chips__item { margin: 0; }

.chips__link,
.chips__text {
    display: inline-flex;
    align-items: center;
    padding: .35rem .85rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-size: .95rem;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition), transform var(--transition);
}

.chips--synonym .chips__link {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;

    &:hover {
        background: var(--accent);
        color: #fff;
        transform: translateY(-1px);
        filter: none;
    }

    &:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

.chips--antonym .chips__text {
    color: var(--danger);
    background: var(--danger-soft);
}

.chips--similar .chips__text {
    color: var(--neutral);
    background: var(--neutral-soft);
}

/* ---------- 13. АДАПТИВ ---------- */
@media (max-width: 860px) {
    .home-hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .home-hero__art {
        order: -1;
        min-height: 260px;
    }

    .home-hero__stats { gap: 1.25rem; }

    .home-book {
        width: 200px;
        height: 260px;
        transform: rotateY(-6deg) rotateX(3deg);
    }

    .home-book__letter { font-size: 3.75rem; }
}

@media (max-width: 480px) {
    .home { gap: 2rem; padding-bottom: 1.5rem; }

    .home-hero { padding: 1.25rem 1rem; }
    .home-hero__title { font-size: 1.6rem; line-height: 1.15; }
    .home-hero__lead { font-size: .98rem; }
    .home-hero__actions { flex-direction: column; align-items: stretch; }
    .home-hero__stats { gap: 1rem; padding-top: 1rem; }

    .home-stat__value { font-size: 1.2rem; }
    .home-stat__label { font-size: .78rem; }

    .home-book { width: 160px; height: 210px; }
    .home-book__letter { font-size: 3rem; }
    .home-book__hint { font-size: .85rem; }

    .home-card { padding: 1.15rem 1.1rem; }

    .home-step { padding: 1rem 1rem 1rem 3.5rem; }
    .home-step::before {
        left: .85rem;
        width: 1.9rem;
        height: 1.9rem;
        font-size: .88rem;
    }

    .home-cta { padding: 1.5rem 1.1rem; }

    .btn { width: 100%; }

    .page { padding: .75rem; }
    .card__lemma { font-size: 1.2rem; }

    .grid { grid-template-columns: 1fr; gap: .75rem; }

    .dictionary { padding: var(--space-4) var(--space-3); }
    .search__input { padding-left: 2.4rem; }
    .alphabet__letter { min-width: 2rem; height: 2rem; }

    .letter-page { padding: var(--space-4) var(--space-3); }

    .word { padding: var(--space-4) var(--space-3); }
    .word__section--examples,
    .word__section--history { padding: 14px; }
    .word__prose--examples p { padding-left: 10px; }
    .word__prose { font-size: .95rem; }

    .chips__link,
    .chips__text { font-size: .9rem; padding: .3rem .7rem; }
}

/* ---------- 14. УМЕНЬШЕННАЯ АНИМАЦИЯ ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }

    .home-card:hover,
    .btn:hover,
    .home-faq details,
    .home-footer a,
    .results__link:hover,
    .letter-page__link:hover,
    .alphabet__letter:hover,
    .chips--synonym .chips__link:hover {
        transform: none;
    }
}