:root {
  color-scheme: light;
  --ink: #1f1b16;
  --muted: #766f66;
  --paper: #f2eee5;
  --paper-deep: #e8e0d3;
  --card: rgba(255, 252, 246, 0.72);
  --line: rgba(47, 39, 29, 0.14);
  --accent: #9d3e2a;
  --accent-dark: #732818;
  --jade: #31594c;
  --shadow: 0 22px 70px rgba(57, 40, 23, 0.12);
  --serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eee7da;
  --muted: #aaa094;
  --paper: #171512;
  --paper-deep: #211d18;
  --card: rgba(40, 35, 29, 0.72);
  --line: rgba(236, 224, 204, 0.13);
  --accent: #d66c52;
  --accent-dark: #ed8a70;
  --jade: #74a08f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(157, 62, 42, 0.09), transparent 28rem),
    linear-gradient(90deg, transparent 49.85%, rgba(69, 53, 36, 0.03) 50%, transparent 50.15%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.refresh-button.edition-link { display: inline-flex; align-items: center; justify-content: center; width: auto; text-decoration: none; white-space: nowrap; }

.site-header {
  width: min(1440px, calc(100% - 48px));
  height: 96px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark {
  display: block; flex-shrink: 0; width: 46px; height: 46px;
  border-radius: 12px;
}
.android-app-icon { display: block; border-radius: 16px; margin-bottom: 18px; }
.brand strong { display: block; font: 600 19px/1.2 var(--serif); letter-spacing: .12em; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: .28em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.recent-reading { position: relative; }
.recent-reading-panel { position: absolute; z-index: 60; top: calc(100% + 10px); right: 0; width: min(360px, calc(100vw - 24px)); padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(18px); box-shadow: 0 18px 60px rgba(0,0,0,.18); }
.recent-reading-panel[hidden] { display: none; }
.recent-reading-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 7px 9px; border-bottom: 1px solid var(--line); }
.recent-reading-head strong { font: 600 15px/1.3 var(--serif); }
.recent-reading-head small { color: var(--muted); font-size: 10px; }
.recent-reading-list { display: grid; gap: 5px; padding-top: 6px; }
.recent-reading-item { width: 100%; padding: 10px 9px; display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; border: 0; border-radius: 9px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.recent-reading-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.recent-reading-item strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 500 14px/1.3 var(--serif); }
.recent-reading-item small { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 10px; }
.recent-reading-percent { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--accent); font: 600 12px/1 var(--serif); }
.recent-reading-item .album-progress-track { grid-column: 1 / -1; margin-top: 2px; }
.recent-reading-item .album-progress-position { white-space: normal; line-height: 1.6; }
.icon-button, .primary-button, .tool-button, .refresh-button {
  border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 72%, transparent);
  cursor: pointer; transition: .2s ease;
}
.icon-button:hover, .tool-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.refresh-button { height: 42px; padding: 0 14px; border-radius: 999px; color: var(--muted); font-size: 12px; }
.refresh-button:hover { border-color: var(--jade); color: var(--jade); }
.primary-button { padding: 11px 17px; border-radius: 999px; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.12); }

