/*
 * Theme Name: book
 * Theme URI: https://daimarushi.cn
 * Description: 一本翻开的书 —— 复古泛黄的双页阅读主题，左页目录、右页正文。
 * Author: randaxia
 * Author URI: https://daimarushi.cn
 * Version: 1.5.4
 */

:root {
    /* 留言输入框背景图：直接替换 assets/letter-bg.png 即可换图，
       也可以改成任意图片地址，例如 url("https://example.com/letter.jpg") */
    --letter-bg: url("assets/letter-bg.png");
    --paper: #f4e7ca;
    --paper-hi: #f8eed6;
    --paper-lo: #e6d2a9;
    --paper-deep: #d8bf92;
    --ink: #3a2b1b;
    --ink-soft: #6b573c;
    --ink-faint: #9a8560;
    --rule: rgba(88, 64, 36, .20);
    --rule-soft: rgba(88, 64, 36, .12);
    --seal: #9c3d2e;
    --seal-soft: rgba(156, 61, 46, .12);
    --gold: #a4813c;
    --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; overflow-x: hidden; }

body.book-body {
    margin: 0;
    background: #120c07;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

/* ---------------- 桌面与背景 ---------------- */

.desk {
    position: relative;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2.3vh, 28px) clamp(20px, 4vw, 76px);
    
}

.desk__bg {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: saturate(.92) brightness(.7) contrast(1.02);
    transform: scale(1.03);
    z-index: 0;
}

.desk__light {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(56% 38% at 50% 0%, rgba(255, 206, 140, .26), rgba(255, 190, 110, 0) 72%),
        radial-gradient(120% 100% at 50% 45%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .56) 100%);
}

/* 全局透明 PNG 形状遮罩：叠在桌面照片之上、书本之下 */
.desk__mask {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image: url("assets/mask.png");
    background-repeat: repeat;
    background-position: 0 0;
    background-size: 3px 3px;
    opacity: 1;
    transform: none;
    image-rendering: pixelated;
}

/* 书后的暖光，缓慢呼吸 */
.book-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(1380px, 96vw);
    height: 84%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(58% 52% at 50% 46%, rgba(255, 190, 112, .22), rgba(255, 160, 80, .06) 55%, rgba(0, 0, 0, 0) 78%);
    filter: blur(18px);
    animation: glowBreath 9s ease-in-out infinite;
}

@keyframes glowBreath {
    0%, 100% { opacity: .75; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.025); }
}

/* ---------------- 书体 ---------------- */

.book {
    position: relative;
    z-index: 2;
    width: min(1240px, 100%);
    height: 100%;
    
}

/* 书页本体：合上时整本书向右半侧收拢，封面正好落在原来右页的位置 */
.book__spread {
    position: relative;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 5px 5px 7px 7px;
    transform: translateX(0);
    
}

