/* 
Looking for css to "borrow"? 
I hate css.
*/
html {
    scroll-behavior: smooth;
}

:root {
    --bg: #fcfbf9;
    --text: #222222;
    --accent: #2e5c38;
    --accent-hover: #1e3d25;
    --border: #e0ded8;
    --card: #ffffff;
    --moderated: #757575;
    --danger: #d32f2f;
    --header-bg: #1f3322;
    --footer-bg: #19291b;
    color-scheme: light;
    scrollbar-color: var(--border) transparent;
    /*scrollbar-width: thin;*/
}

[data-theme="dark"] {
    --bg: #121512;
    --text: #e2e8e0;
    --accent: #52b76a;
    --accent-hover: #75d48b;
    --border: #283328;
    --card: #181f18;
    --moderated: #9ca3af;
    --header-bg: #0c120c;
    --footer-bg: #090d09;
    color-scheme: dark;
    scrollbar-color: #384538 transparent;
}

*, *::before, *::after {
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.g-recaptcha {
    color-scheme: light;
    width: 302px;
    height: 76px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.15s ease, color 0.15s ease;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2.5px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:visited {
    color: var(--accent);
}

a:hover, a:focus {
    color: var(--accent-hover);
    text-decoration-thickness: 2px;
}

header a, 
.nav-btn, 
.nav-link, 
.btn, 
.btn-sm, 
.btn-act,
.card-btn,
.folder-link {
    text-decoration: none !important;
}

header, .editor-header {
    background: var(--header-bg);
    color: #fff;
    padding: 0.65rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    z-index: 1000;
}

header a, .editor-header a { 
    color: #fff; 
}

.brand {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 1;
}

header nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}
.theme-toggle-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: none;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    padding: 0.35rem 0.45rem;
    align-items: center;
    justify-content: center;
}
.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.nav-link {
    color: #d8e5d6 !important;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}

.nav-user-badge {
    background: rgba(255, 255, 255, 0.14);
    color: #d1fae5;
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-user-badge svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff !important;
    padding: 0.38rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}
.nav-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.nav-btn-admin, .nav-btn-primary {
    background: var(--accent);
    border-color: #3b7648;
}
.nav-btn-admin:hover, .nav-btn-primary:hover {
    background: var(--accent-hover);
}

@media (max-width: 720px) {
    .brand {
        font-size: 0.95rem;
        max-width: 70%;
    }

    .nav-toggle {
        display: flex;
    }

    header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--header-bg);
        border-bottom: 2px solid var(--accent);
        box-shadow: 0 12px 25px rgba(0, 0, 0, 0.45);
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    header nav.open {
        display: flex;
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 0.5rem 0.75rem;
        width: 100%;
    }

    .theme-toggle-btn {
        width: 100%;
        height: 38px;
    }

    .nav-user-badge, .nav-btn {
        width: 100%;
        justify-content: center;
        padding: 0.55rem;
        font-size: 0.9rem;
    }

    .article-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

main { 
    flex: 1 0 auto;
    width: 100%;
    max-width: 960px; 
    margin: 2rem auto; 
    padding: 0 1.5rem; 
}

.wiki-content {
    font-size: 1.05rem;
}

.wiki-content::after {
    content: "";
    display: table;
    clear: both;
}

.wiki-crossref { 
    text-decoration: underline dotted !important; 
    color: var(--accent); 
    font-weight: 500;
}

.article-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.article-top-bar a.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    font-size: 0.95rem;
    line-height: 1;
}

.article-top-bar a.back-link svg {
    width: 0.82em;
    height: 0.82em;
    stroke-width: 3.2;
    flex-shrink: 0;
    position: relative;
    top: 0.04em;
    transition: transform 0.15s ease;
}

.article-top-bar a.back-link:hover svg {
    transform: translateX(-4px);
}
.btn-edit-page {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--card);
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}
.btn-edit-page:hover {
    background: var(--border);
}

