/* ==========================================================================
   回忆日记 · 书本模式 (css/modules/journal_book.css)
   在原来的「列表 → 详情」之上多一本可以翻页的日记本；旧版没动，右上角图标随时切换。
   所有类名都以 jb- 开头，不会和旧样式冲突。
   ========================================================================== */

/* ---------- 显示切换：书本模式下藏起旧列表，列表模式下藏起书 ---------- */
#journal-book-root { display: none; }
#memory-journal-screen.jb-on > main.content { display: none !important; }
#memory-journal-screen.jb-on #journal-book-root { display: block; }
#memory-journal-screen.jb-on #journal-multi-select-bar { display: none !important; }
#memory-journal-screen.jb-on .app-header { position: relative; z-index: 60; }

/* 头部的切换按钮（多了一个按钮，间距收紧一点，免得挤到标题） */
#memory-journal-screen .app-header .action-btn-group.jb-grp { gap: 13px; }
#journal-view-toggle-btn svg { transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); }
#journal-view-toggle-btn:active svg { transform: scale(.82) rotate(-8deg); }

/* ---------- 根节点与主题变量 ---------- */
.jb-root {
    flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden;
    --jb-w: 320px; --jb-h: 470px; --jb-fs: 17px; --jb-lh: 33px;
    --jb-tw: 260px; --jb-th: 380px; --jb-gap: 40px;
    --jb-font: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Kaiti TC", "DFKai-SB", "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
    font-family: var(--jb-font); -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
    color: var(--ink);
}
/* 栗棕 */
.jb-root, .jb-root[data-theme="classic"] {
    --cover: #7a4a33; --cover-hi: #a06a4b; --cover-lo: #4a2a1b;
    --foil-a: #f8e7a8; --foil-b: #b88a3e; --foil-c: #fff6d1;
    --paper: #fbf4e3; --paper-lo: #efe3c8; --ink: #3b2f2a; --ink-soft: #8b7765;
    --accent: #b5483c; --accent-dk: #7e2a22; --rule: rgba(150, 112, 70, .24);
    --edge1: #f1e8d2; --edge2: #e7dcc1; --edge3: #ddd1b3; --edge4: #d2c5a4;
    --desk: #d8c9b0; --desk-hi: rgba(255, 244, 222, .75); --desk-lo: rgba(110, 80, 50, .25);
    --bar-bg: rgba(255, 251, 242, .78); --bar-ink: #5b4a3d; --bar-line: rgba(120, 90, 60, .16);
}
/* 夜航蓝 */
.jb-root[data-theme="navy"] {
    --cover: #23344f; --cover-hi: #3a5278; --cover-lo: #121c2e;
    --foil-a: #f4ecd2; --foil-b: #a9916a; --foil-c: #ffffff;
    --paper: #f6f2e8; --paper-lo: #e8e2d2; --ink: #27303f; --ink-soft: #7a8191;
    --accent: #c4a05a; --accent-dk: #8a6d33; --rule: rgba(80, 96, 130, .22);
    --edge1: #eee9db; --edge2: #e3dccb; --edge3: #d8d0bc; --edge4: #cbc2ab;
    --desk: #b4bccb; --desk-hi: rgba(240, 244, 252, .75); --desk-lo: rgba(40, 55, 85, .3);
    --bar-bg: rgba(246, 248, 252, .78); --bar-ink: #3d4a63; --bar-line: rgba(60, 80, 120, .16);
}
/* 樱花粉 */
.jb-root[data-theme="sakura"] {
    --cover: #e3a1b3; --cover-hi: #f2c3cf; --cover-lo: #b9718a;
    --foil-a: #fff4ee; --foil-b: #d79a8e; --foil-c: #ffffff;
    --paper: #fffaf6; --paper-lo: #f6e8e4; --ink: #5a4048; --ink-soft: #a88c93;
    --accent: #e0708d; --accent-dk: #a8435f; --rule: rgba(214, 140, 160, .26);
    --edge1: #f9eee9; --edge2: #f1e1db; --edge3: #e8d3cc; --edge4: #dcc3bb;
    --desk: #f2d9df; --desk-hi: rgba(255, 246, 248, .85); --desk-lo: rgba(190, 110, 130, .22);
    --bar-bg: rgba(255, 249, 250, .8); --bar-ink: #7b5560; --bar-line: rgba(200, 120, 140, .18);
}
/* 抹茶绿 */
.jb-root[data-theme="matcha"] {
    --cover: #4f7566; --cover-hi: #6f9988; --cover-lo: #2e4a3f;
    --foil-a: #f5efc9; --foil-b: #b39a55; --foil-c: #fffbe2;
    --paper: #f8f6e9; --paper-lo: #e9e6d2; --ink: #33413a; --ink-soft: #7f8a80;
    --accent: #c7794a; --accent-dk: #8e4d28; --rule: rgba(90, 130, 105, .22);
    --edge1: #efecda; --edge2: #e4e1cb; --edge3: #d9d5bc; --edge4: #cdc8ac;
    --desk: #cdd8c6; --desk-hi: rgba(243, 250, 238, .8); --desk-lo: rgba(60, 100, 80, .25);
    --bar-bg: rgba(248, 251, 244, .8); --bar-ink: #47604f; --bar-line: rgba(70, 110, 85, .16);
}
/* 薰衣草 */
.jb-root[data-theme="lavender"] {
    --cover: #8b79b8; --cover-hi: #ab9bd3; --cover-lo: #5a4a84;
    --foil-a: #f6f0ff; --foil-b: #c3a9ea; --foil-c: #ffffff;
    --paper: #faf7ff; --paper-lo: #ece6f6; --ink: #3d3556; --ink-soft: #8d84a5;
    --accent: #8e6fd1; --accent-dk: #5d3fa0; --rule: rgba(130, 110, 190, .22);
    --edge1: #f1ecf8; --edge2: #e7e0f2; --edge3: #dcd3ea; --edge4: #cfc5e0;
    --desk: #d9d2ec; --desk-hi: rgba(250, 247, 255, .85); --desk-lo: rgba(90, 70, 150, .25);
    --bar-bg: rgba(250, 248, 255, .8); --bar-ink: #5a4d7c; --bar-line: rgba(110, 90, 170, .16);
}
/* 午夜 */
.jb-root[data-theme="midnight"] {
    --cover: #16161f; --cover-hi: #2a2a38; --cover-lo: #08080d;
    --foil-a: #f3dc9a; --foil-b: #a98536; --foil-c: #fff1c2;
    --paper: #262633; --paper-lo: #1d1d28; --ink: #e8e2d4; --ink-soft: #8f8a9a;
    --accent: #e2b659; --accent-dk: #9a7421; --rule: rgba(255, 255, 255, .075);
    --edge1: #2d2d3b; --edge2: #262633; --edge3: #20202b; --edge4: #1a1a24;
    --desk: #0e0e14; --desk-hi: rgba(70, 70, 100, .35); --desk-lo: rgba(0, 0, 0, .55);
    --bar-bg: rgba(30, 30, 42, .8); --bar-ink: #d9d3c4; --bar-line: rgba(255, 255, 255, .1);
}
.jb-root[data-ff="song"] { --jb-font: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Noto Serif SC", serif; }
.jb-root[data-ff="sans"] { --jb-font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }

/* 纸纹 / 皮革纹理（内联 SVG 噪点，不用外部图片） */
.jb-root {
    --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .36  0 0 0 0 .22  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

/* ---------- 桌面背景 ---------- */
.jb-desk { position: absolute; inset: 0; background:
    radial-gradient(120% 70% at 50% -5%, var(--desk-hi), transparent 62%),
    radial-gradient(100% 60% at 50% 108%, var(--desk-lo), transparent 70%),
    var(--desk); transition: background-color .5s; }
.jb-desk::before { content: ''; position: absolute; inset: 0; opacity: .5; background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .035) 0 2px, transparent 2px 7px); }
.jb-desk::after { content: ''; position: absolute; inset: 0; background-image: var(--noise); opacity: .25; mix-blend-mode: multiply; }
.jb-dust { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.jb-dust i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .8);
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, .5); opacity: 0; animation: jb-dust 9s ease-in-out infinite; }
.jb-root[data-theme="midnight"] .jb-dust i { background: #ffe9a8; box-shadow: 0 0 8px 2px rgba(255, 220, 130, .55); }
@keyframes jb-dust { 0% { opacity: 0; transform: translate(0, 12px) scale(.6); } 25% { opacity: .85; } 70% { opacity: .5; } 100% { opacity: 0; transform: translate(14px, -46px) scale(1.2); } }

/* ---------- 书的舞台 ---------- */
.jb-stage { position: absolute; left: 50%; margin-left: calc(var(--jb-w) / -2); top: 18px; width: var(--jb-w); height: var(--jb-h); transform: none;
    transition: transform .8s cubic-bezier(.3, .9, .3, 1); }
.jb-root.jb-intro .jb-stage { animation: jb-rise 1s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes jb-rise { from { opacity: 0; transform: translateY(36px) scale(.94) rotate(-1.2deg); } to { opacity: 1; transform: none; } }

.jb-hardback { position: absolute; inset: -3px -6px -6px -3px; border-radius: 6px 13px 13px 6px;
    background: linear-gradient(135deg, var(--cover-hi), var(--cover) 45%, var(--cover-lo));
    box-shadow: 0 22px 40px -8px rgba(0, 0, 0, .42), 0 6px 12px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.jb-stack { position: absolute; inset: 1px 0 1px 3px; border-radius: 2px 6px 6px 2px; background: var(--paper-lo);
    box-shadow: 1px 1px 0 var(--edge1), 2px 2px 0 var(--edge2), 3px 3px 0 var(--edge3), 4px 4px 0 var(--edge4), 5px 5px 0 var(--edge3); }

.jb-pages { position: absolute; inset: 0; perspective: 2600px; perspective-origin: 12% 50%; clip-path: inset(-70px -70px -70px 0); touch-action: none; }

/* ---------- 单张纸（leaf）：正反两面 ---------- */
.jb-leaf { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; will-change: transform; pointer-events: none; }
.jb-leaf.jb-top { pointer-events: auto; }
.jb-leaf.jb-cover { inset: -3px -6px -6px -3px; }
.jb-face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; overflow: hidden;
    border-radius: 3px 8px 8px 3px; }
.jb-face.jb-rear { transform: rotateY(180deg); }
.jb-leaf.jb-cover .jb-face { overflow: visible; border-radius: 6px 13px 13px 6px; }

/* 翻动时的光影：--s 由脚本按翻页进度 0 → 1 → 0 驱动 */
.jb-shade, .jb-hl, .jb-cast { position: absolute; inset: 0; pointer-events: none; }
.jb-shade { background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .12) 55%, rgba(0, 0, 0, 0)); opacity: calc(var(--s, 0) * .85); }
.jb-rear .jb-shade { background: linear-gradient(270deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .1) 60%, rgba(0, 0, 0, 0)); opacity: calc(var(--s, 0) * .75); }
.jb-hl { background: linear-gradient(100deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, .55) 47%, rgba(255, 255, 255, 0) 64%); opacity: calc(var(--s, 0) * .7); mix-blend-mode: soft-light; }
.jb-cast { opacity: 0; }

