.rules-page {
    width: 100%;
    padding: 18px 20px 28px;
}

/* PAGE TITLE */

.rules-heading {
    min-height: 58px;

    padding: 0 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    background: #0b1728;

    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 5px 5px 0 0;
}

.rules-heading h1 {
    margin: 0;

    color: #ffffff;

    font-size: 25px;
    font-weight: 700;
    line-height: 1;

    letter-spacing: -0.02em;
}

.rules-heading__section {
    color: var(--ffo-gold);

    font-size: 13px;
    line-height: 1;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* SEARCH */

.rules-search {
    width: 100%;

    padding: 14px 16px 16px;

    background: #0d1a2c;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-search__label {
    display: block;

    margin-bottom: 8px;

    color: var(--ffo-gold);

    font-size: 11px;
    line-height: 1;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rules-search__controls {
    width: 100%;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.rules-search__input {
    width: 100%;
    height: 46px;

    padding: 0 14px;

    appearance: none;

    background: #07111f;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 4px;

    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    outline: none;
}

.rules-search__input::placeholder {
    color: #7f8aa0;
}

.rules-search__input:focus {
    border-color: rgba(240, 197, 69, 0.62);
}

.rules-search__clear {
    height: 46px;

    padding: 0 14px;

    background: #162b6f;
    border: 0;
    border-radius: 4px;

    color: #ffffff;

    font-family: inherit;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;

    text-transform: uppercase;

    cursor: pointer;
}

.rules-search__clear:hover,
.rules-search__clear:focus-visible {
    background: #1c3689;
}

/* SECTION GRID */

.rules-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;

    padding: 12px;

    background: #07111f;

    border-radius: 0 0 5px 5px;
}

.rules-grid__item {
    position: relative;

    min-width: 0;
    min-height: 152px;

    display: flex;
    align-items: center;

    padding: 18px 17px;

    background: #0b1728;
    border-left: 3px solid transparent;
    border-radius: 4px;

    color: #dce4f2;

    text-decoration: none;
}

a.rules-grid__item {
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease;
}

a.rules-grid__item:hover,
a.rules-grid__item:focus-visible {
    background: #101d31;
    border-left-color: var(--ffo-gold);

    color: #ffffff;

    outline: none;
}

.rules-grid__item[hidden] {
    display: none;
}

.rules-grid__title {
    display: block;

    color: inherit;

    font-size: 17px;
    line-height: 1.25;
    font-weight: 800;
}

.rules-empty {
    min-height: 110px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: #07111f;
    border-radius: 0 0 5px 5px;

    color: #aeb8cc;

    font-size: 13px;
    line-height: 1.3;
    font-weight: 700;
    text-align: center;
}

.rules-empty[hidden] {
    display: none;
}

/* INDIVIDUAL RULE SECTION */

.rules-section-nav {
    min-height: 46px;

    display: flex;
    align-items: center;

    padding: 0 16px;

    background: #0d1a2c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-section-nav__back {
    min-height: 30px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 11px;

    background: #162b6f;
    border-radius: 3px;

    color: #ffffff;

    font-size: 10px;
    line-height: 1;
    font-weight: 900;
    text-decoration: none;
    text-transform: uppercase;
}

.rules-section-nav__back:hover,
.rules-section-nav__back:focus-visible {
    background: #1c3689;
    color: #ffffff;
}

.rules-content {
    width: 100%;

    background: #07111f;
    border-radius: 0 0 5px 5px;
}

.rules-content__header {
    min-height: 66px;

    display: flex;
    align-items: center;

    padding: 0 18px;

    background: #101d31;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-content__header h2 {
    margin: 0;

    color: var(--ffo-gold);

    font-size: 22px;
    line-height: 1.1;
    font-weight: 900;
}

.rules-content__body {
    padding: 18px;

    color: #dce4f2;

    font-size: 14px;
    line-height: 1.6;
}

.rules-content__body > p:first-child {
    margin-top: 0;
}

.rules-content__body p {
    margin: 12px 0;
}

.rules-content__body ul,
.rules-content__body ol {
    margin: 10px 0 0;
    padding-left: 24px;
}

.rules-content__body li {
    margin: 7px 0;
}

.rules-callout,
.rules-subsection {
    margin-top: 16px;
    padding: 15px 16px;

    background: #0b1728;
    border-radius: 4px;
}

.rules-callout {
    border-left: 3px solid var(--ffo-gold);
}

.rules-callout h3,
.rules-subsection h3 {
    margin: 0 0 10px;

    color: #ffffff;

    font-size: 15px;
    line-height: 1.35;
    font-weight: 900;
}

.rules-subsection h3:not(:first-child) {
    margin-top: 18px;
}

.rules-table-wrap {
    width: 100%;

    margin: 12px 0 16px;

    overflow: hidden;

    background: #07111f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.rules-table {
    width: 100%;

    border-collapse: collapse;
}

.rules-table th,
.rules-table td {
    padding: 10px 12px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.07);

    text-align: left;
}

.rules-table th {
    background: #101d31;

    color: var(--ffo-gold);

    font-size: 10px;
    line-height: 1;
    font-weight: 900;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rules-table td {
    color: #dce4f2;

    font-size: 13px;
    line-height: 1.3;
    font-weight: 700;
}

.rules-table tbody tr:last-child td {
    border-bottom: 0;
}

/* TACTICS MATRIX */

.tactics-matrix__guide {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
    gap: 12px;
    margin: 16px 0;
    padding: 18px;
    background: linear-gradient(135deg, #101d31 0%, #0b1728 100%);
    border: 1px solid rgba(240, 197, 69, 0.28);
    border-left: 4px solid var(--ffo-gold);
    border-radius: 5px;
}

.tactics-matrix__guide h3,
.tactics-matrix__section-heading h3 {
    margin: 4px 0 8px;
    color: #ffffff;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 900;
}

.tactics-matrix__guide p,
.tactics-matrix__section-heading p {
    margin: 0;
    color: #aeb8cc;
}

.tactics-matrix__eyebrow {
    color: var(--ffo-gold);
    font-size: 10px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tactics-matrix__example {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 14px;
    background: #07111f;
    border-radius: 4px;
}

.tactics-matrix__example span {
    color: var(--ffo-gold);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.tactics-matrix__example strong {
    color: #ffffff;
    font-size: 13px;
}

.tactics-matrix__example code {
    color: #dce4f2;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    white-space: nowrap;
}

.tactics-matrix__codes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.tactics-matrix__code {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    background: #07111f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.tactics-matrix__code strong,
.tactics-matrix__card > header strong,
.tactics-matchups__item strong {
    color: var(--ffo-gold);
}

.tactics-matrix__code strong {
    width: 26px;
    flex: 0 0 26px;
    font-size: 17px;
    text-align: center;
}

.tactics-matrix__code span {
    min-width: 0;
    color: #dce4f2;
    font-size: 12px;
    font-weight: 800;
}

.tactics-matrix__note {
    color: #aeb8cc;
    font-size: 12px;
}

.tactics-matrix__section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
}

.tactics-matrix__section-heading h3 {
    margin-bottom: 0;
}

.tactics-matrix__section-heading > p {
    max-width: 470px;
    font-size: 12px;
    text-align: right;
}

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

.tactics-matrix__card {
    min-width: 0;
    overflow: hidden;
    background: #07111f;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 5px;
}

.tactics-matrix__card > header {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    background: #101d31;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tactics-matrix__card > header strong {
    min-width: 34px;
    font-size: 20px;
    line-height: 1;
}

.tactics-matrix__card > header span {
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tactics-matrix__table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tactics-matrix__table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.tactics-matrix__table th,
.tactics-matrix__table td {
    padding: 9px 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.tactics-matrix__table th:last-child,
.tactics-matrix__table td:last-child {
    border-right: 0;
}

.tactics-matrix__table tbody tr:last-child th,
.tactics-matrix__table tbody tr:last-child td {
    border-bottom: 0;
}

.tactics-matrix__table thead th {
    background: #0d1a2c;
    color: #8f9aaf;
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tactics-matrix__table tbody th {
    width: 28%;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
}

.tactics-matrix__value {
    color: #aeb8cc;
    font-size: 11px;
    font-weight: 800;
}

.tactics-matrix__value--zero {
    color: #5f6b7f;
}

.tactics-matrix__value--full {
    color: #ffffff;
}

.tactics-matrix__value--boost {
    background: rgba(240, 197, 69, 0.09);
    color: var(--ffo-gold);
}

.tactics-matrix__value--reduction {
    background: rgba(239, 83, 80, 0.09);
    color: #ff8a87;
}

.tactics-matchups {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 14px;
}

.tactics-matchups__item {
    min-width: 0;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 8px;
    padding: 10px;
    background: #07111f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.tactics-matchups__item strong {
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 19px;
}

.tactics-matchups__item span {
    color: #8f9aaf;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.tactics-matchups__item b {
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 0.06em;
}

.tactics-matchups__item--none {
    opacity: 0.72;
}

@media (max-width: 820px) {
    .tactics-matrix__guide,
    .tactics-matrix__cards {
        grid-template-columns: 1fr;
    }

    .tactics-matrix__codes,
    .tactics-matchups {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tactics-matrix__section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .tactics-matrix__section-heading > p {
        text-align: left;
    }
}

@media (max-width: 520px) {
    .rules-page {
        padding-right: 10px;
        padding-left: 10px;
    }

    .rules-content__body {
        padding: 12px;
    }

    .tactics-matrix__guide {
        padding: 14px;
    }

    .tactics-matrix__example {
        overflow-x: auto;
    }

    .tactics-matrix__codes,
    .tactics-matchups {
        grid-template-columns: 1fr;
    }
}