/* 皮革封面 / 外框厚度 */
.book__spread::before {
    content: "";
    position: absolute;
    inset: -5px -9px -8px;
    border-radius: 8px 8px 10px 10px;
    background: linear-gradient(180deg, #55361c, #2f1b0b 42%, #1b0f05);
    box-shadow:
        0 34px 70px rgba(0, 0, 0, .74),
        0 10px 22px rgba(0, 0, 0, .46),
        inset 0 0 0 1px rgba(212, 174, 112, .26),
        inset 0 1px 0 rgba(255, 228, 178, .22);
    z-index: 0;
}

/* 书根：一道收口，不再有叠页 */
.book__spread::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: -7px;
    height: 8px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(180deg, #3d2714, #1b0f05);
    box-shadow: 0 7px 18px rgba(0, 0, 0, .52);
    z-index: 1;
}

/* 书签飘带：文章右上角，贴着正文右缘垂下 */
.book__ribbon {
    position: absolute;
    top: 0;
    right: calc(clamp(20px, 3vw, 46px) - 13px);
    left: auto;
    width: 13px;
    height: 62px;
    z-index: 6;
    pointer-events: none;
    background: linear-gradient(180deg, #b0462f 0%, #933524 44%, #6d2117 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
    box-shadow:
        2px 4px 10px rgba(40, 12, 6, .28),
        inset 1px 0 0 rgba(255, 220, 170, .26),
        inset -1px 0 0 rgba(60, 10, 4, .35);
    transform-origin: top center;
    animation: ribbonSway 8s ease-in-out infinite;
    transition: opacity .32s ease, visibility .32s;
}
.book__ribbon::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 8px;
    background: linear-gradient(180deg, rgba(58, 16, 9, .55), rgba(58, 16, 9, 0));
}
.book__ribbon i {
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 12px;
    width: 1px;
    margin-left: -.5px;
    background: linear-gradient(180deg, rgba(246, 214, 160, .55), rgba(246, 214, 160, .06));
}
.book.is-closed .book__ribbon,
.book.is-closing .book__ribbon { opacity: 0; visibility: hidden; }

@keyframes ribbonSway {
    0%, 100% { transform: rotate(-.8deg); }
    50% { transform: rotate(1.1deg); }
}
.book__spine {
    position: absolute;
    left: 50%;
    top: 6px;
    bottom: 0;
    width: 28px;
    transform: translateX(-50%);
    z-index: 6;
    pointer-events: none;
    background: linear-gradient(90deg,
        rgba(74, 50, 24, 0) 0%,
        rgba(74, 50, 24, .14) 26%,
        rgba(52, 34, 15, .40) 48%,
        rgba(74, 50, 24, .16) 70%,
        rgba(74, 50, 24, 0) 100%);
}


/* ============================================================
   封面：素纸精装（象牙纸面 · 圆柱书脊 · 竖排书名）
   —— 完全独立于内页与桌面场景，只作用于 #bookCover
   ============================================================ */

.book__coverwrap {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 50%;
    z-index: 20;
    pointer-events: none;
}

/* 封面容器：不参与旋转，只负责交互、透视与层级 */
.book-cover {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    perspective: 2200px;
    perspective-origin: 20% 46%;
}
.book-cover:focus-visible { outline: 2px solid rgba(150, 52, 36, .55); outline-offset: 4px; }

/* 合上时投在桌面上的影子：独立一层，不跟随封面旋转 */
.book-cover__cast {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 2px 4px 4px 2px;
    pointer-events: none;
    box-shadow:
        0 30px 54px -26px rgba(16, 10, 4, .82),
        0 12px 24px -14px rgba(16, 10, 4, .55),
        5px 9px 22px -16px rgba(16, 10, 4, .62);
}

/* 会翻动的那一片：封面 + 封底内衬 */
.book-cover__leaf {
    position: absolute;
    inset: 0;
    z-index: 1;
    transform-origin: left center;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
}

.book-cover__face,
.book-cover__back {
    position: absolute;
    inset: 0;
    border-radius: 2px 4px 4px 2px;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ---------- 封面正面：象牙纸面 ---------- */

.book-cover__face {
    background:
        linear-gradient(103deg, #e2d7be 0%, #ede3ce 30%, #f3ead8 66%, #e9ddc5 100%),
        radial-gradient(140% 90% at 62% 0%, rgba(255, 253, 246, .55), rgba(255, 253, 246, 0) 78%),
        radial-gradient(86% 62% at 97% 96%, rgba(158, 128, 78, .16), rgba(158, 128, 78, 0) 76%);
    box-shadow:
        inset 0 1px 0 rgba(255, 253, 246, .72),
        inset -1px 0 0 rgba(120, 96, 58, .16),
        inset 0 -1px 0 rgba(120, 96, 58, .12);
}

/* 纸纤维：极细的经纬纹，避免大面积留白过于平整 */
.bc-cloth {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .62;
    mix-blend-mode: multiply;
    background-image:
        repeating-linear-gradient(0deg, rgba(122, 98, 62, .042) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
        repeating-linear-gradient(90deg, rgba(122, 98, 62, .032) 0 1px, rgba(255, 255, 255, 0) 1px 4px);
}

/* 纸面噪点 */
.bc-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .17;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.86' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.55'/%3E%3C/svg%3E");
}

/* 旧渍：淡淡的水痕与霉点，像放了很久的纸 */
.bc-age {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .55;
    mix-blend-mode: multiply;
    background:
        radial-gradient(17% 11% at 74% 29%, rgba(150, 112, 62, .14), rgba(150, 112, 62, 0) 70%),
        radial-gradient(11% 8% at 63% 62%, rgba(150, 112, 62, .11), rgba(150, 112, 62, 0) 70%),
        radial-gradient(25% 15% at 87% 79%, rgba(140, 104, 56, .10), rgba(140, 104, 56, 0) 72%),
        radial-gradient(8% 6% at 47% 17%, rgba(150, 112, 62, .09), rgba(150, 112, 62, 0) 70%),
        radial-gradient(30% 20% at 12% 96%, rgba(140, 104, 56, .10), rgba(140, 104, 56, 0) 74%);
}

/* ---------- 书脊（书骨）：一段被光擦亮的圆背 ---------- */

.bc-spine {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 37px;
    pointer-events: none;
    background:
        /* 圆柱体受光：外侧转入暗部，靠封面一侧渐次提亮 */
        linear-gradient(90deg,
            rgba(38, 26, 12, .78) 0%,
            rgba(58, 42, 22, .52) 2px,
            rgba(74, 56, 30, .34) 6px,
            rgba(255, 250, 236, .04) 13px,
            rgba(255, 253, 244, .14) 40%,
            rgba(255, 253, 244, .30) 62%,
            rgba(255, 253, 244, .52) 84%,
            rgba(255, 253, 244, .16) 100%),
        linear-gradient(90deg,
            #6d5d47 0%, #867555 7%, #a5957a 24%,
            #c4b59a 44%, #dbcdb2 64%, #f0e6d1 84%, #f7f0e0 92%, #e7ddc7 100%);
    box-shadow:
        4px 0 15px -8px rgba(58, 42, 18, .70),
        inset -1px 0 0 rgba(96, 74, 40, .38);
}

/* 外侧板边：一条 2px 的高光，做出包边的厚度 */
.bc-spine::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(86deg,
        rgba(255, 250, 235, .50),
        rgba(255, 250, 235, .16) 10%,
        rgba(84, 64, 36, .22) 86%,
        rgba(42, 28, 12, .40));
}

/* 书脊与封面之间的压槽：向封面一侧漏出的浅影 */
.bc-spine::after {
    content: "";
    position: absolute;
    right: -1px;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(90deg,
        rgba(102, 78, 42, .26),
        rgba(102, 78, 42, .08) 42%,
        rgba(255, 255, 250, 0) 100%);
}

/* 书头 / 书根：上下两端收口的一道细棱 */
.bc-spine__cap {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(180deg, rgba(48, 34, 16, .28), rgba(255, 252, 240, .14) 62%, rgba(48, 34, 16, 0));
    box-shadow: 0 1px 0 rgba(255, 253, 244, .30);
}
.bc-spine__cap--t { top: 0; }
.bc-spine__cap--b { bottom: 0; transform: scaleY(-1); }

/* ---------- 竖排书名 + 侧栏小字（BOOK／域名） ---------- */

.bc-plate {
    position: absolute;
    z-index: 3;
    left: 22%;
    right: 21%;
    top: 7.5%;
    bottom: 12%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    pointer-events: none;
}

/* 书名与朱印这一列 */
.bc-plate__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    min-width: 0;
    max-height: 100%;
}

.bc-plate__title {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--serif);
    font-size: max(17px, min(19vmin, calc(56vh / var(--bc-ratio, 5.36))));
    font-weight: 500;
    line-height: 1;
    letter-spacing: .10em;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    color: #201e19;
    text-shadow: 0 0 .6px rgba(24, 20, 14, .55);
}

/* 书名下的朱印：只留一圈细边，不上实底 */
.bc-plate__seal {
    flex: none;
    width: 33px;
    height: 33px;
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1;
    color: rgba(154, 46, 30, .92);
    border: 1.7px solid rgba(154, 46, 30, .62);
    border-radius: 1px;
    background: rgba(255, 252, 244, .16);
    transform: rotate(-2.5deg);
    box-shadow: 0 0 0 1px rgba(255, 252, 244, .28);
}

/* 书名旁边的一列小字：BOOK — 细分隔线 — 域名 */
.bc-plate__side {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    max-height: 100%;
    padding-top: 30px;
}

.bc-plate__mark {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 11px;
    letter-spacing: .36em;
    line-height: 1;
    color: rgba(46, 42, 34, .56);
    white-space: nowrap;
}

/* 中间那道分隔线：两端渐隐，像刻在纸上的一刀 */
.bc-plate__rule {
    flex: none;
    width: 21px;
    height: 1px;
    background: linear-gradient(90deg,
        rgba(58, 50, 38, 0),
        rgba(58, 50, 38, .52) 18%,
        rgba(58, 50, 38, .52) 82%,
        rgba(58, 50, 38, 0));
}

.bc-plate__host {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 8.5px;
    letter-spacing: .24em;
    line-height: 1;
    max-height: 100%;
    overflow: hidden;
    color: rgba(56, 50, 40, .42);
    white-space: nowrap;
}

/* 后台自定义封面图：轻纱覆盖，保证墨字仍然清楚 */
.book-cover__art {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: saturate(.94) contrast(1.02);
}
.book-cover__art::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(247, 240, 227, .64) 0%,
            rgba(247, 240, 227, .34) 32%,
            rgba(247, 240, 227, .28) 66%,
            rgba(244, 236, 222, .68) 100%);
}
.book-cover.has-art .bc-cloth,
.book-cover.has-art .bc-age { opacity: .14; }
.book-cover.has-art .bc-plate__title {
    text-shadow: 0 0 17px rgba(252, 248, 238, .92), 0 0 4px rgba(252, 248, 238, .72);
}
.book-cover.has-art .bc-plate__seal { color: rgba(158, 52, 36, .8); }
.book-cover.has-art .bc-plate__mark { color: rgba(46, 42, 34, .72); }
.book-cover.has-art .bc-plate__host { color: rgba(46, 42, 34, .58); }
.book-cover.has-art .bc-plate__rule {
    background: linear-gradient(90deg,
        rgba(58, 50, 38, 0),
        rgba(58, 50, 38, .52) 22%,
        rgba(58, 50, 38, .52) 78%,
        rgba(58, 50, 38, 0));
}

/* 纸面边缘：一圈极浅的压凹，不抢戏 */
.bc-bevel {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow:
        inset 0 0 0 1px rgba(104, 82, 48, .14),
        inset 0 0 24px 6px rgba(146, 116, 68, .10);
}

/* 轻触翻开 */
.book-cover__hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4.2%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 10px;
    letter-spacing: .28em;
    text-indent: .28em;
    color: rgba(56, 50, 40, .40);
    pointer-events: none;
}
.book-cover__hint::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(158, 52, 36, .62);
    animation: coverPulse 2.8s ease-in-out infinite;
}
@keyframes coverPulse {
    0%, 100% { opacity: .28; transform: scale(.7); }
    50%      { opacity: 1; transform: scale(1.15); }
}

/* 高光：鼠标悬停时掠过 */
.book-cover__sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(104deg, rgba(255, 250, 235, 0) 36%, rgba(255, 250, 235, .12) 47%, rgba(255, 250, 235, 0) 58%);
    transform: translateX(-26%);
    transition: opacity .55s ease, transform 1.25s ease;
}
.book.is-closed .book-cover:hover .book-cover__sheen { opacity: 1; transform: translateX(26%); }

/* ---------- 封面内衬（翻开后朝上的那一面）---------- */

.book-cover__back {
    transform: rotateY(180deg);
    background:
        repeating-linear-gradient(58deg, rgba(150, 110, 64, .075) 0 3px, rgba(150, 110, 64, 0) 3px 9px),
        repeating-linear-gradient(-34deg, rgba(150, 110, 64, .05) 0 2px, rgba(150, 110, 64, 0) 2px 8px),
        radial-gradient(124% 100% at 62% 14%, #f7efdb, #ece0c6 56%, #dbcba7 100%);
    box-shadow: inset 0 0 0 1px rgba(120, 92, 52, .20);
}
.bc-end {
    position: absolute;
    inset: 15px;
    border: 1px solid rgba(120, 92, 52, .14);
    border-radius: 2px;
}
.bc-end::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(120, 92, 52, .08);
}
.bc-end__mark {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    letter-spacing: .52em;
    text-indent: .52em;
    color: rgba(120, 92, 52, .24);
}

