*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

.rules-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--main-font);
    color: #fff;
    background:
        radial-gradient(55% 45% at 50% 0%, rgba(2, 207, 92, 0.14), rgba(5, 5, 9, 0) 65%),
        radial-gradient(28% 24% at 15% 20%, rgba(2, 207, 92, 0.06), rgba(5, 5, 9, 0) 70%),
        radial-gradient(20% 18% at 85% 16%, rgba(2, 207, 92, 0.05), rgba(5, 5, 9, 0) 70%),
        #050509;
    padding-top: 96px;
    overflow-x: hidden;
}

.rules-body footer,
.rules-body .footer,
.rules-body .site-footer {
    margin-top: auto;
}

.rules-body ::selection {
    background: rgba(2, 207, 92, 0.24);
    color: #fff;
}

.rules-wrapper {
    width: 100%;
    flex: 1 0 auto;
}

.rules-hero {
    position: relative;
    width: min(1380px, calc(100% - 40px));
    margin: 0 auto;
    padding: 26px 0 18px;
}

.rules-hero::before {
    content: "";
    position: absolute;
    inset: 26px 0 18px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.01)),
        rgba(10, 10, 12, 0.74);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 22px 70px rgba(0, 0, 0, 0.58),
        inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
}

.rules-hero::after {
    content: "";
    position: absolute;
    inset: 26px 0 18px;
    border-radius: 28px;
    background:
        radial-gradient(65% 90% at 50% 0%, rgba(2, 207, 92, 0.15), rgba(2, 207, 92, 0) 60%);
    pointer-events: none;
}

.rules-hero-top,
.rules-stickybar {
    position: relative;
    z-index: 1;
}

.rules-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 56px 56px 10px;
}

.rules-hero-text {
    max-width: 820px;
}

.rules-kicker {
    margin: 0 0 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(2, 207, 92, 0.98);
    background: rgba(2, 207, 92, 0.10);
    border: 1px solid rgba(2, 207, 92, 0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.rules-title {
    margin: 0;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: 0.98;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    text-shadow: 0 18px 50px rgba(0,0,0,0.7);
    background: linear-gradient(90deg, #ffffff 0%, #d8ffe8 55%, #88f7b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.rules-lead {
    margin: 18px 0 0;
    max-width: 760px;
    font-size: 1rem;
    line-height: 1.85;
    color: rgba(255,255,255,0.76);
}

.rules-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    flex-shrink: 0;
}

.rules-type-switch {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 10px;
    border-radius: 18px;
    background: rgba(9, 10, 13, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.03),
        0 16px 36px rgba(0,0,0,0.4);
}

.rules-type-btn,
.rules-admin-btn,
.rules-chip,
.rule-edit-btn,
.rule-delete-btn,
.category-delete-btn {
    appearance: none;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.84);
    border-radius: 14px;
    min-height: 44px;
    padding: 0 16px;
    font-family: var(--main-font);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.rules-type-btn:hover,
.rules-admin-btn:hover,
.rules-chip:hover,
.rule-edit-btn:hover,
.rule-delete-btn:hover,
.category-delete-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(2, 207, 92, 0.22);
    color: #fff;
    box-shadow: 0 18px 45px rgba(0,0,0,0.45);
}

.rules-type-btn.is-active,
.rules-chip.is-active,
.rules-admin-btn {
    background: linear-gradient(135deg, #02cf5c, #019643);
    border-color: rgba(2, 207, 92, 0.42);
    box-shadow:
        0 12px 28px rgba(2, 207, 92, 0.18),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.rules-stickybar {
    margin: 24px 56px 24px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(8, 9, 12, 0.68);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.03),
        0 18px 42px rgba(0,0,0,0.42);
}

.rules-stickybar-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

.rules-stickybar-title {
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.9);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding-top: 8px;
}

.rules-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #02cf5c;
    box-shadow: 0 0 18px rgba(2, 207, 92, 0.55);
}

.rules-quicknav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
}

.rules-chip {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    text-transform: none;
    color: rgba(255,255,255,0.76);
}

.rules-chip.is-active {
    color: #04140a;
}

#rulesContent {
    width: min(1380px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 60px;
}

.rules-empty {
    padding: 34px 24px;
    border-radius: 22px;
    text-align: center;
    background: rgba(10,10,12,0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.36);
}

