body.wiki-page main.rules-layout {
    max-width: 1600px;
    width: 100%;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    padding: 24px;
    align-items: stretch;
}

body.wiki-page .rules-sidebar {
    position: sticky;
    top: 88px;
    height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.wiki-page .rules-sidebar .sliced-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
}

body.wiki-page .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
}

body.wiki-page .rules-content {
    min-width: 0;
    overflow-wrap: anywhere;
    display: flex;
    flex-direction: column;
}

body.wiki-page .rules-content .sliced-inner {
    min-height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
    flex: 1;
}

body.wiki-page .scrollable-inner {
    padding: 40px;
    padding-bottom: 60px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

body.wiki-page .sidebar-header {
    padding: 20px 20px 0 20px;
}

.wiki-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 14px;
    transition: color 0.2s;
}
.wiki-back:hover { color: var(--accent); }

.wiki-search {
    width: 100%;
    background: #1c1c1c;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.wiki-search:focus { border-color: var(--accent); }
.wiki-search::placeholder { color: #666; }

.nav-group-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 6px;
    margin-top: 12px;
    border-radius: 2px;
    transition: background 0.2s, color 0.2s;
    user-select: none;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}
.nav-group-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-group-toggle svg {
    transition: transform 0.2s;
    color: var(--muted);
    flex-shrink: 0;
}
.nav-group-toggle:hover svg { color: var(--accent); }

.nav-link.nav-sub {
    padding-left: 24px;
    font-size: 12px;
}

.nav-empty {
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
}

.search-result {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
}

.search-result-title {
    font-size: 13px;
    line-height: 1.35;
}

.search-result-section {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-snippet {
    font-size: 11.5px;
    color: #aaa;
    line-height: 1.45;
}

.search-result-snippet mark {
    background: rgba(232, 105, 58, 0.35);
    color: #fff;
    padding: 0 1px;
}

.wiki-welcome { padding: 0; }

.wiki-hero-wrapper {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 32px;
    align-items: stretch;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.wiki-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wiki-hero h1 {
    font-size: 36px;
    font-weight: 600;
    margin: 0 0 14px;
    letter-spacing: -0.8px;
    line-height: 1.1;
}
.wiki-hero h1 span { color: var(--accent); }

.wiki-hero-desc {
    color: #bbb;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 24px;
    max-width: 620px;
}

.wiki-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.wiki-hero-actions .btn {
    font-size: 12px;
    padding: 11px 20px;
    letter-spacing: 0.5px;
}

.wiki-hero-address {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    font-family: var(--font-mono);
}
.wiki-hero-address code {
    color: var(--accent);
    background: #222;
    padding: 2px 8px;
    border: 1px solid #333;
    font-family: var(--font-mono);
    font-size: 12px;
}

.wiki-notice {
    background: rgba(232, 105, 58, 0.06);
    border: 1px solid rgba(232, 105, 58, 0.3);
    border-left: 3px solid var(--accent);
    padding: 24px;
    color: #ccc;
    font-size: 14px;
    line-height: 1.65;
    display: flex;
    align-items: center;
    margin: 0;
}
.wiki-notice strong { color: var(--text); }

.wiki-sections-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.wiki-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 0;
}

.wiki-card {
    min-height: 44px;
    background: #151515;
    border: 1px solid var(--border);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    color: inherit;
    font: inherit;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wiki-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.25s ease;
}

.wiki-card:hover {
    border-color: #444;
    transform: translateY(-2px);
    background: #181818;
}
.wiki-card:hover::before { transform: scaleY(1); }

.wiki-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(232, 105, 58, 0.08);
    border: 1px solid rgba(232, 105, 58, 0.25);
    color: var(--accent);
    margin-bottom: 14px;
    transition: all 0.2s;
}
.wiki-card:hover .wiki-card-icon {
    background: rgba(232, 105, 58, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(232, 105, 58, 0.15);
}

.wiki-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
    letter-spacing: -0.3px;
}

.wiki-card-desc {
    font-size: 13px;
    color: #999;
    margin: 0 0 14px;
    line-height: 1.5;
    flex: 1;
}

.wiki-card-count {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}
.wiki-card:hover .wiki-card-count { color: var(--accent); }

.wiki-article-top { margin-bottom: 14px; }
.wiki-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.2s;
}
.wiki-back-link:hover { color: var(--accent); }