/* ---------- 书口：右侧叠页 ---------- */

.book-cover__fore {
    position: absolute;
    z-index: 2;
    top: 6px;
    bottom: 6px;
    right: -9px;
    width: 9px;
    border-radius: 0 3px 3px 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255, 251, 240, .58), rgba(210, 188, 148, .34) 55%, rgba(150, 120, 76, .30)),
        repeating-linear-gradient(90deg, #f6ecd8 0 1px, #dccaa8 1px 2px, #eee2c9 2px 3px);
    box-shadow:
        2px 0 7px rgba(0, 0, 0, .30),
        inset 0 1px 0 rgba(255, 255, 255, .55),
        inset 0 -1px 0 rgba(120, 88, 42, .30);
}

/* ============================================================
   合书 / 翻开：所有图层共用一条时间轴，杜绝各自为政的错时
   ============================================================ */

.book {
    --book-flip: 960ms;
    --book-ease: cubic-bezier(.33, .04, .2, 1);
}

/* ---- 封面的两个终态 ---- */
.book:not(.is-closed) .book-cover__leaf {
    transform: rotateY(-172deg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.book.is-closing .book-cover__leaf,
.book.is-opening .book-cover__leaf {
    visibility: visible;
}

.book.is-opening .book-cover__leaf {
    animation: cvOpen var(--book-flip) var(--book-ease) both;
    will-change: transform, opacity;
}
.book.is-closing .book-cover__leaf {
    animation: cvClose var(--book-flip) var(--book-ease) both;
    will-change: transform, opacity;
}
@keyframes cvOpen {
    0%   { transform: rotateY(0deg); opacity: 1; }
    66%  { opacity: 1; }
    100% { transform: rotateY(-172deg); opacity: 0; }
}
@keyframes cvClose {
    0%   { transform: rotateY(-172deg); opacity: 0; }
    14%  { opacity: 1; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

.book.is-opening .book-cover { pointer-events: none; }
.book:not(.is-closed) .book__coverwrap { pointer-events: none; }

/* ---- 书体左右收拢 ---- */
.book__spread { transform: translateX(0); }
.book.is-closed .book__spread { transform: translateX(-25%); }
.book.is-opening .book__spread { animation: spreadOpen var(--book-flip) var(--book-ease) both; }
.book.is-closing .book__spread { animation: spreadClose var(--book-flip) var(--book-ease) both; }
@keyframes spreadOpen { from { transform: translateX(-25%); } to { transform: translateX(0); } }
@keyframes spreadClose { from { transform: translateX(0); } to { transform: translateX(-25%); } }

/* ---- 皮革外框 ---- */
.book__spread::before,
.book__spread::after { opacity: 1; }
.book.is-closed .book__spread::before,
.book.is-closed .book__spread::after { opacity: 0; }
.book.is-opening .book__spread::before,
.book.is-opening .book__spread::after { animation: frameIn var(--book-flip) linear both; }
.book.is-closing .book__spread::before,
.book.is-closing .book__spread::after { animation: frameOut var(--book-flip) linear both; }
@keyframes frameIn  { 0%, 8% { opacity: 0; } 56%, 100% { opacity: 1; } }
@keyframes frameOut { 0%, 10% { opacity: 1; } 46%, 100% { opacity: 0; } }

/* ---- 书脊（中缝）---- */
.book__spine { opacity: 1; }
.book.is-closed .book__spine { opacity: 0; }
.book.is-opening .book__spine { animation: spineIn var(--book-flip) linear both; }
.book.is-closing .book__spine { animation: spineOut var(--book-flip) linear both; }
@keyframes spineIn  { 0%, 34% { opacity: 0; } 82%, 100% { opacity: 1; } }
@keyframes spineOut { 0%, 4% { opacity: 1; } 30%, 100% { opacity: 0; } }

/* ---- 书页 ---- */
.book.is-closed .page { opacity: 0; }
.book.is-opening .page--left  { animation: pageInL var(--book-flip) linear both; }
.book.is-opening .page--right { animation: pageInR var(--book-flip) linear both; }
.book.is-closing .page--left  { animation: pageOutL var(--book-flip) linear both; }
.book.is-closing .page--right { animation: pageOutR var(--book-flip) linear both; }
@keyframes pageInL  { 0%, 40% { opacity: 0; } 88%, 100% { opacity: 1; } }
@keyframes pageInR  { 0%, 4% { opacity: 0; } 38%, 100% { opacity: 1; } }
@keyframes pageOutR { 0%, 8% { opacity: 1; } 40%, 100% { opacity: 0; } }
@keyframes pageOutL { 0%, 2% { opacity: 1; } 28%, 100% { opacity: 0; } }

.book.is-closed .page,
.book.is-closing .page,
.book.is-opening .page { pointer-events: none; }

/* ---- 桌面投影 ---- */
.book-cover__cast { opacity: 1; }
.book:not(.is-closed) .book-cover__cast { opacity: 0; }
.book.is-opening .book-cover__cast { animation: castOut var(--book-flip) linear both; }
.book.is-closing .book-cover__cast { animation: castIn var(--book-flip) linear both; }
@keyframes castOut { 0%, 8% { opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes castIn  { 0%, 38% { opacity: 0; } 92%, 100% { opacity: 1; } }

/* ---- 书口叠页：合书过程中跟着封面一起长出来，不再等书合完 ---- */
.book-cover__fore { opacity: 1; }
.book:not(.is-closed) .book-cover__fore { opacity: 0; }
.book.is-opening .book-cover__fore { animation: foreOut var(--book-flip) linear both; }
.book.is-closing .book-cover__fore { animation: foreIn var(--book-flip) linear both; }
@keyframes foreOut {
    0%, 5% { opacity: 1; transform: translateX(0); }
    30%, 100% { opacity: 0; transform: translateX(6px); }
}
@keyframes foreIn {
    0%, 40% { opacity: 0; transform: translateX(7px); }
    86%, 100% { opacity: 1; transform: translateX(0); }
}

/* 书签飘带：随书页一起收放 */
.book__ribbon { transition: opacity .3s ease, visibility .3s; }

.page {
    position: relative;
    z-index: 2;
    min-width: 0;
    overflow: hidden;
    background: var(--paper);
}

.page--left {
    border-radius: 4px 0 0 5px;
    background:
        linear-gradient(90deg, #dcc69b 0%, #ecd9b4 1.4%, #f7ecd4 9%, var(--paper) 42%, #efdfbd 92%, #d9c196 100%);
    box-shadow: inset -18px 0 26px -18px rgba(70, 46, 20, .55);
}

.page--right {
    border-radius: 0 4px 5px 0;
    background:
        linear-gradient(270deg, #dcc69b 0%, #ecd9b4 1.4%, #f7ecd4 9%, var(--paper) 42%, #efdfbd 92%, #d9c196 100%);
    box-shadow: inset 18px 0 26px -18px rgba(70, 46, 20, .55);
}

.page--right::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 78px;
    height: 78px;
    pointer-events: none;
    background: linear-gradient(315deg, rgba(120, 88, 42, .26), rgba(255, 248, 232, 0) 62%);
}

.page__grain {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .30;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
}

.page__progress {
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
    z-index: 7;
    background: linear-gradient(180deg, rgba(156, 61, 46, .75), rgba(164, 129, 60, .22));
    transition: height .12s linear;
}

.page__progress--right { right: auto; left: 0; }

.page__scroll {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 clamp(18px, 2.4vw, 40px);
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.page__scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------------- 左页：刊头 ---------------- */

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex: 0 0 auto;
    padding: clamp(15px, 2.2vh, 26px) 0 11px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.brand__seal {
    flex: none;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 3px;
    font-size: 22px;
    line-height: 1;
    color: #f6e3c2;
    background: linear-gradient(155deg, #ad4a30, #7d2a1c);
    box-shadow: inset 0 0 0 1px rgba(255, 230, 190, .38), 0 2px 6px rgba(60, 20, 10, .35);
}

.brand__seal--image { overflow: hidden; background: none; box-shadow: none; }
.brand__seal--image img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }

.brand__text { min-width: 0; }
.brand__text strong {
    display: block;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .10em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand__text em {
    display: block;
    margin-top: 3px;
    font-style: normal;
    font-size: 10.5px;
    letter-spacing: .16em;
    color: var(--ink-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iconbtn {
    position: relative;
    z-index: 2;
    flex: none;
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(164, 129, 60, .42);
    border-radius: 50%;
    background: radial-gradient(120% 120% at 32% 24%, #fffdf4, #f1e2c1);
    color: #8a6c33;
    cursor: pointer;
    box-shadow:
        inset 0 0 0 3px rgba(255, 250, 236, .72),
        inset 0 0 0 4px rgba(164, 129, 60, .16),
        0 1px 3px rgba(60, 40, 15, .14);
    transition: color .2s, border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.iconbtn:hover {
    color: var(--seal);
    border-color: rgba(156, 61, 46, .5);
    background: radial-gradient(120% 120% at 32% 24%, #fff9ec, #f4e3c4);
    box-shadow:
        inset 0 0 0 3px rgba(255, 250, 236, .8),
        inset 0 0 0 4px rgba(156, 61, 46, .16),
        0 2px 8px rgba(60, 20, 10, .18);
}
.iconbtn:active { transform: scale(.94); }
.iconbtn.is-open { color: var(--seal); border-color: rgba(156, 61, 46, .5); background: rgba(156, 61, 46, .1); }

/* ---------------- 搜索 ---------------- */

.search {
    flex: 0 0 auto;
    overflow: hidden;
    padding: 1px 0 11px;
    border-bottom: 1px solid var(--rule);
    animation: searchDrop .26s ease both;
}

.search[hidden] { display: none; }

@keyframes searchDrop {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.search__box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 14px;
    border: 1px solid rgba(120, 92, 52, .34);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(255, 253, 245, .97), rgba(245, 233, 209, .93));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .75),
        inset 0 0 0 1px rgba(255, 255, 255, .40),
        0 1px 2px rgba(70, 46, 20, .07);
    transition: border-color .22s, box-shadow .22s, background .22s;
}

/* 左侧一道细金线，像书页里夹着的索引签 */
.search__box::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(164, 129, 60, .62), rgba(164, 129, 60, .10));
    pointer-events: none;
}

.search__box:focus-within {
    border-color: rgba(156, 61, 46, .42);
    background: linear-gradient(180deg, #fffdf7, #f8efdb);
    box-shadow:
        0 0 0 3px rgba(164, 129, 60, .12),
        inset 0 0 0 1px rgba(255, 255, 255, .6);
}

.search__icon { flex: none; color: var(--gold); transition: color .2s, transform .2s; }
.search__box:focus-within .search__icon { color: var(--seal); transform: scale(1.06); }

.search__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: var(--serif);
    font-size: 13.5px;
    letter-spacing: .02em;
    color: var(--ink);
}
.search__input:focus { outline: none; }
.search__input::placeholder { color: rgba(122, 100, 66, .55); letter-spacing: .04em; }
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear {
    flex: none;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(88, 64, 36, .12);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.search__clear:hover { background: rgba(156, 61, 46, .16); color: var(--seal); }
.search__clear[hidden] { display: none; }

/* 挖坟按钮：一枚压印的朱红书签，和封面烫金呼应 */
.search__btn {
    position: relative;
    flex: none;
    height: 30px;
    padding: 0 15px;
    font-family: var(--serif);
    font-size: 12px;
    letter-spacing: .16em;
    text-indent: .16em;
    color: #fbeed6;
    background: linear-gradient(180deg, #ad4a30 0%, #8d3120 52%, #6f2417 100%);
    border: 1px solid #64200f;
    border-radius: 4px;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 226, 180, .38),
        inset 0 -1px 0 rgba(58, 16, 6, .50),
        0 1px 3px rgba(60, 20, 10, .22);
    transition: filter .2s, transform .15s, box-shadow .2s;
}
.search__btn:hover {
    filter: brightness(1.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 236, 200, .50),
        inset 0 -1px 0 rgba(58, 16, 6, .45),
        0 2px 7px rgba(60, 20, 10, .24);
}
.search__btn:active { transform: translateY(1px); }

.search__hint {
    margin: 7px 2px 0;
    font-size: 10.5px;
    letter-spacing: .08em;
    color: var(--ink-faint);
}

/* 「不填也行，等着被提示吧」：一枚压在挖坟框下的朱印纸签 */
.search__error {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 5px 10px 5px 5px;
    font-size: 10.5px;
    line-height: 1.5;
    letter-spacing: .04em;
    color: var(--seal);
    background: linear-gradient(180deg, rgba(255, 249, 234, .97), rgba(245, 227, 199, .94));
    border: 1px solid rgba(156, 61, 46, .28);
    border-left: 2px solid rgba(156, 61, 46, .62);
    border-radius: 4px;
}
.search__error[hidden] { display: none; }
.search__error.is-in { animation: errIn .2s ease both; }
.search__error-mark {
    flex: none;
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    line-height: 1;
    color: #fdf3df;
    background: linear-gradient(155deg, #b04a33, #8c3020);
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(255, 230, 190, .28);
}
.search__error-text { font-weight: 600; letter-spacing: .08em; }
.search__error-tip { font-size: 9.5px; color: rgba(107, 87, 60, .78); }
.search__error-tip::before { content: "·"; margin-right: 5px; color: rgba(156, 61, 46, .45); }

.search__box.is-invalid {
    border-color: rgba(156, 61, 46, .6);
    background: linear-gradient(180deg, #fdf3e6, #f7e6cf);
}
.search__box.is-invalid .search__icon { color: var(--seal); }
.search__box.is-invalid .search__input::placeholder { color: rgba(156, 61, 46, .58); }
.search__box.is-shake { animation: fieldShake .34s cubic-bezier(.36, .07, .19, .97) both; }

/* ---------------- 导航 ---------------- */

.menu {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    padding: 11px 0 12px;
    border-bottom: 1px solid var(--rule);
}
.menu a {
    position: relative;
    padding: 3px 0;
    font-size: 13.5px;
    letter-spacing: .14em;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color .2s;
}
.menu a:hover { color: var(--seal); }
.menu a.is-active { color: var(--seal); }
.menu a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--seal);
}

/* ---------------- 目录 ---------------- */

.catalog-head {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 15px 0 6px;
}
.catalog-head__cn { font-size: 13px; letter-spacing: .34em; color: var(--ink); font-weight: 600; }
.catalog-head__en { font-size: 9px; letter-spacing: .26em; color: var(--ink-faint); text-transform: uppercase; }
.catalog-head__count { margin-left: auto; font-size: 10.5px; letter-spacing: .1em; color: var(--ink-faint); }
.catalog-head__count.is-hit { color: var(--seal); }

.postlist {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 0 6px;
    list-style: none;
}

.entry { border-bottom: 1px dashed var(--rule-soft); }
.entry:last-child { border-bottom: none; }
.entry.is-hidden { display: none; }

.entry__link {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 2px 10px 0;
    color: var(--ink);
    text-decoration: none;
    transition: color .18s, padding-left .22s;
}
.entry__link:hover { color: var(--seal); padding-left: 4px; }

.entry__mark {
    flex: none;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .35;
    transform: translateY(-4px);
}
.entry.is-current .entry__mark { width: 8px; height: 2px; border-radius: 1px; opacity: 1; background: var(--seal); }

.entry__title {
    flex: 0 1 auto;
    max-width: calc(100% - 62px);
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entry.is-current .entry__title { font-weight: 600; color: var(--seal); }

.entry__leader {
    flex: 1 1 10px;
    min-width: 8px;
    border-bottom: 1px dotted rgba(88, 64, 36, .40);
    transform: translateY(-4px);
}

.entry__date {
    flex: none;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.catalog-note {
    flex: 0 0 auto;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: var(--ink-faint);
    padding: 2px 0 0;
}
.catalog-note:empty { display: none; }
.catalog-note a { color: var(--seal); text-decoration: none; border-bottom: 1px solid rgba(156, 61, 46, .3); }

.catalog-foot {
    flex: 0 0 auto;
    padding: 12px 0 6px;
    border-top: 1px solid var(--rule-soft);
    font-size: 12px;
    color: var(--ink-faint);
}
.catalog-home { color: var(--ink-faint); text-decoration: none; letter-spacing: .08em; }
.catalog-home:hover { color: var(--seal); }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager a, .pager span {
    display: inline-block;
    min-width: 26px;
    padding: 2px 7px;
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 2px;
}
.pager a:hover { color: var(--seal); border-color: rgba(156, 61, 46, .35); }
.pager .current { color: var(--seal); border-color: rgba(156, 61, 46, .4); background: var(--seal-soft); }

/* ---------------- 页脚 ---------------- */

.colophon {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 20px 0 clamp(10px, 1.8vh, 20px);
    text-align: center;
    font-size: 11px;
    line-height: 1.9;
    letter-spacing: .06em;
    color: var(--ink-faint);
}
.colophon__mark {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
    color: rgba(164, 129, 60, .8);
}
.colophon__mark i {
    flex: 1 1 auto;
    height: 1px;
}
.colophon__mark i:first-child { background: linear-gradient(90deg, rgba(88, 64, 36, 0), rgba(88, 64, 36, .30)); }
.colophon__mark i:last-child { background: linear-gradient(90deg, rgba(88, 64, 36, .30), rgba(88, 64, 36, 0)); }
.colophon__mark span { font-size: 9px; line-height: 1; opacity: .9; }

.colophon__line {
    margin: 0 0 7px;
    font-size: 12.5px;
    line-height: 1.9;
    letter-spacing: .16em;
    color: var(--ink-soft);
}
.colophon__meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 3px 6px;
}
.colophon__meta a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid rgba(88, 64, 36, .28);
    transition: color .2s, border-color .2s;
}
.colophon__meta a:hover { color: var(--seal); border-color: rgba(156, 61, 46, .4); }
.colophon__dot { opacity: .55; }

.colophon__sign {
    margin: 5px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 10px;
    letter-spacing: .08em;
}
.colophon__chip {
    display: inline-block;
    padding: 1px 6px;
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #f6e3c2;
    background: linear-gradient(155deg, #a4813c, #7c5c26);
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(255, 240, 208, .3);
}
.colophon__sign a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid rgba(88, 64, 36, .28);
}
.colophon__sign a:hover { color: var(--seal); border-bottom-color: rgba(156, 61, 46, .4); }
.colophon__icp { margin: 4px 0 0; font-size: 10px; opacity: .85; }

/* ---------------- 右页：正文 ---------------- */

.page__scroll--right { padding: 0 clamp(20px, 3vw, 46px) 76px; overflow-anchor: none; }

.detail-wrap { flex: 0 0 auto; transition: opacity .22s ease; }
.detail-wrap.is-loading { opacity: .3; pointer-events: none; }

.detail { padding-top: clamp(16px, 2.4vh, 30px); }

/* 文章详情页：作者 / 日期 / 分类 / 留言居中 */
.detail--post .detail__meta {
    justify-content: center;
    text-align: center;
    gap: 5px 9px;
    padding-bottom: 11px;
}

/* 文章详情页标题居中 */
.detail--post .detail__title { text-align: center; }
.detail--post .detail__orn {
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.detail__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    font-size: 11.5px;
    letter-spacing: .1em;
    color: var(--ink-faint);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
}
.detail__meta a { color: var(--seal); text-decoration: none; }
.detail__meta a:hover { text-decoration: underline; }
.detail__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; }
.detail__kicker-inline {
    padding: 1px 7px;
    font-size: 10px;
    letter-spacing: .18em;
    color: var(--gold);
    border: 1px solid rgba(164, 129, 60, .38);
    border-radius: 2px;
}

/* 独立页面：标题与日期居中 */
.detail--page .detail__meta {
    justify-content: center;
    border-bottom: none;
    padding-bottom: 4px;
}
.detail--page .detail__title {
    text-align: center;
    margin: .1em 0 .35em;
}
.detail--page .detail__orn { max-width: 260px; margin-left: auto; margin-right: auto; }

.detail__kicker {
    margin: 0 0 6px;
    font-size: 9.5px;
    letter-spacing: .34em;
    color: var(--ink-faint);
    text-transform: uppercase;
}

.detail__title {
    margin: .55em 0 .3em;
    font-size: clamp(21px, 2vw, 28px);
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink);
    word-break: break-word;
}

.detail__orn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--gold);
    font-size: 10px;
}
.detail__orn::before, .detail__orn::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
}
.detail__orn::before { background: linear-gradient(90deg, rgba(164, 129, 60, 0), rgba(164, 129, 60, .55)); }
.detail__orn::after { background: linear-gradient(90deg, rgba(164, 129, 60, .55), rgba(164, 129, 60, 0)); }
.detail__orn span { flex: none; opacity: .8; }

.prose {
    font-size: 15.5px;
    line-height: 2;
    color: #3d2e1e;
    letter-spacing: .015em;
    word-break: break-word;
}
.prose p { margin: 0 0 1.1em; text-indent: 2em; }
.prose > p:first-child { text-indent: 2em; }
.prose h2, .prose h3, .prose h4 {
    margin: 1.9em 0 .75em;
    line-height: 1.5;
    font-weight: 600;
    color: var(--ink);
}
.prose h2 { font-size: 19px; padding-left: 11px; border-left: 3px solid var(--seal); }
.prose h3 { font-size: 17px; }
.prose h4 { font-size: 15.5px; color: var(--ink-soft); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.6em; }
.prose li { margin-bottom: .35em; }
.prose blockquote {
    margin: 1.5em 0;
    padding: 12px 16px;
    background: rgba(164, 129, 60, .10);
    border-left: 2px solid var(--gold);
    color: var(--ink-soft);
}
.prose blockquote p { text-indent: 0; margin-bottom: .4em; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.prose img,
.prose video,
.prose iframe,
.prose svg,
.prose canvas {
    display: block;
    max-width: 100% !important;
    width: auto;
    height: auto !important;
    margin-left: auto;
    margin-right: auto;
}
.prose img {
    padding: 5px;
    background: #fbf4e2;
    border: 1px solid var(--rule);
    border-radius: 2px;
    object-fit: contain;
}
.prose figure,
.prose p,
.prose li,
.prose div { max-width: 100%; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { font-size: 11.5px; color: var(--ink-faint); text-align: center; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
.prose pre { max-width: 100%; }
.prose .alignleft, .prose .alignright { float: none; margin: 1em auto; }
.prose .aligncenter { margin-left: auto; margin-right: auto; }
.prose a { color: var(--seal); text-decoration: none; border-bottom: 1px solid rgba(156, 61, 46, .35); }
.prose a:hover { border-bottom-color: var(--seal); }
.prose code {
    padding: .12em .38em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
    background: rgba(88, 64, 36, .10);
    border-radius: 2px;
}
.prose pre {
    margin: 1.4em 0;
    padding: 13px 15px;
    overflow-x: auto;
    background: rgba(88, 64, 36, .08);
    border: 1px solid var(--rule);
    border-radius: 3px;
    line-height: 1.7;
}
.prose pre code { background: none; padding: 0; font-size: 12.5px; }
.prose hr { border: none; height: 1px; margin: 2em 0; background: var(--rule); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.3em 0; font-size: 14px; }
.prose th, .prose td { padding: 7px 10px; border: 1px solid var(--rule); text-align: left; }
.prose th { background: rgba(88, 64, 36, .07); font-weight: 600; }
.prose .more { text-indent: 0; }
.prose form.protected input[type="password"] {
    padding: 7px 10px;
    background: #fdf8ea;
    border: 1px solid var(--rule);
    font-family: var(--serif);
}

.detail__tags {
    margin: 1.8em 0 0;
    font-size: 11.5px;
    letter-spacing: .08em;
    color: var(--ink-faint);
}
.detail__tags:empty { display: none; }
.detail__tags a {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 2px 9px;
    color: var(--ink-soft);
    text-decoration: none;
    border: 1px solid var(--rule);
    border-radius: 999px;
}
.detail__tags a:hover { color: var(--seal); border-color: rgba(156, 61, 46, .4); }

.detail__actions { text-indent: 0 !important; margin-top: 1.6em; }

.archive-head { padding: clamp(16px, 2.4vh, 30px) 0 0; }
.archive-head__title {
    margin: .2em 0 .4em;
    font-size: clamp(20px, 1.9vw, 26px);
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.45;
}
.archive-head__desc { margin: 0; font-size: 12px; letter-spacing: .08em; color: var(--ink-faint); }

/* ---------------- 评论区 ---------------- */

.comments {
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid var(--rule);
}

.comments__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.comments__title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .26em; color: var(--ink-soft); }
.comments__count { font-size: 11px; letter-spacing: .08em; color: var(--ink-faint); }

.commentlist { list-style: none; margin: 0; padding: 0; }

.comment-body {
    position: relative;
    padding: 15px 0 12px;
    border-bottom: 1px dashed var(--rule-soft);
}
.commentlist > .comment-body:last-child { border-bottom: none; }
.comment-body.comment-child {
    border-bottom: none;
    padding: 11px 0 6px;
}

.comment-head {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
}

/* 手绘印章头像 */
.comment-avatar {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, #f8eed6, #e6d1a9);
    box-shadow:
        0 0 0 1px rgba(156, 61, 46, .24),
        0 0 0 4px rgba(255, 248, 232, .6),
        0 2px 7px rgba(60, 40, 15, .18);
    transition: box-shadow .25s ease, transform .25s ease;
}
.comment-avatar::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px dashed rgba(156, 61, 46, .22);
    pointer-events: none;
}
.comment-body:hover .comment-avatar {
    box-shadow:
        0 0 0 1px rgba(156, 61, 46, .4),
        0 0 0 4px rgba(255, 250, 238, .85),
        0 4px 12px rgba(60, 40, 15, .24);
    transform: translateY(-1px);
}
.bk-avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}
.bk-avatar svg { display: block; width: 100%; height: 100%; }

.comment-id { min-width: 0; flex: 1 1 auto; }
.comment-id cite.fn {
    display: block;
    font-style: normal;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comment-id cite.fn a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid rgba(156, 61, 46, .28);
    padding-bottom: 1px;
    transition: color .2s, border-color .2s;
}
.comment-id cite.fn a:hover { color: var(--seal); border-bottom-color: var(--seal); }

.comment-badge {
    display: inline-block;
    margin-left: 7px;
    padding: 0 5px;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: .12em;
    color: var(--gold);
    border: 1px solid rgba(164, 129, 60, .45);
    border-radius: 2px;
    vertical-align: 1px;
}

.comment-meta {
    margin: 3px 0 0;
    font-size: 10.5px;
    letter-spacing: .06em;
    color: var(--ink-faint);
}
.comment-meta time { font-variant-numeric: tabular-nums; }
.comment-at { margin-left: 7px; }
.comment-at b { font-weight: 400; color: var(--seal); opacity: .9; }

.comment-floor {
    flex: none;
    margin-left: auto;
    padding: 1px 7px;
    font-size: 10px;
    letter-spacing: .08em;
    color: var(--gold);
    background: rgba(164, 129, 60, .09);
    border: 1px solid rgba(164, 129, 60, .28);
    border-radius: 2px;
    font-variant-numeric: tabular-nums;
}

.comment-content {
    margin: 8px 0 0 51px;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--ink-soft);
    word-break: break-word;
    background: rgba(255, 250, 238, .52);
    border: 1px solid rgba(120, 92, 52, .14);
    border-radius: 3px 10px 10px 10px;
}
.comment-child .comment-content { background: rgba(255, 252, 242, .38); }
.comment-content p { margin: 0 0 .45em; text-indent: 0; }
.comment-content p:last-child { margin-bottom: 0; }
.comment-content a { color: var(--seal); border-bottom: 1px solid rgba(156, 61, 46, .3); text-decoration: none; }

.comment-actions {
    margin: 5px 0 0 51px;
    opacity: .5;
    transition: opacity .2s;
}
.comment-body:hover .comment-actions { opacity: 1; }
.js-reply {
    padding: 2px 0;
    font-family: var(--serif);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ink-faint);
    background: none;
    border: 0;
    border-bottom: 1px dotted rgba(88, 64, 36, .4);
    cursor: pointer;
    transition: color .2s, border-color .2s;
}
.js-reply::before { content: "↳ "; opacity: .7; }
.js-reply:hover { color: var(--seal); border-bottom-color: var(--seal); }

.comment-children {
    list-style: none;
    margin: 8px 0 0 26px;
    padding-left: 14px;
    border-left: 1px solid rgba(88, 64, 36, .18);
}

.comments__empty, .comments__closed, .comments__more {
    margin: 12px 0 0;
    font-size: 13px;
    letter-spacing: .06em;
    color: var(--ink-faint);
}

/* ---------------- 评论表单 ---------------- */

.respond {
    position: relative;
    margin-top: 26px;
    padding: 15px 15px 14px;
    background: linear-gradient(180deg, rgba(255, 250, 238, .92), rgba(246, 233, 207, .74));
    border: 1px solid rgba(120, 92, 52, .26);
    border-radius: 10px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .55) inset,
        0 12px 28px -22px rgba(60, 40, 15, .65);
}
.respond::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(164, 129, 60, .16);
    border-radius: 7px;
    pointer-events: none;
}
.respond::after {
    content: "";
    position: absolute;
    right: 11px;
    top: 11px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid rgba(156, 61, 46, .3);
    background: rgba(156, 61, 46, .06);
    pointer-events: none;
}

.reply { position: relative; margin-top: 8px; }
.reply__login { margin: 0 0 9px; font-size: 12.5px; color: var(--ink-soft); }
.reply__login a { color: var(--seal); text-decoration: none; }
.reply__logout { margin-left: 8px; font-size: 11px; color: var(--ink-faint) !important; }
.reply__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 9px; align-items: start; }
.field-wrap { position: relative; min-width: 0; }

.field {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--serif);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink);
    background: linear-gradient(180deg, #fffaf0, #f8eed9);
    border: 1px solid rgba(120, 92, 52, .26);
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(88, 64, 36, .07);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field::placeholder { color: rgba(122, 100, 66, .55); }
.field:focus {
    outline: none;
    background-color: #fffdf5;
    border-color: rgba(156, 61, 46, .5);
    box-shadow: inset 0 1px 2px rgba(88, 64, 36, .04), 0 0 0 3px rgba(156, 61, 46, .08);
}
/* 留言输入框：一张铺在框里的信笺。
   换图：替换 assets/letter-bg.png，或改文件顶部 :root 里的 --letter-bg */
.field--area {
    min-height: 128px;
    padding: 7px 12px;
    line-height: 28px;
    resize: vertical;
    background-color: #fffaf0;
    background-image:
        repeating-linear-gradient(180deg, rgba(88, 64, 36, 0) 0 27px, rgba(88, 64, 36, .08) 27px 28px),
        var(--letter-bg);
    background-repeat: repeat, no-repeat;
    background-size: auto, cover;
    background-position: 0 0, center;
    background-attachment: local, local;
}
.field--area:focus { background-color: #fffdf7; }

/* 校验提示：一枚朱印小签，压在字段下方 */
.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 9px 4px 5px;
    font-size: 10.5px;
    line-height: 1.5;
    letter-spacing: .04em;
    color: var(--seal);
    background: linear-gradient(180deg, rgba(255, 249, 234, .97), rgba(246, 229, 202, .92));
    border: 1px solid rgba(156, 61, 46, .26);
    border-radius: 4px;
    box-shadow: 0 2px 6px -3px rgba(70, 30, 10, .32), inset 0 1px 0 rgba(255, 255, 255, .55);
    animation: errIn .18s ease both;
}
.field-error::before {
    content: "!";
    flex: none;
    width: 13px;
    height: 13px;
    margin-top: 1px;
    display: grid;
    place-items: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    line-height: 1;
    color: #fdf3df;
    background: linear-gradient(155deg, #b04a33, #8c3020);
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(255, 230, 190, .28);
}
.field-error[hidden] { display: none; }
@keyframes errIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: none; }
}
.field.is-invalid {
    border-color: rgba(156, 61, 46, .62);
    background-color: #fdf1e6;
    box-shadow: inset 0 1px 2px rgba(88, 64, 36, .06), 0 0 0 3px rgba(156, 61, 46, .09);
}
.field.is-shake { animation: fieldShake .34s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes fieldShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

.reply__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 11px;
}
.reply__hint { font-size: 11px; letter-spacing: .05em; color: var(--ink-faint); }