.cite-ref a { 
    font-weight: bold; 
    text-decoration: none !important; 
    padding: 0 2px;
}
.wiki-references { 
    clear: both !important;
    margin-top: 2rem !important; 
    padding-top: 1rem !important; 
    border-top: 1px solid var(--border); 
    font-size: 0.9rem; 
}
.wiki-references ol { 
    padding-left: 1.5rem; 
}
.wiki-references .backref { 
    margin-left: 0.4rem; 
}

.wiki-figure,
.wiki-carousel {
    position: relative !important;
    padding: 0 !important;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    box-sizing: border-box;
}

.wiki-figure.align-right,
.wiki-carousel.align-right {
    float: right;
    clear: right;
    margin: 0.35rem 0 1.25rem 1.5rem;
}

.wiki-figure.align-left,
.wiki-carousel.align-left {
    float: left;
    clear: left;
    margin: 0.35rem 1.5rem 1.25rem 0;
}

.wiki-figure.align-center,
.wiki-carousel.align-center {
    display: block;
    width: 100%;
    margin: 1.5rem auto;
    clear: both;
}

.carousel-track {
    display: flex;
    align-items: flex-start;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.carousel-track::-webkit-scrollbar {
    display: none;
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    background: var(--card);
    border: none;
    scroll-snap-align: start;
}

.wiki-figure img,
.carousel-slide img {
    display: block !important;
    width: 100%;
    height: auto;
    max-height: 65vh;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
    border: none;
    background: transparent;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.figure-caption, 
.carousel-caption {
    display: block;
    margin: 0 !important;
    padding: 6px 10px !important;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text);
    background: var(--card);
    border-top: 1px solid var(--border);
    width: 100%;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: opacity 0.2s ease, transform 0.1s ease, background 0.1s ease;
    padding: 0;
    opacity: 1;
    visibility: visible;
}
.carousel-nav svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}
.carousel-nav:hover {
    background: var(--border);
    transform: translateY(-50%) scale(1.1);
}
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

.carousel-nav.disabled {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

@media (max-width: 640px) {
    .wiki-figure.align-right,
    .wiki-figure.align-left,
    .wiki-carousel.align-right,
    .wiki-carousel.align-left {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 1.25rem 0 !important;
        clear: both !important;
    }
}

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14, 18, 14, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    touch-action: none;
}
.lightbox-overlay.active { 
    display: flex; 
}

.lightbox-toolbar {
    width: 100%;
    padding: 0.65rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    z-index: 100001;
}

.lightbox-hint {
    font-size: 0.8rem;
    color: #bbb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lightbox-controls { 
    display: flex; 
    gap: 0.45rem; 
    align-items: center; 
}

.lb-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e5e5e5;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lb-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}
.lb-btn:hover { 
    background: rgba(255, 255, 255, 0.2); 
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.lb-btn-close {
    background: rgba(211, 47, 47, 0.18);
    border-color: rgba(211, 47, 47, 0.35);
    color: #f87171;
    margin-left: 0.25rem;
}
.lb-btn-close:hover {
    background: rgba(211, 47, 47, 0.35);
    border-color: #ef4444;
    color: #fff;
}

@media (max-width: 600px) {
    .lightbox-hint {
        display: none;
    }
}

.lightbox-stage {
    flex: 1;
    width: 100vw;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
}

.lightbox-img {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    transform-origin: center center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
    cursor: default;
    transition: opacity 0.25s ease-in, transform 0.1s ease-out;
}

.lightbox-stage.is-zoomed .lightbox-img {
    cursor: grab;
}
.lightbox-stage.dragging .lightbox-img {
    cursor: grabbing !important;
}

.lightbox-caption-bar {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    box-sizing: border-box;
    max-height: 15vh;
    overflow-y: auto;
}

.lightbox-stage.img-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: imgSpinner 0.7s linear infinite;
    z-index: 100005;
    pointer-events: none;
}

.lightbox-stage.img-loading .lightbox-img {
    opacity: 0;
    pointer-events: none;
}

