.rules-page {
    --rules-accent: #4ba75b;
    --rules-accent-dark: #347d42;
    --rules-accent-soft: #eef8f0;
    --rules-border: #dce8de;
    --rules-text-muted: #627067;
    margin: 0 auto;
    padding-bottom: 48px;
}

html {
    scroll-behavior: smooth;
}

.rules-toc {
    margin: 0 0 48px;
    padding: clamp(18px, 2.5vw, 28px);
    border: 1px solid var(--rules-border);
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fcf8 0%, var(--rules-accent-soft) 100%);
}

.rules-toc__title {
    margin: 0 0 18px;
    color: #202820;
    font-size: clamp(18px, 1.5vw, 20px);
    font-weight: 400;
    line-height: 1.35;
}

.rules-toc__title::before,
.rules-toc__title::after {
    display: none;
    content: none;
}

.rules-toc__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rules-toc__link {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    gap: 10px;
    align-items: center;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #fff;
    color: #273029;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(42, 83, 49, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rules-toc__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--rules-accent-soft);
    color: var(--rules-accent-dark);
    font-size: 14px;
    font-weight: 700;
}

.rules-toc__arrow {
    color: var(--rules-accent);
    font-size: 20px;
    line-height: 1;
}

.rules-toc__link:hover {
    border-color: #b8d8be;
    color: var(--rules-accent-dark);
    box-shadow: 0 7px 20px rgba(42, 83, 49, 0.11);
    transform: translateY(-2px);
}

.rules-toc__link:focus-visible,
.rules-section__back:focus-visible {
    outline: 3px solid rgba(75, 167, 91, 0.35);
    outline-offset: 3px;
}

.rules-content {
    width: 100%;
    max-width: none;
}

.rules-section {
    width: 100%;
    padding: 0 0 38px;
    margin: 0 0 38px;
    border-bottom: 1px solid var(--rules-border);
    scroll-margin-top: 110px;
}

.rules-section:last-child {
    margin-bottom: 24px;
}

.rules-section__title {
    display: block;
    margin: 0 0 18px;
    color: #202820;
    font-size: clamp(18px, 1.7vw, 22px);
    font-weight: 600;
    line-height: 1.35;
}

.rules-section__title::before {
    content: attr(data-section);
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    border-radius: 9px;
    background: var(--rules-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transform: none;
    vertical-align: middle;
}

.rules-section p {
    max-width: none;
    margin-top: 0;
    margin-bottom: 14px;
    line-height: 1.65;
}

.rules-section ol,
.rules-section ul {
    max-width: none;
}

.rules-section__back {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    margin-top: 10px;
    color: var(--rules-accent-dark);
    font-weight: 600;
    text-decoration: none;
}

.rules-section__back:hover {
    color: #225c2d;
    text-decoration: underline;
}

.rules-signature {
    width: 100%;
    max-width: none;
    padding: 22px 24px;
    border-left: 4px solid var(--rules-accent);
    background: var(--rules-accent-soft);
}

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

@media (max-width: 767px) {
    .rules-page {
        padding-bottom: 32px;
    }

    .rules-toc {
        margin-right: -15px;
        margin-left: -15px;
        padding: 20px 15px 22px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .rules-toc__list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding: 2px 15px 12px 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .rules-toc__item {
        flex: 0 0 min(78vw, 270px);
        scroll-snap-align: start;
    }

    .rules-toc__link {
        height: 100%;
    }

    .rules-section {
        padding-bottom: 30px;
        margin-bottom: 30px;
        scroll-margin-top: 76px;
    }

    .rules-section__title {
        line-height: 1.25;
    }

    .rules-section__title::before {
        width: 30px;
        height: 30px;
        margin-right: 9px;
        border-radius: 8px;
        font-size: 13px;
    }

    .rules-section p {
        line-height: 1.58;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .rules-toc__link {
        transition: none;
    }
}