.btn {
    display: inline-block;
    padding: 9px 24px;
    font-family: var(--serif);
    font-size: 13px;
    letter-spacing: .18em;
    color: #f8ecd4;
    text-decoration: none;
    background: linear-gradient(160deg, #a8482f, #7d2a1c);
    border: 1px solid #6c2317;
    border-radius: 4px;
    cursor: pointer;
    box-shadow:
        inset 0 0 0 1px rgba(255, 230, 190, .22),
        0 3px 10px -4px rgba(60, 20, 10, .55);
    transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { filter: brightness(1.08); box-shadow: inset 0 0 0 1px rgba(255, 236, 200, .34), 0 5px 14px -5px rgba(60, 20, 10, .6); }
.btn:active { transform: translateY(1px); }

/* 回复提示条 */
.respond__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 9px;
    border-bottom: 1px dashed rgba(88, 64, 36, .16);
}
.respond__title { font-size: 12.5px; letter-spacing: .24em; color: var(--ink-soft); }
.respond__title::before { content: "❖"; margin-right: 7px; font-size: 9px; color: var(--gold); }
.respond__to {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 2px 9px;
    font-size: 10.5px;
    letter-spacing: .06em;
    color: var(--seal);
    background: rgba(156, 61, 46, .07);
    border: 1px solid rgba(156, 61, 46, .26);
    border-radius: 999px;
}
.respond__to[hidden] { display: none; }
.respond__to b { font-weight: 600; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.respond__cancel {
    padding: 1px 8px;
    font-family: var(--serif);
    font-size: 10px;
    color: var(--ink-faint);
    background: rgba(255, 252, 242, .8);
    border: 1px solid rgba(88, 64, 36, .2);
    border-radius: 999px;
    cursor: pointer;
}
.respond__cancel:hover { color: var(--seal); border-color: rgba(156, 61, 46, .4); }

/* 头像选择：默认收起，点开才展开 */
.avatar-picker {
    margin-bottom: 12px;
    background: rgba(255, 252, 242, .46);
    border: 1px solid rgba(120, 92, 52, .22);
    border-radius: 8px;
    overflow: hidden;
}
.avatar-picker__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    font-family: var(--serif);
    text-align: left;
    color: var(--ink);
    background: none;
    border: 0;
    cursor: pointer;
    transition: background .2s;
}
.avatar-picker__toggle:hover { background: rgba(164, 129, 60, .07); }
.avatar-picker__preview {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(150deg, #f8eed6, #e6d1a9);
    box-shadow: 0 0 0 1px rgba(156, 61, 46, .22), 0 2px 6px rgba(60, 40, 15, .16);
}
.avatar-picker__preview .bk-avatar { width: 100%; height: 100%; display: block; }
.avatar-picker__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.avatar-picker__txt b { font-size: 11.5px; font-weight: 600; letter-spacing: .14em; color: var(--ink-soft); }
.avatar-picker__txt i { margin-top: 2px; font-style: normal; font-size: 10px; letter-spacing: .04em; color: var(--ink-faint); }
.avatar-picker__chev {
    flex: none;
    margin-left: auto;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--ink-faint);
    border: 1px solid rgba(120, 92, 52, .24);
    background: rgba(255, 252, 242, .6);
    transition: transform .24s ease, color .2s;
}
.avatar-picker.is-open .avatar-picker__chev { transform: rotate(180deg); color: var(--seal); }
.avatar-picker__panel { padding: 3px 8px 9px; border-top: 1px dashed rgba(88, 64, 36, .14); animation: avatarDrop .2s ease both; }
.avatar-picker__panel[hidden] { display: none; }
@keyframes avatarDrop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.avatar-picker__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px 3px; }
.avatar-picker__hint { margin: 7px 1px 0; font-size: 9.5px; letter-spacing: .04em; color: var(--ink-faint); }