.comments-section { 
    clear: both !important;
    margin-top: 2rem !important; 
    border-top: 1px solid var(--border); 
    padding-top: 1.25rem !important; 
}
.comment-card {
    background: var(--card);
    border-left: 2px solid var(--border);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    border-radius: 0 4px 4px 0;
}
.comment-card.moderated {
    background: var(--bg);
    border-left-color: var(--border);
    color: var(--moderated);
}
.comment-meta { 
    font-size: 0.85rem; 
    color: #888; 
    margin-bottom: 0.4rem; 
    display: flex; 
    gap: 0.5rem; 
    align-items: center; 
}
.comment-actions { 
    margin-top: 0.5rem; 
    font-size: 0.85rem; 
    display: flex; 
    gap: 1rem; 
}
.comment-actions button {
    background: none; 
    border: none; 
    padding: 0; 
    color: var(--accent); 
    cursor: pointer; 
    text-decoration: underline; 
    font-family: inherit; 
    font-size: 0.85rem;
}
.comment-actions .btn-mod { 
    color: var(--danger); 
}

.comment-thread { 
    margin-left: 1.25rem; 
}
.depth-clamped { 
    margin-left: 0.5rem; 
    border-left: 2px dashed var(--border); 
}

.field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.info-bubble-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.info-btn {
    background: var(--border);
    border: none;
    color: var(--text);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.speech-bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    width: 220px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    z-index: 100;
    pointer-events: none;
    font-weight: normal;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #111 transparent transparent transparent;
}
.info-bubble-wrap:hover .speech-bubble,
.info-bubble-wrap:focus-within .speech-bubble,
.info-bubble-wrap.active .speech-bubble {
    display: block;
}

.comment-form input, 
.comment-form textarea,
input[type="text"],
input[type="url"],
select,
textarea {
    width: 100%; 
    padding: 0.65rem; 
    margin-bottom: 0.75rem; 
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border); 
    border-radius: 4px; 
    font-family: inherit;
}

.btn { 
    background: var(--accent); 
    color: #fff !important;
    padding: 0.5rem 1.2rem; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 0.95rem; 
}
.btn-sm { 
    padding: 0.35rem 0.8rem; 
    font-size: 0.85rem; 
}
.btn-secondary { 
    background: var(--border); 
    color: var(--text) !important; 
}
.btn-danger { 
    background: var(--danger); 
    color: #fff !important; 
}