.home-view { width: min(1440px, calc(100% - 48px)); margin: auto; }
.intro { min-height: 420px; display: grid; grid-template-columns: 1.3fr .7fr; align-items: center; gap: 40px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .34em; }
h1 { margin: 22px 0; font: 500 clamp(50px, 7vw, 104px)/.98 var(--serif); letter-spacing: -.04em; }
h1 em { color: var(--accent); font-style: normal; }
.intro-copy { width: min(580px, 90%); color: var(--muted); font: 400 16px/1.9 var(--serif); letter-spacing: .06em; }
.intro-aside { display: grid; gap: 14px; }
.library-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.library-stats div { padding: 30px 18px; text-align: center; border-right: 1px solid var(--line); }
.library-stats div:last-child { border: 0; }
.library-stats strong { display: block; font: 500 clamp(28px, 4vw, 50px)/1 var(--serif); }
.library-stats span { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; letter-spacing: .2em; }
.wechat-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
}
.wechat-copy { min-width: 0; }
.wechat-label { color: var(--jade); font-size: 10px; font-weight: 600; letter-spacing: .2em; }
.wechat-copy strong { display: block; margin-top: 8px; font: 500 20px/1.3 var(--serif); letter-spacing: .06em; }
.wechat-copy p { margin: 8px 0 0; color: var(--muted); font: 12px/1.6 var(--serif); }
.wechat-qr { flex: 0 0 106px; width: 106px; aspect-ratio: 1; display: grid; place-items: center; position: relative; padding: 5px; background: #fff; border: 1px solid var(--line); }
.wechat-qr img { width: 100%; height: 100%; object-fit: contain; }
.wechat-qr-group { flex: none; display: flex; align-items: flex-start; gap: 9px; }
.wechat-qr-option { display: grid; justify-items: center; gap: 6px; }
.wechat-qr-option .wechat-qr { width: 88px; flex-basis: 88px; }
.wechat-qr-option > span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.community-wechat-card { align-items: center; }

.shelf-section, .ebook-section, .android-section { padding: 70px 0 30px; }
.android-intro-link { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 24px; color: var(--accent); text-underline-offset: 5px; font-size: 13px; line-height: 1.8; }
.android-intro-link span { color: var(--muted); }
.android-section { scroll-margin-top: 24px; }
.android-card { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 48px; padding: 36px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.android-overview { min-width: 0; align-self: center; }
.android-overview .eyebrow { margin-top: 0; }
.android-overview h3 { margin: 14px 0; font: 500 clamp(26px, 3vw, 38px)/1.35 var(--serif); }
.android-overview > p:not(.eyebrow) { color: var(--muted); font-size: 14px; line-height: 1.9; }
.android-download { display: inline-flex; align-items: center; gap: 24px; margin-top: 12px; min-height: 48px; text-decoration: none; font-size: 14px; }
.android-download:focus-visible, .android-intro-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.android-overview > .android-version { margin-bottom: 0; font-size: 12px; }
.android-features { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.android-features li { padding-left: 18px; border-left: 2px solid var(--jade); }
.android-features strong { font: 600 18px/1.5 var(--serif); }
.android-features p, .android-install p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.android-install { grid-column: 1 / -1; padding-top: 22px; border-top: 1px solid var(--line); }
.android-install > strong { color: var(--jade); font-size: 13px; }
@media (max-width: 700px) {
  .android-card { grid-template-columns: 1fr; gap: 28px; padding: 24px 20px; }
  .android-section .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .android-section .section-heading h2 { font-size: 26px; }
}
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.section-heading > div { display: flex; align-items: center; gap: 15px; }
.section-heading h2 { margin: 0; font: 500 30px/1 var(--serif); letter-spacing: .08em; }
.section-heading p { margin: 0; color: var(--muted); font: 13px/1 var(--serif); }
.section-number { color: var(--accent); font: 12px/1 var(--serif); border-bottom: 1px solid var(--accent); padding: 0 2px 5px; }
.shelf-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.shelf-card {
  grid-column: span 6; overflow: hidden; border: 1px solid var(--line); background: var(--card);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.shelf-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
.shelf-preview { display: block; width: 100%; padding: 0; border: 0; overflow: hidden; background: #efe5d2; cursor: pointer; text-decoration: none; }
.shelf-preview img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .45s ease; }
.shelf-card:hover .shelf-preview img { transform: scale(1.015); }
.shelf-copy { padding: 22px 24px 24px; }
.shelf-card .ordinal { color: var(--muted); font: 12px/1 var(--serif); letter-spacing: .16em; }
.shelf-card h3 { margin: 12px 0 8px; font: 500 clamp(26px, 2.5vw, 38px)/1.12 var(--serif); }
.shelf-card p { margin: 0; color: var(--ink); font: 15px/1.7 var(--serif); }
.shelf-card small { display: block; margin-top: 8px; color: var(--muted); font: 12px/1.6 var(--serif); }
.shelf-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.shelf-open, .shelf-download { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 16px; font-size: 12px; font-weight: 600; letter-spacing: .1em; }
.shelf-open { gap: 8px; color: #fff9f1; background: var(--accent); border-color: var(--accent); }
.shelf-open::after { content: "→"; font-size: 18px; transition: transform .2s; }
.shelf-card:hover .shelf-open::after { transform: translateX(5px); }
.shelf-download { color: var(--ink); border: 1px solid var(--line); text-decoration: none; }
.shelf-download:hover { border-color: var(--accent); color: var(--accent); }
.album-card .shelf-preview { background: #151412; }
.album-card .shelf-preview img { object-position: center top; }
.album-open, .article-open { text-decoration: none; }
.album-progress-track { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--line); }
.album-progress-track span { display: block; height: 100%; background: var(--accent); }

.empty-state { padding: 70px 0; color: var(--muted); text-align: center; font-family: var(--serif); }
.ebook-browser { overflow: hidden; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.ebook-breadcrumb { min-height: 54px; display: flex; align-items: center; gap: 8px; padding: 10px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.ebook-breadcrumb span { color: var(--muted); }
.ebook-breadcrumb button { flex: none; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.ebook-breadcrumb button:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ebook-breadcrumb button[aria-current="page"] { color: var(--ink); font-weight: 600; cursor: default; }
.ebook-list { display: grid; }
.ebook-item { width: 100%; min-height: 68px; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 17px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.ebook-item:last-child { border-bottom: 0; }
.ebook-item:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.ebook-kind-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--paper-deep); color: var(--accent); font: 600 10px/1 var(--serif); letter-spacing: .04em; }
.ebook-folder .ebook-kind-icon { color: var(--jade); font-size: 15px; }
.ebook-item-copy { min-width: 0; }
.ebook-item-copy strong, .ebook-item-copy small { display: block; }
.ebook-item-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 500 16px/1.35 var(--serif); }
.ebook-item-copy small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.ebook-item-action { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.ebook-item-action b { color: var(--accent); font-size: 17px; font-weight: 400; }
.ebook-folder .ebook-item-action b { color: var(--jade); }
.ebook-empty { margin: 0; padding: 55px 20px; color: var(--muted); text-align: center; font: 13px/1.6 var(--serif); }
.site-footer { width: min(1440px, calc(100% - 48px)); margin: 80px auto 0; padding: 30px 0 48px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font: 12px/1 var(--serif); }

.reader-view { position: fixed; inset: 0; z-index: 10; overflow: hidden; background: #11100e; color: #f4eee4; }
.reader-content-frame { position: absolute; inset: 0; overflow: hidden; }
.reader-toolbar { position: absolute; z-index: 20; inset: 0 0 auto; min-height: 70px; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: rgba(20, 18, 15, .90); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(255,255,255,.1); transition: transform .25s ease; }
.reader-toolbar .icon-button, .reader-toolbar .tool-button { border-color: rgba(255,255,255,.13); background: rgba(255,255,255,.05); color: #f4eee4; }
.reader-title { min-width: 0; margin-right: auto; }
.reader-title small, .reader-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-title small { color: #aa9e8d; font-size: 10px; letter-spacing: .15em; }
.reader-title strong { margin-top: 3px; font: 500 16px/1.3 var(--serif); }
.landscape-page-counter { display: none; flex: none; color: #d2c8ba; font: 11px/1 var(--serif); }
.reader-tools { display: flex; gap: 7px; }
.tool-button { height: 42px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; color: inherit; font-size: 11px; text-decoration: none; }
.tool-button[hidden] { display: none !important; }
.tool-button span:first-child { font-weight: 700; }
.reader-progress { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; background: rgba(255,255,255,.05); }
.reader-progress span { display: block; height: 100%; width: 0; background: #d26a50; transition: width .15s; }
@keyframes correction-danmaku-move { from { transform: translateX(0); } to { transform: translateX(var(--danmaku-end, -1200px)); } }
.page-stage { position: absolute; inset: 70px 0 0; display: grid; place-items: center; padding: 18px 76px 76px; overflow: hidden; overscroll-behavior: contain; }
.album-page:not([src]) { visibility: hidden; }
.current-image.render-error::after { content: "这一页暂时无法显示，请重新打开图集"; color: #d26a50; }

.current-image { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.current-image .album-page { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 18px 70px rgba(0,0,0,.45); cursor: zoom-in; }
.current-image.is-loading::after { content: "载入图解…"; color: #8e8578; font: 13px/1 var(--serif); }
.current-image.is-loading img { display: none; }
.page-controls { position: absolute; z-index: 18; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 5px; border: 1px solid rgba(255,255,255,.12); background: rgba(20,18,15,.88); backdrop-filter: blur(15px); border-radius: 999px; }
.page-controls button { width: 42px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: #f4eee4; cursor: pointer; }
.page-controls button:hover { background: rgba(255,255,255,.1); }
.page-controls button:disabled { opacity: .25; cursor: default; }
.page-controls span { min-width: 78px; text-align: center; color: #c3b9aa; font-size: 11px; }
.quiet-button { position: absolute; z-index: 17; right: 15px; bottom: 16px; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; background: rgba(20,18,15,.65); color: #8e8578; font-size: 10px; cursor: pointer; }
.fullscreen-page-info {
  display: none; position: absolute; z-index: 22; top: max(14px, env(safe-area-inset-top)); left: 50%;
  width: min(520px, calc(100% - 28px)); padding: 11px 14px 10px; transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.14); border-radius: 10px; color: #f6f0e7;
  background: rgba(18,16,13,.72); backdrop-filter: blur(14px); pointer-events: none;
}
.forced-landscape-info { display: none; }
.fullscreen-page-info > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.fullscreen-page-info strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 500 13px/1.4 var(--serif); }
.fullscreen-page-info > div > span { flex: none; color: #c7bcad; font-size: 11px; }
.fullscreen-page-info small { display: block; margin-top: 7px; color: #a99f92; text-align: center; font-size: 9px; letter-spacing: .06em; }
.fullscreen-progress-track { height: 2px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.14); }
.fullscreen-progress-track span { display: block; width: 0; height: 100%; background: #dc7258; transition: width .15s ease; }
.reader-view.fullscreen-reading { background: #000; }
.reader-view.fullscreen-reading .reader-toolbar,
.reader-view.fullscreen-reading .page-controls,
.reader-view.fullscreen-reading .quiet-button { display: none !important; }
.reader-view.fullscreen-reading .fullscreen-page-info { display: block; }
.reader-view.fullscreen-reading .reader-content-frame { inset: 0; }
.reader-view.fullscreen-reading .page-stage { inset: 0; padding: 0; touch-action: none; background: #000; }
.reader-view.fullscreen-reading .current-image { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.reader-view.fullscreen-reading .current-image .album-page { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: none; cursor: pointer; }
.reader-view.quiet .reader-toolbar { transform: translateY(-105%); }
.reader-view.quiet .page-stage { inset: 0; padding-top: 18px; }


@media (min-width: 901px) {
  .fullscreen-page-info {
    width: min(760px, calc(100% - 36px));
    padding: 7px 12px 6px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 14px;
    row-gap: 5px;
  }
  .reader-view.fullscreen-reading .fullscreen-page-info { display: grid; }
  .fullscreen-page-info > div:first-child { display: contents; }
  .fullscreen-page-info strong { grid-column: 1; grid-row: 1; }
  .fullscreen-page-info small {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    white-space: nowrap;
  }
  .fullscreen-page-info > div > span { grid-column: 3; grid-row: 1; }
  .fullscreen-progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 1px;
    margin-top: 0;
  }
}

.contents-panel { position: absolute; z-index: 31; inset: 0 auto 0 0; width: min(390px, 88vw); background: #1b1814; border-right: 1px solid rgba(255,255,255,.1); transform: translateX(-102%); transition: transform .25s ease; overflow: auto; }
.contents-panel.open { transform: translateX(0); }
.contents-head { position: sticky; top: 0; z-index: 2; min-height: 88px; padding: 18px; display: flex; align-items: center; justify-content: space-between; background: rgba(27,24,20,.95); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.09); }
.contents-head small, .contents-head strong { display: block; }
.contents-head small { color: #8e8578; font-size: 10px; letter-spacing: .14em; }
.contents-head strong { margin-top: 5px; font: 500 18px/1.3 var(--serif); }
.contents-head .icon-button { border-color: rgba(255,255,255,.12); background: transparent; color: white; }
.contents-panel nav { padding: 10px; }
.contents-item { width: 100%; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 9px; border: 0; background: transparent; color: #eee7da; text-align: left; cursor: pointer; border-radius: 6px; }
.contents-item:hover, .contents-item.active { background: rgba(255,255,255,.07); }
.contents-item.active { box-shadow: inset 2px 0 #d26a50; }
.contents-cover { width: 56px; aspect-ratio: 16/9; display: grid; place-items: center; background: #26211c; color: #d26a50; font: 12px/1 var(--serif); }
.contents-thumb { width: 56px; aspect-ratio: 16/9; display: block; object-fit: cover; object-position: center top; background: #26211c; }
.contents-item strong { display: block; font: 500 14px/1.3 var(--serif); }
.contents-item small { display: block; margin-top: 4px; color: #8e8578; font-size: 10px; }
.contents-item > span { color: #8e8578; font-size: 10px; }
.panel-scrim { position: absolute; z-index: 30; inset: 0; border: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }

.similar-panel { position: fixed; inset: 82px 18px auto auto; margin: 0; width: min(720px, calc(100vw - 36px)); max-height: calc(100dvh - 104px); padding: 0 20px 18px; overflow: auto; overscroll-behavior: contain; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: #211d18; color: #f4eee4; box-shadow: 0 24px 90px #0009; color-scheme: dark; }
.similar-panel::backdrop { background: #0007; }
.similar-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 12px; background: #211d18; }
.similar-head small { color: #b7ab9a; font-size: 11px; }
.similar-head h2 { margin: 6px 0 0; font: 600 22px/1.4 var(--serif); }
.similar-head .icon-button { flex: none; background: transparent; color: inherit; border-color: #ffffff25; }
.similar-hint, .similar-status { color: #b7ab9a; font: 12px/1.7 var(--sans); margin: 0 0 12px; }
.similar-status { color: #dc9a7b; }
.similar-list { display: grid; gap: 10px; }
.similar-item { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; width: 100%; text-align: left; padding: 14px; border: 1px solid #ffffff18; border-radius: 10px; background: #ffffff04; cursor: pointer; }
.similar-item:hover, .similar-item:focus-visible { background: #ffffff0b; border-color: #dc9a7b; outline: none; }
.similar-item:disabled { opacity: .6; cursor: progress; }
.similar-preview { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16/9; border-radius: 5px; overflow: hidden; background: #151310; }
.similar-preview::before { content: "图解预览"; position: absolute; font-size: 11px; color: #9b9080; }
.similar-preview.preview-error::before { content: "预览暂不可用"; }
.similar-preview img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.similar-preview img:not([src]) { visibility: hidden; }
.similar-copy { display: grid; gap: 9px; min-width: 0; }
.similar-copy small { color: #b7ab9a; font: 11px/1.6 var(--sans); }
.similar-clause { font: 15px/1.8 var(--serif); overflow-wrap: anywhere; }
.similar-score { color: #dc9a7b; font-size: 11px; line-height: 1.6; }
.similar-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.similar-actions button { background: transparent; border: 1px solid #ffffff25; cursor: pointer; }
.similar-actions .tool-button { width: auto; min-width: 100px; padding: 0 14px; }
#similarButton { width: auto; padding: 0 12px; }
#similarButton span:last-child { display: inline; }
.phone-device #similarButton { display: none; }
@media (max-width: 700px) {
  .similar-item { grid-template-columns: 110px 1fr; gap: 12px; }
}

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; padding: 65px 0; min-height: auto; }
  .library-stats { max-width: 560px; }
  .intro-aside { max-width: 560px; }
  .shelf-card { grid-column: span 6; }
  .tool-button span:last-child { display: none; }
  .tool-button { width: 42px; padding: 0; justify-content: center; }
}

@media (max-width: 600px) {
  .site-header, .home-view, .site-footer { width: min(100% - 28px, 1440px); }
  .site-header { height: 76px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand small { display: none; }
  .primary-button { padding: 9px 12px; font-size: 12px; }
  .recent-reading .primary-button { max-width: 92px; padding-inline: 10px; white-space: nowrap; }
  .recent-reading-panel { width: min(330px, calc(100vw - 28px)); }
  .refresh-button { width: 40px; padding: 0; overflow: hidden; font-size: 0; }
  .refresh-button::first-letter { font-size: 19px; }
  .header-actions { gap: 6px; }
  .header-actions .icon-button { width: 34px; height: 34px; }
  .progress-menu-button { width: auto; height: 36px; padding: 0 9px; font-size: 11px; white-space: nowrap; }
  .progress-menu-button::first-letter { font-size: inherit; }
  .intro { padding: 54px 0; gap: 30px; }
  h1 { font-size: clamp(48px, 16vw, 76px); }
  .intro-copy { width: 100%; font-size: 14px; }
  .library-stats div { padding: 22px 8px; }
  .wechat-card { padding: 15px; }
  .wechat-qr { flex-basis: 92px; width: 92px; }
  .community-wechat-card { align-items: flex-start; flex-direction: column; }
  .community-wechat-card .wechat-qr-group { width: 100%; justify-content: flex-start; }
  .wechat-qr-option .wechat-qr { width: 92px; flex-basis: 92px; }
  .shelf-section, .ebook-section { padding-top: 50px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { display: none; }
  .shelf-grid { gap: 10px; }
  .shelf-card { grid-column: span 12; }
  .ebook-item { min-height: 64px; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; padding: 9px 12px; }
  .ebook-kind-icon { width: 38px; height: 38px; }
  .ebook-item-copy strong { font-size: 14px; }
  .ebook-item-action { font-size: 0; gap: 0; }
  .site-footer { display: block; line-height: 1.8; }
  .reader-toolbar { padding: 8px 10px; gap: 8px; min-height: 62px; }
  .reader-title small { display: none; }
  .reader-title strong { max-width: 28vw; font-size: 14px; }
  .reader-tools { gap: 4px; }
  .tool-button, .reader-toolbar .icon-button { width: 38px; height: 38px; }
  .page-stage { inset: 62px 0 0; padding: 8px 8px 72px; }
}

@media (max-width: 380px) {
  .brand { gap: 7px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 15px; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .phone-device .reader-toolbar {
    min-height: 34px; padding: 5px 8px; gap: 10px; border: 0;
    background: transparent; backdrop-filter: none; pointer-events: none;
  }
  .phone-device .reader-toolbar .back-button, .phone-device .reader-toolbar .reader-tools, .phone-device .reader-toolbar .reader-progress,
  .phone-device .reader-title small { display: none; }
  .phone-device .reader-title {
    margin: 0; min-width: 0; padding: 5px 8px; border-radius: 6px;
    background: rgba(18, 16, 13, .48); backdrop-filter: blur(8px);
  }
  .phone-device .reader-title strong { max-width: 68vw; margin: 0; font: 500 12px/1.2 var(--serif); }
  .phone-device .landscape-page-counter {
    display: block; margin-left: auto; padding: 6px 8px; border-radius: 6px;
    background: rgba(18, 16, 13, .48); backdrop-filter: blur(8px);
  }
  .phone-device .page-stage { inset: 0; padding: 0; }
  .phone-device .page-controls, .phone-device .quiet-button { display: none !important; }

  .phone-device .reader-view.fullscreen-reading .fullscreen-page-info {
    top: max(5px, env(safe-area-inset-top)); width: calc(100% - 20px); padding: 6px 10px;
    border: 0; border-radius: 7px; background: rgba(18, 16, 13, .48); backdrop-filter: blur(8px);
  }
  .phone-device .fullscreen-page-info strong { font-size: 12px; }
  .phone-device .fullscreen-page-info > div > span { font-size: 11px; }
  .phone-device .fullscreen-page-info .fullscreen-progress-track, .phone-device .fullscreen-page-info small { display: none; }
}

@media (orientation: portrait) and (max-width: 900px) {
  .reader-view.forced-landscape {
    width: var(--reader-vw, 100vw);
    height: var(--reader-vh, 100vh);
  }
  .reader-view.forced-landscape .reader-toolbar { display: none; }
  .phone-device .reader-view.fullscreen-reading.forced-landscape .reader-workspace {
    inset: auto;
    top: calc(var(--reader-vh, 100vh) / 2);
    left: calc(var(--reader-vw, 100vw) / 2);
    width: var(--reader-vh, 100vh);
    height: var(--reader-vw, 100vw);
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
    overflow: hidden;
  }
  .reader-view.forced-landscape .reader-content-frame { inset: 0; }
  .reader-view.forced-landscape .page-stage { inset: 0; padding: 0; touch-action: none; overscroll-behavior: none; }
  .reader-view.forced-landscape .current-image {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
  }
  .reader-view.forced-landscape .current-image .album-page {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  .reader-view.forced-landscape .page-controls,
  .reader-view.forced-landscape .quiet-button,
  .reader-view.forced-landscape .fullscreen-page-info { display: none !important; }
  .reader-view.forced-landscape .forced-landscape-info {
    position: absolute; z-index: 24; inset: 0 0 auto; width: 100%; min-height: 34px;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 5px 8px;
    color: #f4eee4; pointer-events: none;
  }
  .forced-landscape-info button, .forced-landscape-info span {
    min-height: 24px; padding: 5px 8px; border: 0; border-radius: 6px;
    background: rgba(18, 16, 13, .48); backdrop-filter: blur(8px);
  }
  .forced-landscape-info button { min-width: 0; color: #f4eee4; text-align: left; cursor: pointer; pointer-events: auto; }
  .forced-landscape-info strong { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 500 12px/1.2 var(--serif); }
  .forced-landscape-info span { flex: none; color: #d2c8ba; font: 11px/1.2 var(--serif); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* 对照阅读：主图与副图共享可调大小的阅读区域。 */
.reader-workspace { position: absolute; inset: 0; }
#companionButton { width: auto; padding: 0 12px; }
#companionButton span:last-child { display: inline; }
#companionButton[aria-pressed="true"] { background: #9d3e2a; border-color: #dc9a7b; }
.phone-device #companionButton { display: none; }

.home-search { display: flex; align-items: center; gap: 12px; width: min(520px, 100%); margin: 24px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); text-align: left; font: 14px/1.6 var(--sans); cursor: pointer; }
.home-search span:first-child { font-size: 26px; line-height: 1; color: var(--accent); }
.home-search span:last-child { margin-left: auto; color: var(--accent); }
.home-search:hover, .home-search:focus-visible { border-color: var(--accent); }
.search-panel { position: fixed; inset: 0; margin: auto; width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0 24px 24px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.search-panel::backdrop { background: #0008; }
.search-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 14px; background: var(--paper); }
.search-head h2 { margin: 0; font: 600 24px/1.5 var(--serif); }
.search-input-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.search-input-row { display: flex; gap: 10px; }
.search-input-row input { min-width: 0; flex: 1; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 16px; }
.search-input-row input:focus { outline: 2px solid var(--jade); outline-offset: 1px; }
.search-input-row .primary-button { flex: none; border-radius: 10px; }
.search-filter { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.search-filter select { min-width: 0; flex: 1; max-width: 330px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: 13px var(--sans); }
.search-hint, .search-status { font: 12px/1.8 var(--sans); color: var(--muted); }
.search-status { color: var(--accent); }
.search-list { display: grid; gap: 10px; }
.search-item { display: grid; gap: 8px; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.search-item:hover, .search-item:focus-visible { border-color: var(--accent); outline: none; }
.search-item:disabled { opacity: .6; cursor: progress; }
.search-item small { color: var(--muted); font-size: 11px; }
.search-item strong { font: 600 17px/1.5 var(--serif); }
.search-excerpt { font: 15px/1.8 var(--serif); }
.search-result-action { color: var(--accent); font-size: 12px; }
.search-item mark { padding: 0 2px; border-radius: 2px; color: var(--ink); background: color-mix(in srgb, var(--accent) 23%, var(--paper)); }
.search-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.search-actions .tool-button { width: auto; min-width: 100px; padding: 0 14px; justify-content: center; }
@media (max-width: 600px) {
  .header-actions { gap: 6px; }
  .search-panel { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 0 14px 16px; }
  .search-input-row { gap: 8px; }
  .search-input-row input { padding-inline: 10px; }
  .search-item { padding: 12px; }
}
.companion-pane[hidden], .reader-divider[hidden] { display: none; }
.reader-view.companion-open .reader-workspace { inset: 70px 0 0; display: flex; flex-direction: row; }
.reader-view.companion-open .reader-content-frame { position: relative; inset: auto; flex: 0 0 calc((100% - 12px) * var(--main-share, .5)); min-width: 0; min-height: 0; }
.reader-view.companion-open .page-stage { inset: 0; padding: 12px 12px 62px; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.reader-view.companion-open .current-image { min-width: 0; min-height: 0; overflow: hidden; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.reader-view.companion-open .current-image .album-page { width: 100%; height: 100%; object-fit: contain; background: transparent; box-shadow: none; }
.reader-view.companion-open .page-controls { bottom: 10px; }
.reader-view.companion-open .reader-workspace[data-companion-layout="left"] { flex-direction: row-reverse; }
.reader-view.companion-open .reader-workspace[data-companion-layout="bottom"] { flex-direction: column; }
.reader-view.companion-open .reader-workspace[data-companion-layout="top"] { flex-direction: column-reverse; }
.reader-divider { position: relative; display: grid; place-items: center; flex: 0 0 12px; touch-action: none; cursor: col-resize; background: #302922; outline-offset: -2px; }
.reader-divider span { width: 3px; height: 44px; border-radius: 3px; background: #9c8871; }
.reader-divider:hover, .reader-divider:focus-visible, .resizing .reader-divider { background: #654938; }
.reader-divider[aria-orientation="horizontal"] { cursor: row-resize; }
.reader-divider[aria-orientation="horizontal"] span { width: 44px; height: 3px; }
.reader-workspace.resizing { user-select: none; }
.companion-pane { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #1b1814; color: #eee7da; }
.companion-head { display: flex; flex: none; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.companion-head > div { flex: 1; min-width: 0; }
.companion-head small { display: block; font-size: 10px; color: #b4a28c; }
.companion-head strong { display: block; margin-top: 4px; font: 500 15px/1.4 var(--serif); overflow-wrap: anywhere; }
.companion-head .icon-button { flex: none; width: 32px; height: 32px; color: inherit; background: transparent; border-color: #ffffff25; }
.companion-options { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 6px; font-size: 11px; color: #b4a28c; }
.companion-options select, .companion-options button { min-height: 32px; padding: 4px 7px; color: #eee7da; background: #28211a; border: 1px solid #ffffff25; border-radius: 6px; font: inherit; }
.companion-options select { color-scheme: dark; }
.companion-status { flex: none; margin: 0; padding: 2px 14px 6px; color: #dc9a7b; font-size: 11px; line-height: 1.6; }
.companion-clause { flex: none; margin: 0 14px 8px; font: 12px/1.65 var(--serif); color: #bfb2a2; }
.companion-clause summary { cursor: pointer; }
.companion-clause p { margin: 6px 0; max-height: 110px; overflow: auto; }
.companion-image-stage { position: relative; flex: 1 0 96px; min-height: 96px; display: grid; place-items: center; overflow: hidden; }
.companion-image-stage img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 8px; object-fit: contain; }
.companion-image-stage p { padding: 12px; color: #b4a28c; font-size: 12px; text-align: center; }
.companion-image-stage p:empty { display: none; }
.companion-controls { display: flex; flex: none; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 8px 10px; border-top: 1px solid #ffffff12; }
.companion-controls button { min-width: 38px; min-height: 36px; border: 1px solid #ffffff25; border-radius: 20px; color: inherit; background: transparent; cursor: pointer; }
.companion-controls button:disabled { opacity: .3; cursor: default; }
.companion-controls span { font-size: 11px; color: #bfb2a2; }
.reader-view.companion-open.quiet .reader-workspace { inset: 0; }
.reader-view.companion-open.fullscreen-reading .reader-toolbar,
.reader-view.companion-open.fullscreen-reading .page-controls,
.reader-view.companion-open.fullscreen-reading .quiet-button,
.reader-view.companion-open.fullscreen-reading .fullscreen-page-info,
.reader-view.companion-open.fullscreen-reading .reader-divider,
.reader-view.companion-open.fullscreen-reading .companion-head,
.reader-view.companion-open.fullscreen-reading .companion-options,
.reader-view.companion-open.fullscreen-reading .companion-status,
.reader-view.companion-open.fullscreen-reading .companion-clause,
.reader-view.companion-open.fullscreen-reading .companion-controls { display: none !important; }
.reader-view.companion-open.fullscreen-reading .reader-workspace { inset: 0; }
.reader-view.companion-open.fullscreen-reading .reader-content-frame { flex-basis: calc(100% * var(--main-share, .5)); }
.reader-view.companion-open.fullscreen-reading .page-stage { padding: 0; outline: none; }
.reader-view.companion-open.fullscreen-reading .companion-pane { overflow: hidden; background: #000; }
.reader-view.companion-open.fullscreen-reading .companion-image-stage { min-height: 0; flex: 1 1 0; touch-action: none; outline: none; }
.reader-view.companion-open.fullscreen-reading .companion-image-stage img { padding: 0; }
