:root {
    --rl-panel: #2c2f38;
    --rl-panel-soft: rgba(0, 0, 0, 0.22);
    --rl-border: rgba(255, 255, 255, 0.07);
    --rl-border-strong: rgba(255, 255, 255, 0.12);
    --rl-text: #e7ebf3;
    --rl-text-muted: #9aa0ad;
    --rl-text-dim: #6e7280;
    --rl-accent: #48c388;
    --rl-accent-hover: #5cd29a;
    --rl-amber: #e5b878;
    --rl-radius: 14px;
    --rl-tracking: 0.18em;
    --rl-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.55);
}

.rules-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.rules-hero {
    position: relative;
    overflow: hidden;
    padding: 32px 32px 28px;
    background: var(--rl-panel);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    box-shadow: var(--rl-shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    isolation: isolate;
}
.rules-hero__number {
    position: absolute;
    z-index: 0;
    bottom: -22px;
    right: -8px;
    font-family: 'Open Sans', system-ui, sans-serif;
    font-size: 150px;
    font-weight: 800;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.045);
    pointer-events: none;
    user-select: none;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}
.rules-hero__top {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.rules-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: var(--rl-tracking);
    text-transform: uppercase;
    color: var(--rl-text-muted);
}
.rules-hero__eyebrow-rule {
    width: 22px;
    height: 1px;
    background: var(--rl-border-strong);
    flex-shrink: 0;
}
.rules-hero__title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--rl-text);
    letter-spacing: -0.5px;
}
.rules-hero__title em { font-style: normal; color: var(--rl-accent); }
.rules-hero__desc {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--rl-text-muted);
    max-width: 620px;
}

@media (max-width: 768px) {
    .rules-hero { padding: 22px 20px; gap: 10px; }
    .rules-hero__title { font-size: 22px; }
    .rules-hero__desc { font-size: 13px; }
    .rules-hero__number { font-size: 100px; bottom: -16px; right: -6px; }
}

/* === layout === */

.rules-layout {
    display: grid;
    grid-template-columns: minmax(230px, 0.32fr) 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) {
    .rules-layout { grid-template-columns: 1fr; }
}

/* === nav === */

.rules-nav {
    background: var(--rl-panel);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    box-shadow: var(--rl-shadow);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 16px;
}
.rules-nav__empty {
    padding: 16px;
    color: var(--rl-text-dim);
    font-size: 13px;
    text-align: center;
}

.rules-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--rl-text-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.rules-nav__link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--rl-text);
    text-decoration: none;
}
.rules-nav__link--active {
    background: rgba(72, 195, 136, 0.10);
    border-color: rgba(72, 195, 136, 0.30);
    color: var(--rl-accent);
}
.rules-nav__icon {
    flex-shrink: 0;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.rules-nav__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rules-nav__item--group > .rules-nav__link--toggle {
    justify-content: flex-start;
}
.rules-nav__caret {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--rl-text-dim);
    transition: transform 0.18s ease;
}
.rules-nav__item--open > .rules-nav__link--toggle .rules-nav__caret,
.rules-nav__item--group.rules-nav__item--expanded > .rules-nav__link--toggle .rules-nav__caret {
    transform: rotate(90deg);
}

.rules-nav__sub {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-left: 14px;
    margin: 2px 0 4px;
    border-left: 1px solid var(--rl-border-strong);
}
.rules-nav__item--open > .rules-nav__sub,
.rules-nav__item--expanded > .rules-nav__sub {
    display: flex;
}
.rules-nav__link--sub {
    font-size: 12.5px;
    padding: 9px 10px;
}

/* === content === */

.rules-content {
    background: var(--rl-panel);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    box-shadow: var(--rl-shadow);
    padding: 26px 28px;
    min-width: 0;
}
.rules-content__head {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--rl-border);
}
.rules-content__title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--rl-text);
    letter-spacing: -0.3px;
}
.rules-content__body {
    color: var(--rl-text-muted);
    font-size: 14px;
    line-height: 1.75;
}
.rules-content__body p { margin: 0 0 12px; }
.rules-content__body ol,
.rules-content__body ul {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rules-content__body ol { counter-reset: rules-counter; list-style: none; padding-left: 0; }
.rules-content__body ol > li {
    counter-increment: rules-counter;
    position: relative;
    padding-left: 34px;
    color: var(--rl-text-muted);
}
.rules-content__body ol > li::before {
    content: counter(rules-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(72, 195, 136, 0.10);
    border: 1px solid rgba(72, 195, 136, 0.30);
    color: var(--rl-accent);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rules-content__body ul > li { list-style: disc; color: var(--rl-text-muted); }
.rules-content__body strong:not([style*="color"]) { color: var(--rl-text); }
.rules-content__body a:not([style*="color"]) { color: var(--rl-amber); text-decoration: none; border-bottom: 1px dotted rgba(229, 184, 120, 0.4); }
.rules-content__body a:hover { color: var(--rl-accent); }
.rules-content__empty {
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--rl-border-strong);
    border-radius: 10px;
    color: var(--rl-text-dim);
    text-align: center;
}

@media (max-width: 768px) {
    .rules-content { padding: 20px; }
}