/* ---------- 纸张 ---------- */
.jb-paper { position: absolute; inset: 0; background: var(--paper); transition: background-color .45s; }
.jb-paper::before { content: ''; position: absolute; inset: 0; background-image: var(--grain); opacity: .55; mix-blend-mode: multiply; pointer-events: none; }
.jb-paper::after { content: ''; position: absolute; inset: 0; pointer-events: none; background:
    linear-gradient(90deg, rgba(0, 0, 0, .24), rgba(0, 0, 0, .07) 14px, rgba(0, 0, 0, 0) 40px),
    radial-gradient(135% 105% at 56% 50%, rgba(0, 0, 0, 0) 66%, rgba(110, 80, 40, .13)); }
.jb-root[data-theme="midnight"] .jb-paper::before { opacity: .18; mix-blend-mode: screen; }
.jb-rear .jb-paper { background: var(--paper-lo); }
.jb-rear .jb-paper::after { background: linear-gradient(270deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, .05) 14px, rgba(0, 0, 0, 0) 38px); }

.jb-page { position: absolute; inset: 0; }
.jb-head { position: absolute; left: 30px; right: 54px; top: 15px; height: 22px; display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; letter-spacing: .06em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; }
.jb-head b { font-weight: 500; }
.jb-head span:last-child { max-width: 52%; overflow: hidden; text-overflow: ellipsis; }
.jb-foot { position: absolute; left: 0; right: 0; bottom: 13px; text-align: center; font-size: 12px; color: var(--ink-soft); letter-spacing: .12em; }
.jb-foot::before, .jb-foot::after { content: ''; display: inline-block; width: 18px; height: 1px; background: var(--rule); vertical-align: middle; margin: 0 8px; }