.rules-empty h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.rules-empty p {
    margin: 0 0 18px;
    color: rgba(255,255,255,0.65);
    line-height: 1.8;
}

.rules-grid {
    display: grid;
    gap: 26px;
}

.rules-section {
    position: relative;
    border-radius: 26px;
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)),
        rgba(10, 10, 12, 0.74);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 22px 70px rgba(0,0,0,0.44),
        inset 0 1px 0 rgba(255,255,255,0.03);
    overflow: hidden;
}

.rules-section::before {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(2,207,92,0), rgba(2,207,92,0.7), rgba(2,207,92,0));
    opacity: 0.55;
}

.rules-sectionTop {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.rules-sectionLeft {
    max-width: 820px;
}

.rules-sectionTitle {
    margin: 0;
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #fff;
}

.rules-sectionDesc {
    margin: 10px 0 0;
    font-size: 0.96rem;
    line-height: 1.85;
    color: rgba(255,255,255,0.70);
}

.rules-sectionRight {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.rules-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
    font-size: 0.82rem;
    font-weight: 800;
}

.rules-card-admin {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.category-delete-form,
.rule-delete-form {
    margin: 0;
}

.category-delete-btn,
.rule-delete-btn {
    background: rgba(220,78,78,0.14);
    border-color: rgba(220,78,78,0.26);
    color: #fff;
}

.rule-edit-btn,
.category-edit-btn {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.rules-card {
    border-radius: 22px;
    background: rgba(7, 8, 11, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.03),
        0 16px 40px rgba(0,0,0,0.34);
    overflow: hidden;
}

.rules-card-empty {
    padding: 22px 20px;
    color: rgba(255,255,255,0.65);
    font-size: 0.94rem;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rule-item {
    position: relative;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.rule-item:first-child {
    border-top: 0;
}

.rule-item:hover {
    background: rgba(255,255,255,0.018);
}

.rule-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.rule-main-text,
.rule-text {
    min-width: 0;
    flex: 1;
}

.rule-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(2, 207, 92, 0.10);
    border: 1px solid rgba(2, 207, 92, 0.16);
    color: rgba(2, 207, 92, 0.96);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.rule-content {
    display: block;
    color: rgba(255,255,255,0.84);
    font-size: 0.97rem;
    line-height: 1.9;
    word-break: break-word;
}

.rule-content strong {
    color: #fff;
    font-weight: 900;
}

.rule-content em {
    color: rgba(255,255,255,0.92);
}

.rule-content u {
    text-decoration-color: rgba(2, 207, 92, 0.55);
    text-underline-offset: 3px;
}

.rule-inline-code {
    display: inline-block;
    margin: 0 2px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    color: #d8ffe8;
    font-size: 0.88em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.rule-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.rule-note {
    margin-top: 16px;
    padding: 18px 18px 16px;
    border-radius: 18px;
    background:
        radial-gradient(70% 120% at 0% 0%, rgba(2,207,92,0.12), rgba(2,207,92,0) 45%),
        rgba(8, 9, 12, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 16px 36px rgba(0,0,0,0.34);
}

.rule-note-kicker {
    margin-bottom: 8px;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(2, 207, 92, 0.95);
}

.rule-note-text {
    color: rgba(255,255,255,0.76);
    font-size: 0.95rem;
    line-height: 1.85;
}

.rules-admin-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.rules-admin-modal.open {
    display: block;
}

.rules-admin-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(55% 55% at 50% 8%, rgba(2,207,92,0.18), rgba(5,5,9,0) 58%),
        rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rules-admin-dialog {
    position: relative;
    width: min(940px, calc(100% - 36px));
    margin: 92px auto 28px;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(10, 10, 12, 0.90);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.rules-admin-dialog::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 12px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(2, 207, 92, 0.95), rgba(1, 150, 67, 0.15));
    opacity: 0.55;
}

.rules-admin-header {
    padding: 18px 18px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rules-admin-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #fff;
}

.rules-admin-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.82);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.rules-admin-close:hover {
    background: rgba(2,207,92,0.14);
    border-color: rgba(2,207,92,0.40);
    box-shadow: 0 0 16px rgba(2,207,92,0.18);
    transform: translateY(-1px);
}

.rules-admin-tabs {
    padding: 0 18px 12px;
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rules-admin-tab {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.03);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.rules-admin-tab:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.16);
}

.rules-admin-tab-active {
    background: linear-gradient(135deg, #02cf5c, #019643);
    border-color: rgba(2, 207, 92, 0.40);
    box-shadow: 0 0 0 1px rgba(2, 207, 92, 0.10) inset;
}

.rules-admin-body {
    padding: 0 18px 18px;
    overflow: auto;
}

.rules-admin-body::-webkit-scrollbar {
    width: 10px;
}

.rules-admin-body::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.25);
}

.rules-admin-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.10);
    border-radius: 999px;
    border: 2px solid rgba(10,10,12,0.86);
}

.rules-admin-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.16);
}

