:root {
    color-scheme: dark;
    --bg: #101a31;
    --ink: #eee9df;
    --gold: #c4a975;
    --muted: #98a1b6;
    --line: rgba(196, 169, 117, 0.2);
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: radial-gradient(ellipse at 50% 42%, #263455 0, #16213a 45%, #10182c 100%);
    color: var(--ink);
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    min-height: 100dvh;
    font-size: 14px;
    line-height: 1.6;
}
button,
input {
    font: inherit;
}
button {
    cursor: pointer;
    color: inherit;
}
button:disabled {
    opacity: 0.3;
    cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 5px;
}
[hidden] {
    display: none !important;
}
a {
    color: inherit;
    text-decoration: none;
}
.masthead {
    max-width: 1600px;
    margin: auto;
    padding: 25px 4vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    gap: 20px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}
.official-link {
    color: var(--gold);
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    white-space: nowrap;
}
.official-link:hover {
    color: var(--ink);
    border-color: var(--gold);
    background: #ffffff0a;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-mark {
    font-family: Georgia, serif;
    font-size: 35px;
    border: 1px solid var(--gold);
    border-radius: 0 0 18px 18px;
    width: 44px;
    height: 51px;
    text-align: center;
    color: var(--gold);
}
.brand strong {
    display: block;
    font-family: 'Songti SC', 'SimSun', serif;
    font-size: 19px;
    letter-spacing: 0.15em;
    font-weight: 500;
}
.brand small {
    display: block;
    font-family: Georgia, serif;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--gold);
    margin-top: 8px;
}
.edition {
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 14px;
}
.edition i {
    width: 22px;
    height: 1px;
    background: var(--gold);
}
.reader {
    max-width: 2200px;
    margin: 0 auto;
    padding: 25px 4vw 12px;
}
.caption {
    display: flex;
    justify-content: space-between;
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 0.22em;
    margin-bottom: 18px;
    gap: 8px 16px;
    flex-wrap: wrap;
}
.caption span:first-child {
    font-family: Georgia, serif;
}
.caption span:last-child {
    color: var(--muted);
    letter-spacing: 0.12em;
}
.stage {
    height: clamp(200px, calc(100dvh - 405px), 780px);
    position: relative;
    isolation: isolate;
}
.stage:before {
    content: '';
    position: absolute;
    inset: 12% 7%;
    border-radius: 50%;
    background: #030817;
    filter: blur(45px);
    opacity: 0.38;
    z-index: -1;
}
#book {
    width: 100%;
    height: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
}
.stf__wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}
.book-page {
    background: #f9f8f4;
    overflow: hidden;
    box-shadow: 0 4px 24px #02081850;
}
.page-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.page-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    background: #eeeae1;
    color: #526078;
    font-size: 12px;
    letter-spacing: 0.08em;
}
.page-placeholder .spinner {
    border-color: #9da7b644;
    border-top-color: #526078;
}
.page-placeholder.is-error {
    color: #75492a;
}
.book-page[data-state='ready'] .page-placeholder {
    display: none;
}
.startup {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #16213a;
    z-index: 15;
    color: var(--muted);
    font-size: 13px;
}
.spinner {
    width: 23px;
    height: 23px;
    border: 1px solid #c4a97533;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.gesture-hint {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 8px;
    text-align: center;
    font-size: 14px;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 18px 0;
}
.gesture-hint .hint-part {
    white-space: nowrap;
}
.gesture-hint .hint-separator {
    color: var(--gold);
}
.toolbar {
    margin: auto;
    width: max-content;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #0b1425b3;
    box-shadow: 0 10px 30px #080e1a33;
}
.tool,
.arrow {
    border: 0;
    background: transparent;
    min-width: 36px;
    height: 38px;
    border-radius: 4px;
}
.tool {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}
.tool span:first-child {
    font-size: 22px;
    color: var(--gold);
}
.tool:hover,
.arrow:hover:enabled {
    background: #ffffff0a;
    color: var(--ink);
}
.arrow {
    font-size: 22px;
    color: var(--gold);
}
.divider {
    width: 1px;
    height: 21px;
    background: var(--line);
}
.page-form {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: var(--muted);
    white-space: nowrap;
}
.page-form input {
    width: 42px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-align: center;
    padding: 5px 0;
    border-radius: 0;
    -moz-appearance: textfield;
}
.page-form input::-webkit-inner-spin-button {
    appearance: none;
}
.reading-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    color: var(--muted);
    min-height: 30px;
    padding-top: 12px;
    flex-wrap: wrap;
}
.retry {
    display: block;
    margin: 0 auto 10px;
    background: transparent;
    border: 1px solid var(--gold);
    border-radius: 4px;
    color: var(--gold);
    padding: 9px 14px;
    font-size: 12px;
}
.thumbnails {
    margin: 16px auto 10px;
    border-top: 1px solid var(--line);
    padding: 22px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 15px;
}
.thumb {
    background: #0b142580;
    border: 1px solid transparent;
    padding: 8px;
    color: var(--muted);
    border-radius: 4px;
}
.thumb img {
    width: 100%;
    aspect-ratio: 1.357;
    object-fit: contain;
    display: block;
    background: #26314a;
}
.thumb span {
    display: block;
    font-size: 12px;
    margin-top: 9px;
}
.thumb[aria-current='page'] {
    border-color: var(--gold);
    color: var(--gold);
}
.footer {
    padding: 18px 4vw 25px;
    display: flex;
    justify-content: space-between;
    color: #69758d;
    font-size: 12px;
    letter-spacing: 0.1em;
    max-width: 1600px;
    margin: auto;
    gap: 12px;
    flex-wrap: wrap;
}
.footer span:first-child {
    font-family: Georgia, serif;
    letter-spacing: 0.18em;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
dialog {
    padding: 0;
    width: 96vw;
    max-width: 1600px;
    height: 94dvh;
    max-height: 94dvh;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111a2b;
    color: var(--ink);
    overflow: hidden;
}
dialog::backdrop {
    background: #020712d9;
    backdrop-filter: blur(8px);
}
dialog[open] {
    display: flex;
    flex-direction: column;
}
.zoom-bar {
    min-height: 58px;
    flex-shrink: 0;
    gap: 8px;
    flex-wrap: wrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    border-bottom: 1px solid var(--line);
}
.zoom-bar strong {
    font-size: 13px;
    font-weight: 400;
}
.zoom-bar button,
.zoom-scroll button {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 7px 12px;
    margin-left: 6px;
    font-size: 12px;
}
.zoom-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    text-align: center;
    padding: 22px;
    overscroll-behavior: contain;
}
.zoom-scroll img {
    display: block;
    width: 1800px;
    max-width: none;
    height: auto;
    margin: auto;
}
.zoom-scroll p {
    font-size: 13px;
    color: var(--muted);
}
.noscript {
    position: fixed;
    inset: 30% 10%;
    padding: 30px;
    background: var(--bg);
    border: 1px solid var(--gold);
    z-index: 30;
    text-align: center;
}
body:has(dialog[open]) {
    overflow: hidden;
}
@media (max-width: 760px) {
    .masthead {
        padding: 16px 4vw;
        gap: 12px;
    }
    .brand-mark {
        display: none;
    }
    .brand strong {
        font-size: 16px;
        letter-spacing: 0.08em;
    }
    .brand small {
        font-size: 12px;
        letter-spacing: 0.02em;
        margin-top: 4px;
    }
    .official-link {
        padding: 8px 10px;
    }
    .edition {
        display: none;
    }
    .reader {
        padding: 22px 4vw 8px;
    }
    .caption {
        font-size: 12px;
        letter-spacing: 0.1em;
        margin-bottom: 16px;
    }
    .stage {
        height: clamp(150px, calc(100dvh - 360px), 670px);
    }
    .toolbar {
        gap: 3px;
        padding: 6px;
    }
    .tool {
        gap: 4px;
        padding: 0 4px;
    }
    .tool span:last-child {
        display: none;
    }
    .toolbar .divider {
        margin: 0 2px;
    }
    .page-form input {
        width: 36px;
    }
    .gesture-hint {
        font-size: 14px;
        margin: 17px 0;
    }
    .footer {
        font-size: 12px;
        padding: 12px 5vw 20px;
    }
    .footer span:last-child {
        display: none;
    }
    .thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    .zoom-bar {
        padding: 10px 12px;
    }
    .zoom-scroll {
        padding: 12px;
    }
    .zoom-scroll img {
        width: 1500px;
    }
}
@media (max-height: 500px) and (orientation: landscape) {
    .masthead {
        padding: 10px 4vw;
    }
    .brand-mark {
        display: none;
    }
    .brand strong {
        font-size: 14px;
    }
    .brand small,
    .caption,
    .gesture-hint,
    .footer {
        display: none;
    }
    .reader {
        padding-top: 12px;
    }
    .stage {
        height: calc(100dvh - 170px);
        min-height: 120px;
    }
    .toolbar {
        margin-top: 10px;
        padding: 2px 15px;
    }
    .reading-meta {
        padding-top: 5px;
        min-height: 22px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 2s;
    }
}