/* 正文：用 CSS 多列做分页（每一页只是同一份文字的一列） */
.jb-body { position: absolute; left: 30px; top: 46px; width: var(--jb-tw); height: var(--jb-th); overflow: hidden; }
.jb-root[data-pat="lined"] .jb-body { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--jb-lh) - 1px), var(--rule) calc(var(--jb-lh) - 1px), var(--rule) var(--jb-lh)); }
.jb-root[data-pat="dots"] .jb-body { background-image: radial-gradient(circle, var(--rule) 1.1px, transparent 1.5px); background-size: var(--jb-lh) var(--jb-lh); background-position: 0 calc(var(--jb-lh) - 3px); }
.jb-root[data-pat="grid"] .jb-body { background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px); background-size: var(--jb-lh) var(--jb-lh); background-position: 0 calc(var(--jb-lh) - 1px); }
.jb-flow { width: var(--jb-tw); height: var(--jb-th); column-width: var(--jb-tw); column-gap: var(--jb-gap); column-fill: auto;
    font-size: var(--jb-fs); line-height: var(--jb-lh); color: var(--ink); font-family: var(--jb-font); transition: none; }
.jb-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; pointer-events: none; }
.jb-flow p { margin: 0; text-indent: 2em; text-align: justify; overflow-wrap: anywhere; line-break: strict; orphans: 2; widows: 2; }
.jb-flow p.jb-blank { height: var(--jb-lh); text-indent: 0; }
.jb-flow p.jb-empty { text-indent: 0; color: var(--ink-soft); font-style: italic; }
.jb-ehead { break-inside: avoid; }
.jb-etitle { margin: 0; font-size: calc(var(--jb-fs) * 1.32); line-height: var(--jb-lh); font-weight: 700; letter-spacing: .04em; color: var(--ink); }
.jb-emeta { font-size: calc(var(--jb-fs) * .74); line-height: var(--jb-lh); color: var(--ink-soft); letter-spacing: .05em; }
.jb-orn-line { height: var(--jb-lh); position: relative; }
.jb-orn-line::before { content: ''; position: absolute; left: 16px; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, var(--accent), transparent 80%); opacity: .55; }
.jb-orn-line::after { content: '✦'; position: absolute; left: 0; top: 50%; transform: translateY(-52%); font-size: 10px; color: var(--accent); }
.jb-flow .jb-end { display: inline-block; width: 0; height: 0; }