.wiki-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #333;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.wiki-article-meta svg { color: var(--accent); }

.wiki-article {
    overflow-wrap: anywhere;
    animation: contentFadeIn 0.4s ease-out forwards;
    flex: 1;
}

.wiki-article h1.wiki-h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.5px;
}
.wiki-article h2.wiki-h2,
.wiki-article h3.wiki-h3 {
    scroll-margin-top: 72px;
}
.wiki-article p {
    color: #ccc;
    font-size: 15px;
    line-height: 1.75;
    margin: 0 0 16px;
}
.wiki-article strong { color: var(--text); }
.wiki-article em { color: #ddd; }

.wiki-article code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    background: #222;
    padding: 1px 6px;
    border: 1px solid #333;
}

.wiki-article a.wiki-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    transition: all 0.2s;
}
.wiki-article a.wiki-link:hover {
    color: var(--accent-hover);
    border-bottom-style: solid;
    text-shadow: 0 0 8px rgba(232, 105, 58, 0.4);
}
.wiki-article .wiki-link-internal {
    color: var(--accent);
    border-bottom: 1px dashed rgba(232, 105, 58, 0.4);
    padding: 0 2px;
    cursor: help;
}

.wiki-toc {
    display: block;
    width: 100%;
    background: #151515;
    border: 1px solid #2a2a2a;
    border-left: 3px solid var(--accent);
    margin: 0 0 24px;
}

.wiki-toc > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 12px 20px;
    list-style: none;
    cursor: pointer;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.wiki-toc > summary::-webkit-details-marker {
    display: none;
}

.wiki-toc > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s;
}

.wiki-toc[open] > summary::after {
    transform: rotate(-135deg);
}

.wiki-toc > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.wiki-toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px 24px;
    padding: 0 20px 16px;
}

.wiki-toc-group {
    min-width: 0;
}

.wiki-toc-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: #bbb;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.wiki-toc-link:hover {
    color: var(--accent);
}

.wiki-toc-h3 {
    padding-left: 16px;
    font-size: 12.5px;
}

