        :root {
            --bg: #f3f0e8;
            --ink: #1d1a16;
            --muted: #6b645a;
            --line: #d9d2c5;
            --panel: #fffdf8;
            --accent: #0f5c4c;
            --accent-soft: #e6f2ef;
            --danger: #9b2c2c;
        }

        * { box-sizing: border-box; }
        html {
            font-size: 16px !important;
        }
        html, body {
            margin: 0;
            height: 100%;
            color: var(--ink);
            background:
                radial-gradient(1200px 600px at 10% -10%, #fff8e8 0%, transparent 55%),
                radial-gradient(900px 500px at 100% 0%, #e8f3ef 0%, transparent 50%),
                var(--bg);
            font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
            font-size: 16px;
            line-height: 1.5;
        }

        .gate {
            min-height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
        }

        .gate-card {
            width: min(560px, 100%);
            background: var(--panel);
            border: 1px solid var(--line);
            padding: 36px 32px;
        }

        .gate-card h1 {
            margin: 0 0 8px;
            font-size: 28px;
            letter-spacing: 0.02em;
        }

        .gate-card p {
            margin: 0 0 24px;
            color: var(--muted);
            font-size: 15px;
            line-height: 1.6;
        }

        .gate-card label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: var(--muted);
        }

        .gate-row {
            display: flex;
            gap: 10px;
        }

        .gate-row input {
            flex: 1;
            min-width: 0;
            height: 44px;
            padding: 0 14px;
            border: 1px solid var(--line);
            background: #fff;
            font-size: 15px;
            outline: none;
        }

        .gate-row input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(15, 92, 76, 0.12);
        }

        .gate-row button,
        .toolbar button {
            height: 44px;
            padding: 0 18px;
            border: 0;
            background: var(--accent);
            color: #fff;
            font-size: 15px;
            cursor: pointer;
        }

        .gate-row button:hover,
        .toolbar button:hover { filter: brightness(1.05); }

        .search-wrap {
            position: relative;
        }

        .suggest-list {
            list-style: none;
            margin: 8px 0 0;
            padding: 6px 0;
            max-height: 280px;
            overflow: auto;
            border: 1px solid var(--line);
            background: #fff;
        }

        .suggest-list[hidden] { display: none; }

        .suggest-list li button {
            display: block;
            width: 100%;
            height: auto;
            padding: 10px 14px;
            border: 0;
            background: transparent;
            color: var(--ink);
            text-align: left;
            font-size: 14px;
            line-height: 1.4;
            cursor: pointer;
        }

        .suggest-list li button:hover,
        .suggest-list li button.active {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .suggest-list .suggest-title {
            display: block;
            font-weight: 600;
        }

        .suggest-list .suggest-file {
            display: block;
            margin-top: 2px;
            color: var(--muted);
            font-size: 12px;
            word-break: break-all;
        }

        .hint {
            margin-top: 14px;
            font-size: 13px;
            color: var(--muted);
            word-break: break-all;
        }

        .reader {
            display: none;
            height: 100vh;
            height: 100dvh;
            flex-direction: column;
        }

        .reader.active { display: flex; }

        .toolbar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 16px;
            border-bottom: 1px solid var(--line);
            background: rgba(255, 253, 248, 0.96);
            backdrop-filter: blur(8px);
            flex-wrap: wrap;
            flex-shrink: 0;
            z-index: 5;
        }

        .toolbar .title {
            flex: 1;
            min-width: 160px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .toolbar .nav-group {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .toolbar button {
            height: 36px;
            padding: 0 14px;
            background: var(--accent-soft);
            color: var(--accent);
            white-space: nowrap;
        }

        .toolbar button.primary {
            background: var(--accent);
            color: #fff;
        }

        .toolbar .hint-keys {
            font-size: 12px;
            color: var(--muted);
            margin-left: 4px;
        }

        .layout {
            flex: 1;
            min-height: 0;
            display: flex;
            position: relative;
            overflow: hidden;
        }

        .sidebar {
            width: 300px;
            border-right: 1px solid var(--line);
            background: var(--panel);
            overflow: auto;
            flex-shrink: 0;
        }

        .sidebar.hidden { display: none; }

        .sidebar h2 {
            margin: 0;
            padding: 16px;
            font-size: 14px;
            color: var(--muted);
            border-bottom: 1px solid var(--line);
            position: sticky;
            top: 0;
            background: var(--panel);
        }

        #toc {
            list-style: none;
            margin: 0;
            padding: 8px 0 24px;
        }

        #toc a {
            display: block;
            padding: 10px 16px;
            color: var(--ink);
            text-decoration: none;
            font-size: 14px;
            line-height: 1.4;
        }

        #toc a:hover { background: var(--accent-soft); color: var(--accent); }

        .epub-reader-stage {
            flex: 1;
            min-width: 0;
            min-height: 0;
            position: relative;
            background: #faf8f3;
        }

        #epubProtectArea {
            position: absolute;
            inset: 0;
            overflow: hidden;
        }

        #epubProtectArea.allow-copy {
            -webkit-user-select: text;
            user-select: text;
        }

        #viewer {
            width: 100%;
            height: 100%;
            display: none;
            margin: 0 auto;
            background: #faf8f3;
            overflow: hidden;
        }

        /* epub.js 滚动容器 */
        #viewer:not(.pdf-pager) .epub-container,
        #viewer:not(.pdf-pager) > div {
            width: 100% !important;
            height: 100% !important;
            overflow-y: auto !important;
            overflow-x: hidden !important;
            -webkit-overflow-scrolling: touch;
        }

        #viewer.pdf-pager {
            overflow: hidden;
            background:
                linear-gradient(180deg, #efe8d8 0%, #faf8f3 48%, #efe8d8 100%);
            perspective: 1800px;
        }

        #viewer.pdf-pager.is-zoomed {
            overflow: auto;
            perspective: none;
        }

        .zoom-group {
            display: none;
            align-items: center;
            gap: 4px;
        }

        body.pdf-mode .zoom-group {
            display: flex;
        }

        .zoom-group button {
            min-width: 36px;
        }

        #zoomLabel {
            min-width: 48px;
            text-align: center;
            font-size: 13px;
            color: var(--muted);
        }

        .pdf-sheet {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px 56px;
            transform: translateX(0);
            opacity: 1;
            transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.42s ease;
        }

        .pdf-sheet.flip-in-right { transform: translateX(72%) rotateY(-18deg); opacity: 0; }
        .pdf-sheet.flip-in-left { transform: translateX(-72%) rotateY(18deg); opacity: 0; }
        .pdf-sheet.flip-out-left { transform: translateX(-78%) rotateY(22deg); opacity: 0; }
        .pdf-sheet.flip-out-right { transform: translateX(78%) rotateY(-22deg); opacity: 0; }

        #viewer.pdf-pager.is-zoomed .pdf-sheet {
            position: relative;
            inset: auto;
            width: max-content;
            min-width: 100%;
            min-height: 100%;
            height: auto;
            align-items: flex-start;
            transform: none;
            transition: none;
        }

        .pdf-page {
            position: relative;
            background: #fff;
            box-shadow:
                8px 0 24px rgba(60, 40, 10, 0.08),
                0 12px 36px rgba(0, 0, 0, 0.12);
        }

        .pdf-page canvas {
            display: block;
            max-width: none;
        }

        .pdf-page .textLayer {
            position: absolute;
            left: 0;
            top: 0;
            overflow: hidden;
            line-height: 1;
            -webkit-text-size-adjust: none;
            text-size-adjust: none;
            transform-origin: 0 0;
            z-index: 2;
            cursor: text;
            -webkit-user-select: text;
            user-select: text;
        }

        .pdf-page .textLayer span,
        .pdf-page .textLayer br {
            position: absolute;
            color: transparent;
            white-space: pre;
            cursor: text;
            transform-origin: 0% 0%;
        }

        .pdf-page .textLayer ::selection {
            background: rgba(15, 92, 76, 0.28);
            color: transparent;
        }

        .pdf-jump {
            display: flex;
            gap: 8px;
            align-items: center;
            padding: 12px 16px 8px;
        }

        .pdf-jump input {
            width: 72px;
            height: 32px;
            padding: 0 8px;
            border: 1px solid var(--line);
        }

        .pdf-jump button {
            height: 32px;
            padding: 0 10px;
            border: 0;
            background: var(--accent-soft);
            color: var(--accent);
            cursor: pointer;
        }

        #pageInfo {
            font-size: 13px;
            color: var(--muted);
            min-width: 72px;
        }

        /* 电脑端左右点击翻页热区 */
        .page-hotzone {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 72px;
            z-index: 2;
            border: 0;
            background: transparent;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s ease, background 0.2s ease;
        }

        .page-hotzone:hover {
            opacity: 1;
            background: linear-gradient(90deg, rgba(15, 92, 76, 0.08), transparent);
        }

        .page-hotzone.next:hover {
            background: linear-gradient(270deg, rgba(15, 92, 76, 0.08), transparent);
        }

        .page-hotzone.prev { left: 0; }
        .page-hotzone.next { right: 0; }

        .page-hotzone span {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 36px;
            height: 64px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 253, 248, 0.92);
            border: 1px solid var(--line);
            color: var(--accent);
            font-size: 22px;
        }

        .page-hotzone.prev span { left: 12px; }
        .page-hotzone.next span { right: 12px; }

        .epub-status {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            text-align: center;
            color: var(--muted);
            background: #fff;
            z-index: 3;
        }

        .epub-status.error { color: var(--danger); }

        #epubWatermark,
        #epubShield,
        #sidebarMask {
            display: none;
        }

        #sidebarMask.show {
            display: block;
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.35);
            z-index: 3;
        }

        @media (max-width: 992px) {
            .sidebar {
                position: absolute;
                left: 0;
                top: 0;
                bottom: 0;
                z-index: 4;
                box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
            }

            .page-hotzone,
            .toolbar .hint-keys { display: none; }

            .toolbar .nav-group .desktop-only { display: none; }
        }

        @media (min-width: 993px) {
            .toolbar .mobile-only { display: none; }
        }