/* 页面出现时，文字像被写下来一样依次浮现 */
.jb-leaf.jb-reveal .jb-flow p, .jb-leaf.jb-reveal .jb-ehead { animation: jb-ink .7s ease both; animation-delay: calc(var(--k, 0) * 55ms); }
@keyframes jb-ink { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 翻页提示：右下角的折角 */
.jb-curl { position: absolute; right: 0; bottom: 0; width: 38px; height: 38px; pointer-events: none; transform-origin: 100% 100%; animation: jb-curl 3.4s ease-in-out infinite;
    background: linear-gradient(315deg, rgba(0, 0, 0, 0) 50%, var(--paper-lo) 50%, rgba(255, 255, 255, .6) 53%, rgba(0, 0, 0, .12) 100%);
    box-shadow: -3px -3px 7px rgba(0, 0, 0, .16); border-top-left-radius: 8px; }
@keyframes jb-curl { 0%, 100% { transform: scale(.72); } 50% { transform: scale(1); } }

/* ---------- 书签缎带（收藏） ---------- */
.jb-ribbon { position: absolute; top: -3px; right: 18px; width: 22px; height: 50px; z-index: 6; cursor: pointer; transform-origin: top center; -webkit-tap-highlight-color: transparent; }
.jb-ribbon::before { content: ''; position: absolute; left: -8px; right: -8px; top: 0; bottom: -10px; }
.jb-ribbon i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent-dk), var(--accent) 45%, var(--accent-dk)); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3));
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); transition: transform .55s cubic-bezier(.3, 1.45, .5, 1), opacity .3s; }
.jb-ribbon.off i { transform: translateY(-56px); opacity: .6; }
.jb-ribbon.on { animation: jb-sway 5s ease-in-out infinite; }
.jb-ribbon.on i { transform: none; }
@keyframes jb-sway { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); } }
.jb-star { position: absolute; width: 10px; height: 10px; left: 50%; top: 30px; margin: -5px; pointer-events: none; color: var(--accent);
    animation: jb-star .8s cubic-bezier(.2, .8, .3, 1) forwards; }
.jb-star::before { content: '✦'; font-size: 12px; }
@keyframes jb-star { from { opacity: 1; transform: translate(0, 0) scale(.5) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(160deg); } }