.avatar-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 1px 4px;
    font-family: var(--serif);
    background: none;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: background .18s, border-color .18s, transform .18s;
}
.avatar-opt svg {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(156, 61, 46, .16), 0 1px 3px rgba(60, 40, 15, .14);
    transition: box-shadow .2s, transform .2s;
}
.avatar-opt__name { font-size: 8.5px; line-height: 1.2; letter-spacing: .04em; color: var(--ink-faint); white-space: nowrap; }
.avatar-opt:hover { background: rgba(164, 129, 60, .09); }
.avatar-opt:hover svg { transform: translateY(-1px); }
.avatar-opt.is-on { border-color: rgba(156, 61, 46, .42); background: rgba(156, 61, 46, .06); }
.avatar-opt.is-on svg {
    box-shadow:
        0 0 0 2px rgba(156, 61, 46, .45),
        0 0 0 4px rgba(255, 250, 238, .75),
        0 2px 6px rgba(60, 40, 15, .2);
}
.avatar-opt.is-on .avatar-opt__name { color: var(--seal); }
.avatar-opt:focus-visible { outline: 2px solid rgba(156, 61, 46, .45); outline-offset: 1px; }

/* ---------------- 浮动控件 ---------------- */

.mback {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 9;
    display: none;
    align-items: center;
    gap: 3px;
    padding: 6px 12px 6px 8px;
    font-family: var(--serif);
    font-size: 12.5px;
    letter-spacing: .06em;
    color: var(--ink-soft);
    background: rgba(250, 242, 224, .92);
    border: 1px solid var(--rule);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    cursor: pointer;
}

