* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    background-color: #050505;
    color: #c0c0c0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

body.is-corrupting {
    text-rendering: optimizeSpeed;
}

.intro-black-fade {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background-color: #000000;
    pointer-events: none;
    animation: blackFadeOut 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

@keyframes blackFadeOut {
    0% {
        opacity: 1;
        visibility: visible;
    }

    99% {
        opacity: 0;
        visibility: visible;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

.mirror-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: url('/worlds/resources/background/mirror-world/birthday1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.03);
    transition: transform 0.1s ease-out;
}

.wiki-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
}

.wiki-wrapper[inert] {
    pointer-events: none;
    user-select: none;
}

.wiki-panel,
.sidebar-panel,
.back-link {
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.wiki-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.back-link {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    transition: all 0.3s ease;
    background-color: rgba(10, 10, 12, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.back-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(10, 10, 12, 0.8);
}

.wiki-logo {
    font-size: 1.4rem;
    font-weight: 300;
    color: #fff;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.wiki-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    padding: 2rem 0 3rem 0;
    align-items: start;
}

.wiki-toc {
    position: sticky;
    top: 2rem;
    background-color: rgba(12, 12, 16, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toc-title {
    font-size: 0.85rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toc-list li a {
    display: block;
    padding: 0.4rem 0.8rem;
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.toc-list li a:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: #888;
}

.wiki-main {
    background-color: rgba(12, 12, 16, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.article-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.article-title {
    font-size: 2.5rem;
    font-weight: 300;
    color: #fff;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-tag {
    font-size: 0.9rem;
    padding: 0.2rem 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.05em;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.status-upcoming {
    background-color: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.4);
}

.status-active {
    background-color: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.status-ended {
    background-color: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
    border: 1px solid rgba(158, 158, 158, 0.4);
}

.article-subtitle {
    font-size: 1rem;
    color: #888;
}

.article-content h2 {
    font-size: 1.5rem;
    color: #ddd;
    font-weight: 400;
    margin: 2.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    scroll-margin-top: 2rem;
}

.article-content h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 1.2rem;
    background-color: #888;
    border-radius: 2px;
}

.article-content p {
    color: #bbb;
    font-size: 1rem;
    line-height: 1.9;
    margin-bottom: 1rem;
    text-align: justify;
}

.article-content ul {
    margin-bottom: 1.5rem;
    padding-left: 2.5rem;
    color: #bbb;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content a.link {
    color: #4a90e2;
    text-decoration: none;
}

.article-content a.link:hover {
    text-decoration: underline;
}

.article-content sup {
    line-height: 0;
}

.noise-trigger {
    color: #4a90e2;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    font-weight: bold;
    transition: all 0.3s ease;
}

.noise-trigger:hover {
    color: #66b1ff;
    text-decoration-style: solid;
}

.comments-section {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    scroll-margin-top: 2rem;
}

.comments-section h3 {
    font-size: 1.4rem;
    color: #ddd;
    font-weight: 400;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-section ol {
    list-style: none;
    padding-left: 0;
    counter-reset: comment-counter;
}

.comments-section li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.8rem;
    color: #bbb;
    font-size: 0.95rem;
    line-height: 1.6;
    counter-increment: comment-counter;
}

.comments-section li::before {
    content: counter(comment-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: #bbb;
}

.comment-backref {
    color: #4a90e2;
    text-decoration: none;
    margin-right: 0.4rem;
    font-weight: bold;
}

.comment-backref:hover {
    text-decoration: underline;
}

.wiki-tooltip {
    position: fixed;
    z-index: 9999;
    background-color: #f9f9f9;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: pre-wrap;
    /* 支持换行符 */
    text-align: left;
}

.wiki-tooltip.visible {
    opacity: 1;
}

.wiki-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #f9f9f9 transparent transparent transparent;
}

.wiki-tooltip.bottom::after {
    bottom: auto;
    top: -6px;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #f9f9f9 transparent;
}

.article-intro {
    position: relative;
    padding: 1rem 3.5rem 2rem 3.5rem;
    margin-bottom: 2.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.article-intro::before {
    content: '“';
    position: absolute;
    top: -1.5rem;
    left: 0.5rem;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 6rem;
    line-height: 1;
    color: rgba(180, 180, 220, 0.25);
    pointer-events: none;
}

.article-intro::after {
    content: '”';
    position: absolute;
    bottom: -4rem;
    right: 0.5rem;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 6rem;
    line-height: 1;
    color: rgba(180, 180, 220, 0.25);
    pointer-events: none;
}

.article-intro p {
    color: #ccc;
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.article-intro p:last-child {
    margin-bottom: 0;
}

.notice-box {
    background-color: rgba(255, 255, 255, 0.03);
    border-left: 4px solid #888;
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
}

.notice-box.warning {
    border-left-color: #b02e6d;
    background-color: rgba(176, 46, 109, 0.05);
}

.notice-box p {
    margin-bottom: 0;
    color: #ccc;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.info-table th,
.info-table td {
    padding: 0.8rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.info-table th {
    background-color: rgba(255, 255, 255, 0.04);
    color: #ddd;
    font-weight: 500;
    width: 30%;
}

.info-table td {
    color: #bbb;
}

.wiki-footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: #555;
    margin-top: auto;
}

#hidden-section.is-typing> :last-child::after {
    content: '▌';
    margin-left: 2px;
    color: #888;
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

#hidden-section.revealed #middle-line {
    cursor: pointer;
    color: #ddd;
    animation: middlePulse 2.8s ease-in-out infinite;
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 4px;
}

#hidden-section.revealed #middle-line:hover {
    color: #fff;
    animation-play-state: paused;
    background-color: rgba(255, 255, 255, 0.04);
}

@keyframes middlePulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

#corruption-layer {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    overflow: hidden;
    background: transparent;
    transition: background 1.5s ease;
    contain: strict;
    will-change: background;
}

#corruption-layer.dim {
    background: rgba(0, 0, 0, 0.65);
}

#corruption-layer.full-black {
    background: #000;
    transition: background 1.2s ease;
}

.corrupt-char {
    position: absolute;
    color: #000;
    font-family: monospace;
    line-height: 1;
    opacity: 0;
    animation: corruptFadeIn 0.8s ease forwards;
    user-select: none;
    will-change: opacity;
}

@keyframes corruptFadeIn {
    to {
        opacity: 1;
    }
}

#final-message {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease;
}

#final-message.show {
    opacity: 1;
}

#final-message span {
    color: #f0f8ff;
    font-size: clamp(1.2rem, 3.4vw, 2.2rem);
    letter-spacing: 0.25em;
    padding-left: 0.25em;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: scale(0.85);
    filter: blur(10px);
    transition: opacity 2s ease, transform 2.6s cubic-bezier(0.16, 1, 0.3, 1), filter 2s ease;
    text-shadow:
        0 0 2px #ffffff,
        0 0 8px #cce6ff,
        0 0 16px #66b3ff,
        0 0 30px #338cff,
        -15px 0 40px rgba(51, 140, 255, 0.6),
        15px 0 40px rgba(51, 140, 255, 0.6),
        0 0 80px rgba(0, 76, 204, 0.8);
}

#final-message.show span {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 960px) {
    .wiki-body {
        grid-template-columns: 1fr;
    }

    .wiki-toc {
        display: none;
    }

    .wiki-main {
        padding: 2rem 1.5rem;
    }

    .article-title {
        font-size: 2rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .article-intro {
        padding: 1.5rem 2rem 2rem 2rem;
    }

    .article-intro::before {
        font-size: 5rem;
        top: -1rem;
        left: 0;
    }

    .article-intro::after {
        font-size: 5rem;
        bottom: -3rem;
        right: 0;
    }
}

@media (max-width: 768px) {
    .wiki-wrapper {
        padding: 0 1rem;
    }
}