/* ---------- 封面 ---------- */
.jb-cvr { position: absolute; inset: 0; border-radius: 6px 13px 13px 6px; overflow: visible; color: #fff;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, .20) 0%, rgba(255, 255, 255, 0) 34%, rgba(0, 0, 0, .16) 100%),
        radial-gradient(120% 90% at 28% 8%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 55%),
        var(--noise), var(--cover);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 2px 3px rgba(255, 255, 255, .15), inset 0 -3px 6px rgba(0, 0, 0, .25); }
.jb-hinge { position: absolute; left: 24px; top: 0; bottom: 0; width: 12px; background: linear-gradient(90deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, 0) 55%, rgba(255, 255, 255, .15)); }
.jb-frame { position: absolute; inset: 20px 18px 20px 46px; border: 1.5px solid transparent; border-radius: 4px;
    border-image: linear-gradient(135deg, var(--foil-a), var(--foil-b) 45%, var(--foil-c) 70%, var(--foil-b)) 1; opacity: .92; }
.jb-frame::before { content: ''; position: absolute; inset: 5px; border: 1px solid; border-image: linear-gradient(135deg, var(--foil-b), var(--foil-a) 50%, var(--foil-b)) 1; opacity: .7; }
.jb-cvr-in { position: absolute; inset: 20px 18px 20px 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 10px; }
.jb-foil { background: linear-gradient(100deg, var(--foil-b) 0%, var(--foil-a) 28%, var(--foil-c) 40%, var(--foil-a) 52%, var(--foil-b) 74%, var(--foil-a) 100%); background-size: 260% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: jb-foil 5.5s linear infinite;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .38)); }
@keyframes jb-foil { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.jb-cvr-top { font-size: 11px; letter-spacing: .42em; text-indent: .42em; font-family: Georgia, "Times New Roman", serif; opacity: .95; }
.jb-emblem { width: 92px; height: 92px; margin: 22px 0 18px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); animation: jb-float 6s ease-in-out infinite; }
@keyframes jb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.jb-cvr-title { font-size: 30px; font-weight: 700; letter-spacing: .28em; text-indent: .28em; line-height: 1.2; }
.jb-cvr-sub { margin-top: 12px; font-size: 14px; letter-spacing: .14em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-cvr-line { width: 46px; height: 1px; margin: 16px auto; background: linear-gradient(90deg, transparent, var(--foil-a), transparent); }
.jb-cvr-foot { font-size: 11px; letter-spacing: .2em; opacity: .9; font-family: Georgia, "Times New Roman", serif; }
.jb-tail { position: absolute; left: 66%; bottom: -34px; width: 20px; height: 56px; transform-origin: top center; animation: jb-sway 4.6s ease-in-out infinite; z-index: -1;
    background: linear-gradient(90deg, var(--accent-dk), var(--accent) 45%, var(--accent-dk)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)); }
.jb-cvr-back { position: absolute; inset: 0; border-radius: 13px 6px 6px 13px; background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .22) 0 1.4px, transparent 1.6px) 0 0 / 22px 22px,
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .14) 0 1.2px, transparent 1.4px) 0 0 / 18px 18px,
    linear-gradient(135deg, var(--cover-hi), var(--cover-lo)); }
.jb-hint { position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; font-size: 12px; letter-spacing: .3em; text-indent: .3em; color: var(--bar-ink); opacity: .75; pointer-events: none;
    animation: jb-pulse 2.4s ease-in-out infinite; transition: opacity .4s; font-family: var(--jb-font); }
.jb-root:not(.jb-on-cover) .jb-hint { opacity: 0; animation: none; }
@keyframes jb-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }

/* ---------- 扉页 / 目录 / 结尾 ---------- */
.jb-center { position: absolute; left: 30px; top: 46px; width: var(--jb-tw); height: var(--jb-th); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--ink); }
.jb-avatar { position: relative; width: 96px; height: 96px; border-radius: 50%; padding: 5px; background: linear-gradient(135deg, var(--foil-a), var(--foil-b), var(--foil-a)); box-shadow: 0 6px 14px rgba(0, 0, 0, .22); }
.jb-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 3px solid var(--paper); box-sizing: border-box; }
.jb-avatar::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 1px dashed var(--accent); opacity: .55; animation: jb-spin 28s linear infinite; }
@keyframes jb-spin { to { transform: rotate(360deg); } }
.jb-t-name { margin-top: 24px; font-size: calc(var(--jb-fs) * 1.5); font-weight: 700; letter-spacing: .18em; text-indent: .18em; }
.jb-t-sub { margin-top: 6px; font-size: calc(var(--jb-fs) * .78); letter-spacing: .3em; text-indent: .3em; color: var(--ink-soft); font-family: Georgia, "Times New Roman", serif; }
.jb-t-div { margin: 22px 0 18px; color: var(--accent); letter-spacing: .6em; text-indent: .6em; font-size: 13px; }
.jb-t-stat { font-size: calc(var(--jb-fs) * .88); line-height: 1.9; color: var(--ink); }
.jb-t-stat small { display: block; color: var(--ink-soft); font-size: .82em; letter-spacing: .08em; }
.jb-t-quote { margin-top: 26px; padding: 0 8px; font-size: calc(var(--jb-fs) * .86); line-height: 1.8; color: var(--ink-soft); font-style: italic; }