.alert { 
    padding: 0.75rem; 
    border-radius: 4px; 
    margin-bottom: 1rem; 
}
.alert-error { 
    background: rgba(211, 47, 47, 0.15); 
    color: #ef4444; 
    border: 1px solid rgba(211, 47, 47, 0.3);
}
.alert-success { 
    background: rgba(46, 125, 50, 0.15); 
    color: #4ade80; 
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.custom-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.custom-modal-backdrop.active { 
    display: flex; 
}
.custom-modal-box {
    background: var(--card);
    color: var(--text);
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.custom-modal-box h4 { 
    margin: 0 0 0.5rem 0; 
}
.custom-modal-box p { 
    margin: 0 0 1.25rem 0; 
    font-size: 0.9rem; 
    color: var(--text); 
    opacity: 0.85;
}
.custom-modal-actions { 
    display: flex; 
    justify-content: flex-end; 
    gap: 0.75rem; 
}

footer {
    background: var(--footer-bg);
    color: #c7d8c5;
    padding: 1.5rem 1.25rem;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
}

.footer-wrap {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.footer-wrap strong {
    color: #fff;
}
.footer-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.footer-contact a {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 500;
}

@media (max-width: 640px) {
    .footer-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

.search-bar-wrap {
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    gap: 0.5rem;
    margin: 1.5rem 0 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.search-bar-wrap svg {
    color: var(--accent);
    margin-left: 0.4rem;
    flex-shrink: 0;
}

.search-bar-wrap input {
    border: none !important;
    background: transparent !important;
    color: var(--text) !important;
    padding: 0.4rem 0.25rem !important;
    margin: 0 !important;
    flex: 1;
    outline: none !important;
    font-size: 0.95rem;
}

.search-result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    transition: transform 0.1s, border-color 0.1s;
}

.search-result-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.realm-pill {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: rgba(46, 125, 50, 0.15);
    color: var(--accent);
    letter-spacing: 0.5px;
}

.hub-header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent) !important;
    line-height: 1;
}

.hub-header-link svg {
    width: 0.82em;
    height: 0.82em;
    stroke-width: 3.2;
    flex-shrink: 0;
    position: relative;
    top: 0.04em;
    transition: transform 0.15s ease;
}

.hub-header-link:hover svg {
    transform: translateX(4px);
}

.wiki-infobox {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

.wiki-infobox.align-right {
    float: right;
    clear: right;
    margin: 0.35rem 0 1.25rem 1.5rem;
}
.wiki-infobox.align-left {
    float: left;
    clear: left;
    margin: 0.35rem 1.5rem 1.25rem 0;
}
.wiki-infobox.align-center {
    margin: 1.5rem auto;
    clear: both;
}

.infobox-title {
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.infobox-image {
    margin: 0;
    padding: 0.75rem;
    background: transparent;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}
.infobox-image img {
    max-width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: contain;
    border-radius: 3px;
    cursor: zoom-in;
    display: block;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    line-height: 1.45;
}
.infobox-table tr {
    border-bottom: 1px solid var(--border);
}
.infobox-table tr:last-child {
    border-bottom: none;
}
.infobox-table th {
    text-align: left;
    vertical-align: top;
    padding: 0.45rem 0.65rem;
    width: 38%;
    font-weight: 600;
    color: var(--text);
    background: rgba(0, 0, 0, 0.02);
}
.infobox-table td {
    vertical-align: top;
    padding: 0.45rem 0.65rem;
    color: var(--text);
}

@media (max-width: 640px) {
    .wiki-infobox.align-right,
    .wiki-infobox.align-left {
        float: none !important;
        width: 100% !important;
        margin: 1.5rem 0 !important;
    }
}

.wiki-infobox p, 
.wiki-carousel p, 
.wiki-figure p {
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
}

.infobox-title {
    margin: 0 !important;
    padding: 0.5rem 0.75rem !important;
}

.infobox-image {
    margin: 0 !important;
    padding: 0.4rem !important;
}

.img-loading {
    min-height: 160px;
    position: relative;
}

.img-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: imgSpinner 0.7s linear infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes imgSpinner {
    to { transform: rotate(360deg); }
}

.lightbox-trigger {
    opacity: 0;
    transition: opacity 0.25s ease-in;
}

.lightbox-trigger.loaded {
    opacity: 1;
}

@keyframes radiatingWave {
    0% {
        border-color: var(--accent);
        box-shadow: 0 0 0 0px color-mix(in srgb, var(--accent) 90%, transparent),
                    0 0 6px 1px var(--accent);
    }
    75% {
        box-shadow: 0 0 0 16px color-mix(in srgb, var(--accent) 0%, transparent),
                    0 0 14px 6px transparent;
    }
    100% {
        border-color: var(--accent);
        box-shadow: 0 0 0 20px transparent,
                    0 0 16px 8px transparent;
    }
}

.wiki-figure,
.wiki-carousel,
.infobox-image img {
    transition: border-color 0.2s ease;
}

.wiki-figure:hover,
.wiki-carousel:hover {
    border-color: var(--accent);
    animation: radiatingWave 1.3s infinite cubic-bezier(0.15, 0.85, 0.35, 1);
}

.infobox-image img:hover {
    border-radius: 4px;
    border-color: var(--accent);
    animation: radiatingWave 1.3s infinite cubic-bezier(0.15, 0.85, 0.35, 1);
}

@media (prefers-reduced-motion: reduce) {
    .wiki-figure:hover,
    .wiki-carousel:hover,
    .infobox-image img:hover {
        animation: none;
        box-shadow: 0 0 10px 2px color-mix(in srgb, var(--accent) 60%, transparent);
        border-color: var(--accent);
    }
}

.wiki-timeline {
    position: relative;
    margin: 2rem 0 2rem 0.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--accent);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.75rem;
}
.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-node {
    position: absolute;
    left: calc(-1.5rem - 7px);
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2.5px solid var(--accent);
    box-shadow: 0 0 0 3px var(--bg);
}

.timeline-date {
    display: inline-block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    background: rgba(46, 125, 50, 0.12);
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    margin-bottom: 0.35rem;
}

.timeline-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.wiki-doc-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1.25rem 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s, transform 0.1s;
}
.wiki-doc-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.doc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--accent);
    flex-shrink: 0;
}
.doc-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.doc-details {
    flex: 1;
    min-width: 0;
}