/* 换一篇：垂在页脚的一枚烫金书签 */
.shuffle {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 9;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 31px 9px 10px;
    font-family: var(--serif);
    color: #f2d9a8;
    background: linear-gradient(158deg, #5b3a1b 0%, #2b1809 48%, #432a12 100%);
    border: 0;
    border-radius: 5px 0 0 5px;
    clip-path: polygon(0 0, 100% 0, calc(100% - 13px) 50%, 100% 100%, 0 100%);
    box-shadow:
        0 10px 22px -8px rgba(10, 5, 1, .78),
        inset 0 1px 0 rgba(255, 232, 184, .16);
    text-decoration: none;
    cursor: pointer;
    transform: translateZ(0);
    transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.shuffle::before {
    content: "";
    position: absolute;
    inset: 3px 16px 3px 3px;
    border: 1px solid rgba(214, 178, 112, .40);
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(255, 226, 170, .07), rgba(0, 0, 0, 0) 70%);
    clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%);
    pointer-events: none;
}
.shuffle::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(156, 61, 46, .95), rgba(156, 61, 46, .18));
    pointer-events: none;
}
.shuffle:hover {
    background: linear-gradient(158deg, #6d4721 0%, #341d0b 48%, #4f3014 100%);
    box-shadow: 0 13px 26px -9px rgba(10, 5, 1, .82), inset 0 1px 0 rgba(255, 238, 194, .28);
    transform: translateY(-1px);
}
.shuffle:active { transform: translateY(1px) scale(.99); }
.shuffle:focus-visible { outline: 2px solid rgba(156, 61, 46, .55); outline-offset: 3px; }

.shuffle__ico {
    flex: none;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #f0d29a;
    border: 1px solid rgba(214, 178, 112, .52);
    background: radial-gradient(circle at 35% 25%, rgba(255, 226, 170, .24), rgba(0, 0, 0, 0) 70%);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .14);
    transition: transform .45s cubic-bezier(.2, .8, .3, 1);
}
.shuffle:hover .shuffle__ico { transform: rotate(180deg); }
.shuffle.is-busy .shuffle__ico { animation: shuffleSpin .9s linear infinite; }
.shuffle.is-busy { opacity: .8; pointer-events: none; }