.jb-toc { position: absolute; left: 30px; top: 46px; width: var(--jb-tw); height: var(--jb-th); overflow: hidden; }
.jb-toc-h { height: 74px; text-align: center; }
.jb-toc-h h3 { margin: 4px 0 0; font-size: calc(var(--jb-fs) * 1.35); letter-spacing: .5em; text-indent: .5em; font-weight: 700; color: var(--ink); }
.jb-toc-h div { font-size: 11px; letter-spacing: .3em; text-indent: .3em; color: var(--ink-soft); margin-top: 4px; font-family: Georgia, "Times New Roman", serif; }
.jb-toc-row { height: 46px; display: flex; align-items: center; gap: 8px; cursor: pointer; border-bottom: 1px dashed var(--rule); color: var(--ink); -webkit-tap-highlight-color: transparent; }
.jb-toc-row:active { background: rgba(128, 128, 128, .1); }
.jb-leaf.jb-reveal .jb-toc-row { animation: jb-ink .55s ease both; animation-delay: calc(var(--k, 0) * 45ms); }
.jb-toc-d { flex: none; width: 44px; font-size: 12px; color: var(--ink-soft); letter-spacing: .04em; font-family: Georgia, "Times New Roman", serif; }
.jb-toc-t { flex: 0 1 auto; min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(var(--jb-fs) * .95); }
.jb-toc-l { flex: 1; min-width: 8px; border-bottom: 1.5px dotted var(--ink-soft); opacity: .45; transform: translateY(5px); }
.jb-toc-p { flex: none; font-size: 12px; color: var(--ink-soft); font-family: Georgia, "Times New Roman", serif; }
.jb-toc-f { flex: none; width: 10px; height: 16px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.jb-toc-empty { text-align: center; color: var(--ink-soft); font-size: calc(var(--jb-fs) * .9); padding-top: 60px; line-height: 1.9; font-style: italic; }

.jb-end-icon { width: 54px; height: 54px; color: var(--accent); animation: jb-float 5s ease-in-out infinite; }
.jb-end-t { margin-top: 18px; font-size: calc(var(--jb-fs) * 1.35); letter-spacing: .3em; text-indent: .3em; font-weight: 700; }
.jb-end-s { margin: 8px 0 24px; font-size: calc(var(--jb-fs) * .82); color: var(--ink-soft); letter-spacing: .1em; }
.jb-pills { display: flex; flex-direction: column; gap: 10px; width: 78%; }
.jb-pill { border: 1px solid var(--accent); color: var(--accent-dk); background: transparent; border-radius: 22px; padding: 10px 0; font: inherit; font-size: calc(var(--jb-fs) * .88); letter-spacing: .14em; text-indent: .14em; cursor: pointer; position: relative; overflow: hidden; transition: transform .2s; }
.jb-root[data-theme="midnight"] .jb-pill { color: var(--accent); }
.jb-pill:active { transform: scale(.96); background: rgba(128, 128, 128, .12); }
.jb-pill.main { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(0, 0, 0, .18); }
.jb-root[data-theme="midnight"] .jb-pill.main { color: #1b1b24; }

/* 生成中：羽毛笔写字 */
.jb-quill { width: 120px; height: 90px; overflow: visible; }
.jb-quill .ln { stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; fill: none; stroke-dasharray: 90; stroke-dashoffset: 90; animation: jb-write 2.6s ease-in-out infinite; }
.jb-quill .ln:nth-child(2) { animation-delay: .5s; } .jb-quill .ln:nth-child(3) { animation-delay: 1s; }
@keyframes jb-write { 0% { stroke-dashoffset: 90; } 55%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -90; } }
.jb-quill .pen { color: var(--accent); transform-origin: 18px 62px; animation: jb-pen 2.6s ease-in-out infinite; }
@keyframes jb-pen { 0% { transform: translate(0, 0) rotate(-6deg); } 55% { transform: translate(70px, -2px) rotate(4deg); } 100% { transform: translate(0, 0) rotate(-6deg); } }

/* ---------- 底部工具栏 ---------- */
.jb-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-radius: 26px; z-index: 40; max-width: calc(100% - 20px);
    background: var(--bar-bg); border: 1px solid var(--bar-line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 8px 22px rgba(0, 0, 0, .16); color: var(--bar-ink); transition: opacity .4s, transform .5s cubic-bezier(.3, 1.2, .4, 1); }
.jb-root.jb-on-cover .jb-bar { opacity: 0; transform: translateX(-50%) translateY(22px); pointer-events: none; }
.jb-btn { position: relative; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; padding: 0; transition: transform .2s, background .2s, opacity .2s; }
.jb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.jb-btn:active { transform: scale(.86); background: rgba(128, 128, 128, .16); }
.jb-btn[disabled] { opacity: .28; pointer-events: none; }
.jb-btn.on svg { fill: var(--accent); stroke: var(--accent); }
.jb-btn .aa { font-family: Georgia, serif; font-size: 16px; font-weight: 700; letter-spacing: -.5px; }
.jb-no { min-width: 62px; padding: 0 6px; text-align: center; font-size: 12px; letter-spacing: .06em; font-family: Georgia, "Times New Roman", serif; white-space: nowrap; }
.jb-sep { width: 1px; height: 18px; background: var(--bar-line); margin: 0 3px; }

.jb-pop { position: absolute; bottom: 70px; left: 50%; z-index: 45; padding: 12px; border-radius: 18px; min-width: 190px; background: var(--bar-bg); border: 1px solid var(--bar-line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22); color: var(--bar-ink); opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px) scale(.96); transform-origin: 50% 100%; transition: opacity .25s, transform .35s cubic-bezier(.3, 1.3, .5, 1); }
.jb-pop.show { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.jb-pop-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.jb-pop-row + .jb-pop-row { margin-top: 12px; }
.jb-step { width: 38px; height: 34px; border: 1px solid var(--bar-line); border-radius: 12px; background: rgba(255, 255, 255, .35); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.jb-step:active { transform: scale(.92); }
.jb-pop-v { min-width: 34px; text-align: center; font-size: 14px; font-family: Georgia, serif; }
.jb-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(128, 128, 128, .15); gap: 2px; }
.jb-seg button { border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.jb-seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.jb-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
.jb-sw { border: 0; background: transparent; padding: 0; color: inherit; font: inherit; font-size: 11px; cursor: pointer; text-align: center; }
.jb-sw i { display: block; width: 46px; height: 46px; margin: 0 auto 4px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), border-color .2s; }
.jb-sw.on i { border-color: var(--accent); transform: scale(1.1); }
.jb-sw:active i { transform: scale(.92); }

/* ---------- 写日记的稿纸 ---------- */
.jb-editor { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 14px 14px 18px; background: rgba(20, 14, 10, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0);
    pointer-events: none; transition: background .4s, backdrop-filter .4s, -webkit-backdrop-filter .4s; }
.jb-editor.show { background: rgba(20, 14, 10, .45); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); pointer-events: auto; }
.jb-ed-paper { position: relative; width: 100%; max-width: 460px; height: 100%; max-height: 640px; display: flex; flex-direction: column; border-radius: 6px 14px 14px 6px; background: var(--paper); overflow: hidden; color: var(--ink);
    box-shadow: 0 24px 50px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(40px) rotate(-1.6deg) scale(.96); transition: opacity .35s, transform .55s cubic-bezier(.2, 1.1, .3, 1); }