.doc-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(46, 125, 50, 0.12);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 0.2rem;
}

.doc-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    line-height: 1.35;
}

.doc-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text) !important;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none !important;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.doc-download-btn:hover {
    background: var(--border);
    border-color: var(--accent);
}
.doc-download-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

@media (max-width: 600px) {
    .wiki-doc-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .doc-download-btn {
        width: 100%;
        justify-content: center;
    }
}

.wiki-clear {
    clear: both !important;
    display: block !important;
    width: 100% !important;
    height: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0 !important;
    line-height: 0 !important;
}

.wiki-divider {
    clear: both !important;
    display: block !important;
    width: 100% !important;
    border: none !important;
    border-top: 1px solid var(--border) !important;
    margin: 2rem 0 !important;
    background: transparent !important;
}

.wiki-heading {
    position: relative;
    scroll-margin-top: 1.5rem;
}

.heading-anchor {
    display: inline-block;
    margin-left: 0.45rem;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--accent) !important;
    text-decoration: none !important;
    opacity: 0.35;
    padding: 0 0.3rem;
    border-radius: 3px;
    vertical-align: middle;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.wiki-heading:hover .heading-anchor,
.heading-anchor:focus {
    opacity: 1;
}

.heading-anchor:hover {
    background: rgba(46, 125, 50, 0.15);
}

.heading-anchor.copied {
    opacity: 1 !important;
    background: var(--accent) !important;
    color: #fff !important;
}

@media (max-width: 640px) {
    .heading-anchor {
        opacity: 0.6;
    }
}

.wiki-toc {
    display: table;
    min-width: 220px;
    max-width: 340px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1.5rem 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.toc-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.toc-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
}
.toc-toggle-btn:hover {
    text-decoration: underline;
}

.toc-body {
    display: block;
}
.toc-body.collapsed {
    display: none;
}

.toc-top-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-item {
    margin: 0.25rem 0;
    line-height: 1.35;
}

.toc-item a {
    font-size: 0.88rem;
    color: var(--accent);
    text-decoration: none;
}
.toc-item a:hover {
    text-decoration: underline;
}

.toc-level-2 {
    font-weight: 500;
}
.toc-level-3 {
    margin-left: 1.15rem;
    font-size: 0.82rem;
}
.toc-level-4 {
    margin-left: 2rem;
    font-size: 0.78rem;
}

@media (min-width: 1480px) {
    .wiki-toc {
        position: fixed;
        /* Force it way up near the top (just below the header) */
        top: 6rem; 
        
        /* Center it perfectly in the empty left-hand void */
        left: calc((100vw - 960px) / 4); 
        transform: translateX(-50%);
        
        width: 260px;
        margin: 0;
        /* Prevent it from clipping off the bottom if it gets too long */
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
        z-index: 10;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        scrollbar-width: thin;
    }

    /* Keep the TOC inline and normal while writing in the editor preview pane */
    .pane-preview .wiki-toc {
        position: static;
        transform: none;
        width: 100%;
        max-width: 340px;
        margin: 1.5rem 0;
        left: auto;
        top: auto;
        max-height: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    }
}