@keyframes shuffleSpin {
    to { transform: rotate(360deg); }
}

.shuffle__txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.shuffle__txt b { font-size: 13px; font-weight: 600; letter-spacing: .18em; }
.shuffle__txt i { margin-top: 2px; font-style: normal; font-size: 9px; letter-spacing: .2em; color: rgba(233, 205, 156, .58); }
.shuffle__key {
    flex: none;
    margin-left: 1px;
    padding: 1px 5px;
    font-size: 9px;
    letter-spacing: .04em;
    color: rgba(240, 216, 168, .66);
    border: 1px solid rgba(214, 178, 112, .26);
    border-radius: 3px;
}

/* 翻页提示 */
.book-toast {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 12;
    max-width: min(78%, 420px);
    padding: 7px 15px;
    font-size: 11.5px;
    letter-spacing: .08em;
    color: #f6e7c8;
    text-align: center;
    background: rgba(38, 22, 9, .9);
    border: 1px solid rgba(214, 178, 112, .28);
    border-radius: 2px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .42);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity .26s ease, transform .26s ease, visibility .26s;
    pointer-events: none;
}
.book-toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* 换页：只淡入淡出内容层，不做 3D 位移，避免整页抖动 */
.detail-wrap {
    transform: translate3d(0, 0, 0);
    transition: opacity .17s ease, transform .2s ease;
}
.detail-wrap.is-turn-out {
    opacity: 0;
    transform: translate3d(0, -5px, 0);
    transition: opacity .15s ease, transform .16s ease;
    will-change: opacity, transform;
}
.detail-wrap.is-turn-in {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
    transition: none;
}