.jb-editor.show .jb-ed-paper { opacity: 1; transform: none; }
.jb-ed-paper::before { content: ''; position: absolute; inset: 0; background-image: var(--grain); opacity: .5; mix-blend-mode: multiply; pointer-events: none; }
.jb-ed-paper::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 36px; background: linear-gradient(90deg, rgba(0, 0, 0, .2), rgba(0, 0, 0, .05) 14px, transparent); pointer-events: none; }
.jb-ed-bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px 36px; }
.jb-ed-bar b { font-size: 15px; letter-spacing: .3em; }
.jb-ed-btn { border: 0; background: transparent; font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 12px; cursor: pointer; color: var(--ink-soft); }
.jb-ed-btn.ok { color: #fff; background: var(--accent); padding: 6px 16px; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.jb-root[data-theme="midnight"] .jb-ed-btn.ok { color: #1b1b24; }
.jb-ed-btn:active { transform: scale(.94); }
.jb-root .jb-ed-title { position: relative; z-index: 2; margin: 0 20px 0 36px; padding: 6px 0; border: 0; border-bottom: 1.5px solid var(--rule); outline: none; background: transparent; color: var(--ink); font-family: var(--jb-font); font-size: 22px; font-weight: 700; letter-spacing: .04em; -webkit-user-select: text; user-select: text; }
.jb-root .jb-ed-text { position: relative; z-index: 2; flex: 1; margin: 6px 20px 0 36px; padding: 0; border: 0; outline: none; resize: none; background-color: transparent; color: var(--ink); font-family: var(--jb-font); font-size: var(--jb-fs); line-height: var(--jb-lh);
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--jb-lh) - 1px), var(--rule) calc(var(--jb-lh) - 1px), var(--rule) var(--jb-lh)); background-attachment: local; -webkit-user-select: text; user-select: text; }
.jb-root .jb-ed-title::placeholder, .jb-root .jb-ed-text::placeholder { color: var(--ink-soft); opacity: .7; }
.jb-ed-count { position: relative; z-index: 2; padding: 6px 22px 10px 36px; text-align: right; font-size: 11px; color: var(--ink-soft); letter-spacing: .1em; }

