:root {
    --paper: #f5f0e7;
    --paper-soft: #faf7f1;
    --surface: rgba(255, 255, 255, 0.66);
    --surface-solid: #fffdf8;

    --text: #292623;
    --muted: #756e67;
    --line: rgba(65, 52, 41, 0.13);

    --accent: #9b3f47;
    --accent-hover: #7f3037;
    --accent-soft: rgba(155, 63, 71, 0.09);

    --shadow: 0 20px 60px rgba(72, 55, 39, 0.1);

    --reader-scale: 1;

    font-family:
        "Noto Serif CJK SC",
        "Source Han Serif SC",
        "Songti SC",
        "STSong",
        "SimSun",
        serif;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #171615;
    --paper-soft: #1e1c1a;
    --surface: rgba(40, 37, 34, 0.78);
    --surface-solid: #211f1d;

    --text: #ebe4d9;
    --muted: #aaa096;
    --line: rgba(255, 255, 255, 0.1);

    --accent: #d37c81;
    --accent-hover: #e69a9e;
    --accent-soft: rgba(211, 124, 129, 0.11);

    --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #171615;
        --paper-soft: #1e1c1a;
        --surface: rgba(40, 37, 34, 0.78);
        --surface-solid: #211f1d;

        --text: #ebe4d9;
        --muted: #aaa096;
        --line: rgba(255, 255, 255, 0.1);

        --accent: #d37c81;
        --accent-hover: #e69a9e;
        --accent-soft: rgba(211, 124, 129, 0.11);

        --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);

        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(
            circle at top right,
            var(--accent-soft),
            transparent 34rem
        ),
        var(--paper);

    line-height: 1.8;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

code {
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    background: var(--paper-soft);
}

.top-progress {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;

    width: 100%;
    height: 3px;

    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
}