.wiki-article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    gap: 16px;
}
.wiki-article-nav .btn {
    flex: 1;
    max-width: 48%;
    font-size: 13px;
    padding: 12px 16px;
    text-align: left;
    white-space: normal;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.wiki-article-nav .btn:last-child {
    text-align: right;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    body.wiki-page main.rules-layout {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    body.wiki-page .rules-sidebar {
        position: static;
        height: auto;
        overflow: visible;
    }
    body.wiki-page .rules-sidebar.sliced-wrapper {
        background: transparent;
        clip-path: none;
        padding: 0;
        border: none;
    }
    body.wiki-page .rules-sidebar .sliced-inner {
        clip-path: none;
        border: 1px solid var(--border);
        height: auto;
    }
    .wiki-nav-toggle > summary {
        clip-path: none;
        border: 1px solid var(--border);
        border-bottom: none;
    }
    .wiki-hero-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .wiki-cards {
        grid-template-columns: 1fr;
    }
    .wiki-hero h1 { font-size: 28px; }
    .wiki-hero-actions .btn { flex: 1; min-width: 140px; justify-content: center; }
    .wiki-article h1.wiki-h1 { font-size: 22px; }
    .wiki-article h2.wiki-h2 { font-size: 18px; }
    body.wiki-page .rules-sidebar > details > .sliced-inner {
        position: static;
    }
    body.wiki-page .rules-content .sliced-inner {
        min-height: 0;
    }
    .wiki-article-nav {
        margin-top: 40px;
        margin-bottom: 60px;
    }
}

.wiki-group.wiki-entity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    margin: 20px 0;
}

.wiki-entity {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 132px;
    min-height: 128px;
    padding: 12px 10px;
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #ccc;
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
}
.wiki-entity::before {
    content: attr(data-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(232, 105, 58, 0.08);
    border: 1px solid rgba(232, 105, 58, 0.25);
}
.wiki-entity::after {
    content: attr(data-note);
    display: block;
    margin-top: 6px;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wiki-nav-toggle {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.wiki-nav-toggle > summary {
    display: none;
}

.wiki-nav-toggle > summary::-webkit-details-marker {
    display: none;
}

.wiki-mini-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    min-height: 44px;
    margin: -8px 0 12px;
    padding: 0;
    background: rgba(21, 21, 21, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.wiki-mini-back {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 8px;
    background: none;
    border: 0;
    color: var(--accent);
    font: inherit;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
}

.wiki-mini-title {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.wiki-to-toc {
    position: sticky;
    bottom: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 44px;
    margin: -44px 0 0 auto;
    padding: 0 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
}

.wiki-to-toc.visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

@media (min-width: 901px) {
    .wiki-mini-bar {
        display: none;
    }
}

@media (max-width: 900px) {
    .wiki-search,
    .wiki-back,
    .wiki-back-link,
    .nav-group-toggle {
        min-height: 44px;
    }
    .wiki-mini-bar {
        top: 64px;
    }
    .wiki-nav-toggle {
        display: block;
        height: auto;
    }
    .wiki-nav-toggle > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        padding: 12px 16px;
        list-style: none;
        cursor: pointer;
        color: var(--accent);
        background: #151515;
        font-family: var(--font-mono);
        font-size: 12px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }
    .wiki-nav-toggle > summary::after {
        content: "";
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.2s;
    }
    .wiki-nav-toggle[open] > summary::after {
        transform: rotate(-135deg);
    }
    .wiki-nav-toggle > summary:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }
    body.wiki-page .rules-sidebar .sliced-inner {
        height: auto;
        max-height: 60vh;
    }
    .wiki-article-nav {
        flex-direction: column;
        align-items: stretch;
    }
    .wiki-article-nav .btn {
        width: 100%;
        max-width: none;
        text-align: left;
        justify-content: flex-start;
    }
    .wiki-article-nav .btn:last-child {
        text-align: left;
        justify-content: flex-start;
    }
    .wiki-article h2.wiki-h2,
    .wiki-article h3.wiki-h3 {
        scroll-margin-top: 120px;
    }
    .wiki-search {
        font-size: 16px;
    }
}

@media (max-width: 520px) {
    body.wiki-page .scrollable-inner {
        padding: 16px;
    }
    .wiki-article h1.wiki-h1 {
        font-size: 22px;
    }
    .wiki-article h2.wiki-h2 {
        font-size: 18px;
    }
    .wiki-article p {
        font-size: 15px;
        line-height: 1.7;
    }
    .wiki-group.wiki-entity-row {
        gap: 12px;
    }
    .wiki-entity {
        width: calc(50% - 6px);
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wiki-toc > summary::after,
    .wiki-nav-toggle > summary::after {
        transition: none !important;
    }
    .wiki-to-toc {
        transition: none !important;
    }
}

.wiki-toc > summary::marker,
.wiki-nav-toggle > summary::marker {
    content: "";
}

@media (hover: none) {
    .wiki-card:hover {
        transform: none;
    }
}

.wiki-mini-sep {
    color: var(--border);
}

@media (min-width: 901px) {
    body.wiki-page .rules-sidebar .wiki-nav-toggle > .sliced-inner {
        flex: 1;
        height: auto;
        min-height: 0;
    }
}