@media (prefers-reduced-motion: reduce) {
    .jb-dust i, .jb-foil, .jb-emblem, .jb-tail, .jb-curl, .jb-avatar::after, .jb-ribbon.on, .jb-hint, .jb-end-icon, .jb-quill .ln, .jb-quill .pen { animation: none !important; }
    .jb-leaf.jb-reveal .jb-flow p, .jb-leaf.jb-reveal .jb-ehead, .jb-leaf.jb-reveal .jb-toc-row { animation: none !important; }
}

/* ---------- 跳页淡出 / 翻到头的回弹 ---------- */
.jb-stage { transition: transform .8s cubic-bezier(.3, .9, .3, 1), opacity .14s; }
.jb-stage.jb-blink { opacity: 0; }
.jb-stage.jb-bump-l { animation: jb-bump-l .38s cubic-bezier(.3, 1.6, .5, 1); }
.jb-stage.jb-bump-r { animation: jb-bump-r .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes jb-bump-l { 0%, 100% { transform: none; } 35% { transform: translateX(-11px) rotate(-.6deg); } }
@keyframes jb-bump-r { 0%, 100% { transform: none; } 35% { transform: translateX(11px) rotate(.6deg); } }

/* ---------- 书本模式下，顶栏（回忆日记）跟着主题色走 ---------- */
#memory-journal-screen { --jbh-bg: rgba(216, 201, 176, .92); --jbh-ink: #3b2f2a; --jbh-line: rgba(120, 90, 60, .22); }
#memory-journal-screen[data-jb-theme="navy"] { --jbh-bg: rgba(180, 188, 203, .92); --jbh-ink: #27303f; --jbh-line: rgba(60, 80, 120, .22); }
#memory-journal-screen[data-jb-theme="sakura"] { --jbh-bg: rgba(242, 217, 223, .92); --jbh-ink: #5a4048; --jbh-line: rgba(200, 120, 140, .24); }
#memory-journal-screen[data-jb-theme="matcha"] { --jbh-bg: rgba(205, 216, 198, .92); --jbh-ink: #33413a; --jbh-line: rgba(70, 110, 85, .22); }
#memory-journal-screen[data-jb-theme="lavender"] { --jbh-bg: rgba(217, 210, 236, .92); --jbh-ink: #3d3556; --jbh-line: rgba(110, 90, 170, .22); }
#memory-journal-screen[data-jb-theme="midnight"] { --jbh-bg: rgba(14, 14, 20, .94); --jbh-ink: #e8e2d4; --jbh-line: rgba(255, 255, 255, .1); }
#memory-journal-screen.jb-on .app-header { background-color: var(--jbh-bg) !important; border-bottom: 1px solid var(--jbh-line) !important; transition: background-color .5s, border-color .5s; }
#memory-journal-screen.jb-on .app-header .title,
#memory-journal-screen.jb-on .app-header .back-btn,
#memory-journal-screen.jb-on .app-header .action-btn { color: var(--jbh-ink) !important; transition: color .5s; }
#memory-journal-screen.jb-on .app-header .action-btn svg,
#memory-journal-screen.jb-on .app-header .back-btn svg { stroke: var(--jbh-ink) !important; transition: stroke .5s; }