.site-header {
    position: sticky;
    z-index: 100;
    top: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 72px;
    padding: 0 5vw;

    border-bottom: 1px solid var(--line);

    background: color-mix(
        in srgb,
        var(--paper) 86%,
        transparent
    );

    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    border-radius: 50%;

    color: white;
    background: var(--accent);

    font-size: 1.08rem;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text strong {
    font-size: 0.98rem;
}

.brand-text small {
    margin-top: 0.25rem;
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: 0.61rem;
    letter-spacing: 0.16em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;

    font-size: 0.9rem;
}

.header-actions > a {
    color: var(--muted);
}

.header-actions > a:hover {
    color: var(--accent);
}

.tool-button {
    display: grid;
    place-items: center;

    min-width: 38px;
    height: 38px;
    padding: 0 0.6rem;

    cursor: pointer;

    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.tool-button:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.font-button {
    font-family: Arial, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
}

.hero {
    position: relative;
    overflow: hidden;

    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 3rem;

    max-width: 1180px;
    min-height: 570px;
    margin: 0 auto;
    padding: 7rem 4rem 6rem;

    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-label,
.section-title > p,
.chapter-label {
    margin: 0 0 1rem;

    color: var(--accent);

    font-family: Arial, sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.hero h1 {
    max-width: 790px;
    margin: 0;

    font-size: clamp(2.4rem, 5vw, 4.8rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.hero-description {
    max-width: 720px;
    margin: 2rem 0 0;

    color: var(--muted);

    font-size: 1.06rem;
    line-height: 2;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    margin-top: 2.4rem;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;
    padding: 0 1.5rem;

    border-radius: 999px;

    font-size: 0.94rem;
    font-weight: 600;
}

.primary-button {
    color: white;
    background: var(--accent);
}

.primary-button:hover {
    background: var(--accent-hover);
}

.secondary-button {
    border: 1px solid var(--line);
    background: var(--surface);
}

.secondary-button:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.hero-symbols {
    position: relative;

    display: grid;
    grid-template-columns: repeat(2, 105px);
    gap: 1rem;

    justify-content: center;
}

.hero-symbols span {
    display: grid;
    place-items: center;

    width: 105px;
    height: 105px;

    border: 1px solid var(--line);
    border-radius: 50%;

    color: var(--accent);
    background: var(--surface);

    box-shadow: var(--shadow);

    font-size: 2rem;
}

.hero-symbols span:nth-child(2),
.hero-symbols span:nth-child(3) {
    transform: translateY(2rem);
}

.content-section {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 4rem;

    max-width: 1080px;
    margin: 0 auto;
    padding: 6rem 2rem;

    border-top: 1px solid var(--line);
}

.section-title h2 {
    margin: 0;
    font-size: 1.75rem;
}

.story-description {
    max-width: 720px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 2.15;
}

.story-description p:first-child {
    margin-top: 0;
}

.chapter-section {
    display: block;
}

.chapter-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 2rem;
}

.chapter-count {
    color: var(--muted);
    font-size: 0.88rem;
}

.chapter-list {
    display: grid;
    gap: 0.85rem;
}

.chapter-card {
    display: grid;
    grid-template-columns: 55px minmax(0, 1fr) auto 30px;
    gap: 1rem;
    align-items: center;

    min-height: 90px;
    padding: 1.2rem 1.4rem;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: var(--surface);

    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.chapter-card:hover {
    transform: translateY(-2px);

    border-color: color-mix(
        in srgb,
        var(--accent) 45%,
        var(--line)
    );

    box-shadow: var(--shadow);
}

.chapter-number {
    color: var(--accent);

    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.chapter-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chapter-main strong {
    font-size: 1.02rem;
}

.chapter-main small,
.chapter-time {
    color: var(--muted);
    font-size: 0.8rem;
}

.chapter-arrow {
    color: var(--accent);
    font-size: 1.15rem;
}

.empty-state {
    padding: 4rem 2rem;

    text-align: center;

    border: 1px dashed var(--line);
    border-radius: 16px;

    color: var(--muted);
}

.reader-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 5rem;

    width: min(1250px, calc(100% - 4rem));
    margin: 0 auto;
    padding: 4rem 0 7rem;
}

.chapter-sidebar {
    position: sticky;
    top: 102px;

    align-self: start;

    max-height: calc(100vh - 130px);
    overflow-y: auto;
    padding-right: 0.8rem;
}

.back-home {
    display: inline-block;
    margin-bottom: 2.2rem;

    color: var(--muted);
    font-size: 0.87rem;
}

.back-home:hover {
    color: var(--accent);
}

.sidebar-title {
    margin: 0 0 1rem;

    color: var(--muted);

    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.chapter-sidebar nav {
    display: grid;
    gap: 0.3rem;
}

.chapter-sidebar nav a {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 0.5rem;

    padding: 0.7rem 0.8rem;

    border-radius: 8px;

    color: var(--muted);

    font-size: 0.84rem;
    line-height: 1.55;
}

.chapter-sidebar nav a span {
    color: var(--accent);
    font-family: Arial, sans-serif;
    font-size: 0.74rem;
}

.chapter-sidebar nav a:hover,
.chapter-sidebar nav a.active {
    color: var(--text);
    background: var(--accent-soft);
}

.reader-page {
    width: 100%;
    max-width: 800px;
}

.reader-header {
    margin-bottom: 4rem;
    padding-bottom: 2rem;

    border-bottom: 1px solid var(--line);
}

.reader-header h1 {
    margin: 0;

    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.35;
}

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    margin-top: 1.5rem;

    color: var(--muted);
    font-size: 0.81rem;
}

.novel-content {
    font-size: calc(1.11rem * var(--reader-scale));
    line-height: 2.15;
    letter-spacing: 0.025em;
}

.novel-content p {
    margin: 0 0 1.55em;

    white-space: pre-line;
    overflow-wrap: anywhere;

    text-align: justify;
    text-indent: 2em;
}

.novel-content p:has(br),
.novel-content p:first-child {
    text-indent: 0;
}

.chapter-end {
    display: flex;
    align-items: center;
    gap: 1rem;

    margin: 5rem 0 3rem;

    color: var(--muted);

    font-family: Arial, sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
}

.chapter-end::before,
.chapter-end::after {
    content: "";

    flex: 1;

    height: 1px;

    background: var(--line);
}

.page-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;

    padding-top: 2rem;

    border-top: 1px solid var(--line);
}

.page-link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;

    min-height: 90px;
    padding: 1rem 1.2rem;

    border: 1px solid var(--line);
    border-radius: 12px;

    background: var(--surface);
}

.page-link:hover {
    border-color: var(--accent);
}

.page-link small {
    color: var(--muted);
    font-size: 0.75rem;
}

.page-link strong {
    font-size: 0.9rem;
    line-height: 1.6;
}

.page-link.next {
    text-align: right;
}

.site-footer {
    padding: 3rem 2rem;

    text-align: center;

    color: var(--muted);
    border-top: 1px solid var(--line);

    font-size: 0.78rem;
}

.site-footer p {
    margin: 0.25rem 0;
}

.not-found-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 100vh;
    padding: 2rem;

    text-align: center;
}

.not-found-page h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.not-found-page > p:not(.chapter-label) {
    margin-bottom: 2rem;
    color: var(--muted);
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 5rem 2rem;
    }

    .hero-symbols {
        display: none;
    }

    .content-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .reader-layout {
        display: block;
        width: min(100% - 2rem, 800px);
    }

    .chapter-sidebar {
        display: none;
    }
}

@media (max-width: 640px) {
    .site-header {
        min-height: 64px;
        padding: 0 1rem;
    }

    .brand-text strong {
        max-width: 135px;
        overflow: hidden;

        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions > a {
        display: none;
    }

    .hero {
        padding: 4rem 1.25rem;
    }

    .hero h1 {
        font-size: 2.35rem;
    }

    .hero-description {
        font-size: 0.96rem;
    }

    .content-section {
        padding: 4rem 1.25rem;
    }

    .chapter-heading {
        align-items: flex-start;
    }

    .chapter-card {
        grid-template-columns: 42px minmax(0, 1fr) 22px;
        padding: 1rem;
    }

    .chapter-time {
        display: none;
    }

    .reader-layout {
        width: calc(100% - 2rem);
        padding-top: 2.5rem;
    }

    .reader-header {
        margin-bottom: 2.7rem;
    }

    .reader-header h1 {
        font-size: 2rem;
    }

    .novel-content {
        font-size: calc(1.05rem * var(--reader-scale));
        line-height: 2.05;
    }

    .novel-content p {
        text-align: left;
    }

    .page-navigation {
        grid-template-columns: 1fr;
    }

    .page-link.next {
        text-align: left;
    }
}