/* 合上书：在返回顶部上方 */
.bookclose {
    position: absolute;
    right: 16px;
    bottom: 64px;
    z-index: 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-family: var(--serif);
    font-size: 9px;
    letter-spacing: .06em;
    color: var(--ink-soft);
    background: linear-gradient(160deg, rgba(253, 246, 230, .96), rgba(238, 224, 196, .96));
    border: 1px solid rgba(164, 129, 60, .44);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(40, 25, 8, .24), inset 0 0 0 3px rgba(255, 250, 236, .5);
    transition: color .2s, border-color .2s, transform .2s, background .2s;
}
.bookclose svg { transition: transform .2s; }
.bookclose[hidden] { display: none; }
.bookclose:hover { color: var(--seal); border-color: rgba(156, 61, 46, .5); background: #fffaf0; }
.bookclose:hover svg { transform: translateY(-1px); }
.bookclose:active { transform: scale(.95); }

.totop {
    position: absolute;
    right: 16px;
    bottom: 14px;
    z-index: 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-family: var(--serif);
    font-size: 9px;
    letter-spacing: .06em;
    color: var(--ink-soft);
    background: linear-gradient(160deg, rgba(253, 246, 230, .96), rgba(238, 224, 196, .96));
    border: 1px solid rgba(120, 92, 52, .3);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(40, 25, 8, .24), inset 0 0 0 3px rgba(255, 250, 236, .5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(.92);
    transition: opacity .24s ease, transform .24s ease, visibility .24s;
}
.totop svg { transition: transform .2s; }
.totop.is-on { opacity: 1; visibility: visible; transform: none; }
.totop:hover { color: var(--seal); border-color: rgba(156, 61, 46, .45); }
.totop:hover svg { transform: translateY(-2px); }
.totop:active { transform: scale(.95); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
    .desk { padding: clamp(10px, 2vh, 22px) clamp(14px, 2.6vw, 34px); }
    .entry__title { font-size: 14.5px; }
}

@media (max-width: 900px) {
    body.book-body { overflow: hidden; }
    .desk { height: 100dvh; padding: 0; }
    .book { width: 100%; animation: none; }
    /* 手机端一屏一页，合上时封面铺满整屏，不做左右收拢 */
    .book__spread {
        grid-template-columns: 1fr;
        border-radius: 0;
        transform: none !important;
        transition: none;
    }
    .book__spread::before, .book__spread::after, .book__spine,
    .book-glow { display: none; }
    .book__ribbon { right: calc(20px - 11px); width: 11px; height: 50px; }
    .book__coverwrap {
        left: 0;
        width: 100%;
    }
    .book-cover { perspective: 1700px; perspective-origin: 12% 42%; }
    .book-cover__face, .book-cover__back { border-radius: 0 6px 6px 0; }
    .bc-spine { width: 28px; }
    /* 手机竖屏：纸面接近满屏，书名随屏高收缩，侧栏小字贴着书名走 */
    .bc-plate {
        left: 18%;
        right: 18%;
        top: 7%;
        bottom: 12%;
        gap: 12px;
    }
    .bc-plate__main { gap: 13px; }
    .bc-plate__title { font-size: max(16px, min(20vmin, calc(54vh / var(--bc-ratio, 5.36)))); }
    .bc-plate__seal { width: 29px; height: 29px; font-size: 14px; }
    .bc-plate__side { gap: 8px; }
    .bc-plate__mark { font-size: 10px; letter-spacing: .32em; }
    .bc-plate__rule { width: 17px; }
    .bc-plate__host { font-size: 8px; letter-spacing: .22em; }
    .book-cover__fore { right: -7px; width: 7px; top: 6px; bottom: 6px; }
    .book-cover__hint { bottom: 16px; font-size: 9.5px; }
    .bookclose { right: 14px; bottom: 66px; z-index: 45; }
    .desk__mask { opacity: .42; background-size: 320px auto; }
    .page--left { border-radius: 0; box-shadow: none; }
    .page--right {
        position: fixed;
        inset: 0;
        z-index: 40;
        border-radius: 0;
        transform: translateX(101%);
        visibility: hidden;
        box-shadow: -12px 0 42px rgba(0, 0, 0, .55);
        transition: transform .42s cubic-bezier(.22, .8, .28, 1), visibility .42s;
    }
    body.is-reading .page--right,
    body.is-single .page--right {
        transform: translateX(0);
        visibility: visible;
    }
    .mback { display: inline-flex; }
    .shuffle { left: 14px; bottom: 14px; padding: 8px 26px 8px 9px; }
    .shuffle__txt i, .shuffle__key { display: none; }
    .book-toast { bottom: 70px; max-width: 84%; }
    .page__scroll { padding: 0 20px; }
    .page__scroll--right { padding: 0 20px 76px; }
    .detail { padding-top: 52px; }
    .archive-head { padding-top: 52px; }
    .masthead { padding-top: 18px; }
    .reply__row { grid-template-columns: 1fr; gap: 8px; }
    .field-error { font-size: 10px; }
    .reply__foot { flex-direction: column; align-items: stretch; gap: 8px; }
    .reply__hint { text-align: center; }
    .btn { text-align: center; }
    .totop { right: 14px; bottom: 16px; }
    .comment-children { margin-left: 10px; padding-left: 10px; }
    .comment-content, .comment-actions { margin-left: 46px; }
    .comment-floor { font-size: 9.5px; padding: 0 5px; }
}

@media (max-width: 380px) {
    .brand__text strong { font-size: 16px; }
    .entry__title { font-size: 14px; max-width: calc(100% - 54px); }
    .menu { gap: 4px 13px; }
    .comment-avatar { width: 34px; height: 34px; }
    .comment-content, .comment-actions { margin-left: 45px; }
    .avatar-opt svg { width: 29px; height: 29px; }
    .avatar-picker__hint { display: none; }
    .shuffle__txt b { font-size: 12px; }
}

@media (max-height: 640px) and (min-width: 901px) {
    .masthead { padding-top: 12px; }
    .detail { padding-top: 14px; }
    .detail__title { margin-top: .35em; }
    .colophon { padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
    .book { animation: none; }
}