.rules-admin-panel {
    display: none;
}

.rules-admin-panel-active {
    display: block;
}

.rules-admin-panel form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rules-admin-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rules-admin-field label {
    font-size: 0.82rem;
    font-weight: 800;
    color: rgba(255,255,255,0.8);
}

.rules-admin-field input,
.rules-admin-field select,
.rules-admin-field textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.92);
    padding: 12px 12px;
    outline: none;
    font-family: var(--main-font);
}

.rules-admin-field input[type="file"] {
    padding: 10px 12px;
}

.rules-admin-field textarea {
    resize: vertical;
    min-height: 110px;
}

.rules-admin-field input:focus,
.rules-admin-field select:focus,
.rules-admin-field textarea:focus {
    border-color: rgba(2,207,92,0.24);
    box-shadow: 0 0 0 3px rgba(2,207,92,0.08);
}

.rules-admin-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
}

.rules-admin-submit {
    appearance: none;
    border: 1px solid rgba(2,207,92,0.3);
    cursor: pointer;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    font-family: var(--main-font);
    font-size: 0.82rem;
    font-weight: 900;
    color: #FFFFFFE0;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #02cf5c, #019643);
    box-shadow: 0 14px 30px rgba(2,207,92,0.2);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.rules-admin-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.icon-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

.icon-choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 72px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    overflow: hidden;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.icon-choice:hover {
    transform: translateY(-1px);
    border-color: rgba(2,207,92,0.22);
    box-shadow: 0 18px 40px rgba(0,0,0,0.34);
}

.icon-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.icon-choice span {
    color: rgba(255,255,255,0.78);
    font-size: 0.8rem;
    font-weight: 800;
}

.icon-choice img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.icon-choice:has(input:checked) {
    border-color: rgba(2,207,92,0.3);
    background: rgba(2,207,92,0.10);
    box-shadow: 0 0 0 1px rgba(2,207,92,0.12) inset;
}

@media (max-width: 1100px) {
    .rules-hero-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .rules-hero-actions {
        width: 100%;
        align-items: flex-start;
    }

    .rules-type-switch {
        justify-content: flex-start;
    }

    .rules-stickybar-inner {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .rules-quicknav {
        justify-content: flex-start;
        width: 100%;
    }

    .rules-sectionTop {
        flex-direction: column;
        align-items: flex-start;
    }

    .rules-sectionRight {
        width: 100%;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .rules-body {
        padding-top: 88px;
    }

    .rules-hero,
    #rulesContent {
        width: min(100% - 24px, 1240px);
    }

    .rules-hero-top {
        padding: 28px 18px 10px;
    }

    .rules-stickybar {
        margin: 18px 18px 0;
        padding: 12px;
    }

    .rules-section {
        padding: 18px;
        border-radius: 20px;
    }

    .rule-item {
        padding: 18px;
    }

    .rule-main {
        flex-direction: column;
    }

    .rule-actions {
        width: 100%;
    }

    .rules-admin-dialog {
        width: min(100% - 16px, 940px);
        margin: 72px auto 16px;
        max-height: calc(100vh - 88px);
    }
}

@media (max-width: 520px) {
    .rules-kicker {
        font-size: 0.7rem;
        letter-spacing: 0.12em;
    }

    .rules-title {
        line-height: 1.02;
    }

    .rules-type-switch,
    .rules-quicknav {
        width: 100%;
    }

    .rules-type-btn,
    .rules-chip,
    .rules-admin-btn,
    .rule-edit-btn,
    .rule-delete-btn,
    .category-delete-btn,
    .rules-admin-submit {
        width: 100%;
    }

    .rules-card-admin,
    .rule-actions,
    .rules-admin-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .rules-count-pill {
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}